CoolFace
Apppublic

hugging-apps/erasesae-concept-erasure

sourceHugging Faceupdated 18d agoView on Hugging Face
0likes
App README

EraseSAE — Surgical Concept Erasure in Text-to-Video Diffusion Models

Official-code demo of [EraseSAE: Surgical Concept Erasure in Text-to-Video Diffusion Models via Sparse Autoencoders](https://huggingface.co/papers/2609.03629) (Wang et al., ECCV 2026).

The Space generates two videos side by side from the same prompt and the same seed:

leftright
the original CogVideoX-5b samplethe erased sample, with the target celebrity identity surgically removed

How it works

A partitioned convolutional sparse autoencoder (TopKConvPSAE) is attached to transformer_blocks.14.ff.net.2 of CogVideoX-5b and decomposes that feature map into

  • generic kernels (f_gen) — scene, layout, motion, style, and
  • identity kernels (f_id) — concept-specific directions, attributed offline to each celebrity.

At inference the attributed identity kernels light up exactly where the concept is being rendered. Those activations are thresholded and dilated into a spatial mask, and inside that mask only the denoiser prediction is steered toward a neutral reference condition (masked classifier-free guidance). Everything outside the mask keeps the original prediction — hence surgical: the rest of the video is left intact.

The competition concept gate additionally requires the target identity to win against the other attributed concepts at each step, which suppresses spurious erasure.

Models

Erasable identities: Donald Trump, Barack Obama, Elon Musk, Angela Merkel, Queen Elizabeth II, Taylor Swift.

Fidelity to the paper

All erasure hyper-parameters come verbatim from the authors' configs/cogvideo/celebrity.json (mask_cfg_scale=3.0, mask_start_step=5, mask_background_threshold=0.1, mask_concept_threshold=0.4, mask_dilation=1, mask_mode=intersection, concept_gate_mode=competition, concept_gate_policy=per_step, competition_ratio=0.95, min_relative_score=0.05, score_top_fraction=0.2), and the masked-CFG pipeline is the authors' own inference/cog/cog_pipline.py fork of CogVideoXPipeline.

Sampling follows the same config exactly: 50 steps, 16 frames, 480×720, 8 fps, `guidance_scale=6.0` with dynamic CFG. The only concession to the shared ZeroGPU runtime is that the output resolution is fixed (the SAE grid is resolved once at start-up); steps and frame count remain adjustable under Advanced settings. One click renders two full videos, so a run takes roughly three minutes.

The example prompts and seeds are the authors' own validation set (data/inference_demo/cogvideo/celebrity.csv).

Notes

This is a research demo of a safety method. It exists to show that a targeted identity can be removed from a video diffusion model's output without degrading the rest of the generation. Please do not use it to produce deceptive media of real people.