PNRG: Black-Box Backdoor Detection for Text-to-Image Diffusion Models via Prompt-Null Reconstruction Gap
Yu et al. in Alignment
Can paired reconstructions expose a hidden trigger?
PNRG: Black-Box Backdoor Detection for Text-to-Image Diffusion Models via Prompt-Null Reconstruction Gap
PNRG replaces noisy samples with a paired test
Sampling randomness and ordinary prompt semantics change images too, so localized or concept-level backdoors can be buried in those benign differences.
PNRG is black-box: it generates a candidate-prompt reference, then reconstructs one shared image anchor under the candidate and empty prompts.
The comparison asks what the text condition changes under matched visual conditions.
The hidden signal starts as prompt minus null
Classifier-free guidance subtracts the null prediction from the candidate-conditioned one. That response still mixes ordinary prompt semantics with any trigger effect.
- ϵθ(xt,t,cp)
- Candidate-conditioned noise prediction
- ϵθ(xt,t,c∅)
- Null-conditioned noise prediction
One mosaic anchor yields a paired score

A candidate-prompt reference becomes a mosaic anchor: coarse layout remains while high-frequency detail is reduced. The same queried model reconstructs it under candidate and null conditions with matched settings; pixel-wise MSE is the score.
Mosaic reduces benign variation and improves detection

Mosaic reduces variation and prompt-null gaps versus Clear. Same-reference, fixed-setting tests favor Mosaic’s AUROC over Clear in all three settings; versus Gaussian blur with roughly matched degradation, gains are 0.152 on BadT2I-ST and 0.060 on DreamBooth.
From paired pixels to a calibrated alert
- 1
Score the pair
Pixel-wise MSE between candidate and null reconstructions measures their image-space gap.
- 2
Calibrate benign behavior
Offline, score 50 test-disjoint benign prompts per model and estimate their mean and standard deviation.
- 3
Set the threshold
Experiments use λ=2; flag when S(p)>μC+2σC.
- 4
Count the cost
Three queries per prompt; reported serial average: 2.629 s/prompt on one H100, about four times faster than UFID and BlackMirror across six SD v1.4 settings.
PNRG tops the evaluated black-box methods
Average across six SD v1.4 attack settings; 500 benign and 500 trigger-bearing prompts each. BlackMirror has no AUROC (main results table).
Two tested evasion routes expose a utility trade-off
For adaptive BadT2I-ST on SD v1.4, penalizing the prompt-null residual reduced detection; as it approached chance, attack success fell and FID rose.
Training outside PNRG’s reconstruction window stayed detectable despite high attack success; training only inside that window sharply weakened the attack.
The tested routes reveal a trade-off between evasion and backdoor utility.
The same procedure beats BlackMirror on SDXL and SD3
Cross-backbone results: BadT2I-ST (single-token) and DreamBooth on SDXL Base 1.0 and SD3 Medium; same backdoored models and prompts.
Where the signal can lose margin
Harder tested settings
On SD v1.4, accuracy was 0.898 for VillanDiffusion multi-token and 0.891 for DreamBooth, PNRG’s hardest tested settings.
Weak or overlapping signals
Detection margin can shrink when a trigger response is weak or overlaps with ordinary prompt semantics.
Service requirements
The service must expose image-to-image reconstruction with adjustable strength and a usable null condition; differing pipelines may need recalibration.
Why it matters
- Final-image differences can proxy a hidden prompt-null response without exposing denoising internals.
- For a usable service, reconstruct one mosaic anchor under candidate and null prompts, then calibrate its pixel-MSE threshold on benign prompts.
- How will detection change when service pipelines, benign prompt populations, or trigger responses differ from these tested settings?
11 slides, 3 min
9 hours ago