COMPASS: Context-Modulated PID Attention Steering System for Hallucination Mitigation

Kenji Sahay, Snigdha Pandya, Rohan Nagale, Anna Lin, Shikhar Shiromani, Kevin Zhu, Sunishchal DevarXiv 2025 · DOI

Summary

COMPASS is a lightweight, real-time system designed to reduce hallucinations in Large Language Models (LLMs) by applying classical control theory to the attention mechanism. By monitoring a "Context Reliance Score" during decoding, the system dynamically steers attention back to the provided context whenever a high risk of hallucination is detected. This approach achieves a 2.8–5.8% reduction in errors without requiring retraining or multiple decoding passes.

Problem Statement

LLMs frequently suffer from "contextual hallucinations," where the model generates text that is unsupported by the input context. This typically occurs when the model over-relies on its internal parametric knowledge or its own previously generated tokens. Existing solutions often involve expensive retraining or computationally intensive multi-pass verification. COMPASS addresses the need for an efficient, "single-stream" intervention that can correct model behavior on-the-fly.

Methodology

The COMPASS system treats hallucination mitigation as a closed-loop feedback problem consisting of four main stages:

  1. Context Reliance Score (CRS): The system calculates the ratio of attention mass placed on "context" tokens versus "generated" tokens, serving as a real-time diagnostic signal.
  2. Hallucination Detection: An XGBoost classifier analyzes windowed statistics of these CRS scores to predict the probability of a hallucination.
  3. PID Controller: A Proportional-Integral-Derivative (PID) controller uses the hallucination risk as an "error signal" to calculate an intervention "gain." This ensures smooth, stable corrective behavior.
  4. Attention Steering: If risk is high, a positive bias is added to the pre-softmax logits of selected attention heads, forcing them to focus on context tokens.
The COMPASS single-stream control loop architecture.

Experimental Evaluation

The authors evaluated COMPASS across four benchmarks: HotpotQA, XSum, HaluEval, and RAGTruth. Models tested included Qwen-2.5-7B, LLaMA-2 (7B/13B), and Mistral-7B.

Key Results

COMPASS demonstrated significant improvements in factual grounding across all tested models and datasets:

  • Hallucination Reduction: Absolute hallucination rates (Mitigation Rate) were reduced by 2.8% to 5.8%.
  • Grounding Metrics: Span Density (unsupported claims) decreased significantly, notably by 22.4% for LLaMA-2-13B on RAGTruth.
  • Context Reliance: Context Overlap increased by up to 0.12, indicating successful steering toward the provided evidence.
Performance metrics across benchmarks showing hallucination mitigation and improved grounding.

The system is computationally efficient, as it reuses attention tensors from the forward pass and employs a lightweight classifier, resulting in modest latency overhead compared to auxiliary-model methods.

Insights and Limitations

COMPASS highlights that attention patterns are predictive "sensors" for model state. The use of a PID loop provides more stable behavior than simple thresholding by accounting for the history and trend of errors. However, the current implementation focuses on short-horizon attention, which may miss gradual drift in long-context scenarios. Future work will explore integrating richer detector signals and developing formal stability guarantees for PID-steered attention.

Summary updated

BibTeX
@misc{sahay2025compass,
  author = {Kenji Sahay and Snigdha Pandya and Rohan Nagale and Anna Lin and Shikhar Shiromani and Kevin Zhu and Sunishchal Dev},
  title = {{COMPASS: Context-Modulated PID Attention Steering System for Hallucination Mitigation}},
  year = {2025},
  eprint = {2511.14776},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.14776},
}
Figure