Skip to main content
QUICK REVIEW

[论文解读] Follow My Instruction and Spill the Beans: Scalable Data Extraction from Retrieval-Augmented Generation Systems

Zhenting Qi, Hanlin Zhang|arXiv (Cornell University)|Feb 27, 2024
Web Data Mining and AnalysisComputer Science被引用 3
一句话总结

本文揭示,经过指令微调的检索增强生成(RAG)模型容易受到提示注入攻击,导致其外部数据存储中的原文内容被直接提取。作者通过仅使用100个自动生成的查询,在生产环境的GPT中实现了可扩展、高成功率的数据泄露——在一部77,000字的书籍中,最高实现41%的原文提取,且在25个定制化的GPT中成功率高达100%。

ABSTRACT

Retrieval-Augmented Generation (RAG) improves pre-trained models by incorporating external knowledge at test time to enable customized adaptation. We study the risk of datastore leakage in Retrieval-In-Context RAG Language Models (LMs). We show that an adversary can exploit LMs' instruction-following capabilities to easily extract text data verbatim from the datastore of RAG systems built with instruction-tuned LMs via prompt injection. The vulnerability exists for a wide range of modern LMs that span Llama2, Mistral/Mixtral, Vicuna, SOLAR, WizardLM, Qwen1.5, and Platypus2, and the exploitability exacerbates as the model size scales up. We also study multiple effects of RAG setup on the extractability of data, indicating that following unexpected instructions to regurgitate data can be an outcome of failure in effectively utilizing contexts for modern LMs, and further show that such vulnerability can be greatly mitigated by position bias elimination strategies. Extending our study to production RAG models GPTs, we design an attack that can cause datastore leakage with a 100% success rate on 25 randomly selected customized GPTs with at most 2 queries, and we extract text data verbatim at a rate of 41% from a book of 77,000 words and 3% from a corpus of 1,569,000 words by prompting the GPTs with only 100 queries generated by themselves.

研究动机与目标

  • 调查检索增强生成(RAG)系统中数据泄露的风险,特别是通过提示注入攻击的方式。
  • 评估指令微调的大语言模型(LLMs)是否可被利用,以提取其非参数化数据存储中的原文内容。
  • 评估该漏洞在多种开源和生产级大语言模型(包括Llama2、Mistral、Vicuna和GPTs)中的可利用性。
  • 研究模型规模和指令微调对通过对抗性提示导致上下文泄露可能性的影响。
  • 强调在医疗、金融和法律等敏感领域中,隐私保护与数据管理的潜在影响。

提出的方法

  • 设计对抗性提示,利用大语言模型的指令遵循能力,明确指示其重复检索到的上下文内容。
  • 采用检索在上下文(RIC)方法构建RAG系统,即将检索到的文本块预先添加到用户查询前,再输入大语言模型。
  • 通过黑盒API接口查询模型,迭代生成领域特定的查询,以最大化数据提取效率。
  • 使用ROUGE、BLEU、F1和BERTScore等指标评估提取性能,衡量原文内容重建的准确性。
  • 开展消融研究,对比基础模型与指令微调模型(如Llama2、Mistral)在相同数据存储上的表现,以隔离指令微调的影响。
  • 将分析扩展至生产环境的GPT,使用最少的自动生成查询,在25个定制化的GPT上测试数据泄露情况。
Figure 1: An overview of attacking RAG systems built with RIC method and instruction-tuned LMs. In an RIC-based RAG system, a retriever first retrieves text chunks from the datastore according to user input and then prepends them to the input as context. Attackers can inject adversarial prompt to th
Figure 1: An overview of attacking RAG systems built with RIC method and instruction-tuned LMs. In an RIC-based RAG system, a retriever first retrieves text chunks from the datastore according to user input and then prepends them to the input as context. Attackers can inject adversarial prompt to th

实验结果

研究问题

  • RQ1能否通过提示注入,使指令微调的大语言模型被迫泄露其RAG数据存储中的原文内容?
  • RQ2模型规模(如7B与70B)如何影响RAG系统中数据提取攻击的成功率?
  • RQ3指令微调在多大程度上增加了大语言模型对上下文泄露攻击的脆弱性?
  • RQ4在生产级RAG系统(如GPT)中,是否能以极低的查询开销实现大规模数据泄露?
  • RQ5在预训练阶段曾接触过数据存储内容(如《哈利·波特》)是否加剧了原文内容提取的风险?

主要发现

  • 指令微调的大语言模型在提示注入攻击下表现出显著更高的脆弱性,与基础模型相比,平均ROUGE得分提高了65.76分。
  • 在25个随机选择的定制化GPT中,仅使用最多两个查询,即实现了系统提示和操作内容100%的成功提取。
  • 在GPT上仅用100个自动生成的查询,即从一本77,000字的受版权保护书籍中实现了41%的原文提取准确率。
  • 在更大的维基百科语料库(1,569,000字)上,相同100次查询的限制下,原文提取准确率达到3%,证明了该方法的可扩展性。
  • 消融研究发现,指令微调显著提升了攻击的可利用性,因为指令遵循能力越强的模型,越容易原样重复上下文内容。
  • 消融研究还表明,若数据存储内容曾在预训练阶段被接触过(如《哈利·波特》),则提取性能进一步提升,表明可能存在数据污染效应。
Figure 2: Reconstruction rate of Harry Potter and the Sorcerer’s Stone ( Blue ) and Wikipedia ( Green ) against the number of domain-specific queries.
Figure 2: Reconstruction rate of Harry Potter and the Sorcerer’s Stone ( Blue ) and Wikipedia ( Green ) against the number of domain-specific queries.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。