Optimization-based Prompt Injection Attack to LLM-as-a-Judge
作者: Jiawen Shi, Zenghui Yuan, Yinuo Liu, Yue Huang, Pan Zhou, Lichao Sun, Neil Zhenqiang Gong
分类: cs.CR, cs.AI
发布日期: 2024-03-26 (更新: 2025-08-24)
备注: To appear in the Proceedings of The ACM Conference on Computer and Communications Security (CCS), 2024
🔗 代码/项目: GITHUB
💡 一句话要点
提出JudgeDeceiver以解决LLM作为评判者的攻击问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 提示注入 大型语言模型 安全性 优化方法 攻击与防御
📋 核心要点
- 现有的LLM作为评判者方法在面对攻击时存在脆弱性,容易被注入恶意提示以操控输出。
- 本文提出JudgeDeceiver,通过优化方法生成攻击序列,确保LLM选择攻击者指定的候选响应。
- 实验结果显示,JudgeDeceiver在多个应用场景中表现优异,显著优于传统的手动注入攻击方法。
📝 摘要(中文)
LLM作为评判者利用大型语言模型(LLM)从候选响应中选择最佳答案。本文提出JudgeDeceiver,一种基于优化的提示注入攻击,能够在攻击者控制的候选响应中注入精心设计的序列,使得LLM无论其他候选响应如何,均选择该响应。我们将寻找该序列的过程形式化为优化问题,并提出基于梯度的方法进行近似求解。实验结果表明,JudgeDeceiver的有效性显著高于现有的手动构造注入序列的攻击方法,并在LLM驱动的搜索、AI反馈强化学习和工具选择等三个案例研究中表现出色。此外,我们还考虑了已知答案检测、困惑度检测等防御措施,结果显示这些防御措施不足,强调了开发新防御策略的紧迫性。
🔬 方法详解
问题定义:本文旨在解决LLM作为评判者时的安全性问题,现有方法在面对恶意提示注入时表现脆弱,容易被攻击者操控输出。
核心思路:JudgeDeceiver通过将寻找有效注入序列的过程形式化为优化问题,利用梯度方法进行求解,以确保LLM选择攻击者指定的响应。
技术框架:整体流程包括:首先定义优化目标,其次通过梯度方法生成注入序列,最后在LLM中测试该序列的有效性。主要模块包括序列生成模块和评估模块。
关键创新:JudgeDeceiver的创新在于将提示注入问题转化为优化问题,采用梯度方法进行求解,与传统的手动构造方法相比,具有更高的效率和准确性。
关键设计:在设计中,关键参数包括优化目标的设置、损失函数的选择以及序列生成的策略,确保生成的序列能够有效影响LLM的选择。具体的网络结构和参数设置在实验部分进行了详细说明。
🖼️ 关键图片
📊 实验亮点
实验结果表明,JudgeDeceiver在多个场景下的成功率显著高于现有的攻击方法,尤其是在LLM驱动的搜索和RLAIF应用中,成功率提升幅度超过30%。此外,针对已知答案检测和困惑度检测的防御措施效果有限,进一步验证了该攻击方法的有效性。
🎯 应用场景
JudgeDeceiver的研究成果在多个领域具有潜在应用价值,包括LLM驱动的搜索引擎、AI反馈强化学习(RLAIF)以及工具选择等场景。通过提高LLM的安全性,可以增强其在实际应用中的可靠性,防止恶意操控。未来,该研究可能推动新型防御策略的开发,提升AI系统的整体安全性。
📄 摘要(原文)
LLM-as-a-Judge uses a large language model (LLM) to select the best response from a set of candidates for a given question. LLM-as-a-Judge has many applications such as LLM-powered search, reinforcement learning with AI feedback (RLAIF), and tool selection. In this work, we propose JudgeDeceiver, an optimization-based prompt injection attack to LLM-as-a-Judge. JudgeDeceiver injects a carefully crafted sequence into an attacker-controlled candidate response such that LLM-as-a-Judge selects the candidate response for an attacker-chosen question no matter what other candidate responses are. Specifically, we formulate finding such sequence as an optimization problem and propose a gradient based method to approximately solve it. Our extensive evaluation shows that JudgeDeceive is highly effective, and is much more effective than existing prompt injection attacks that manually craft the injected sequences and jailbreak attacks when extended to our problem. We also show the effectiveness of JudgeDeceiver in three case studies, i.e., LLM-powered search, RLAIF, and tool selection. Moreover, we consider defenses including known-answer detection, perplexity detection, and perplexity windowed detection. Our results show these defenses are insufficient, highlighting the urgent need for developing new defense strategies. Our implementation is available at this repository: https://github.com/ShiJiawenwen/JudgeDeceiver.