通过分析文档上下文多样性,高效检测RAG中的恶意内容。
EcoSafeRAG: Efficient Security through Context Analysis in Retrieval-Augmented Generation
- 在不依赖模型内部知识的前提下,通过句级处理和诱饵引导检测异常
- 相比原始RAG,延迟仅增加1.2倍,令牌消耗减少48%-80%
- 可即插即用,兼顾安全防护与性能提升,适合实际部署场景
检索增强生成(RAG)通过引入外部知识弥补大语言模型(LLM)静态知识的不足,提升回答的事实准确性和上下文相关性。但同时,它也带来了如语料库投毒等新型攻击风险。现有防御方法多依赖模型内部知识,与RAG设计初衷相悖。为解决这一矛盾,EcoSafeRAG采用句级处理与诱饵引导的上下文多样性检测机制,无需依赖LLM内部知识即可识别恶意内容。实验表明,EcoSafeRAG实现了当前最优的安全性能,支持即插即用部署,在保持实际运行成本可控的同时(相对延迟仅1.2倍,令牌减少48%-80%),还能提升纯净场景下的RAG表现。
原文摘要 · Abstract (English)
Retrieval-Augmented Generation (RAG) compensates for the static knowledge limitations of Large Language Models (LLMs) by integrating external knowledge, producing responses with enhanced factual correctness and query-specific contextualization. However, it also introduces new attack surfaces such as corpus poisoning at the same time. Most of the existing defense methods rely on the internal knowledge of the model, which conflicts with the design concept of RAG. To bridge the gap, EcoSafeRAG uses sentence-level processing and bait-guided context diversity detection to identify malicious content by analyzing the context diversity of candidate documents without relying on LLM internal knowledge. Experiments show EcoSafeRAG delivers state-of-the-art security with plug-and-play deployment, simultaneously improving clean-scenario RAG performance while maintaining practical operational costs (relatively 1.2$\times$ latency, 48\%-80\% token reduction versus Vanilla RAG).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。