Skip to main content
QUICK REVIEW

[论文解读] BadRAG: Identifying Vulnerabilities in Retrieval Augmented Generation of Large Language Models

Jiaqi Xue, Mengxin Zheng|arXiv (Cornell University)|Jun 3, 2024
Topic Modeling被引用 4
一句话总结

BadRAG 提出了一种框架,通过使用语义查询触发的对抗性文本污染外部语料库,来识别并利用检索增强生成(RAG)系统中的安全漏洞。利用对比优化(COP),该方法在污染查询中实现了 98.2% 的检索成功率,同时在 GPT-4 中引发 74.6% 的拒绝率,揭示了基于 RAG 的大语言模型存在严重风险。

ABSTRACT

Large Language Models (LLMs) are constrained by outdated information and a tendency to generate incorrect data, commonly referred to as "hallucinations." Retrieval-Augmented Generation (RAG) addresses these limitations by combining the strengths of retrieval-based methods and generative models. This approach involves retrieving relevant information from a large, up-to-date dataset and using it to enhance the generation process, leading to more accurate and contextually appropriate responses. Despite its benefits, RAG introduces a new attack surface for LLMs, particularly because RAG databases are often sourced from public data, such as the web. In this paper, we propose \TrojRAG{} to identify the vulnerabilities and attacks on retrieval parts (RAG database) and their indirect attacks on generative parts (LLMs). Specifically, we identify that poisoning several customized content passages could achieve a retrieval backdoor, where the retrieval works well for clean queries but always returns customized poisoned adversarial queries. Triggers and poisoned passages can be highly customized to implement various attacks. For example, a trigger could be a semantic group like "The Republican Party, Donald Trump, etc." Adversarial passages can be tailored to different contents, not only linked to the triggers but also used to indirectly attack generative LLMs without modifying them. These attacks can include denial-of-service attacks on RAG and semantic steering attacks on LLM generations conditioned by the triggers. Our experiments demonstrate that by just poisoning 10 adversarial passages can induce 98.2\% success rate to retrieve the adversarial passages. Then, these passages can increase the reject ratio of RAG-based GPT-4 from 0.01\% to 74.6\% or increase the rate of negative responses from 0.22\% to 72\% for targeted queries.

研究动机与目标

  • 识别由污染外部语料库引发的 RAG 系统安全漏洞。
  • 开发一种方法,实现通过语义化、可定制查询触发的检索后门。
  • 通过对齐机制利用,对大语言模型实施间接攻击,而无需修改模型本身。
  • 评估这些攻击在真实世界大语言模型(如 GPT-4 和 Claude-3)上的有效性。
  • 提出一种基于触发词标记掩码的防御机制,以检测对抗性查询。

提出的方法

  • 提出对比学习驱动的对抗性文本优化方法——针对文本的对比优化(COP),用于为特定语义触发器优化对抗性文本。
  • 将触发查询定义为正样本,将干净查询定义为负样本,最大化其与正样本的相似性,同时最小化与负样本的相似性。
  • 使用语义触发器(例如,'共和党,唐纳德·特朗普')来有条件地激活污染文本的检索。
  • 通过 '对齐即攻击'(AaaA)机制利用大语言模型的对齐机制,通过提示模型拒绝响应来诱导拒绝服务攻击。
  • 采用 '选择性事实即攻击'(SFaaA)方法,利用官方来源中事实正确但存在偏见的文章,引导大语言模型产生负面输出。
  • 提出一种防御机制,通过系统性地使用 [MASK] 标记替换,观察检索相似度分数的变化,以检测对抗性查询。

实验结果

研究问题

  • RQ1能否构造出仅在特定语义触发器下被检索的对抗性文本,同时对干净查询保持不可检测性?
  • RQ2通过利用对齐机制,污染的 RAG 语料库在多大程度上能对大语言模型引发拒绝服务攻击?
  • RQ3是否可以仅通过污染的检索数据,在不修改大语言模型的前提下实现语义引导攻击?
  • RQ4这些攻击在真实世界的大语言模型(如 GPT-4 和 Claude-3)上的有效性如何?
  • RQ5能否通过分析标记掩码后检索相似度的变化,检测出对抗性查询?

主要发现

  • 仅污染 10 个对抗性文本(占总语料库的 0.04%),即实现了针对触发查询的 98.2% 的污染内容检索成功率。
  • 在拒绝服务场景下,该攻击使 GPT-4 的拒绝率从 0.01% 上升至 74.6%。
  • 情感引导攻击使目标查询的负面响应概率从 0.22% 上升至 72%。
  • AaaA 方法通过利用 '所有上下文均包含私人信息' 的提示,实现了 74.6% 的拒绝率,成功利用了大语言模型的对齐策略。
  • SFaaA 方法利用事实正确但存在偏见的官方文章,实现了 72% 的负面响应概率,绕过了大语言模型的检测机制。
  • 所提出的基于 [MASK] 标记替换的防御机制在检测对抗性查询方面表现出色,尤其在单标记触发情况下效果更佳,但对较长触发器的检测效果有所下降。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。