[论文解读] Adversarial Demonstration Attacks on Large Language Models
本文提出 advICL,一种仅操作上下文示例以破坏 LLM 内在学习的对抗攻击,以及其可迁移变体 T-advICL,能够推广到未见输入。
With the emergence of more powerful large language models (LLMs), such as ChatGPT and GPT-4, in-context learning (ICL) has gained significant prominence in leveraging these models for specific tasks by utilizing data-label pairs as precondition prompts. While incorporating demonstrations can greatly enhance the performance of LLMs across various tasks, it may introduce a new security concern: attackers can manipulate only the demonstrations without changing the input to perform an attack. In this paper, we investigate the security concern of ICL from an adversarial perspective, focusing on the impact of demonstrations. We propose a novel attack method named advICL, which aims to manipulate only the demonstration without changing the input to mislead the models. Our results demonstrate that as the number of demonstrations increases, the robustness of in-context learning would decrease. Additionally, we also identify the intrinsic property of the demonstrations is that they can be used (prepended) with different inputs. As a result, it introduces a more practical threat model in which an attacker can attack the test input example even without knowing and manipulating it. To achieve it, we propose the transferable version of advICL, named Transferable-advICL. Our experiment shows that the adversarial demonstration generated by Transferable-advICL can successfully attack the unseen test input examples. We hope that our study reveals the critical security risks associated with ICL and underscores the need for extensive research on the robustness of ICL, particularly given its increasing significance in the advancement of LLMs.
研究动机与目标
- 评估大语言模型(LLMs)的上下文学习(ICL)中演示示例的安全风险。
- 开发仅扰动演示示例而不改变输入的攻击,并评估其对 ICL 鲁棒性的影响。
- 探究对未见输入以及跨模型、跨模板的对抗性演示的可迁移性。
提出的方法
- 将上下文学习正式定义为以演示 C 和测试输入 x_test 为条件的文本生成问题。
- 在 TextAttack 框架中扩展演示遮蔽机制,以仅扰动演示。
- 引入基于余弦相似性约束的逐个演示扰动界限 Delta_i,以生成高质量的对抗性演示。
- 在演示扰动下最小化损失 L 的优化目标公式:min_delta L(f({C_delta}, s(x_test,_)), y_test)。
- 采用贪婪的黑盒扰动策略(字符级/单词级),在相似性约束下生成对抗性演示。
实验结果
研究问题
- RQ1在 ICL 中,是否可以通过扰动演示示例而不改变测试输入来误导 LLM?
- RQ2演示示例数量如何影响在仅演示攻击下的 ICL 鲁棒性?
- RQ3对未见输入以及跨模型,是否对抗性演示具有迁移性?
- RQ4是否存在可迁移的、通用风格的演示攻击,以及它在不同模板和数据集上的效果如何?
主要发现
- AdvICL 仅通过扰动演示就实现较高的攻击成功率(例如,在 DBpedia 的 8-shot 上,LLaMA-7B 的 ASR 高达 97.72%)。
- 增加演示数量通常会提高 ASR,揭示多次示例 ICL 的鲁棒性风险。
- 演示可以被追加到不同的输入之前,形成可迁移的威胁模型,攻击者不需要知道测试输入。
- 可迁移的 AdvICL(T- advICL)产生普遍对抗性演示,显著提高对未见输入的迁移性(例如,在未见输入的 DBpedia 上 ASR 为 72.32%)。
- 感知评估显示对抗性演示质量较高(AEQS 约 90%,具有较强的 CosSim 和 BLEU 分数,并且 Adv PPL 降低)。
- T- advICL 在约 R=3 次迭代时收敛,并且受益于更大的候选集 k,提升稳定性和迁移性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。