mlsanityData to 14 Oct 2026

Robustness via Referencing: Defending against Prompt Injection Attacks by Referencing the Executed Instruction

arXiv 2504.20472 ↗First posted 29 Apr 2025cs.CRcited by 16

On the map: LLM safety and security → Prompt injection and agent security

Abstract (arXiv)

Large language models (LLMs) have demonstrated impressive performance and have come to dominate the field of natural language processing (NLP) across various tasks. However, due to their strong instruction-following capabilities and inability to distinguish between instructions and data content, LLMs are vulnerable to prompt injection attacks. These attacks manipulate LLMs into deviating from the original input instructions and executing maliciously injected instructions within data content, such as web documents retrieved from search engines. Existing defense methods, including prompt-engineering and fine-tuning approaches, typically instruct models to follow the original input instructions while suppressing their tendencies to execute injected instructions. However, our experiments reveal that suppressing instruction-following tendencies is challenging. Through analyzing failure cases, we observe that although LLMs tend to respond to any recognized instructions, they are aware of which specific instructions they are executing and can correctly reference them within the original prompt. Motivated by these findings, we propose a novel defense method that leverages, rather than suppresses, the instruction-following abilities of LLMs. Our approach prompts LLMs to generate responses that include both answers and their corresponding instruction references. Based on these references, we filter out answers not associated with the original input instructions. Comprehensive experiments demonstrate that our method outperforms prompt-engineering baselines and achieves performance comparable to fine-tuning methods, reducing the attack success rate (ASR) to 0 percent in some scenarios. Moreover, our approach has minimal impact on overall utility.

Key facts. Cited by 16 papers in the map (data through 14 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 42 of its 62 references that are in the map. First posted on arXiv 29 Apr 2025.

Builds on

42 of 62 references.

Closest ancestors · 19

Same direction, newest first

  1. 2025Adaptive Attacks Break Defenses Against Indirect Prompt Injection Attacks on LLM Agents27 Feb
  2. 2025Can Indirect Prompt Injection Attacks Be Detected and Removed?23 Feb
  3. 2025RTBAS: Defending LLM Agents Against Prompt Injection and Privacy Leakage13 Feb
  4. 2024Universal and Context-Independent Triggers for Precise Control of LLM Outputs22 Nov
  5. 2024Defense Against Prompt Injection Attack by Leveraging Attack Techniques1 Nov
  6. 2024FATH: Authentication-based Test-time Defense against Indirect Prompt Injection Attacks28 Oct
  7. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions19 Apr
  8. 2024Optimization-based Prompt Injection Attack to LLM-as-a-Judge26 Mar
  9. 2024Defending Against Indirect Prompt Injection Attacks With Spotlighting20 Mar
  10. 2024Automatic and Universal Prompt Injection Attacks against Large Language Models7 Mar
  11. 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar
  12. 2024StruQ: Defending Against Prompt Injection with Structured Queries9 Feb
7 more
  1. 2024Signed-Prompt: A New Approach to Prevent Prompt Injection Attacks Against LLM-Integrated Applications15 Jan
  2. 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuning29 Dec
  3. 2023Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models21 Dec
  4. 2023Formalizing and Benchmarking Prompt Injection Attacks and Defenses19 Oct
  5. 2023Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injection17 Aug
  6. 2023Prompt Injection attack against LLM-integrated Applications8 Jun
  7. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection23 Feb

Other references · 23

  1. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,415
  5. 2024GPT-4o System Cardcited by 4,588
  6. 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
  7. 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
  8. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
  9. 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,955
  10. 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,407
  11. 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 832
  12. 2023AlpacaFarm: A Simulation Framework for Methods that Learn from Human Feedbackcited by 748
11 more
  1. 2022A Survey on In-context Learningcited by 721
  2. 2023StructGPT: A General Framework for Large Language Model to Reason over Structured Datacited by 343
  3. 2023On the Exploitability of Instruction Tuningcited by 116
  4. 2023AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Modelscited by 111
  5. 2024Machine Against the RAG: Jamming Retrieval-Augmented Generation with Blocker Documentscited by 102
  6. 2025GuardReasoner: Towards Reasoning-based LLM Safeguardscited by 100
  7. 2024UniGraph: Learning a Unified Cross-Domain Foundation Model for Text-Attributed Graphscited by 66
  8. 2025Safety in Large Reasoning Models: A Surveycited by 64
  9. 2023Towards Reasoning in Large Language Models via Multi-Agent Peer Review Collaborationcited by 51
  10. 2025Evaluating the Paperclip Maximizer: Are RL-Based Language Models More Likely to Pursue Instrumental Goals?cited by 33
  11. 2024Can Knowledge Graphs Make Large Language Models More Trustworthy? An Empirical Study Over Open-ended Question Answeringcited by 24

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 8; 2026: 8.

16 papers.

Sort:

By area:

Similar, not cited

Close in wording, no citation either way

  1. 2025Prompt Injection as an Emerging Threat: Evaluating the Resilience of Large Language Models
  2. 2025Backdoor-Powered Prompt Injection Attacks Nullify Defense Methods
  3. 2025System Prompt Poisoning: Persistent Attacks on Large Language Models Beyond User Injection
  4. 2025LLMail-Inject: A Dataset from a Realistic Adaptive Prompt Injection Challenge
  5. 2025A Critical Evaluation of Defenses against Prompt Injection Attacks
  6. 2026AttackEval: A Systematic Empirical Study of Prompt Injection Attack Effectiveness Against Large Language Models
  7. 2026Merging Triggers, Breaking Backdoors: Defensive Poisoning for Instruction-Tuned Language Models
  8. 2026Know Thy Enemy: Securing LLMs Against Prompt Injection via Diverse Data Synthesis and Instruction-Level Chain-of-Thought Learning