[论文解读] Automatic and Universal Prompt Injection Attacks against Large Language Models
该论文提出一种统一的、基于梯度的方法,自动生成能够在多项目标(静态、半动态、动态)上击败防御的通用提示注入数据,训练样本仅有五个。
Large Language Models (LLMs) excel in processing and generating human language, powered by their ability to interpret and follow instructions. However, their capabilities can be exploited through prompt injection attacks. These attacks manipulate LLM-integrated applications into producing responses aligned with the attacker's injected content, deviating from the user's actual requests. The substantial risks posed by these attacks underscore the need for a thorough understanding of the threats. Yet, research in this area faces challenges due to the lack of a unified goal for such attacks and their reliance on manually crafted prompts, complicating comprehensive assessments of prompt injection robustness. We introduce a unified framework for understanding the objectives of prompt injection attacks and present an automated gradient-based method for generating highly effective and universal prompt injection data, even in the face of defensive measures. With only five training samples (0.3% relative to the test data), our attack can achieve superior performance compared with baselines. Our findings emphasize the importance of gradient-based testing, which can avoid overestimation of robustness, especially for defense mechanisms.
研究动机与目标
- 为提示注入攻击定义统一的目标,以涵盖之前多样化的目标(静态、半动态、动态)。
- 开发一种不依赖手工提示的自动、通用攻击方法。
- 在很少的训练样本下,展示强大的攻击有效性和在多数据集上的普适性。
- 评估对现有防御的鲁棒性,并展示该方法能够绕过它们。
提出的方法
- 提出三个提示注入目标(静态、半动态、动态),以统一先前的攻击目标。
- 将攻击表述为最小化一个损失,使LLM输出目标对抗性响应,使用目标在给定 I、D、注入 S 下的负对数概率。
- 对离散标记进行带动量的梯度搜索,迭代地通过选择能够最小化目标损失的替换来替换注入内容。
- 为每个目标定义目标句子,并将损失 J_RT 计算为 -log P(RT | I, D, S_1:k)。
- 对一批训练数据计算梯度,对 G_t 应用动量增量,并从前 k 个负梯度中选择替换的标记,每次迭代抽取 B 个候选。
实验结果
研究问题
- RQ1哪些统一目标能够捕捉到现有提示注入目标的多样性?
- RQ2一种自动的、基于梯度的方法是否能够生成在指令和数据集上都有效的通用注入数据?
- RQ3带动量的优化对提示注入攻击的收敛速度与解质量有何影响?
- RQ4诸如改写、重新分词、数据隔离等防御措施能否抵挡自动的通用提示注入?
- RQ5在极少训练数据下且跨多任务类型时,该方法是否仍然有效?
主要发现
- 所提出的带动量梯度方法在静态、半动态和动态目标下都达到较高的攻击成功率。
- 仅用五个训练样本(测试数据的0.3%),攻击在平均ASR上有所提升,并在未见指令上保持有效性。
- 消融显示与基线 GCG 相比,动量策略在收敛速度和解质量上平均提升约21%。
- 该攻击对若干防御仍然有效,且自适应策略(如 EOT)进一步提高了对防御的有效性。
- 在七个NLP任务(重复检测、语法纠错、仇恨检测、自然语言推理、情感分析、垃圾邮件、摘要)上的评估显示了跨数据集的普适性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。