通过引用实现鲁棒性:通过引用已执行的指令来防御提示注入攻击
Robustness via Referencing: Defending against Prompt Injection Attacks by Referencing the Executed Instruction
AI总结:
本文提出通过利用LLM的指令遵循能力来防御提示注入攻击,通过生成包含答案和对应指令引用的响应,有效过滤非原始指令关联的答案,实验表明其在降低攻击成功率方面优于现有方法。
摘要:
大型语言模型(LLMs)在自然语言处理(NLP)领域表现出色,但其强大的指令遵循能力和无法区分指令与数据内容的能力使其易受提示注入攻击。这些攻击使LLMs偏离原始输入指令并执行恶意注入的指令,如搜索引擎检索的网页文档。现有防御方法,包括提示工程和微调方法,通常指导模型遵循原始指令并抑制执行注入指令的倾向。然而,我们的实验表明抑制指令遵循倾向具有挑战性。通过分析失败案例,我们发现尽管LLMs倾向于响应任何识别的指令,但它们能够正确引用正在执行的特定指令并在原始提示中参考。受这些发现启发,我们提出了一种新的防御方法,利用而非抑制LLM的指令遵循能力。我们的方法促使LLM生成包含答案和相应指令引用的响应。基于这些引用,我们过滤出与原始输入指令无关的答案。全面实验表明,我们的方法优于提示工程基线,并在某些场景中达到与微调方法相当的性能,将攻击成功率(ASR)降至0%。此外,我们的方法对整体效用影响极小。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。