Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Toward Faithful Retrieval-Augmented Generation with Sparse Autoencoders

About

Retrieval-Augmented Generation (RAG) improves the factuality of large language models (LLMs) by grounding outputs in retrieved evidence, but faithfulness failures, where generations contradict or extend beyond the provided sources, remain a critical challenge. Existing hallucination detection methods for RAG often rely either on large-scale detector training, which requires substantial annotated data, or on querying external LLM judges, which leads to high inference costs. Although some approaches attempt to leverage internal representations of LLMs for hallucination detection, their accuracy remains limited. Motivated by recent advances in mechanistic interpretability, we employ sparse autoencoders (SAEs) to disentangle internal activations, successfully identifying features that are specifically triggered during RAG hallucinations. Building on a systematic pipeline of information-based feature selection and additive feature modeling, we introduce RAGLens, a lightweight hallucination detector that accurately flags unfaithful RAG outputs using LLM internal representations. RAGLens not only achieves superior detection performance compared to existing methods, but also provides interpretable rationales for its decisions, enabling effective post-hoc mitigation of unfaithful RAG. Finally, we justify our design choices and reveal new insights into the distribution of hallucination-related signals within LLMs. The code is available at https://github.com/Teddy-XiongGZ/RAGLens.

Guangzhi Xiong, Zhenghao He, Bohan Liu, Sanchit Sinha, Aidong Zhang• 2025

Related benchmarks

TaskDatasetResultRank
Hallucination DetectionRAGTruth Llama2-7B (test)
Accuracy75.76
21
Hallucination DetectionDolly Llama2-7B (test)
Acc77.78
21
Hallucination DetectionRAGTruth Llama2-13B (test)
Acc83.33
21
Hallucination DetectionDolly Llama2-13B (test)
Accuracy75.76
21
Answer-level hallucination detectionRAGTruth
AP73.29
18
Answer-level hallucination detectionHalluRAG
AP80.06
18
Token-level hallucination detectionRAGTruth
AP (Token-level)45.75
18
Token-level hallucination detectionHalluRAG
AP63.8
18
Showing 8 of 8 rows

Other info

Follow for update