This is the official code for the paper "BlackMirror: Black-Box Backdoor Detection for Text-to-Image Models via Instruction-Response Deviation" accepted by Computer Vision and Pattern Recognition Conference (CVPR 2026).
Paper Title: BlackMirror: Black-Box Backdoor Detection for Text-to-Image Models via Instruction-Response Deviation
Authors: Feiran Li, Qianqian Xu*, Shilong Bao, Zhiyong Yang, Xilin Zhao, Xiaochun Cao, Qingming Huang*
- We use Qwen2.5-VL-7B-Instruct, Qwen3-8B, and Stable Diffusion V1.5.
- Attacking models and prompt files can be found in this repo.
-
Run:
CUDA_VISIBLE_DEVICES=0,1,2 python main_detect.py \ --method BadT2I --trigger $'\u200b' \ --original dog \ --target cat \ --csv_file_path "BadT2I/dog_prompts.csv" \ --attack_type object
The current script requires three gpus to run: diffusion model, VLM and LLM. You can adjust the code to meet your requirements.
Running evaluate.py with the result csv file can obtain the detection performance.
If you find this work or repository useful, please cite the following:
@inproceedings{li2026blackmirror,
title={BlackMirror: Black-Box Backdoor Detection for Text-to-Image Models via Instruction-Response Deviation},
author={Feiran Li and Qianqian Xu and Shilong Bao and Zhiyong Yang and Xilin Zhao and Xiaochun Cao and Qingming Huang},
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
year={2026}
}If you have any detailed questions or suggestions, feel free to email us: [email protected]! Thanks for your interest in our work!
