EcoSafeRAG: Efficient Security through Context Analysis in Retrieval-Augmented Generation
Ruobing Yao, Yifei Zhang, Shuang Song, Neng Gao, Chenyang Tu
Abstract
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 × latency, 48%-80% token reduction versus Vanilla RAG).- Anthology ID:
- 2025.findings-emnlp.215
- Volume:
- Findings of the Association for Computational Linguistics: EMNLP 2025
- Month:
- November
- Year:
- 2025
- Address:
- Suzhou, China
- Editors:
- Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, Violet Peng
- Venue:
- Findings
- SIG:
- Publisher:
- Association for Computational Linguistics
- Note:
- Pages:
- 4034–4050
- Language:
- URL:
- https://preview.aclanthology.org/author-page-yu-wang-polytechnic/2025.findings-emnlp.215/
- DOI:
- 10.18653/v1/2025.findings-emnlp.215
- Cite (ACL):
- Ruobing Yao, Yifei Zhang, Shuang Song, Neng Gao, and Chenyang Tu. 2025. EcoSafeRAG: Efficient Security through Context Analysis in Retrieval-Augmented Generation. In Findings of the Association for Computational Linguistics: EMNLP 2025, pages 4034–4050, Suzhou, China. Association for Computational Linguistics.
- Cite (Informal):
- EcoSafeRAG: Efficient Security through Context Analysis in Retrieval-Augmented Generation (Yao et al., Findings 2025)
- PDF:
- https://preview.aclanthology.org/author-page-yu-wang-polytechnic/2025.findings-emnlp.215.pdf