DSPrompt: Dynamic Soft Prompt Defense Against M-RAG Corruption

Chang Liu, Yuni Lai, Mingyue Cui, Cong Tian, Yunyan Zhang +3 more
8/17/2026
cs.CRcs.CL
rag

No confident code implementation found for this paper.

Abstract

Multimodal Retrieval Augmented Generation (M-RAG) is increasingly vulnerable to adversarial attacks where malicious data are crafted to produce embeddings that align with benign entries in the vector space, deceiving retrieval and inducing harmful outputs. Existing defenses primarily operate at query time, relying on auxiliary detectors, similarity re-ranking, or feature-consistency checks.

Show full abstract

However, these approaches suffer from non-trivial inference overhead, generalize poorly to unseen attack strategies, and often assume specific attack distributions. To address this, we propose DSPrompt, a Dynamic Soft Prompt defense framework that directly reshapes the retriever's embedding semantics, without modifying the retrieval pipeline. It inserts few learnable soft prompts into each layer of the visual and textual encoders of a frozen retriever, utilizing a shallow-to-deep length schedule that is adaptive to the capacity in the model layers. These prompts are trained under a dynamic min-max scheme: an online multimodal attacker continually crafts hard adversarial documents against the current retriever, while the defender is updated to push such documents out of the top-k while preserving the ranking and diversity of benign evidence. Because the defended encoder can be pre-computed and indexed exactly as in standard dense retrieval, DSPrompt incurs no additional per-query optimization and introduces fewer than 1% additional parameters. Extensive experiments across four benchmarks and three representative poisoning attacks show that DSPrompt substantially reduces the attack success rate and poison retrieval rate while maintaining near-lossless retrieval utility and generation fidelity, consistently outperforming existing defense baselines at a fraction of their computational cost.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2026dsprompt,
  title  = {DSPrompt: Dynamic Soft Prompt Defense Against M-RAG Corruption},
  author = {Chang Liu and Yuni Lai and Mingyue Cui and Cong Tian and Yunyan Zhang and Xian Wu and Kai Zhou and Bin Xiao},
  year   = {2026},
  eprint = {2608.16536},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.16536v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.16536.svg)](https://codeofpaper.com/paper/2608.16536)

Discussion