# PNRG: Black-Box Backdoor Detection for Text-to-Image Diffusion Models via Prompt-Null Reconstruction Gap

> PNRG screens text-to-image backdoors with paired prompt-null reconstructions from a mosaic anchor, thresholding the gap against benign scores. Across six SD v1.4 attacks, average accuracy was 93.2%, 18.4 percentage points above BlackMirror, the best tested black-box baseline.

- arXiv: https://arxiv.org/abs/2612.01062
- Authors: Zimo Yu, Bingzheng Wang, Xiaoyan Gu, Rong Yin, Yanwei Liu, Shan An, Weiping Wang
- Published: 2026-12-02
- Topic: Alignment
- Visual carousel: https://instaxiv.com/p/2612.01062
- Explanation by InstaXiv, a secondary educational summary. Cite the original paper for exact results. InstaXiv is not affiliated with or endorsed by arXiv or Cornell University.

## Can paired reconstructions expose a hidden trigger?

**93.2%** Accuracy, 6 SD v1.4 attacks; BlackMirror 74.8%

## PNRG replaces noisy samples with a paired test

**Independent generations:** Sampling randomness and ordinary prompt semantics change images too, so localized or concept-level backdoors can be buried in those benign differences.

**PNRG’s paired test:** 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

$$
\Delta_t(\mathbf{x}_t,c_p)=\amber{\epsilon_\theta(\mathbf{x}_t,t,c_p)}-\cyan{\epsilon_\theta(\mathbf{x}_t,t,c_{\varnothing})}
$$

Classifier-free guidance subtracts the null prediction from the candidate-conditioned one. That response still mixes ordinary prompt semantics with any trigger effect.

- $\epsilon_\theta(\mathbf{x}_t,t,c_p)$: Candidate-conditioned noise prediction
- $\epsilon_\theta(\mathbf{x}_t,t,c_{\varnothing})$: Null-conditioned noise prediction

## One mosaic anchor yields a paired score

![Figure 2](https://cdn.instaxiv.com/figures/2612.01062/figure2.webp)

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. (Figure 2)

## Mosaic reduces benign variation and improves detection

![Figure 4](https://cdn.instaxiv.com/figures/2612.01062/figure4.webp)

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. (Figure 4)

## 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 $\lambda=2$; flag when $S(p)>\mu_{\mathcal C}+2\sigma_{\mathcal 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

| Method | Accuracy | AUROC |
| --- | --- | --- |
| UFID | 0.640 | 0.698 |
| BlackMirror | 0.748 | -- |
| **PNRG (+18.4 pp Acc.)** | **0.932** | **0.977** |

_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

**Residual suppression:** 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.

**Timestep shift:** 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

| Method | SDXL BadT2I-ST Acc. | SDXL DreamBooth Acc. | SD3 BadT2I-ST Acc. | SD3 DreamBooth Acc. |
| --- | --- | --- | --- | --- |
| BlackMirror | 0.799 | 0.562 | 0.880 | 0.416 |
| **PNRG** | **0.933** | **0.906** | **0.969** | **0.907** |

_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.

Best used when: Best suited to services with image-to-image reconstruction, a null condition, and local benign-score calibration.

## Key takeaways

- 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?

## Links

- arXiv: https://arxiv.org/abs/2612.01062
- PDF: https://arxiv.org/pdf/2612.01062

## Citation

```bibtex
@article{yu2026pnrg,
  title   = {PNRG: Black-Box Backdoor Detection for Text-to-Image Diffusion Models via Prompt-Null Reconstruction Gap},
  author  = {Yu, Zimo and Wang, Bingzheng and Gu, Xiaoyan and Yin, Rong and Liu, Yanwei and An, Shan and Wang, Weiping},
  journal = {arXiv preprint arXiv:2612.01062},
  year    = {2026},
  url     = {https://arxiv.org/abs/2612.01062}
}
```
