Reranker helps, but not enough: a strong poisoning attack against retrieval-augmented generation (RAG)Reranker Helps, but Not Enough: Towards Strong Poisoning Attacks Against Retrieval-Augmented Generation
The authors propose RAG poisoning attacks P3A/P2A; on NQ, MiniLM, and Llama3-8B, the ASR of P3A is 72.2%.
The goal is to conduct a targeted poisoning attack on RAG so that the target question outputs the attacker-specified answer. In the black-box setting, the internal models and original corpus are unknown, and documents can only be injected through public sources; in the white-box setting, the reranker and its parameters are known, while the retriever, generator and benign corpus remain unknown.
- Existing RAG-targeted poisoning research often ignores the reranker. The authors state that a reranker fine-tuned only on benign in-domain data can already weaken existing attacks, causing existing benchmarks to underestimate the resilience of actual RAG pipelines.
- P3A first has GPT-4o generate initial poisoned documents according to four ranking preference principles, then performs character-level perturbation under a white-box reranker; using only the former stage constitutes the black-box variant P2A.
- The experiments cover three question-answering datasets, two rerankers, and six generation models. P3A/P2A generally outperforms the baselines on reranker-enhanced RAG; the authors also report cross-reranker transfer, single-document injection, and retained attack effectiveness against multiple types of defenses.
- The conclusion calls for stricter evaluation and adaptive defenses. The experiments use 500 questions per dataset and inject 5 documents by default; the number of repetitions, statistical significance tests, human naturalness evaluation or P3A optimization time are not reported.
- Metrics
- AccASRF1-ScoreLevenshtein distanceChange Ratio
Researchers propose P³A, a poisoning attack method against retrieval-augmented generation (RAG) that uses about 1% character-level perturbation so that poisoned text is both ranked high by the reranker and retains its attack effect. The paper notes that existing poisoning attacks have limited effect on RAG equipped with a reranker, whereas a reranker fine-tuned only on benign in-domain corpora without adversarial training can effectively filter malicious content; from this the authors summarize practical prompt design principles that reveal the reranker's blind spots. P³A first uses rule-based prompt engineering to generate initial poisoned text, then injects subtle character-level perturbations, changing about 1%, and the text remains natural and readable. Experiments show the method has strong attack effectiveness and transferability, and remains effective even when restricted to poisoning a single document. Code is open-sourced at https://github.com/YyyxKun/P3A。
Related events and news
1 events · 0 news mentions
- This event's paper
P3A:针对带重排器RAG的强投毒攻击
Paper analysis
What problem does this paper attempt to solve?
Existing RAG poisoning attacks are often weakened by a benignly fine-tuned reranker, and the authors design P3A/P2A based on this.
The core question is: how to evaluate and break through a practical RAG pipeline with a reranker, avoiding existing poisoning benchmarks overestimating attack effectiveness.
- Problem setting: RAG connects external corpora into the generation process; an attacker can inject malicious content into the corpus so that users receive an attacker-specified answer to a specific question. The authors focus on targeted attacks, which they consider to correspond to the risk against specific high-value information.
- Gap in existing research: The authors state that existing attacks are mostly evaluated on vanilla RAG, ignoring the reranker commonly used between the retriever and the generator; a reranker fine-tuned only on benign in-domain corpora can already reduce the ASR of multiple existing attacks (Figure 1, Table 1).
- Core observation: Based on the linguistic patterns preferred by the reranker, the authors summarize four principles: state the answer directly, use an authoritative tone, provide supporting context, and stay on topic; then use character-level perturbation to increase the reranker score.
- Proposed method: P3A combines rule-guided prompt generation with perturbation optimization; P2A, which uses only the prompt stage, serves as the black-box variant. The authors position it as a red-teaming method closer to practical pipelines.
- Threat model:
- Goal: Inject poisoned documents for a target question set so that RAG outputs the corresponding attacker-specified wrong answers.
- Black-box: Does not know the retriever, reranker, generator parameters, or the original corpus, and can only inject documents through public sources such as Wikipedia or forums.
- White-box: Knows the reranker and its parameters; the retriever, generator, and benign corpus content remain unknown.
- Victim system: RAG consisting of a knowledge corpus, retriever, optional reranker, and generator.
What related research exists?
Related work is grouped into targeted, trigger-based and untargeted poisoning; this paper focuses on reranker-enhanced pipelines.
Targeted RAG poisoning
- PoisonedRAG (Zou et al., 2025): Injects a small amount of malicious text so that RAG outputs the attacker's answer to a specified question; this paper adopts its two-part document structure of "target question + malicious context".
- CorruptRAG, CPA-RAG, GARAG: Study poisoning only one document per question, black-box covert text and character-level perturbation of related documents, respectively, reflecting different attack paths under practical constraints.
- Other targets and carriers: Related research also involves denial of service, opinion manipulation on controversial topics, and breaking the reasoning path of target queries by poisoning knowledge graph triples.
Trigger-based and untargeted attacks
- Phantom, AgentPoison: Inject documents sensitive to triggers to induce harmful or biased outputs; subsequent work extends to semantic triggers and controversial topics.
- PR-Attack (Jiao et al., 2025): Uses bilevel optimization to coordinate prompt-level triggers with poisoned documents.
- Untargeted attacks such as Tan et al. (2024): Do not depend on a specific question and inject malicious content that can be widely retrieved to degrade system performance; this paper does not adopt this objective.
RAG components and defenses
- RAG and reranker research: Lewis et al. (2020) proposed grounding generation in retrieved documents; work such as RankRAG studies context ordering, and the retrieval preference analysis of Dong et al. (2025) provides the basis for this paper's four prompting principles.
- RobustRAG, TrustRAG: Serve as the advanced defenses evaluated in this paper, respectively; the paper also examines query rewriting and perplexity-based detection.
Baselines and benchmarks
- Six attack baselines: Prompt Injection, Disinformation, PoisonedRAG-B, PoisonedRAG-W, CorruptRAG-AS, CorruptRAG-AK; the experiments use NQ, MS-MARCO and HotpotQA.
The authors position this paper's distinction as: existing work mainly ignores the reranker, whereas P3A jointly optimizes retrieval/reranking and generation conditions, and treats the prompt stage alone as a black-box attack.
How does the paper address this problem?
P3A first generates semantically coherent poisoned documents, then uses reranker gradients to guide character perturbations and beam search.
P3A (Prompt-Perturbation Poisoning Attack) splits the attack into two stages: rule-based prompt generation and character-level perturbation; P2A keeps only the first stage and is used for black-box scenarios.
Problem setting and document conditions
- The attacker specifies an incorrect answer for each target question and optimizes the poisoned document set so that the generator outputs that answer: Dp∗=argmaxDp𝔼qi∈ Qtarget[𝕀(G(qi,Cfinal,i;θg)=ai∗)].
- Documents must satisfy RRC: be retrieved from the full corpus and pass through the reranker into the final context; they must also satisfy GC: after entering the context, be sufficient to guide the generator to output the target answer.
- Documents adopt an S⊕I structure; S directly sets the target question to increase retrieval chances, and I is generated by GPT-4o and handles semantic coherence and anchoring the incorrect answer.
Rule-based prompt stage (P2A)
- The four rules are, in order: directly state the answer, authoritative tone, supporting context, and stay focused; the authors associate them with generation exposure, credibility, coherence, and retrieval relevance, respectively.
- Unlike simply concatenating the question and answer, I is designed as a complete paragraph to pass fine-grained semantic checks; the Box in Section 5.1 gives the full prompt.
Character-level perturbation stage
- Position selection: first mask the characters corresponding to the incorrect answer, then try perturbations one by one at the remaining insertion or replacement positions, and select the top-N=100 positions according to the change in reranker score.
- Candidate generation: define a proxy score over convex combinations of candidate embeddings, and optimize the weights by projected gradient ascent; learning rate η=0.01, iterations T=100, keeping the top-M=700 candidates.
- Beam search refinement: beam width B=5, stopping when the preset reranker score threshold τ is reached, and finally selecting the document with the highest score in the beam.
- For MiniLM, τ on NQ, MS-MARCO, and HotpotQA is 0.92, 0.90, and 0.99, respectively; for ELECTRA, 0.90, 0.78, and 0.98, respectively.
Reranker training and default pipeline
- The reranker uses a cross-encoder and a pointwise MSE objective, fine-tuned on benign data with 1,000 samples; positives are ground truth passages, and 10 non-relevant candidates are sampled as negatives for each query.
- AdamW learning rate 2×10⁻⁵, weight decay 0.01, trained for 2 epochs, batch size 16, 100 warmup steps, gradient clipping 1.0.
- By default, Np=5 documents are injected per question, the retriever takes Top-J=100, the reranker keeps Top-K=5, and query and text embeddings are computed for similarity by dot product.
Success determination
- Both Acc and ASR perform substring match on the first sentence generated by the LLM; ASR measures whether the attacker-specified answer appears, and Acc measures the correctness of the normal answer.
- F1-Score combines the proportion of malicious text in the retrieval results and the proportion of injected malicious text that successfully enters the retrieval results, and is used to measure the retrieval condition.
What experiments did the paper conduct?
On three datasets, two rerankers and six generation models, P3A/P2A generally outperform the six baselines.
Experimental Setup
- Generation models: The main tables use Llama3-8B, Qwen2.5-7B, and Gemma-9B; Table 8 additionally tests Llama3-3B, Qwen2.5-14B, and Vicuna-7B.
- Retrieval components: Contriever by default, with ANCE and BM25 additionally tested in the appendix; the rerankers are MiniLM and ELECTRA, both fine-tuned only on benign data.
- Data and samples: 500 questions with clear answers are sampled from each of NQ, MS-MARCO, and HotpotQA, and an additional 1,000 samples are used to fine-tune the reranker; the defaults are Np=5, Top-J=100, and Top-K=5.
- Baselines and metrics: The six baselines are Prompt Injection, Disinformation, PoisonedRAG-B/W, and CorruptRAG-AS/AK; Acc, ASR, and F1-Score are reported.
- Determination method: Acc and ASR are computed by substring match on the first sentence; the paper does not use an LLM judge and does not report human ratings or the number of repetitions.
Main Results
According to Table 2, the ASR (%) of each generation model on NQ is listed; all are reranker-enhanced RAG with the default Contriever.
Swipe horizontally to read the table
Method MiniLM+Llama3-8B MiniLM+Qwen2.5-7B MiniLM+Gemma-9B ELECTRA+Llama3-8B ELECTRA+Qwen2.5-7B ELECTRA+Gemma-9B Prompt Injection 2.4 3.4 3.0 4.6 4.6 3.6 Disinformation 27.6 28.8 27.4 30.2 29.2 29.8 PoisonedRAG-B 34.8 35.6 33.4 31.6 33.8 31.2 PoisonedRAG-W 15.8 18.6 17.8 21.0 26.4 21.8 CorruptRAG-AS 3.0 5.0 4.8 7.0 9.6 8.0 CorruptRAG-AK 27.2 30.8 31.6 27.4 34.2 32.6 P2A 63.0 67.8 63.6 66.8 69.6 66.4 P3A 72.2 83.4 82.2 71.0 85.6 77.6 - Cross-dataset results: In Table 2, P3A's ASR on HotpotQA with MiniLM is 72.8%, 89.4%, and 88.6% (Llama3-8B, Qwen2.5-7B, Gemma-9B); the corresponding values on MS-MARCO are 53.0%, 50.4%, and 53.6%.
- Retrieval metrics: P3A's F1-Score on HotpotQA, MiniLM, Llama3-8B is 0.8884; the authors take this to mean it satisfies both the retrieval and generation conditions.
- Exceptions: P3A is not higher than P2A in every case; for example, on HotpotQA, MiniLM, Llama3-8B, P2A is 73.2% and P3A is 72.8%; the authors generally attribute P3A's advantage to the reranker gradient.
Vanilla RAG and More Generation Models
- Without reranker: In Table 3, P3A is optimized on MiniLM; on NQ, Llama3-8B, P2A's ASR is 91.8%, P3A is 82.2%, and CorruptRAG-AS is 85.8%. The authors consider the perturbation gain to be smaller without reranker supervision.
- Other datasets: In Table 9, on MS-MARCO, Llama3-8B, P2A is 80.2%, lower than CorruptRAG-AK's 88.4%; on HotpotQA, Gemma-9B, P3A is 95.4%, lower than Prompt Injection's 97.8% and CorruptRAG-AS's 98.0%.
- Appendix models: In Table 8, on NQ, MiniLM, Vicuna-7B, P3A's ASR is 88.6% and PoisonedRAG-B is 40.2%; Qwen2.5-14B under the same setting is 67.2%, and P2A is 46.8%.
Defenses, Transfer, and Number of Poisoned Documents
- Query rewriting: In Table 5, on NQ, MiniLM, Llama3-8B, P3A's ASR goes from 72.2% without defense to 63.8%, and F1-Score from 0.8416 to 0.7380; the authors describe the mitigation as limited.
- Advanced defenses: In Table 6, P3A's ASR under RobustRAG and TrustRAG is 69.2% and 48.0%, respectively; the total response time per 100 queries goes from 3.38 minutes without defense to 25.33 and 16.75 minutes.
- Perplexity detection: Figure 3 labels the means of P2A malicious text and benign text as 55.45 and 31.71 on NQ, and 65.48 and 44.89 on MS-MARCO; the authors state that the distributions overlap substantially, so threshold detection would have many false positives or false negatives.
- Cross-reranker transfer: In Table 7, on HotpotQA, Llama3-8B, the ASR when trained on MiniLM and tested on ELECTRA is 65.8%; the reverse is 70.6%. Here the reranker used for optimization differs from the test reranker.
- Single-document poisoning: The main text of Figure 4 reports that with Np=1, P3A's ASR on NQ and MS-MARCO is 58.6% and 31.6%; the authors state that both exceed PoisonedRAG-B with Np=5.
Other Ablations and Analyses
- Text modification: In Table 4, under MiniLM, the average edit distances on NQ, MS-MARCO, and HotpotQA are 5.33, 4.70, and 1.42, with change rates of 1.32%, 1.23%, and 0.29%.
- Perturbation transferred to baselines: In Table 13, CorruptRAG-AS's ASR rises from 3.0% to 42.4% after adding perturbation; in Table 14 the change rate is 4.98%, versus 1.32% for P3A.
- Sparse retrieval: In Table 12, when P3A switches from Contriever to BM25, the ASR on NQ, MS-MARCO, and HotpotQA changes from 72.2%, 53.0%, and 72.8% to 48.6%, 44.4%, and 67.6%, respectively.
- Top-J: In Table 15, as J increases from 40 to 100, P3A's ASR on NQ drops from 76.0% to 72.2%, and on HotpotQA from 75.0% to 72.8%.
- Top-K: In Table 16, for K=1 to 10, P3A on NQ reaches 74.6% at K=4 and 59.8% at K=10; the authors summarize this as first rising and then falling with K.
- Case study: Appendix B.8 gives a complete example where P2A fails and P3A succeeds, used to illustrate that the perturbed document enters the final context.
What are some points that can be further explored?
The authors call for adaptive defenses; the scope of the evidence depends on the established models, sample size and default poisoning budget.
Limitations and future directions noted by the authors
- Evaluation scope: Section 4 states that RAG safety benchmarks that do not consider the reranker are incomplete, and argues for using this more realistic pipeline as the standard for future attack evaluation.
- Future defenses: Section 7 states that stricter safety evaluation and adaptive defense strategies are needed; this is a research direction in the conclusion, not a completed defense experiment.
- Nature of the mechanism explanation: Section 4 attributes the reranker's defensive benefit to cross-attention and fine-grained semantic consistency checking, but the paper does not separately provide a causal intervention experiment to verify this explanation.
Experimental coverage
- Models and data: The main experiments cover 3 generation models, and Table 8 adds 3 more; 2 rerankers, 3 retrievers and 3 datasets are used, with 500 evaluation questions per dataset (Section 6.1, Table 8, Appendix B.4).
- Default attack budget: The main setting is Np=5, Top-J=100, Top-K=5 per question; Figure 4 additionally reports Np=1, and Table 15 and Table 16 vary J and K respectively.
- Defense evaluation: Includes query rewriting, GPT-2 perplexity distribution, RobustRAG and TrustRAG; Table 6 reports the response time per 100 queries for the latter two.
- Optimization cost: The paper does not report the number of queries, gradient computation cost or runtime for P3A to generate a single document, nor does it report the number of experimental repetitions or statistical significance tests.
- Evidence on text quality: Naturalness and readability are mainly supported by edit distance, change rate, perplexity distribution and appendix cases; the paper does not report human evaluation or inter-rater agreement.
Summarize the main content of the paper
P3A combines prompt generation with reranker-aware perturbation for more practical RAG poisoning red teaming.
This is an attack study on targeted poisoning of RAG knowledge bases, focusing on filling in the reranker stage that existing evaluations often ignore.
- Problem: The authors state that a reranker fine-tuned only on benign in-domain data can weaken multiple existing attacks, so evaluating only on vanilla RAG would underestimate the resilience of actual pipelines.
- Method: P3A first has GPT-4o generate "target question + malicious context" documents according to four ranking preference principles, then under a white-box reranker selects character positions, optimizes candidates and performs beam search; P2A keeps only the prompting stage, for black-box scenarios.
- Main results: On NQ, MiniLM, Llama3-8B, P3A's ASR is 72.2%, and PoisonedRAG-B's is 34.8%; on HotpotQA, MiniLM, Qwen2.5-7B, P3A reaches 89.4% (Table 2).
- Defense results: Under the same NQ main setting, P3A is 63.8% after query rewriting, and 69.2% and 48.0% under RobustRAG and TrustRAG respectively; TrustRAG simultaneously increases the response time per 100 queries from 3.38 minutes to 16.75 minutes (Tables 5–6).
- Transfer and budget: On HotpotQA, the ASR for cross MiniLM/ELECTRA optimization and testing is 65.8% and 70.6%; with Np=1, P3A's ASR on NQ is 58.6% (Table 7, Figure 4).
- Boundary: On vanilla RAG, P3A is not always superior to P2A or specialized baselines; for example, on NQ, Llama3-8B, the three are 82.2%, 91.8%, 85.8% respectively (P3A, P2A, CorruptRAG-AS, Table 3).
The authors conclude that P3A/P2A can serve as red-teaming tools closer to actual RAG, and argue that future research should adopt reranker-enhanced pipelines and develop adaptive defenses.
Research lineage
8 foundations · 0 follow-ups in libraryNo later in-library follow-ups recorded yet.
Hover or focus a connected paper to inspect the citation context.