DRIP: Defending Prompt Injection via Token-wise Representation Editing and Residual Fusion

Large language models (LLMs) are rapidly becoming core components of IT infrastructure, tasked with processing user data according to predefined instructions. However, LLMs remain vulnerable to prompt injection attacks, where malicious users inject directive tokens within the data to manipulate model behavior. The current defense strategies attempt to train LLMs to semantically distinguish between data and instruction tokens. Nevertheless, these approaches still face two key challenges: (1) the balance between security and utility, especially when interpreting the instruction-like tokens in the data section, and (2) the robustness against adaptive adversarial samples. In this work, we propose DRIP which aims to (1) achieve a new security-utility balance by ''de-instructionalization'', i.e., precisely removing the instruction semantics from the tokens in the data section while preserving their data semantics and (2) robustly maintain the effectiveness of the intended instruction, even against strong adversarial content. As for ''de-instructionalize'' tokens in the data section, we propose a training paradigm across data curation, model architecture, and loss design. It introduces a lightweight representation-editing module, which is trained to edit the embedding of instruction-like tokens in the data section, enhancing the model's security without compromising utility. As for preserving the intended instruction against unseen adversarial content, we improve the model architecture by introducing a lightweight residual module in LLM, largely reducing the overwriting possibility of adversarial content. We extensively compare DRIP with state-of-the-art techniques, including StruQ, SecAlign, ISE, and PFT on LLaMA-8B and Mistral-7B across three prompt injection benchmarks (SEP, AlpacaFarm, and InjecAgent). The results show that DRIP (1) improves role separation score by 44–64% and reduces attack success rate by over 68% for adaptive attacks and (2) achieves utility on par with the undefended model, indicating a new state-of-the-art against prompt injection attacks.

Link
https://www.semanticscholar.org/paper/5bdd4b4a33f2207d918e44be0d2cbc4524093cf3
Found by
Semantic Scholar
Authors
Ruo-Fan Liu, Yun Lin, Zhi-Yong Huang, Jin Dong
Categories
benchmark
Published
2026-11-14
Last seen by the radar
2026-11-15
Citations
1
Influential citations
0
Radar score
34.11 / 100 (how it is scored)
Why it scored so
Matched: benchmark; Primary record: Semantic Scholar
Related links
https://doi.org/10.1145/3830454.3832577
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Semantic Scholar