Detecting Hallucinations and Abstaining in Large Language Models with Sparse Autoencoder Feature Entropy Trajectories
Abstract
As Large Language Models (LLMs) are deployed in increasingly high-stakes domains and for everyday use, ensuring their safety and reliability is critical. However, LLMs have shown a tendency to hallucinate—generating false, fabricated, or unsupported information with high confidence. Recent work has shown that sparse autoencoders (SAEs) are able to detect and mitigate hallucinations by interpreting LLMs’ internal states at inference-time. In this work, we extend this line of work and propose a new method for using SAEs to detect hallucinations, known as Sparse Autoencoder Feature Entropy Response (SAFER), which triggers abstention when the trajectory of the SAE feature activation entropy over the final output tokens indicates high hallucinatory risk. Through testing on Gemma-2-2B-IT, SAFER achieves an AUROC of 0.726 on PopQA, an AUROC of 0.633 on TriviaQA, and enables abstention that modestly improves accuracy on answered questions. Taken together, our findings suggest a potentially more cost-effective method for detecting hallucinations, specifically when dealing with long-tailed, rare questions.