[论文解读] Defending Against Indirect Prompt Injection Attacks With Spotlighting
本论文提出 spotlighting,一系列提示工程技术(delimiting、datamarking、encoding)帮助 LLMs 区分输入来源并防御间接提示注入攻击,在多种模型上实现显著的 ASR 下降,任务影响微小。
Large Language Models (LLMs), while powerful, are built and trained to process a single text input. In common applications, multiple inputs can be processed by concatenating them together into a single stream of text. However, the LLM is unable to distinguish which sections of prompt belong to various input sources. Indirect prompt injection attacks take advantage of this vulnerability by embedding adversarial instructions into untrusted data being processed alongside user commands. Often, the LLM will mistake the adversarial instructions as user commands to be followed, creating a security vulnerability in the larger system. We introduce spotlighting, a family of prompt engineering techniques that can be used to improve LLMs' ability to distinguish among multiple sources of input. The key insight is to utilize transformations of an input to provide a reliable and continuous signal of its provenance. We evaluate spotlighting as a defense against indirect prompt injection attacks, and find that it is a robust defense that has minimal detrimental impact to underlying NLP tasks. Using GPT-family models, we find that spotlighting reduces the attack success rate from greater than {50}\% to below {2}\% in our experiments with minimal impact on task efficacy.
研究动机与目标
- 将间接提示注入攻击(XPIA)激励并正式化为一种安全风险,当 LLMs 在处理外部数据与用户提示共存时。
- 提出 spotlighting 作为一组变换,向模型揭示输入来源并降低攻击成功率。
- 评估三种 spotlighting 实例在多种 GPT 系列模型和任务上的有效性。
- 评估 spotlighting 对核心 NLP 任务性能的影响,确保在实际应用中的可行性。
提出的方法
- 定义并实现三种 spotlighting 变换:delimiting、datamarking、和 encoding。
- 对输入进行变换并更新系统提示,以指示如何安全处理输入块。
- 使用跨任务的 1000 篇攻击文档的合成语料库来测量 Attack Success Rate (ASR)。
- 比较每种 spotlighting 方法在不同模型(GPT-系列)和任务中的 ASR 降幅。
- 通过基准数据集(SQuAD Q&A、SuperGLUE、IMDB)在有无 datamarking 或 encoding 的情况下评估任务性能影响。

实验结果
研究问题
- RQ1spotlighting 是否能够在跨模型和跨任务的情况下降低间接提示注入攻击的 Attack Success Rate (ASR)?
- RQ2哪种 spotlighting 实例在对下游任务影响可接受的前提下提供最强的防护?
- RQ3在鲁棒性和任务性能方面,使用 delimiting、datamarking 或 encoding 的权衡是什么?
主要发现
- Delimiting 将 GPT-3.5-Turbo 的 ASR 降低约一半,但如果系统提示泄露则容易被伪造绕过。
- Datamarking 在模型和任务上显著降低 ASR,例如 GPT-3.5-Turbo 从 ~50% 降至 <3%,GPT-4 在某些情况下从较高基线降至接近 0%。
- Encoding 产生最强的 ASR 降幅,使摘要中的 ASR 附近为 0%,在 Q&A 对 GPT-3.5-Turbo 为 1.8%,但在容量较低的模型中可能损害解码。
- Datamarking 对下游 NLP 任务在 SQuAD、Word-In-Context、BoolQ、IMDB 等基准上的影响可忽略。
- Encoding 在高容量模型(如 GPT-4)上效果最佳,且由于部分模型的解码挑战,需要针对具体任务进行验证。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。