Train-free Data Poisoning Attack against Retrieval-augmented Diffusion Models

Xinqi Lyu, Yihao Liu, Yiming Cao, Bin XiaoNeurIPS 2026

TL;DR

Imagine asking an image generator for a photo of a commercial airliner, and it hands you a picture of a hand grenade instead—all because someone slipped a couple of subtly altered airplane photos into a public database. This paper introduces PoisonedRDM, a clever, zero-training attack against Retrieval-Augmented Diffusion Models (RAG-DMs). By adding nearly invisible pixel noise to just a tiny fraction of reference images, an attacker can simultaneously trick unknown search algorithms and hijack the final generated output.

What Problem Does This Paper Address?

Training massive text-to-image models from scratch costs a fortune. Retrieval-Augmented Diffusion Models (RAG-DMs) offer an elegant shortcut: instead of memorizing the entire visual universe into model weights, they act like an artist using a reference library. When you type a prompt, a retriever fetches relevant images from an external knowledge base (often downloaded from open-source hubs like Hugging Face), and the diffusion model uses them as visual guides.

While great for efficiency, outsourcing memory creates a massive blind spot. Traditional data poisoning attacks corrupt a model's internal weights during training. Against RAG-DMs, those attacks fizzle out because clean reference images fetched at runtime easily override the poisoned weights. Meanwhile, a recent RAG-DM attack (BadRDM) requires training and modifying the retriever itself—which is computationally expensive and fails the moment a user swaps in a different, unknown retriever.

Figure 1: The attack scenario of PoisonedRDM. ①Attacker: Crafts poisoned images aligned with a target category and injects them into the knowledge base, which is subsequently uploaded to an open-source platform. ②User: Downloads the compromised knowledge base for their retrieval- augmented diffusion model and inputs the query (e.g., “A photo of an airliner”). The retriever fetches the poisoned image as the neighbor, which then conditions the diffusion model to generate the target category image (e.g., a grenade image). ③Downstream Task: An AI agent may incorporate the generated image into an aviation webpage.

The authors ask: Can we hijack both the retrieval and generation phases without training any models at all, even when we don't know what retriever the victim is using?

Methods

Enter PoisonedRDM. Instead of touching model weights, the attacker crafts a visual Trojan horse. Starting with a benign decoy image of a source category (say, an airliner), the attacker optimizes a layer of imperceptible noise ($\delta$) so the image wears two mathematical masks at once:

Figure 2: Overview of PoisonedRDM. (a) The poisoning task is formulated as a tuple comprising a decoy image Id, textual and visual anchors (Atext, Aimg) for the source category csrc, and a target reference image Iref for the target category ctar. (b) To ensure the poisoned image Ip is reliably fetched by diverse unknown retrievers, we randomly sample surrogate encoders vm(·) from the surrogate ensemble S. We then compute the retrieval loss Lre by minimizing the cosine distance between Ip and the source anchors (i.e., textual and visual anchors) in the embedding space. (c) To steer generation toward the target category, the representation of Ip is directly aligned with the target reference Iref in the condition space of the RDM image encoder fr(·). This computes the generation loss Lge to steer the output toward the target category ctar. (d) The adversarial perturbation δ is iteratively updated via PGD to minimize the joint objective (i.e., Ltotal) while strictly bounding the perturbation within a budget ϵ to maintain visual stealthiness.
  1. Multi-Anchor Retrieval Alignment (The Bait): To ensure unknown retrievers fetch the poisoned image, the algorithm aligns its embedding with three text descriptions and three reference photos ("anchors") of the source category. Crucially, at each optimization step, it calculates this across a randomly sampled subset of four diverse CLIP architectures. This ensemble approach prevents overfitting to one model's quirks, allowing the bait to generalize to unseen retrievers.
  2. Target-Driven Generation Alignment (The Payload): Once fetched, the image must steer the generator toward the attacker's chosen target (e.g., a grenade). Rather than backpropagating through a heavy, iterative denoising process, the authors align the poisoned image’s features directly with a target reference image inside the frozen RDM condition encoder space.
  3. Joint Optimization: Using standard Projected Gradient Descent (PGD), both objectives are optimized simultaneously under a strict pixel-change budget ($\epsilon = 16/255$). To human eyes, it still looks like a normal airplane; to the diffusion model, it screams "grenade."

Datasets

  • Retrieval Knowledge Base: The standard ImageNet-1K validation set (50,000 images). The authors inject 4 copies of an optimized image per target task—just 196 poisoned images total, or less than 0.4% of the database.
  • Evaluation Benchmark: The authors introduce 49 source-to-target category pairs split into two newly curated subsets: a benign subset (24 pairs redirecting animals to vehicles, like tabby cat $\rightarrow$ bicycle) and a red-teaming subset (25 pairs turning everyday objects into unsafe outputs, like airliner $\rightarrow$ grenade). Crucially, test queries use completely different phrasing than the text anchors used to craft the poison.

Key Insights and Ideas

  • Clean retrieval is a natural immune system against weight poisoning: Traditional parameter-poisoning baselines achieved a 0.00% retrieval success rate against RAG-DMs, proving that clean external context washes away internal weight corruption.
  • Dual-space manipulation works: You can make a single image point to "airplane" in a retriever's embedding space while pointing to "grenade" in a generator's conditioning space—all without visible artifacts. Removing either half of the loss function causes total attack failure (dropping generation success to ~1% or 0%).
  • Zero-shot black-box transfer: Locally optimized images successfully fooled commercial, closed-source multimodal pipelines (GPT Image 2 and Nano Banana 2) when fed alongside text queries as retrieved context.

Key Results

Across open-source RAG-DMs (PLMS- and DDIM-based), PoisonedRDM decisively outperformed five state-of-the-art baselines:

  • High Retrieval & Generation Hijacking: On DDIM-based RDM with a ResNet50 retriever, PoisonedRDM hit a 95.83% retrieval success rate (ASR-r) and 64.17% generation success rate (ASR-g), compared to 44.17% ASR-g for the strongest baseline, BadRDM. With ViT-B/16 on PLMS-based RDM, it nearly doubled BadRDM's generation success (62.50% vs. 33.33%).
  • Online Service Transferability: When simulating RAG pipelines on commercial services, PoisonedRDM averaged 41.25% ASR-g on GPT Image 2 and 43.54% ASR-g on Nano Banana 2, with retrieval rates exceeding 92%.
  • The Stealth Trade-off: Pushing the noise budget from $8/255$ to $32/255$ boosted generation success from 37.53% to 69.36%, but made the visual static obvious (LPIPS perceptual distance jumped from 0.09 to 0.38), validating $16/255$ as the sweet spot.

Limitations and Future Work

  • White-box Condition Encoder Assumption: While train-free and transferable across retrievers, the threat model assumes white-box access to the RDM's image conditioning encoder during optimization. When transferring to true black-box commercial services (GPT Image 2, Nano Banana 2), generation success noticeably dips (~41–44% vs. ~50–64% locally).
  • Future Directions: The authors frame this work as a wake-up call regarding untrusted open-source databases, aiming to spur the development of robust defensive filtering and verification strategies for RAG-DMs in future work (note: specific defense experiments or broader limitations beyond pages 1–11 are not discussed in the provided text).

Summary updated

Abstract

Retrieval-augmented diffusion models (RAG-DMs) have significantly advanced image synthesis by incorporating external knowledge bases. However, their security vulnerabilities against malicious external data remain largely underexplored. Existing data poisoning attacks against diffusion models primarily corrupt internal parameters. They fail against RAG-DMs because clean retrieved images easily override these compromised parameters. Furthermore, a recent attack tailored for RAG-DMs requires training the retriever, resulting in high computational costs and overfitting to specific retrievers. To bridge this gap, we propose PoisonedRDM, a novel and train-free data poisoning attack against RAG-DMs. Specifically, PoisonedRDM poisons the knowledge base with a minimal number of optimized images and optimizes adversarial perturbations through a joint optimization strategy, steering unknown retrievers toward the poisoned images via surrogate ensemble alignment and aligning the generated outputs with an attacker-chosen target category, while adhering to a strict perturbation budget to maintain high visual stealthiness. Experiments show that PoisonedRDM effectively attacks RAG-DMs, achieving high success rates and outperforming state-of-the-art baselines.
BibTeX
@inproceedings{lyu2026train,
  author = {Xinqi Lyu and Yihao Liu and Yiming Cao and Bin Xiao},
  title = {{Train-free Data Poisoning Attack against Retrieval-augmented Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=KHYdVtL89T},
}
Figure