[ArXiv 2024] LatentAudit: Real-Time White-Box Faithfulness Monitoring for RAG
LatentAudit: Real-Time White-Box Faithfulness Monitoring for Retrieval-Augmented Generation with Verifiable Deployment
LatentAudit is a white-box faithfulness monitor for Retrieval-Augmented Generation (RAG) that uses mid-to-late layer residual stream activations to detect hallucinations. By measuring the Mahalanobis distance between pooled answer-state vectors and evidence embeddings, it achieves near-GPT-4o performance (up to 0.942 AUROC on Llama-3-8B) with a sub-millisecond overhead (0.77 ms).
TL;DR
LatentAudit is a breakthrough in RAG reliability that shifts hallucination detection from expensive behavioral testing (asking another LLM) to efficient mechanistic auditing. By analyzing the "geometry" of a model's residual stream, it detects when a generation drifts away from the retrieved evidence in just 0.77 ms, matching the accuracy of GPT-4o at a fraction of the cost.
The "Judge" Bottleneck: Motivation
The current state of RAG is a paradox: we use Retrieval-Augmented Generation to stop hallucinations, but we need a second, even more expensive model (like GPT-4) to verify if the first model actually listened to the retrieval. This "LLM-as-a-Judge" approach is slow, expensive, and privacy-invasive.
The authors of LatentAudit asked a fundamental question: Does the model already "know" it's hallucinating? Mechanistic interpretability suggests the answer is yes. When a model generates text unsupported by its context, its internal activations drift away from the manifold defined by the evidence.
Methodology: The Geometry of Truth
The core of LatentAudit is its use of Residual-Stream Geometry. Instead of looking at the output text, it looks at the hidden states in the mid-to-late layers (typically layers 14-16 for an 8B model).
1. Answer-State Representation
The system identifies the most salient tokens in the generated answer and computes a mean-pooled centroid of their activations. This provides a stable representation of the "semantic intent" of the generated response.
2. The Mahalanobis Metric
The monitor calculates the Mahalanobis distance between the answer centroid and the evidence embedding. Unlike Euclidean distance, Mahalanobis accounts for the distribution and variance of the data. Hallucinations often deviate along "low-variance" directions—paths the model rarely takes when it is being truthful—making this metric incredibly sensitive to subtle drifts.
Figure 1: Overview of the LatentAudit pipeline, from activation extraction to optional ZK proof generation.
Experiments: Surpassing the Baselines
LatentAudit was tested against popular baselines like SelfCheckGPT and INSIDE. It didn't just win on speed; it rivaled the AUROC of GPT-4o across Llama-3, Qwen, and Mistral families.
- Latency: 0.77 ms (LatentAudit) vs 5,300 ms (GPT-4o).
- Cost: 0.15 (GPT-4o) per query.
- Accuracy: Achieved over 0.94 AUROC on PubMedQA, even under stress tests involving partial support and retrieval misses.
Figure 2: The sharp jump in AUROC occurs in mid-to-late layers, where semantic integration of evidence peaks.
Verifiable Deployment (zkML)
One of the most unique contributions is the ability to compile this monitor into a Zero-Knowledge (ZK) circuit. Because the decision rule is a simple quadratic equation (), it can be proven on-chain using Groth16. This allows a provider to prove their model is being faithful without ever revealing the private model weights or the specific activations.
Critical Insights & Conclusion
LatentAudit proves that hallucination detection is a geometry problem, not a linguistic one. By tapping into the "mechanistic" layer of the LLM, we gain a monitor that is:
- Fast enough for every single token generation.
- Cheap enough to run locally.
- Private enough to satisfy high-compliance industries like healthcare and finance.
While it currently requires "open-weight" access to read the hidden states, the potential for using smaller surrogate models to audit black-box APIs remains an exciting frontier. LatentAudit marks a significant step toward a future where LLM reliability is mathematically verifiable and computationally negligible.
