mlsanityData to 14 Oct 2026

AttnTrace: Contextual Attribution of Prompt Injection and Knowledge Corruption

arXiv 2508.03793 ↗First posted 5 Aug 2025cs.CL cs.CRcited by 7

On the map: Retrieval-augmented generation → Privacy and security of RAG

also in 1 more
Abstract (arXiv)

Long-context large language models (LLMs), such as Gemini-2.5-Pro and Claude-Sonnet-4, are increasingly used to empower advanced AI systems, including retrieval-augmented generation (RAG) pipelines and autonomous agents. In these systems, an LLM receives an instruction along with a context--often consisting of texts retrieved from a knowledge database or memory--and generates a response that is contextually grounded by following the instruction. Recent studies have designed solutions to trace back to a subset of texts in the context that contributes most to the response generated by the LLM. These solutions have numerous real-world applications, including performing post-attack forensic analysis and improving the interpretability and trustworthiness of LLM outputs. While significant efforts have been made, state-of-the-art solutions such as TracLLM often lead to a high computation cost, e.g., it takes TracLLM hundreds of seconds to perform traceback for a single response-context pair. In this work, we propose AttnTrace, a new context traceback method based on the attention weights produced by an LLM for a prompt. To effectively utilize attention weights, we introduce two techniques designed to enhance the effectiveness of AttnTrace, and we provide theoretical insights for our design choice. We also perform a systematic evaluation for AttnTrace. The results demonstrate that AttnTrace is more accurate and efficient than existing state-of-the-art context traceback methods. We also show that AttnTrace can improve state-of-the-art methods in detecting prompt injection under long contexts through the attribution-before-detection paradigm. As a real-world application, we demonstrate that AttnTrace can effectively pinpoint injected instructions in a paper designed to manipulate LLM-generated reviews. The code is at https://github.com/Wang-Yanting/AttnTrace.

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Placed in Privacy and security of RAG, one of 15 directions in Retrieval-augmented generation. Builds on 69 of its 97 references that are in the map. First posted on arXiv 5 Aug 2025.

Builds on

69 of 97 references.

Closest ancestors · 6

Same direction, newest first

  1. 2025Traceback of Poisoning Attacks to Retrieval-Augmented Generation30 Apr
  2. 2024Machine Against the RAG: Jamming Retrieval-Augmented Generation with Blocker Documents9 Jun
  3. 2024BadRAG: Identifying Vulnerabilities in Retrieval Augmented Generation of Large Language Models3 Jun
  4. 2024Certifiably Robust RAG against Retrieval Corruption24 May
  5. 2024TrojanRAG: Retrieval-Augmented Generation Can Be Backdoor Driver in Large Language Models22 May
  6. 2024PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models12 Feb

Other references · 63

  1. 2017Attention Is All You Needcited by 60,361
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  3. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  4. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
  5. 2017A Unified Approach to Interpreting Model Predictionscited by 6,555
  6. 2016"Why Should I Trust You?": Explaining the Predictions of Any Classifiercited by 5,070
  7. 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,824
  8. 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,754
  9. 2017Axiomatic Attribution for Deep Networkscited by 3,384
  10. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
  11. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  12. 2013Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Mapscited by 2,371
38 more
  1. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
  2. 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,745
  3. 2016MS MARCO: A Human Generated MAchine Reading COmprehension Datasetcited by 1,605
  4. 2017Learning Important Features Through Propagating Activation Differencescited by 1,458
  5. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
  6. 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,417
  7. 2023FActScore: Fine-grained Atomic Evaluation of Factual Precision in Long Form Text Generationcited by 1,282
  8. 2021MuSiQue: Multihop Questions via Single-hop Question Compositioncited by 916
  9. 2018RISE: Randomized Input Sampling for Explanation of Black-box Modelscited by 838
  10. 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 832
  11. 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Modelscited by 832
  12. 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Modelscited by 785
  13. 2019Attention is not not Explanationcited by 636
  14. 2017The NarrativeQA Reading Comprehension Challengecited by 597
  15. 2023Enabling Large Language Models to Generate Text with Citationscited by 595
  16. 2020Estimating Training Data Influence by Tracing Gradient Descentcited by 580
  17. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 493
  18. 2024AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Basescited by 429
  19. 2019Is Attention Interpretable?cited by 389
  20. 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 375
  21. 2021QMSum: A New Benchmark for Query-based Multi-domain Meeting Summarizationcited by 365
  22. 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 364
  23. 2025Defeating Prompt Injections by Designcited by 297
  24. 2023Exploiting Programmatic Behavior of LLMs: Dual-Use Through Standard Security Attackscited by 278
  25. 2020Explaining by Removing: A Unified Framework for Model Explanationcited by 218
  26. 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 210
  27. 2023Poisoning Retrieval Corpora by Injecting Adversarial Passagescited by 159
  28. 2025DataSentinel: A Game-Theoretic Detection of Prompt Injection Attackscited by 143
  29. 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QAcited by 122
  30. 2025Securing AI Agents with Information-Flow Controlcited by 121
  31. 2024Automatic and Universal Prompt Injection Attacks against Large Language Modelscited by 119
  32. 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuningcited by 106
  33. 2024The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agentscited by 99
  34. 2024ContextCite: Attributing Model Generation to Contextcited by 98
  35. 2024System-Level Defense against Indirect Prompt Injection Attacks: An Information Flow Control Perspectivecited by 96
  36. 2024Attention Tracker: Detecting Prompt Injection Attacks in LLMscited by 95
  37. 2024Neural Exec: Learning (and Learning from) Execution Triggers for Prompt Injection Attackscited by 85
  38. 2024BadChain: Backdoor Chain-of-Thought Prompting for Large Language Modelscited by 80

50 most cited of 63 All 63 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 7.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025TracLLM: A Generic Framework for Attributing Long Context LLMs
  2. 2025Learning to Extract Context for Context-Aware LLM Inference
  3. 2025Where Did It Go Wrong? Attributing Undesirable LLM Behaviors via Representation Gradient Tracing
  4. 2025SAFE: Improving LLM Systems using Sentence-Level In-generation Attribution
  5. 2026FlashRT: Towards Computationally and Memory Efficient Red-Teaming for Prompt Injection and Knowledge Corruption
  6. 2026ARGUS: Defending LLM Agents Against Context-Aware Prompt Injection
  7. 2026Probing for Knowledge Attribution in Large Language Models
  8. 2026AttnDiff: Attention-based Differential Fingerprinting for Large Language Models