Simple Methods Defend RAG Systems Well Against Real-World Attacks
Retrieval-augmented generation (RAG) systems often generate erroneous responses to out-of-distribution (OOD) queries in safety-critical applications. Method: We propose a lightweight, robust OOD detection framework that jointly models retrieval and generation representations via two complementary dimensionality reduction and feature separation strategies—Principal Component Analysis (PCA) and Neural Collapse (NC)—and integrates GPT-4o with regression models for efficient detection. Response quality is rigorously validated through dual-track evaluation using large language models (LLMs) and human annotators. Contribution/Results: Experiments on standard benchmarks and a real-world COVID-19 vaccine chatbot demonstrate significant improvements in OOD detection accuracy and response relevance. Our results underscore the critical role of external OOD detectors in enhancing RAG safety. Notably, the simple PCA-based strategy outperforms complex baselines under realistic adversarial conditions, highlighting its deployment efficiency and practical utility.