TL;DR
When AI agents hallucinate tool calls, they do so with high confidence and perfect syntax, rendering standard uncertainty metrics useless. This paper demonstrates that the "optimal" way to detect these silent failures depends on model scale: while hidden-state probes work best for tiny models, spectral analysis of attention graphs becomes superior as models grow, though the specific winning technique shifts non-monotonically between 1B and 14B parameters.
What Problem Does This Paper Address?
AI agents are increasingly used to invoke external tools like APIs or databases. A critical failure mode is the "silent hallucination," where an agent generates a syntactically correct but factually incorrect tool call (e.g., a wrong account number or a non-existent function). Because these calls look "normal" to the system, they are executed immediately without human oversight.
Traditional "guardrails" fail here. Metrics like token log-probabilities or sampling consensus (checking if multiple runs agree) perform near chance (0.51–0.62 AUC) because the model isn't "unsure"—it is confidently wrong. This paper investigates two emerging alternatives that look under the hood of a single forward pass: hidden-state probes (looking at internal representations) and spectral analysis (looking at the topology of attention routing). The authors seek to determine which method is best and how that choice changes as models get larger.
Methods
The authors compare several detection strategies across seven different LLMs:
- Hidden-State Probes: A lightweight MLP trained on the internal vectors of specific tokens (the function name, arguments, and closing delimiter).
- Spectral Attention Topology (SpRich): This treats the attention matrix of each layer as a graph. It calculates the Fiedler value (a measure of how "connected" a graph is). Hallucinations tend to show "fragmented" routing. SpRich aggregates these values across all layers into summary statistics.
- Layerwise Multi-Metric (LMM) Probe: The paper’s novel contribution. Instead of aggregating layer data into a single summary, LMM uses a Gradient Boosted Tree (GBT) to look at raw spectral metrics across every layer independently.
- Fast-Fiedler: To make this practical for deployment, the authors used a GPU-accelerated Lanczos approximation, reducing the computational cost of spectral analysis from 3.3 seconds to just 19 milliseconds per sample.
Datasets
The study utilized two primary benchmarks:
- Glaive Function Calling V2: Used for the main head-to-head comparison across seven models (Llama-3.2, Gemma-2, Qwen-2.5, Phi-4).
- Berkeley Function Calling Leaderboard (BFCL) v3 (Hard Mode): Used to test "cross-benchmark transfer," specifically looking at complex cases involving parallel and multiple tool calls.
Key Insights and Ideas
- The Scale-Dependent Crossover: There is no "universal" best detector. At small scales (≤2B), hidden states are most informative. At 3B, per-layer attention (LMM) takes the lead. At 8B, the signal "diffuses" across many layers, making global trajectory aggregation (SpRich) better. At 14B, the signal re-concentrates, and per-layer LMM wins again.
- Monotonic vs. Saturated Gains: Hidden-state probes are "near-ceiling" even at 1B parameters; they don't get much better as the model grows. In contrast, spectral signals improve monotonically with scale. This suggests that as we move toward 70B+ models, spectral methods will likely become the dominant defense.
- Architecture Matters (The GQA Trap): Grouped Query Attention (GQA), common in modern models, can "blind" certain spectral methods by producing rank-deficient matrices. The authors found that their LMM approach is robust to this, while simpler spectral baselines collapse.
- Merging is a Mirage: Surprisingly, combining hidden-state and spectral signals into a "super-detector" never helped. The two signals identify overlapping failures rather than complementary ones.
Key Results
- Detection Accuracy: The LMM-GBT probe achieved an AUC of 0.957 on a 3B model using only attention weights, significantly outperforming the hidden-state baseline (0.947).
- Superiority over Baselines: LMM outperformed all concurrent spectral baselines (like HSAD or Cross-Layer agreement) across every model scale tested.
- Efficiency: By using the "Fast-Fiedler" method, the authors proved that these advanced topological checks can be integrated into production pipelines with negligible latency (19ms).
- Unsupervised Fallback: Even without training data (zero-shot), a simplified version of their tool (LMM-Cascade) reached 0.72–0.81 AUC, far better than standard log-probs.
Limitations and Future Work
- Model Size Ceiling: The study capped at 14B parameters. While the authors predict LMM will dominate at 70B+, this remains an empirical hypothesis.
- Multi-Step Chains: The detectors were tested on single-step tool calls. In "agentic loops" where one hallucination feeds into the next, errors might compound in ways these single-pass detectors haven't yet been tested against.
- Fusion Dimensionality: The attempt to merge signals failed partly due to a "dimensionality mismatch" (100,000 hidden-state features vs. 100 spectral features). Future work might find better ways to align these disparate feature spaces.
Summary updated