CachePrune: Teaching LLMs What Not to Follow via KV-Cache Editing
On the map: Efficient LLM inference and serving → KV cache optimization
also in 1 more
Abstract (arXiv)
Large Language Models (LLMs) are susceptible to indirect prompt injection attacks, where the model inadvertently responds to instructions injected into the prompt context. This vulnerability stems from LLMs' inability to distinguish between data and instructions within a prompt. We propose CachePrune, which defends against this attack by identifying and pruning neurons associated with instruction-following during KV cache encoding of the prompt context. The pruning steers the LLM toward interpreting the context purely as data rather than as instructions to follow. To identify these neurons, we introduce a neural attribution mechanism guided by a preferential attribution loss, and theoretically connect this loss to an upper bound of the Direct Preference Optimization (DPO) objective. Further, we improve the fidelity of neural attribution by leveraging an observed triggering effect in instruction-following. Our approach does not interfere with prompt formatting or incur test-time overhead during response generation. Experiments show that CachePrune significantly reduces the attack success rate while preserving the LLM's ability to follow user instructions.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in KV cache optimization, one of 12 directions in Efficient LLM inference and serving. Builds on 25 of its 39 references that are in the map. First posted on arXiv 29 Apr 2025.
Builds on
25 of 39 references.
References · 25
- 2017Attention Is All You Needcited by 60,361
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2019BERTScore: Evaluating Text Generation with BERTcited by 5,512
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,754
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
- 2023Jailbroken: How Does LLM Safety Training Fail?cited by 1,651
- 2017Learning Important Features Through Propagating Activation Differencescited by 1,458
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
- 2020Transformer Feed-Forward Layers Are Key-Value Memoriescited by 1,336
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Datasetcited by 860
13 more
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 832
- 2024WildChat: 1M ChatGPT Interaction Logs in the Wildcited by 629
- 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 375
- 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 267
- 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuningcited by 106
- 2024The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agentscited by 99
- 2024Get my drift? Catching LLM Task Drift with Activation Deltascited by 72
- 2023Assessing Prompt Injection Risks in 200+ Custom GPTscited by 55
- 2024WIPI: A New Web Threat for LLM-Driven Web Agentscited by 51
- 2024Embedding-based classifiers can detect prompt injection attackscited by 27
- 2023Mitigating Biases for Instruction-following Language Models via Bias Neurons Eliminationcited by 23
- 2024Text Generation: A Systematic Literature Review of Tasks, Evaluation, and Challengescited by 18
- 2022Task-specific Compression for Multi-task Language Models using Attribution-based Pruningcited by 7
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2023Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injection
- 2025Robustness via Referencing: Defending against Prompt Injection Attacks by Referencing the Executed Instruction
- 2025Unveiling Instruction-Specific Neurons & Experts: An Analytical Framework for LLM's Instruction-Following Capabilities
- 2024Jailbreak Instruction-Tuned LLMs via end-of-sentence MLP Re-weighting
- 2026Mask2Shield: Strengthening LLM Safety against Neuron-Pruning Attacks
- 2025Attribution-Guided Pruning for Insight and Control: Circuit Discovery and Targeted Correction in Small-scale LLMs
- 2024ROSE: A Reward-Oriented Data Selection Framework for LLM Task-Specific Instruction Tuning
- 2025ASIDE: Architectural Separation of Instructions and Data in Language Models