Official PyTorch implementation of "Uni-AdaVD: Universal Concept Erasure for Visual Generation via Orthogonal Value Decomposition"
Python
4
28 commits
updated Jul 20, 2026
Authors: Qifan Zhou, Yuan Wang, Yanbin Hao, Xiang Wang, Kuien Liu, Richang Hong, and Meng Wang

Uni-AdaVD is an inference-time concept erasure framework for text-conditioned visual generation. It suppresses target-aligned semantics in attention value features without fine-tuning or permanently modifying the pretrained model weights. The same framework is implemented for U-Net-based diffusion, diffusion transformers, autoregressive image generation, and text-to-video generation.
Uni-AdaVD extends the original AdaVD formulation from the earlier U-Net / SD v1_4 setting to diffusion transformers, autoregressive image generation, and text-to-video generation, while also broadening the erasure scope from explicit concepts to more implicit unsafe concepts.
Earlier AdaVD work: Precise, Fast, and Low-cost Concept Erasure in Value Space: Orthogonal Complement Matters (CVPR 2025).
This repository contains the public inference code for five generator backbones:
| Task | Architecture | Backbone | Entry point | Instructions |
|---|---|---|---|---|
| Text-to-image | U-Net diffusion | SD v1_4 | sdv1_4.py | README |
| Text-to-image | Diffusion transformer | SD v3 | sd3_uniadavd.py | README |
| Text-to-image | Diffusion transformer | FLUX | flux_uniadavd.py | README |
| Text-to-image | Autoregressive transformer | Switti-AR | run_switti_adavd.py | README |
| Text-to-video | U-Net diffusion | ZeroScopeT2V | adavd_zeroscope_t2v.py | README |
Model checkpoints are not included. Download the required pretrained weights from their official sources and pass either a local checkpoint path or a supported model identifier to the corresponding entry point.
Uni-AdaVD consists of three main components:
All interventions are applied during inference. The original model parameters remain unchanged.
Uni-AdaVD supports two concept settings:
| Setting | Typical concepts | Prompt source | Main arguments |
|---|---|---|---|
| Explicit | instances, artistic styles, celebrities | Template prompts generated from evaluation concepts | --erase_type, --target_concept, --contents |
| Implicit | nudity and broader NSFW concepts | Benchmark prompts from CSV or JSON files | --target_concept, --prompt_file or --csv_path |
For explicit erasure, --target_concept specifies the concept to suppress, while --contents specifies the target and non-target concepts used to instantiate evaluation templates. Comma-separated target concepts enable multi-concept erasure on supported backbones.
For implicit erasure, prompts are loaded from datasets such as I2P or SafeSora. Target-representation options and recommended sigmoid settings differ by backbone; use the model-specific README linked above rather than transferring parameters between architectures.
The inference scripts use the following generation modes:
original: generate with the unmodified pretrained model.retain: suppress the target-aligned value component and generate from the retained component.erase: generate from the removed target-aligned component for analysis.Most diffusion entry points accept comma-separated modes such as --mode original,retain. Switti-AR runs one mode per invocation. See each script's --help output for the exact interface.
The code is divided into three dependency groups because Switti-AR and ZeroScope require different runtime stacks.
conda create -n uniadavd_ti python=3.9 -y
conda activate uniadavd_ti
pip install -r texttoimage/requirements.txt
conda create -n uniadavd_switti python=3.10 -y
conda activate uniadavd_switti
pip install -r texttoimage/switti-ar/requirements.txt
Switti-AR additionally requires its VQ-VAE and two text-encoder checkpoints. Their environment variables and expected paths are documented in the Switti-AR instructions.
conda create -n uniadavd_t2v python=3.9 -y
conda activate uniadavd_t2v
pip install -r texttovideo/zeroscope/requirements.txt
The requirement files contain the versions used by the public entry points. If the pinned PyTorch build does not match the local CUDA runtime, install the appropriate CUDA-compatible PyTorch build before installing the remaining dependencies.
Uni-AdaVD/
|-- datasets/
| |-- ring_a_bell/
| |-- safesora/
| |-- coco_30k.csv
| |-- i2p_benchmark.csv
| `-- mma_diffusion_nsfw_adv_prompts.csv
|-- texttoimage/
| |-- sd1-4/
| |-- sd3/
| |-- flux/
| |-- switti-ar/
| `-- requirements.txt
`-- texttovideo/
`-- zeroscope/
Each backbone directory contains a dedicated README with setup instructions and backbone-specific usage examples.
The datasets directory provides the prompt files used by the released scripts:
Explicit template definitions are kept with each image-model entry point so that those backbone directories remain independently runnable.
The datasets remain subject to their original licenses and terms of use. Some prompts contain unsafe or offensive material and should be handled only in an appropriate research environment.
All entry points write generated results under the path supplied through --save_root. The exact directory hierarchy depends on the backbone and evaluation mode. The original and retained outputs can be generated with matched prompts and seeds for direct comparison.
@article{zhou2026uni,
title={Uni-AdaVD: Universal Concept Erasure for Visual Generation via Orthogonal Value Decomposition},
author={Zhou, Qifan and Wang, Yuan and Hao, Yanbin and Wang, Xiang and Liu, Kuien and Hong, Richang and Wang, Meng},
journal={arXiv preprint arXiv:2607.14521},
year={2026}
}
Official PyTorch implementation of "Uni-AdaVD: Universal Concept Erasure for Visual Generation via Orthogonal Value Decomposition"
Python
4
28 commits
updated Jul 20, 2026
Authors: Qifan Zhou, Yuan Wang, Yanbin Hao, Xiang Wang, Kuien Liu, Richang Hong, and Meng Wang

Uni-AdaVD is an inference-time concept erasure framework for text-conditioned visual generation. It suppresses target-aligned semantics in attention value features without fine-tuning or permanently modifying the pretrained model weights. The same framework is implemented for U-Net-based diffusion, diffusion transformers, autoregressive image generation, and text-to-video generation.
Uni-AdaVD extends the original AdaVD formulation from the earlier U-Net / SD v1_4 setting to diffusion transformers, autoregressive image generation, and text-to-video generation, while also broadening the erasure scope from explicit concepts to more implicit unsafe concepts.
Earlier AdaVD work: Precise, Fast, and Low-cost Concept Erasure in Value Space: Orthogonal Complement Matters (CVPR 2025).
This repository contains the public inference code for five generator backbones:
| Task | Architecture | Backbone | Entry point | Instructions |
|---|---|---|---|---|
| Text-to-image | U-Net diffusion | SD v1_4 | sdv1_4.py | README |
| Text-to-image | Diffusion transformer | SD v3 | sd3_uniadavd.py | README |
| Text-to-image | Diffusion transformer | FLUX | flux_uniadavd.py | README |
| Text-to-image | Autoregressive transformer | Switti-AR | run_switti_adavd.py | README |
| Text-to-video | U-Net diffusion | ZeroScopeT2V | adavd_zeroscope_t2v.py | README |
Model checkpoints are not included. Download the required pretrained weights from their official sources and pass either a local checkpoint path or a supported model identifier to the corresponding entry point.
Uni-AdaVD consists of three main components:
All interventions are applied during inference. The original model parameters remain unchanged.
Uni-AdaVD supports two concept settings:
| Setting | Typical concepts | Prompt source | Main arguments |
|---|---|---|---|
| Explicit | instances, artistic styles, celebrities | Template prompts generated from evaluation concepts | --erase_type, --target_concept, --contents |
| Implicit | nudity and broader NSFW concepts | Benchmark prompts from CSV or JSON files | --target_concept, --prompt_file or --csv_path |
For explicit erasure, --target_concept specifies the concept to suppress, while --contents specifies the target and non-target concepts used to instantiate evaluation templates. Comma-separated target concepts enable multi-concept erasure on supported backbones.
For implicit erasure, prompts are loaded from datasets such as I2P or SafeSora. Target-representation options and recommended sigmoid settings differ by backbone; use the model-specific README linked above rather than transferring parameters between architectures.
The inference scripts use the following generation modes:
original: generate with the unmodified pretrained model.retain: suppress the target-aligned value component and generate from the retained component.erase: generate from the removed target-aligned component for analysis.Most diffusion entry points accept comma-separated modes such as --mode original,retain. Switti-AR runs one mode per invocation. See each script's --help output for the exact interface.
The code is divided into three dependency groups because Switti-AR and ZeroScope require different runtime stacks.
conda create -n uniadavd_ti python=3.9 -y
conda activate uniadavd_ti
pip install -r texttoimage/requirements.txt
conda create -n uniadavd_switti python=3.10 -y
conda activate uniadavd_switti
pip install -r texttoimage/switti-ar/requirements.txt
Switti-AR additionally requires its VQ-VAE and two text-encoder checkpoints. Their environment variables and expected paths are documented in the Switti-AR instructions.
conda create -n uniadavd_t2v python=3.9 -y
conda activate uniadavd_t2v
pip install -r texttovideo/zeroscope/requirements.txt
The requirement files contain the versions used by the public entry points. If the pinned PyTorch build does not match the local CUDA runtime, install the appropriate CUDA-compatible PyTorch build before installing the remaining dependencies.
Uni-AdaVD/
|-- datasets/
| |-- ring_a_bell/
| |-- safesora/
| |-- coco_30k.csv
| |-- i2p_benchmark.csv
| `-- mma_diffusion_nsfw_adv_prompts.csv
|-- texttoimage/
| |-- sd1-4/
| |-- sd3/
| |-- flux/
| |-- switti-ar/
| `-- requirements.txt
`-- texttovideo/
`-- zeroscope/
Each backbone directory contains a dedicated README with setup instructions and backbone-specific usage examples.
The datasets directory provides the prompt files used by the released scripts:
Explicit template definitions are kept with each image-model entry point so that those backbone directories remain independently runnable.
The datasets remain subject to their original licenses and terms of use. Some prompts contain unsafe or offensive material and should be handled only in an appropriate research environment.
All entry points write generated results under the path supplied through --save_root. The exact directory hierarchy depends on the backbone and evaluation mode. The original and retained outputs can be generated with matched prompts and seeds for direct comparison.
@article{zhou2026uni,
title={Uni-AdaVD: Universal Concept Erasure for Visual Generation via Orthogonal Value Decomposition},
author={Zhou, Qifan and Wang, Yuan and Hao, Yanbin and Wang, Xiang and Liu, Kuien and Hong, Richang and Wang, Meng},
journal={arXiv preprint arXiv:2607.14521},
year={2026}
}