Skip to content

TRACE: Tracing Target Answers in Poisoned Retrieval Corpora via Token Influence AttributionTracing Target Answers in Poisoned Retrieval Corpora via Token Influence Attribution

arXiv· arXiv:2606.25721· Yan-Lun Chen, Pin-Yu Chen, Chia-Mu Yu, Ying-Dar Lin, Yu-Sung Wu, Wei-Bin LeeNational Yang Ming Chiao Tung University; IBM Research; Hon Hai Research InstituteIndexed by this site · 27 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose TRACE, which uses token influence attribution to detect PoisonedRAG-style corpus poisoning; the authors claim an average TPR of 98.87% on Phi-4-mini, with lower runtime than RAGForensics.

Threat modelThe attacker uses PoisonedRAG-style corpus poisoning: specifying a wrong answer for a target query, injecting malicious documents supporting that answer into the retrieval corpus (5 per question), so that the RAG's target LLM outputs the attacker's preset answer after retrieving these documents. The defense, TRACE, performs white-box token gradient attribution on the retrieved documents before answer generation, without auxiliary classifiers or additional LLM verification.

Questions
RAG systems are vulnerable to corpus poisoning attacks: attackers inject malicious documents that support wrong answers to manipulate model outputs. The authors say existing detection methods rely on auxiliary classifiers or additional LLM verification, with high computation and maintenance overhead, and that lightweight, easy-to-deploy detection mechanisms are needed.
Methods
The authors propose TRACE: drawing on Token Highlighter's token influence attribution, it first backpropagates gradients from a preset affirmation string to find recurrent high-influence keywords in retrieved documents, then uses these keywords as targets for secondary attribution verification; if they recur across documents, the corpus is judged poisoned, with no auxiliary model needed.
Experiments and results
Evaluated on NQ, HotpotQA, MS-MARCO, and 6 LLMs. The authors claim TPR exceeds 90% on almost all models, with Phi-4-mini averaging 98.87% TPR; compared with RAGForensics, TPR is higher and runtime lower; in benign consistent scenarios, FPR rises to 39.22%.
Limitations and future work
The authors note: the method is designed for generative question answering and was not validated on binary-classification QA; at low poisoning rates, false positives exceed true detections, making it suitable as an initial screening; the threshold does not scale with retrieval depth; single-document poisoning and rewritten-target attacks are not covered. Experiments were conducted only on the PoisonedRAG attack, 3 QA datasets, and 6 open-source LLMs.
Experimental setupLlama-3.1-8B、Gemma-3-4b et al. · Natural Questions (NQ)、HotpotQA et al. · TPR、FPR et al.
Evaluated models
Llama-3.1-8BGemma-3-4bQwen-3.5-4BVicuna-7bMistral-7BPhi-4-mini
Benchmarks
Natural Questions (NQ)HotpotQAMS-MARCO
Metrics
TPRFPRDetection Accuracy (ACC)检测耗时
AI summaryResearchers propose TRACE, a lightweight detection framework that identifies RAG corpus poisoning attacks via token influence attribution and can reveal the attacker-specified target answer. The method first finds repeatedly occurring high-influence keywords in retrieved documents, then confirms their influence on model predictions through secondary verification. Experiments on three QA benchmarks and six LLMs show strong detection performance, and the method is lighter-weight than existing approaches that rely on auxiliary classifiers or additional LLM verification.

Researchers propose TRACE, a lightweight detection framework that identifies RAG corpus poisoning attacks via token influence attribution and can reveal the attacker-specified target answer. The method first finds repeatedly occurring high-influence keywords in retrieved documents, then confirms their influence on model predictions through secondary verification. Experiments on three QA benchmarks and six LLMs show strong detection performance, and the method is lighter-weight than existing approaches that rely on auxiliary classifiers or additional LLM verification.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    How to detect RAG corpus poisoning at low cost: the authors propose TRACE, a lightweight detection framework based on token influence attribution.

    Core question: How to lightly detect poisoned documents in the RAG retrieval corpus without introducing auxiliary classifiers or additional LLM verification, and incidentally reveal the attacker's preset target answer.

    • Scenario and importance: RAG is widely used in enterprise scenarios such as customer service, knowledge management, and compliance assistance; the authors state that corpus poisoning causes retrieved malicious documents to steer LLM outputs toward wrong answers, potentially manipulating knowledge-driven applications such as market intelligence and business analysis.
    • Shortcomings of existing methods: The authors state that existing detection mostly relies on auxiliary classifiers or additional LLM verification, incurring computational and maintenance costs from model training or repeated LLM inference, which is impractical for many organizations.
    • Core observation: PoisonedRAG-style attacks synchronously implant the same target answer across multiple documents; these answer-related tokens have abnormally high influence on the target LLM's prediction and recur across documents.
    • Method proposed in the paper: TRACE, a two-stage detection framework—first discovering recurrent high-influence keywords across documents, then performing secondary attribution verification; the authors claim it requires no auxiliary model or external supervision, can be executed on the fly before answer generation, and the recurrent tokens are often exactly the attacker's specified target answer.
    • Threat model:
      • Attacker goal: Specify a target query and a wrong target answer, and make the RAG's target LLM output that answer (Figure 1).
      • Attack method: Use an LLM to generate multiple documents consistently supporting the wrong information and inject them into the retrieval corpus; experiments use the PoisonedRAG default configuration, with 5 poisoned documents per question.
      • Victim system: A RAG question-answering pipeline using Contriever dense retrieval (dot-product similarity, 5 documents retrieved per question) + a target LLM.
      • Defender capability: TRACE requires backpropagation through the target LLM to compute token gradients (i.e., white-box access), screening retrieval results before answer generation.
  2. What related research exists?

    The paper groups related work into three categories: RAG poisoning attacks, poisoning defenses, and poisoning detection, and notes that research specifically on detection is relatively scarce.

    RAG poisoning attacks

    • Zhong et al. (2023), Su et al. (2024): optimize adversarial passages to maximize the probability of being retrieved; Zou et al. (2025)'s PoisonedRAG further jointly manipulates retrieval and generation, and is the attack baseline of this paper.
    • Backdoors and stealthy variants: Chaudhari et al. (2026), Xue et al. (2024), Cheng et al. (2024) introduce trigger-based malicious documents; Zhang et al. (2024), Chang et al. (2025), Sui (2026), Cho et al. (2024), Dhar et al. (2026) explore black-box document generation, genetic perturbation, and invisible Unicode injection.
    • Expanded attack targets: denial of service, agent corruption, jailbreak, opinion manipulation, fact-checking attacks, multimodal poisoning, etc. (Shafran et al. 2025; Chen et al. 2024; Deng et al. 2024; Chen et al. 2025; Gong et al. 2025; Wu et al. 2026; Liu et al. 2025; Ha et al. 2026; Zhang et al. 2025c); Tan et al. (2024) demonstrate RAG's vulnerability to real-world misinformation.

    RAG poisoning defenses

    • Include provably robust architectures (Xiang et al., 2024; Shen et al., 2026), retrieval-stage filtering and reranking (Zhou et al., 2025; Zheng et al., 2025; Pathmanathan et al., 2025; si et al., 2026), generation-level robustness enhancement (Wei et al., 2025; Wang et al., 2025; Walker et al., 2025), and sparse attention and multi-layer defenses (Dekel et al., 2026; Kolhe et al., 2025).
    • The paper notes that recent benchmarks (Liang et al., 2025; Zhang et al., 2025b; Su et al., 2025) consistently show that existing RAG defenses still have vulnerabilities.

    RAG poisoning detection

    • RevPRAG (Tan et al., 2025): identifies attacks via activation anomalies; RAGForensics (Zhang et al., 2025a): focuses on post-hoc attribution and cleanup; RAGMask (Pathmanathan et al., 2025): detects suspicious passages using token masking; RAGuard (Cheng et al., 2025): combines retrieval expansion with perplexity filtering. The paper states that, compared with defense mechanisms, dedicated poisoning detection research is relatively scarce.

    Baselines and benchmarks: the detection baseline is RAGForensics (the authors reimplemented it with the same target LLM as TRACE); the attack baseline is PoisonedRAG; the evaluation datasets are NQ, HotpotQA, and MS-MARCO.

    The authors position this paper as poisoning detection from the perspective of token attribution, directly tracing the tokens that drive the answer within retrieved documents, which differs from the above classifier-style or post-hoc attribution-style methods.

  3. How does the paper address this problem?

    TRACE has two stages: first find recurrent high-influence keywords across documents, then use these words as targets for secondary attribution verification, alerting if they recur.

    Overall approach: adapt Token Highlighter's (Hu et al., 2025) method of finding the most influential tokens into a retrieval-stage detector. TRACE does not explicitly distinguish benign from malicious documents; instead, it traces the tokens with the greatest influence on the target LLM's prediction, and if the same set of high-influence tokens recurs across multiple documents, the corpus is judged to be poisoned.

    Problem setting and formalization

    • Following Token Highlighter's definition: given an LLM Mθ and an embedding function embedθ, a target string s1:n yields an embedding matrix x1:n = embedθ(s1:n).
    • Token influence is defined as Influence(xi) = |∇xi log Pθ(y|x1:n)|2, i.e., the gradient norm of the log probability of generating the affirmation sentence y with respect to the token embedding xi; the k tokens with the highest influence form the key token set Q.

    Phase 1: Keyword search (Algorithm 1)

    • The affirmation string y is preset to "Yes, the answer is:"; for each retrieved document d, the top-k1 high-influence tokens are taken, excluding punctuation, high-frequency words, and tokens already appearing in the question q (the exclusion list is in Appendix B).
    • The reason given by the paper: punctuation and high-frequency words are usually unrelated to the actual semantic answer, and keeping them introduces noise and lowers detection accuracy.
    • Because the attacker's target answer often consists of consecutive tokens, consecutive indices in the top set are concatenated into candidate phrases; phrases are first accumulated in the document-level set Kd into a global multiset Ktemp, and a candidate phrase enters the final keyword set K only when it recurs in at least a1 documents.

    Phase 2: Secondary verification (Algorithm 2)

    • For each candidate keyword p in K, token-level influence gradients are recomputed with p as the target prediction, the top-k2 high-influence tokens are taken in each document, and only tokens appearing in p are kept, forming the document-level trigger set Kd and aggregated into Ktemp.
    • A trigger token's high-influence recurrence must span at least a2 different documents to enter the target set T; if T is non-empty, the detection flag f is set to true and the corpus is judged to be poisoned.

    Key parameters and evaluation method

    • Main-text configuration: k1 = 5, k2 = 3; TPR-priority configuration a1 = 3, a2 = 2 (Figure 3); low-FPR configuration a1 = 4, a2 = 4 (Figure 4); balanced configuration a1 = 4, a2 = 3 (Figures 5, 6).
    • Metrics: TPR is reported for attacked scenarios, FPR for unattacked scenarios; target answer identification is reported as Detection Accuracy (ACC)—a success is recorded if any token in T appears in the ground-truth target answer; all results are averages of three independent trials.
  4. What experiments did the paper conduct?

    Evaluated TPR/FPR/ACC and runtime on 3 QA datasets and 6 LLMs, compared with RAGForensics, and conducted benign consistency and component ablation.

    Experimental setup

    • Target models: Llama-3.1-8B, Gemma-3-4b, Qwen-3.5-4B, Vicuna-7b, Mistral-7B, Phi-4-mini (Appendix C gives the corresponding HuggingFace checkpoints).
    • Attack: PoisonedRAG default configuration, injecting 5 poisoned documents per question, using its evaluation queries and poisoned documents.
    • Datasets and corpora: NQ, HotpotQA, MS-MARCO, and the corresponding knowledge bases provided by PoisonedRAG.
    • Retriever: Contriever, dot-product similarity, retrieving 5 documents per question.
    • Metrics and criteria: TPR (attacked), FPR (no attack), ACC (any token in T matches the ground-truth target answer); results are averages of three independent trials.
    • Baseline: RAGForensics, reimplemented by the authors with the same target LLM, compared using the Figure 3 configuration.

    Main results

    Main results are presented mainly as figures (Figures 3–7); the numbers given in the text are as follows; Table 1 gives a cell-by-cell comparison with RAGForensics (configuration same as Figure 3):

    Swipe horizontally to read the table

    ModelDatasetTRACE TPRForensics TPRTRACE time (s)Forensics time (s)
    Llama-3.1-8BNQ98.97%95.88%1.219.03
    Llama-3.1-8BHotpotQA95.29%92.94%1.149.05
    Llama-3.1-8BMS-MARCO98.67%92.00%1.268.78
    Qwen-3.5-4BNQ98.97%98.97%9.1117.19
    Qwen-3.5-4BHotpotQA96.47%85.88%8.9217.14
    Qwen-3.5-4BMS-MARCO97.33%97.33%9.0016.99
    Phi-4-miniNQ98.97%91.75%1.065.82
    Phi-4-miniHotpotQA97.65%84.71%1.016.43
    Phi-4-miniMS-MARCO100.00%93.33%1.095.42

    According to Table 1. Gemma-3-4b, Vicuna-7b, and Mistral-7B do not appear in this table.

    • The authors state that under the Figure 3 configuration, TRACE's TPR exceeds 90% on almost all target models, and Phi-4-mini's average TPR across the three datasets reaches 98.87%.
    • The authors state that under the Figure 4 configuration, the overall FPR can be pressed below 10%; under the balanced configuration of Figures 5 and 6, the overall TPR remains above 80%, and on Phi-4-mini the TPR exceeds 90% with FPR only slightly above 10%.
    • The authors state that TRACE does not require prior knowledge of the target answer, whereas RAGForensics is reactive and requires first suspecting the output and then performing reverse verification with the known target answer.

    Target answer identification (ACC)

    • Figure 7: the authors state that ACC is about 90% for each model on NQ and MS-MARCO, and drops on HotpotQA but still exceeds 70% for all models.
    • Figure 8: directly matching the target answer with the Phase 1 keyword set K yields higher ACC than Figure 7; the authors observe a gap between high TPR (over 90%) and ACC (70%–82%) on HotpotQA.
    • The authors' analysis: in a few successful alert samples, neither K nor T contains the target answer tokens, but other suspicious tokens entering T still cause the corpus to be correctly judged; the authors hypothesize that these tokens are "semantic anchors" that attract the model's greatest attention.

    Benign answer consistency analysis

    • Table 2: under the balanced configuration (a1 = 4, a2 = 3), the final FPR is 13.24%, of which the answer-matching FPR drops from 13.12% to 5.25% after Phase 2 (a decrease of 7.87 percentage points); under the low-FPR configuration (a1 = 4, a2 = 4), the final FPR is 7.68%, and the answer-matching type drops from 13.12% to 3.59% (a decrease of 9.53 percentage points).
    • The proportion of final false positives in which the detected target matches the gold answer: 39.7% under the balanced configuration and 46.7% under the low-FPR configuration; the authors state that benign consensus remains a source of some final false positives, and TRACE only screens for recurrent answer-driven influence and does not independently judge whether the consensus is benign or malicious.

    Benign-consistent hard negatives

    • Construction: GPT-5 mini selected clean passages from HotpotQA and MS-MARCO that directly support the gold answer; after deduplication, each group has at least 3 passages, for a total of 17 hard-negative retrieval sets; GPT-5 mini only annotated existing documents and did not generate or modify them.
    • Table 3 (three target models, balanced configuration): standard benign retrieval over 257 queries has FPR 13.16%; hard negatives over 17 queries have FPR 39.22%, of which the gold-matching alert rate is 31.37%.
    • The authors state that strong factual consensus is challenging for TRACE, but most evaluations still do not alert, and alerting depends on the strength and recurrence of token-level influence rather than document consistency alone.

    Other ablations and analyses

    The following ablations use Llama-3.1-8B, Qwen-3.5-4B, Phi-4-mini across 3 datasets under the balanced configuration, with results as macro-averages over model-dataset combinations:

    • affirmation string (Table 4): four formulations give TPR 87.47%–88.34%, FPR 13.16%–13.64%, ACC 80.74%–82.10%; the authors state sensitivity to the specific wording is limited.
    • Exclusion list (Table 5): retaining high-frequency words has limited impact (TPR 87.31%, FPR 13.09%); retaining punctuation raises FPR to 73.14% (TPR 98.94%), and the authors state that punctuation filtering is important for preventing non-semantic tokens from becoming evidence.
    • Consecutive token merging (Table 6): when disabled, TPR 88.50%, FPR 13.87%, ACC 81.27%, a small difference from enabled (88.13%, 13.16%, 80.97%); the authors state that merging is not the main source of aggregated detection performance.
    • Retrieval depth (Table 7, Appendix D.1): with 5/10/20 retrieved documents, TPR 88.13%/99.25%/99.36%, FPR 13.16%/58.32%/84.83%, and per-query latency 3.76/10.09/50.00 seconds; the authors caution that the number of poisoned documents is fixed at 5, so the rise in TPR should be understood as increased detector sensitivity rather than a stronger attack.
    • Poison dilution (Table 8, Appendix D.2): with only 1 poisoned document among 5 retrieved and thresholds (4,3), TPR 9.98%, ACC 0.38%; relaxing to (2,2) gives TPR 68.40%, ACC 7.57%; with 3 poisoned documents and thresholds (3,2), TPR 90.15%, ACC 73.29%. The authors state that dilution weakens both the attack signal and detection sensitivity, and that detecting single-document poisoning and paraphrased-target attacks is a future direction.
  5. What are some points that can be further explored?

    The authors list four limitations: task applicability, base-rate effects, threshold scaling, and detection scope; experiments cover only PoisonedRAG-style attacks and QA scenarios.

    Limitations noted by the authors and future directions

    • Task applicability (Limitations): the core mechanism relies on the target LLM's anomalous attention to the attacker-specified answer, and this strategy is designed for generative question answering; when used for binary question answering such as True/False, its assumptions and empirical performance may differ from the experiments in this paper.
    • Base-rate effect (Limitations): when poisoning attacks are rare, unless the FPR is extremely low, the number of false positives will exceed true detections; the authors consider TRACE better suited as a lightweight first-stage screening that outputs a high-recall candidate set for subsequent verification, rather than a standalone blocker.
    • Thresholds do not scale with retrieval depth (Limitations): the absolute recurrence thresholds a1 and a2 do not automatically adjust with the number of retrieved documents, and a larger retrieval set increases the chance of accidental token recurrence, thereby raising false positives; different retrieval depths require depth-dependent calibration or normalized thresholds.
    • Limited detection scope (Limitations): TRACE is not a general RAG poisoning detector; it only screens for PoisonedRAG-style cross-document answer-driven recurrence and does not judge whether the consensus itself is true or benign; attacks lacking this recurrence feature (isolated single-document poisoning, possibly paraphrased-target injection) are outside the currently validated scope.
    • Reduced sensitivity under sparse injection (Limitations): sensitivity decreases when the attacker injects fewer poisoned documents; the authors also note that retrieving fewer poisoned documents itself lowers ASR, so there is a trade-off between attack effectiveness and detectability.
    • Future directions (Appendix D.2): detecting single-document poisoning and paraphrased-target attacks remains an important future direction.

    Scope of experiments

    • The evaluated models are 6 open-source LLMs: Llama-3.1-8B, Gemma-3-4b, Qwen-3.5-4B, Vicuna-7b, Mistral-7B, Phi-4-mini (Section 5.1).
    • Attacks cover only the PoisonedRAG default configuration (5 poisoned documents per question), with datasets NQ, HotpotQA, MS-MARCO, and retriever Contriever, retrieving 5 documents per question (Section 5.1).
    • The detection baseline is compared only with RAGForensics, and Table 1 lists only three models: Llama-3.1-8B, Qwen-3.5-4B, Phi-4-mini (Section 6.1).
    • All results are averages of three independent trials (Section 5.1); the hard-negative evaluation sample size is 17 retrieval sets (Section 6.4).
    • The paper does not report statistical significance tests, nor detection performance under attack methods other than PoisonedRAG.
  6. Summarize the main content of the paper

    TRACE uses token influence attribution for lightweight RAG poisoning screening; the authors report high TPR, low runtime, and the ability to recover the attacker's target answer.

    A RAG poisoning detection paper: targeting PoisonedRAG-style corpus poisoning, the authors propose a lightweight detection framework, TRACE, for deployment scenarios that cannot bear the overhead of auxiliary classifiers or additional LLM verification.

    • Problem addressed: attackers inject multiple documents into the retrieval corpus that consistently support a wrong answer, manipulating RAG output; the authors say existing detection methods have high computation and maintenance costs.
    • Method highlights: drawing on Token Highlighter's gradient attribution, Phase 1 uses a preset affirmation string to find high-influence keywords that recur across documents (excluding punctuation, high-frequency words and question tokens, merging consecutive tokens into phrases, threshold a1); Phase 2 performs secondary attribution targeting these keywords, and raises an alarm if they recur across a2 documents. No auxiliary model is needed, and it can run before answer generation.
    • Main results:
      • The authors say that under the Figure 3 configuration almost all models have TPR above 90%, with Phi-4-mini averaging 98.87% TPR across three datasets; under the low-FPR configuration overall FPR can be pressed below 10%.
      • Compared with RAGForensics (Table 1): TRACE's TPR is no lower than the competitor in every cell, and its time per question is 1.01–9.11 seconds, lower than the competitor's 5.42–17.19 seconds.
      • Target answer identification: ACC is about 90% on NQ and MS-MARCO, and above 70% for all models on HotpotQA (Figure 7).
      • Exceptions: FPR rises to 39.22% on benign consistent hard negatives (Table 3, n=17); with only 1 poisoned document, TPR drops to 9.98% (Table 8).
    • Authors' conclusions and implications: TRACE can screen for poisoning at low cost and recover the attack target without a prior on the target answer; the authors also stress that it should serve as a first-stage screener rather than a standalone blocker, and that detection of single-document poisoning and rewritten-target attacks is left to future work.

Related papers

Show 3 more papers
Read originalarxiv.org