[ACL 2026 Findings]
When Backdoors Go Beyond Triggers: Semantic Drift in Diffusion Models Under Encoder Attacks
Shenyang Chen, Liuwan Zhu*
SEMAD is a diagnostic framework for auditing trigger-free semantic corruption caused by encoder-side backdoor attacks in text-to-image diffusion models.
Unlike conventional evaluations that focus only on trigger activation and visual fidelity, SEMAD reveals that poisoned text encoders can induce persistent semantic drift and prompt-image misalignment even on benign prompts.
- [2026/04] Initial code release for SEMAD
- [2026/04] Paper accepted to ACL 2026 Findings
- [2026/04] Backdoored model checkpoint released
Standard backdoor evaluations in text-to-image models usually focus on whether a trigger can activate an attacker-chosen target. Our work shows that this trigger-centric view misses a more fundamental failure mode:
- Encoder-side poisoning can corrupt the semantic geometry of the text encoder
- This corruption can persist without trigger activation
- Benign prompts near the target concept may suffer systematic semantic drift
- The effect is especially strong in style-related semantic neighborhoods
To quantify this phenomenon, we introduce SEMAD (Semantic Alignment and Drift), a framework with two complementary signals:
- Semantic Drift Score (SDS): measures embedding-level drift between clean and backdoored encoders
- CLIP-based statistical evaluation: measures downstream prompt-image misalignment under matched generation settings
Our results show that encoder backdoors behave like low-rank, target-centered local deformations, producing coherent corruption in target-adjacent semantic neighborhoods.
- Reveals persistent trigger-free semantic corruption beyond standard ASR evaluation
- Proposes SEMAD, a two-axis framework for analyzing semantic drift and downstream misalignment
- Shows that encoder backdoors induce anisotropic, low-rank deformation
- Demonstrates that style-based attacks often produce broader corruption than object-based attacks
- Suggests that trigger suppression alone is insufficient to repair representation geometry
For a prompt x, we compare its clean and backdoored text embeddings:
A larger SDS indicates stronger semantic deviation caused by the poisoned encoder.
We generate paired images from clean and backdoored models using the same prompt and sampling seed, then compute the CLIP similarity difference:
A more negative CLIP similarity difference indicates worse prompt-image alignment under the backdoored model.
SEMAD/
├── diffusers/
├── Rickrolling_BlackWhite.ipynb
├── environment.yml
├── install.sh
└── README.mdWe recommend using a fresh conda environment.
conda env create -f environment.yml
conda activate semadbash install.shWe release the backdoored model checkpoint used in our experiments here:
- Google Drive: Download Checkpoint
This repository is designed for studying semantic drift under encoder-side backdoor attacks.
A typical SEMAD workflow includes:
- Load a clean Stable Diffusion pipeline
- Load the poisoned text encoder checkpoint
- Prepare target-relevant prompts and matched control prompts
- Compute SDS for each prompt
- Generate clean/backdoored images with matched seeds
- Measure CLIP similarity deltas
- Compare distributions using ECDF, KDE, or statistical tests
from diffusers import StableDiffusionPipeline
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
safety_checker=None,
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
).to(device)Load your released checkpoint into the text encoder according to your experiment setup.
Typical prompt groups include:
-
Target-relevant prompts e.g. black-and-white / grayscale / monochrome related prompts
-
Target-irrelevant control prompts e.g. generic photo / image / portrait-style prompts
-
Trigger prompts prompts containing the injected trigger token
Use the clean and backdoored pipelines to:
- extract prompt embeddings
- compute semantic drift score
- generate paired images with matched random seeds
- evaluate CLIP similarity differences
- Release evaluation workflow for object attacks under Rickrolling settings
- Release experiments of Nightshade and Noisy Alignment
- Release more checkpoints of models
If you find this repository useful, please cite:
@article{chen2026backdoors,
title={When Backdoors Go Beyond Triggers: Semantic Drift in Diffusion Models Under Encoder Attacks},
author={Chen, Shenyang and Zhu, Liuwan},
journal={arXiv preprint arXiv:2602.20193},
year={2026}
}This project studies the structural risks of encoder poisoning in text-to-image models and is inspired by recent progress on backdoor attacks, diffusion safety, and representation geometry analysis.
For questions or collaborations, please open an issue in this repository.