WorksComputer Science
FlashAttention with Statistics: Low-Overhead Attention Features for Compact Hallucination Detectors
Abstract
Large language models can produce fluent answers that the supplied context does not support. A compact frozen proxy model can detect such answers by reading the context and another model's response, even from a proprietary generator. Attention-based detectors use summary statistics of the proxy's attention weights, but standard pipelines materialize the attention matrix, whose memory grows quadratically with sequence length. We compute these statistics without materializing attention, by accumulation in the FlashAttention pass, sparse lookups after it, or a second tiled pass over the scores, and classify them by this path into nearly free and costlier ones. On an H100, the statistics of five published detectors add 16% to the latency of a Qwen3-8B forward at 2K tokens, falling to 1.4% at 35K, and store 22.5 KiB per response token. On three benchmarks, probes trained on frozen Qwen3 proxies of 0.6B to 8B parameters prove strong detectors: a 4B proxy outperforms the strongest of nine zero-shot 4-9B LLM judges in F1 on two of the three, the proxies match or outperform specialized grounding checkers of up to 7B parameters, probing each proxy beats prompting it as a judge, and adding attention features significantly improves F1 in half of the 12 benchmark-proxy pairs, never significantly lowering it.
Introduction
Contextual hallucination detection asks whether an answer is supported by the supplied information. The detector need not be the model that generated the answer: the generator may expose neither its weights nor its attention, while a separate detector can be much smaller and cheaper. A compact proxy instead reads the context and completed answer and uses its own internal signals to assess context reliance. Prior work has used surrogate probabilities to estimate black-box confidence (Shrivastava et al., 2023), auxiliary models to calibrate generators [23, 20] (Ulmer et al. 2024), and hidden states or attention from reader models to detect hallucinations in another model’s answers [6] (Han et al. 2025; Yeh et al. 2026; Singh et al. 2026).
Attention-based detectors need only summary statistics of attention weights, such as prompt mass [10], diagonal or previous-token weights (Sriramanan et al., 2024; Vazhnetsеv et al., 2026), sink rates [5], or graph features [4]. Yet standard pipelines materialize the full attention matrix. For a 32-head layer, it occupies about a gigabyte at 4K tokens and tens of gigabytes at 16K–32K, although the detector keeps only a linear number of statistics.
FlashAttention computes exact attention in tiles without storing this matrix [13, 12]. We compute detector statistics1 during or right after that pass so they inherit its linear memory and most of its speed. We classify attention statistics, including those of published detectors, by how our implementation computes them exactly without the matrix: accumulation inside the pass, a fixed number of post-pass lookups, a second pass over the scores, or dense materialization (Figure 2). Our Triton implementation (Tillet et al., 2019) extends the FlashAttention-2 forward to compute the statistics of five published detectors: Lookback Lens (Chuang et al., [10]), LLM-Check (Sriramanan et al., 2024), RAUQ (Vazhentsev et al., 2026), INTRYGUE (Kuleshova et al., [24]), and SinkProbe (Binkowski et al., [5]). Extracting them from every head and layer adds 16% to a Qwen3-8B forward at 2K tokens and 1.4% at 35K, and stores 22.5 KiB per response token (Figure 1 and Figure 6).
Figure 1. Cost of extracting all implemented attention statistics for hallucination detection in every layer of Qwen3-8B and Qwen3-0.6B using our kernels. Top: model forward-pass latency. Bottom: relative overhead compared with the same forward using standard scaled dot-product attention (SDPA), without statistic extraction.
Figure 2. Attention with statistics. Blue: standard FlashAttention (Dao et al., [13]; Dao, [12]); green: our additions. (a) We compute statistics for response rows only; prompt rows can go through any production kernel (§ 2.1). : scores of query tile against key tile . (b) One tile of the pass: the exponentials that FlashAttention already computes also feed the T1 statistics, which are finalized after the last tile; the pass also stores the log-sum-exp (LSE) that T2 and T3 reuse (§ 2.2). (c) The four tiers, i.e. computation paths of a statistic, ordered by the extra work they need: none (T1, fused), a few positions per row (T2, lookup), a second pass over all scores (T3, rescore), or the whole stored map (T4, dense) (§ 2.3).
Figure 6. Figure 1 for peak memory: the peak of each forward above the memory allocated before it, so the model weights are excluded, with all features (solid, points) and without (dashed). Same runs, inputs of at least 2K tokens, and binning; batch 1, H100 NVL, bf16.
Our contributions are threefold. (i) We develop a taxonomy of attention statistics based on how they can be computed exactly without materializing attention maps, identifying which come almost free with FlashAttention and which require a second pass. This taxonomy also guides the design of new inexpensive statistics. (ii) We implement these computation paths in Triton kernels and provide an attention backend, which we release publicly, that integrates them into existing model inference pipelines. Experiments evaluate their overhead and detection performance. (iii) We show that frozen Qwen3 proxies (0.6B–8B) can detect hallucinations in larger model’s answers across three benchmarks. A 4B proxy outperforms the strongest of nine LLM judges (4B–9B) on two benchmarks, and even the smallest, 0.6B proxy beats it on the third and trails it by at most 0.03 F1 on the other two. Adding attention features significantly improves F1 in 6 of the 12 dataset–proxy pairs and never significantly lowers it, emphasizing the usefulness of attention statistics.
Background
Setting and notation
We consider one head of one layer and drop both indices. Let , , be its query, key, and value projections after positional encoding; under grouped-query attention, the heads of a group share and . Positions are indexed from 0. For a query row , let be the keys it may attend to after causal and padding masking, and define
where are the attention scores, the attention weights, and unless the model sets another scale. A statistic is a per-head quantity that a kernel returns: a row reduction of one row , such as its entropy, or a column reduction of one column over a set of rows. A kernel computes each statistic through one computation path, or tier (§ 2.3.1). A feature is a classifier input that the host derives from statistics, for example by averaging over rows (Appendix § 8), and a detector recipe selects features, heads, and layers for a classifier.
When the response is known in advance, as in teacher-forced detection, the input is a prompt of tokens followed by response tokens at positions . The detectors we target read statistics on these response rows. Under the causal mask, a prompt row sees only prompt keys, so its output does not depend on the response and any production kernel can compute it. The response stage evaluates against all of and with a causal mask aligned to the bottom-right corner, as in key–value-cache append kernels (Ye et al. (2025)) (Figure 2a). We call its block of scores and weights the response block; without padding, it has unmasked scores per head.
Online softmax in FlashAttention
FlashAttention computes in tiles without storing the weights (Dao et al. [13]; Dao [12]). The FlashAttention-2 forward pass is query-major: a tile of query rows stays resident while the key tiles it sees stream past (Figure 2b). Its backward pass is key-major: a key tile stays resident while query tiles stream past. We call one evaluation of every score of the response block, in tiles, a pass; the pass is the query-major response stage.
For one row, online softmax carries a running maximum , a normalizer , and an unnormalized output (Milakov and Gimelshein (2018); Rabe and Staats (2021)). For a new key tile , let , , and
Computing Attention Statistics without Materialization
Computation paths
We compute statistics only in the response stage (§ 2.1, Figure 2a). A statistic either fits a bounded state that the pass can update, or it needs final weights, which a later kernel recovers from a re-evaluated score and the stored LSE (§ 2.2). We sort statistics into four tiers by the scores evaluated beyond the pass (Table 1, Figure 2c): T1 (fused) evaluates none, T2 (lookup) a fixed number per row, T3 (rescore) every score a second time, and T4 (dense) materializes the response block. A tier is the path our implementation uses, with Triton kernels for T1–T3 and eager PyTorch for T4, so it bounds the cost from above: the pass could also compute the T2 lookups (§ 2.5), and T1 holds only the bounded-state reductions we implement. The LSE, which every FlashAttention forward writes, belongs to no tier. Appendix § 8 defines every statistic we compute. Appendix § 10 gives the pseudocode and kernel details.
| Tier | Scores | Stat. ops | Memory |
| T1 (fused) entropy, prompt mass, effective support, max weight | none | ||
| T2 (lookup) log , , BOS weight | |||
| T3 (rescore) column sums, sink rates, threshold counts | |||
| T4 (dense) MTopDiv, stored maps |
Table 1. Work per head beyond the pass over the response block, by tier. Scores: extra attention scores evaluated, each costing multiply-adds and one exponential. Stat. ops: statistic-specific elementwise operations, plus the statistic’s own algorithm for T4. Memory: numbers written per head besides the attention output and LSE.
For a new key tile , let . The update is
After the last tile, and . As FlashAttention stores the LSE, a later kernel can recover any weight (Equation (1)) by re-evaluating its score.
Table 16.
T1 (fused): statistics in online softmax
T1 (fused) statistics are accumulated inside the pass and need no extra scores. Consider prompt mass , the share of attention that row puts on the prompt, from which Lookback Lens builds its features [10]. During the pass, row knows each weight only up to the factor , which is fixed only after its last key tile. Prompt mass can nevertheless be accumulated like : keep over the keys seen so far, update it as next to Equation (2), and output after the last tile.
The same works for integer powers of the weights times any function of the score. For an integer and a fixed-dimensional function that does not depend on , , or the LSE, keep the state and update it for each key tile:
Since is an integer, is a product of exponentials the pass already computes. This standard consequence of online softmax defines T1:
Lemma 1 (Separable row reductions) For statistics, let be functions as above and integers. The sums
and any fixed function of and , can be computed in the pass, with no additional exponentials or scores and numbers of state per row, independent of .
Prompt mass is the case , ; entropy is with and ; effective support is with and ; and the maximum weight is . The kernel updates these accumulators per score tile next to the FlashAttention state, keeping nothing per key (Figure 2b). Appendix C gives the proof and the accumulator’s merge and stability properties.
T2–T4: post-pass statistics
T2 (lookup). Some statistics read a fixed number of weights per response row at positions known in advance, optionally summed over rows: the log-diagonal , the previous-token weight , and the weight on a fixed sink column such as the beginning-of-sequence (BOS) token (Sriramanan et al., 2024; Vazhentsev et al., 2026; Xiao et al., 2024). The pass could keep these scores per row and finalize them with the LSE, which would place them in T1. We instead compute them in a separate kernel that reads only , , and the LSE, so it works after any forward kernel that stores the LSE and takes its positions at run time (Appendix D). Its extra scores grow linearly with the sequence length.
T3 (rescore). Column reductions, such as column entropy (not implemented) and the column sums from which sink rates are read [18, 5], cannot be finalized by the query-major pass from bounded state per query row. Row contributes to column , and the factor that turns this into is known only after the row’s last key tile and differs between rows (§ 2.4), so a column sum needs each score again once its row’s LSE is final, or all scores stored. The same holds for row reductions that compare each weight with a function of , such as counts of (not implemented). A second kernel re-evaluates each score, converts it with the stored LSE, and reuses the key-major loop of the FlashAttention-2 backward pass (Appendix D). It evaluates all the exponentials of the response stage, which run on slow non-tensor-core units (Shah et al., 2024), but only half its multiply-adds (no product with ), so it costs close to a second response stage (Figure 3a).
Figure 3. What each benchmark configuration adds to one attention layer (Q2). Configuration enables the paths up to ; reads the BOS column sum from the column sums instead of the lookup. (a) Overhead of each configuration over our statistics-off Base layer at (whiskers: 16K–32K), and of Base relative to SDPA on the whole sequence (diamonds). (b) Latency from 1K to 100K tokens at , . (c) Overhead relative to SDPA cuDNN on the whole sequence, at (solid) and (dashed).
T4 (dense). Statistics that are not bounded-state reductions of the weights, such as the attention-graph divergence MTopDiv [4] and stored attention maps, need the materialized response block, with memory; we have no T4 kernel.
Kernel Benchmark
We evaluate the kernels on their own and ask three questions. (Q1) Are the fused statistics numerically at least as accurate as those from materialized attention? (Q2) What does each tier add on top of attention itself, and how does that compare with production kernels? (Q3) How much does a whole-model forward slow down when it computes the statistics underlying several published detectors with our kernels, and how does that compare with computing them from materialized attention?
Setup. All runs use a single NVIDIA H100 NVL in bf16. Each of our configurations is a whole attention layer: prompt rows go to PyTorch’s SDPA and response rows to our Triton kernels. Base is the same layer with statistics off. We compare both with SDPA on the whole sequence (“full SDPA”) with the FlashAttention-2 and cuDNN backends. See Appendix § 11 for software versions and the timing protocol, and Appendix § 15 for memory.
Benchmark configurations. We measure the tiers in cumulative configurations: enables the paths up to on top of Base, which writes only the output and the LSE. adds the T1 row statistics of Table 1, the lookups of , , and the BOS weight , and the column sums, which replace the BOS lookup by the BOS column sum , so does not return the per-row . All configurations run on the response rows, so their cost grows with .
Numerical accuracy (Q1). We measure the absolute error on response rows against an fp64 reference, for materialized attention and for our kernels, on random inputs and on post-RoPE , , captured from Qwen3-8B, from 2K to 32K tokens.
Finding. Our statistics are three to four orders of magnitude more accurate for every statistic (Table 4 in Appendix § 12), because our kernels reduce fp32 probabilities in registers, whereas materialized attention first rounds each to bf16.
| Statistic | dense | fused | ratio |
| Entropy (T1) | |||
| Effective support (T1) | |||
| Maximum weight (T1) | |||
| Prompt mass (T1) | |||
| LSE (Base) | |||
| (T2) | |||
| (T2) | |||
| BOS column sum (T2) | |||
| Column sum (T3) | |||
| Attention output |
Table 4. Mean absolute error on response rows against an fp64 reference for materialized attention (the dense bf16 path) and our bf16 kernels, and their ratio. Each entry averages the per-head error over heads and layers and reports the worst input type (random or PHANTOM) and length (2K, 8K, 32K). Our statistics are about three to four orders of magnitude closer to fp64; they have the lower error for every statistic, input, and length, in both mean and maximum error.
Marginal cost per tier (Q2). We time one attention layer at batch 1 on synthetic inputs of tokens with response fraction , in Qwen3-8B shapes (32 query heads, 8 KV heads, ) and at and 256. adds at most 5 percentage points of compute time over , and both add 1–30% over Base (Figure 3a; Table 5 in Appendix § 13). The overhead generally increases with and decreases with , both trends explained by T1: the former reflects the response rows processed, while the latter reflects matrix computation scaling with versus T1’s elementwise work. is the costliest configuration, at 16–87%, and shows the same scaling in as ; in , it drops from to but not further, because T3’s second pass adds its own matrix work. Our kernels scale like the production ones all the way to 100K tokens (Figure 3b–Figure 3c), with no wall expected further: at 100K tokens and , a layer with all row statistics takes 387 ms, against 351 ms for cuDNN and 523 ms for FA2 without statistics. Below about 4K tokens, our latency stops falling because a fixed CPU overhead per call dominates (Appendix § 13). In memory, the statistics take 7.6–20 MiB of a layer at 32K (Appendix § 15). Finding. T1 and T2 are cheap enough to compute together by default; T3 is worthwhile only when a detector needs reductions over all final weights.
| Overhead (%) | , | , | , | , | , | , | , | , | , |
| T1 (in pass) vs. Base | 9–12 | 22 | 27–28 | 3–7 | 12–15 | 9 | 1–4 | 6–9 | 2–6 |
| T2 (+ lookups) vs. Base | 9–12 | 21–22 | 27–30 | 3–6 | 12–20 | 9–10 | 1–4 | 6–10 | 4–7 |
| T3 (+ col. sums) vs. Base | 25–26 | 64 | 87 | 16–19 | 39–44 | 53–58 | 19–26 | 39–43 | 54–57 |
| Base vs. full cuDNN | 6–11 | 12–19 | 16–20 | 4–9 | 7–15 | 10–17 | 10–13 | 20–25 | 28–34 |
| Base vs. full FA2 | 0–3 | −4 – −1 | −9 – −8 | −2 – +1 | −8 – −5 | −13 – −12 | −5 – −2 | −16 – −11 | −21 – −20 |
| T2 vs. full cuDNN | 15–25 | 36–45 | 48–55 | 7–16 | 19–38 | 20–29 | 14 | 28–37 | 33–43 |
Table 5. The numbers behind Figure 3a (Q2): latency overhead (%) of one attention layer, as a range over . Upper rows: each configuration of Section 4 over the statistics-off split Base, with the prompt stage on SDPA cuDNN. Lower rows: Base over SDPA on the whole sequence, with the prompt stage on the same backend, and the cost of all row statistics (T2) over full SDPA cuDNN, the fastest production kernel here. H100 NVL, bf16.
Comparison with prior methods (Q3). We compute the attention statistics underlying Lookback Lens (T1) ([10]), LLM-Check (T2) ((Sriramanan et al., 2024)), RAUQ (T2) ((Vazhentsev et al., 2026)), INTRYGUE (T3) ([24]), and SinkProbe (T3) ([5]), with the other T1 statistics, for all 32 heads of all 36 layers of Qwen3-8B, in one teacher-forced forward at batch 1. Where a method pools over all tokens, as LLM-Check and SinkProbe do, our response-row version is an adaptation (Appendix § 8). The floor is the same forward without statistics. We stop at feature extraction; the classifiers cost little and the same for every path. See Appendix § 14 for the SDPA backends and the dense baseline.
Data. From RAGTruth ((Niu et al., 2024)), we take the subset of QA responses generated by Llama-2-70B-chat, and from PHANTOM ([22]), the 2,000-token split of the 10-K filings set (Appendix § 14). Inputs are short here because dense pipelines do not scale much further.
Results. Figure 4 shows the cost of every sample, grouped by prompt length. At these lengths, both paths add about the same latency for every prompt length, but dense latency starts to grow once a response exceeds about 100 tokens, and faster for longer prompts: on the sample with the most response weights, 785 response tokens in 7.2K, dense adds 501 ms to the forward and ours 53 ms. Finding. The clear difference is memory: dense memory grows with , by 2.1 GiB on that sample, whereas ours grows only with , by 23 MiB, so the gap widens with sequence length.
Figure 4. Added latency and peak memory over the forward without features, per sample, by prompt length (Q3). Lines: binned medians. The shortest prompts are RAGTruth QA, the others PHANTOM.
Proxy Detection
§ 3 showed that attention statistics are cheap to extract; here we ask whether a compact proxy detector should extract them. Every proxy forward already yields hidden states and logits at no extra cost, and probes on hidden states are strong detectors on their own ([3, 7]), so attention statistics earn their place only if they add to these signals. We ask four questions. (Q4) Do attention features improve a detector built on hidden states and logits? (Q5) Which attention representation helps: a few light statistics pooled over selected heads, from T1 and T2, or heavier sink statistics of every head, which need T3? (Q6) How does detection scale with proxy size? (Q7) How do proxy detectors compare with LLM judges? § 4.17 then gives the cost of the features in the detection pipeline, and Appendix § 19 tests whether published attention detectors, computed from one forward of the 8B proxy, transfer across the six domains of HaluBench.
Task, data, and metrics
A detector reads a context, a question, and an existing answer and predicts whether the context supports the answer. A frozen Qwen3 proxy ((Yang et al., 2025)) of 0.6B, 1.7B, 4B, or 8B parameters reads each example in one teacher-forced forward, so it need not be the model that wrote the answer.
We use RAGTruth QA ((Niu et al., 2024)), HaluBench ((Ravi et al., 2024)), and TRIVIA+ ([9]), split into training, validation, and test so that groups of related examples never cross splits. We filter and split HaluBench ourselves, because on its unfiltered answers a TF–IDF classifier given only the answer reaches 0.84 AU-ROC. Appendix § 17 gives the splits, the filtering, and text-only baselines.
| Features | RAGTruth QA 0.6B | RAGTruth QA 1.7B | RAGTruth QA 4B | RAGTruth QA 8B | HaluBench 0.6B | HaluBench 1.7B | HaluBench 4B | HaluBench 8B | TRIVIA+ 0.6B | TRIVIA+ 1.7B | TRIVIA+ 4B | TRIVIA+ 8B | |
| A | 7 | .573 | .567 | .503 | .550 | .615 | .639 | .631 | .637 | .531 | .524 | .545 | .527 |
| L | 9 | .440 | .444 | .467 | .433 | .633 | .627 | .642 | .665 | .545 | .523 | .518 | .576 |
| AL | 16 | .566 | .532 | .541 | .546 | .642 | .643 | .656 | .675 | .555 | .560 | .543 | .578 |
| H | 64 | .557 | .559 | .566 | .557 | .697 | .734 | .742 | .742 | .627 | .638 | .634 | .670 |
| AH | 71 | .637 | .581 | .547 | .600 | .698 | .729 | .744 | .746 | .613 | .638 | .639 | .645 |
| HL | 73 | .614 | .559 | .543 | .533 | .697 | .736 | .749 | .754 | .599 | <u>.641</u> | .641 | .647 |
| AHL | 80 | <u>.621</u> | .563 | .528 | .563 | .702 | .726 | .755 | .756 | .641 | .643 | <u>.646</u> | .667 |
| A | 64 | .593 | <u>.577</u> | .583 | .592 | .727 | .718 | <u>.769</u> | <u>.768</u> | .631 | .634 | .616 | .656 |
| AH | 128 | .601 | .529 | <u>.566</u> | <u>.594</u> | <u>.724</u> | .746 | .776 | .791 | <u>.636</u> | .640 | .674 | .671 |
| Best LLM judge | .623 | .755 | .655 |
Table 2. Test F1 by feature set and Qwen3 proxy size. A: cheap attention features; A: all-head sink values; H: compact hidden states; L: logit features; combinations concatenate blocks (Section 5.2). : number of classifier inputs. Bold: best in column; <u>underlined</u>: second best. Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Table 2 reports test F1 with validation-selected threshold, because a deployed detector must label each answer; AUROC is in Table 10 of Appendix § 18.
| Features | RAGTruth QA | HaluBench | TRIVIA+ | ||||||||||
| 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | ||
| A | 7 | .852 | .847 | .838 | .856 | .627 | .636 | .652 | .660 | .642 | .653 | .666 | .645 |
| L | 9 | .764 | .765 | .793 | .765 | .654 | .646 | .661 | .680 | .684 | .661 | .696 | .703 |
| AL | 16 | .852 | .849 | .859 | .859 | .663 | .667 | .680 | .693 | .686 | .682 | .706 | .707 |
| H | 64 | .864 | .855 | .869 | .862 | .792 | .824 | .846 | .846 | .775 | .786 | .807 | .804 |
| AH | 71 | .871 | .861 | .866 | .872 | .795 | .824 | .846 | .847 | .777 | .789 | .806 | .793 |
| HL | 73 | .865 | .856 | .876 | .867 | .797 | .823 | .848 | .851 | .776 | .791 | .804 | .804 |
| AHL | 80 | .873 | .861 | .877 | .875 | .800 | .822 | .848 | .851 | .781 | .796 | .799 | .813 |
| A | 64 | .866 | .873 | .872 | .880 | .801 | .821 | .871 | .877 | .780 | .774 | .801 | .803 |
| AH | 128 | .866 | .857 | .875 | .874 | .814 | .846 | .877 | .881 | .796 | .792 | .820 | .824 |
| Best LLM judge | .909 | .859 | .786 |
Table 10. Test AUROC of the detectors of Table 2. Bold: best in column; underlined: second best (ties marked alike). Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Feature blocks
One proxy forward yields three feature blocks: hidden states and logits from the forward pass, and attention features added by our kernels in two variants, A and A. Feature sets concatenate one or more blocks (e.g., AH). We select the A and L features and the H pooling and projection recipe once, using the highest mean AUROC on the TRIVIA+ and reuse it across all experiments with the details of the protocol in Appendix § 18. Each per-token quantity, i.e., an attention-head statistic, a logit statistic, or a hidden-state coordinate, is pooled over answer tokens by its mean, standard deviation, minimum, and maximum, producing distinct pooled features.
Cheap attention features (A) use the strongest induction heads, which attend to earlier input tokens (Olsson et al., 2022). Each head yields 22 candidate features, averaged across the heads: four pooled features for each of five per-token statistics, the T2 BOS sink rate, and the log-diagonal. Feature selection retains the seven in bold: maximum weight (mean, std, min, max), effective support (mean, std, min, max), entropy (mean, std, min, max), the lookback ratio built from prompt mass and the previous-token weight (mean, std, min, max), the BOS sink rate, and the log-diagonal.
All-head sink values (A) are the richest attention features our kernels provide. Following SinkProbe (Binkowski et al., [5]), we keep, for every head of every layer, its largest sink values from T3, the normalized column sums (Appendix § 8), concatenate them, and project them onto 64 principal components, matching the size of H without selection.
Compact hidden states (H) are the standard probe input. Following prior work (Azaria and Mitchell, [3]; Chen et al., [7]), we use one middle layer without selection. The selection keeps the stacked mean and standard deviation of its coordinates, which are standardized and projected onto 64 principal components (Appendix § 18.§ 1).
Logit features (L) are nine of 224 candidates from seven per-token statistics of the next-token distribution, e.g., the answer token’s minimum probability, kept by recursive feature elimination (Appendix § 18.§ 2).
Selection and training per dataset and proxy
Each dataset–proxy pair refits the scalers and projections on its training split and selects hyperparameters without test labels. For A, the number of heads is chosen by the validation AUROC of A alone and reused in every set that contains A. For A, the number of sink values per head is chosen for each pair by grouped five-fold cross-validation on its training split and reused in AH. Every feature set serves as an input to a class-balanced regularized logistic regression with regularization strength chosen by validation AUROC.
Main results
Attention features (Q4). In every one of the 12 dataset–proxy pairs, the feature set with the best F1 contains A or A (Table 2), and so does the
@page 7/28 starts_mid=0 ends_mid=1
| Features | RAGTruth QA 0.6B | RAGTruth QA 1.7B | RAGTruth QA 4B | RAGTruth QA 8B | HaluBench 0.6B | HaluBench 1.7B | HaluBench 4B | HaluBench 8B | TRIVIA+ 0.6B | TRIVIA+ 1.7B | TRIVIA+ 4B | TRIVIA+ 8B | |
| A | 7 | .573 | .567 | .503 | .550 | .615 | .639 | .631 | .637 | .531 | .524 | .545 | .527 |
| L | 9 | .440 | .444 | .467 | .433 | .633 | .627 | .642 | .665 | .545 | .523 | .518 | .576 |
| AL | 16 | .566 | .532 | .541 | .546 | .642 | .643 | .656 | .675 | .555 | .560 | .543 | .578 |
| H | 64 | .557 | .559 | <u>.566</u> | .557 | .697 | .734 | .742 | .742 | .627 | .638 | .634 | <u>.670</u> |
| AH | 71 | .637 | .581 | .547 | .600 | .698 | .729 | .744 | .746 | .613 | .638 | .639 | .645 |
| HL | 73 | .614 | .559 | .543 | .533 | .697 | .736 | .749 | .754 | .599 | <u>.641</u> | .641 | .647 |
| AHL | 80 | <u>.621</u> | .563 | .528 | .563 | .702 | .726 | .755 | .756 | .641 | .643 | <u>.646</u> | .667 |
| A | 64 | .593 | <u>.577</u> | .583 | .592 | .727 | .718 | <u>.769</u> | <u>.768</u> | .631 | .634 | .616 | .656 |
| AH | 128 | .601 | .529 | .566 | <u>.594</u> | <u>.724</u> | .746 | .776 | .791 | <u>.636</u> | .640 | .674 | .671 |
| Best LLM judge | .623 | .755 | .655 |
Table 2 (PDF p. 7). Test F1 by feature set and Qwen3 proxy size. A: cheap attention features; A: all-head sink values; H: compact hidden states; L: logit features; combinations concatenate blocks (Section 5.2). : number of classifier inputs. Bold: best in column; <u>underlined</u>: second best. Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Table 2 reports test F1 with validation-selected threshold, because a deployed detector must label each answer; AUROC is in Table 10 of Appendix § 18.
Feature blocks
One proxy forward yields three feature blocks: hidden states and logits from the forward pass, and attention features added by our kernels in two variants, A and A. Feature sets concatenate one or more blocks (e.g., AH). We select the A and L features and the H pooling and projection recipe once, using the highest mean AUROC on the TRIVIA+ and reuse it across all experiments with the details of the protocol in Appendix § 18. Each per-token quantity, i.e., an attention-head statistic, a logit statistic, or a hidden-state coordinate, is pooled over answer tokens by its mean, standard deviation, minimum, and maximum, producing distinct pooled features.
Cheap attention features (A) use the strongest induction heads, which attend to earlier input tokens (Olsson et al., 2022). Each head yields 22 candidate features, averaged across the heads: four pooled features for each of five per-token statistics, the T2 BOS sink rate, and the log-diagonal. Feature selection retains the seven in bold: maximum weight (mean, std, min, max), effective support (mean, std, min, max), entropy (mean, std, min, max), the lookback ratio built from prompt mass and the previous-token weight (mean, std, min, max), the BOS sink rate, and the log-diagonal.
All-head sink values (A) are the richest attention features our kernels provide. Following SinkProbe (Binkowski et al., [5]), we keep, for every head of every layer, its largest sink values from T3, the normalized column sums (Appendix § 8), concatenate them, and project them onto 64 principal components, matching the size of H without selection.
Compact hidden states (H) are the standard probe input. Following prior work (Azaria and Mitchell, [3]; Chen et al., [7]), we use one middle layer without selection. The selection keeps the stacked mean and standard deviation of its coordinates, which are standardized and projected onto 64 principal components (Appendix § 18.§ 1).
Logit features (L) are nine of 224 candidates from seven per-token statistics of the next-token distribution, e.g., the answer token’s minimum probability, kept by recursive feature elimination (Appendix § 18.§ 2).
Selection and training per dataset and proxy
Each dataset–proxy pair refits the scalers and projections on its training split and selects hyperparameters without test labels. For A, the number of heads is chosen by the validation AUROC of A alone and reused in every set that contains A. For A, the number of sink values per head is chosen for each pair by grouped five-fold cross-validation on its training split and reused in AH. Every feature set serves as an input to a class-balanced regularized logistic regression with regularization strength chosen by validation AUROC.
Main results
Attention features (Q4). In every one of the 12 dataset–proxy pairs, the feature set with the best F1 contains A or A (Table 2), and so does the
@page 7/28 starts_mid=0 ends_mid=1
| Features | RAGTruth QA 0.6B | RAGTruth QA 1.7B | RAGTruth QA 4B | RAGTruth QA 8B | HaluBench 0.6B | HaluBench 1.7B | HaluBench 4B | HaluBench 8B | TRIVIA+ 0.6B | TRIVIA+ 1.7B | TRIVIA+ 4B | TRIVIA+ 8B | |
| A | 7 | .573 | .567 | .503 | .550 | .615 | .639 | .631 | .637 | .531 | .524 | .545 | .527 |
| L | 9 | .440 | .444 | .467 | .433 | .633 | .627 | .642 | .665 | .545 | .523 | .518 | .576 |
| AL | 16 | .566 | .532 | .541 | .546 | .642 | .643 | .656 | .675 | .555 | .560 | .543 | .578 |
| H | 64 | .557 | .559 | <u>.566</u> | .557 | .697 | .734 | .742 | .742 | .627 | .638 | .634 | <u>.670</u> |
| AH | 71 | .637 | .581 | .547 | .600 | .698 | .729 | .744 | .746 | .613 | .638 | .639 | .645 |
| HL | 73 | .614 | .559 | .543 | .533 | .697 | .736 | .749 | .754 | .599 | <u>.641</u> | .641 | .647 |
| AHL | 80 | <u>.621</u> | .563 | .528 | .563 | .702 | .726 | .755 | .756 | .641 | .643 | <u>.646</u> | .667 |
| A | 64 | .593 | <u>.577</u> | .583 | .592 | .727 | .718 | <u>.769</u> | <u>.768</u> | .631 | .634 | .616 | .656 |
| AH | 128 | .601 | .529 | .566 | <u>.594</u> | <u>.724</u> | .746 | .776 | .791 | <u>.636</u> | .640 | .674 | .671 |
| Best LLM judge | .623 | .755 | .655 |
Table 2 (PDF p. 7, second). Test F1 by feature set and Qwen3 proxy size. A: cheap attention features; A: all-head sink values; H: compact hidden states; L: logit features; combinations concatenate blocks (Section 5.2). : number of classifier inputs. Bold: best in column; <u>underlined</u>: second best. Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Table 2 reports test F1 with validation-selected threshold, because a deployed detector must label each answer; AUROC is in Table 10 of Appendix § 18.
Feature blocks
One proxy forward yields three feature blocks: hidden states and logits from the forward pass, and attention features added by our kernels in two variants, A and A. Feature sets concatenate one or more blocks (e.g., AH). We select the A and L features and the H pooling and projection recipe once, using the highest mean AUROC on the TRIVIA+ and reuse it across all experiments with the details of the protocol in Appendix § 18. Each per-token quantity, i.e., an attention-head statistic, a logit statistic, or a hidden-state coordinate, is pooled over answer tokens by its mean, standard deviation, minimum, and maximum, producing distinct pooled features.
Cheap attention features (A) use the strongest induction heads, which attend to earlier input tokens (Olsson et al., 2022). Each head yields 22 candidate features, averaged across the heads: four pooled features for each of five per-token statistics, the T2 BOS sink rate, and the log-diagonal. Feature selection retains the seven in bold: maximum weight (mean, std, min, max), effective support (mean, std, min, max), entropy (mean, std, min, max), the lookback ratio built from prompt mass and the previous-token weight (mean, std, min, max), the BOS sink rate, and the log-diagonal.
All-head sink values (A) are the richest attention features our kernels provide. Following SinkProbe (Binkowski et al., [5]), we keep, for every head of every layer, its largest sink values from T3, the normalized column sums (Appendix § 8), concatenate them, and project them onto 64 principal components, matching the size of H without selection.
Compact hidden states (H) are the standard probe input. Following prior work (Azaria and Mitchell, [3]; Chen et al., [7]), we use one middle layer without selection. The selection keeps the stacked mean and standard deviation of its coordinates, which are standardized and projected onto 64 principal components (Appendix § 18.§ 1).
Logit features (L) are nine of 224 candidates from seven per-token statistics of the next-token distribution, e.g., the answer token’s minimum probability, kept by recursive feature elimination (Appendix § 18.§ 2).
Selection and training per dataset and proxy
Each dataset–proxy pair refits the scalers and projections on its training split and selects hyperparameters without test labels. For A, the number of heads is chosen by the validation AUROC of A alone and reused in every set that contains A. For A, the number of sink values per head is chosen for each pair by grouped five-fold cross-validation on its training split and reused in AH. Every feature set serves as an input to a class-balanced regularized logistic regression with regularization strength chosen by validation AUROC.
Main results
Attention features (Q4). In every one of the 12 dataset–proxy pairs, the feature set with the best F1 contains A or A (Table 2), and so does the
@page 7/28 starts_mid=0 ends_mid=1
| Features | RAGTruth QA 0.6B | RAGTruth QA 1.7B | RAGTruth QA 4B | RAGTruth QA 8B | HaluBench 0.6B | HaluBench 1.7B | HaluBench 4B | HaluBench 8B | TRIVIA+ 0.6B | TRIVIA+ 1.7B | TRIVIA+ 4B | TRIVIA+ 8B | |
| A | 7 | .573 | .567 | .503 | .550 | .615 | .639 | .631 | .637 | .531 | .524 | .545 | .527 |
| L | 9 | .440 | .444 | .467 | .433 | .633 | .627 | .642 | .665 | .545 | .523 | .518 | .576 |
| AL | 16 | .566 | .532 | .541 | .546 | .642 | .643 | .656 | .675 | .555 | .560 | .543 | .578 |
| H | 64 | .557 | .559 | <u>.566</u> | .557 | .697 | .734 | .742 | .742 | .627 | .638 | .634 | <u>.670</u> |
| AH | 71 | .637 | .581 | .547 | .600 | .698 | .729 | .744 | .746 | .613 | .638 | .639 | .645 |
| HL | 73 | .614 | .559 | .543 | .533 | .697 | .736 | .749 | .754 | .599 | <u>.641</u> | .641 | .647 |
| AHL | 80 | <u>.621</u> | .563 | .528 | .563 | .702 | .726 | .755 | .756 | .641 | .643 | <u>.646</u> | .667 |
| A | 64 | .593 | <u>.577</u> | .583 | .592 | .727 | .718 | <u>.769</u> | <u>.768</u> | .631 | .634 | .616 | .656 |
| AH | 128 | .601 | .529 | .566 | <u>.594</u> | <u>.724</u> | .746 | .776 | .791 | <u>.636</u> | .640 | .674 | .671 |
| Best LLM judge | .623 | .755 | .655 |
Table 2 (PDF p. 7, third). Test F1 by feature set and Qwen3 proxy size. A: cheap attention features; A: all-head sink values; H: compact hidden states; L: logit features; combinations concatenate blocks (Section 5.2). : number of classifier inputs. Bold: best in column; <u>underlined</u>: second best. Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Table 2 reports test F1 with validation-selected threshold, because a deployed detector must label each answer; AUROC is in Table 10 of Appendix § 18.
Feature blocks
One proxy forward yields three feature blocks: hidden states and logits from the forward pass, and attention features added by our kernels in two variants, A and A. Feature sets concatenate one or more blocks (e.g., AH). We select the A and L features and the H pooling and projection recipe once, using the highest mean AUROC on the TRIVIA+ and reuse it across all experiments with the details of the protocol in Appendix § 18. Each per-token quantity, i.e., an attention-head statistic, a logit statistic, or a hidden-state coordinate, is pooled over answer tokens by its mean, standard deviation, minimum, and maximum, producing distinct pooled features.
Cheap attention features (A) use the strongest induction heads, which attend to earlier input tokens (Olsson et al., 2022). Each head yields 22 candidate features, averaged across the heads: four pooled features for each of five per-token statistics, the T2 BOS sink rate, and the log-diagonal. Feature selection retains the seven in bold: maximum weight (mean, std, min, max), effective support (mean, std, min, max), entropy (mean, std, min, max), the lookback ratio built from prompt mass and the previous-token weight (mean, std, min, max), the BOS sink rate, and the log-diagonal.
All-head sink values (A) are the richest attention features our kernels provide. Following SinkProbe (Binkowski et al., [5]), we keep, for every head of every layer, its largest sink values from T3, the normalized column sums (Appendix § 8), concatenate them, and project them onto 64 principal components, matching the size of H without selection.
Compact hidden states (H) are the standard probe input. Following prior work (Azaria and Mitchell, [3]; Chen et al., [7]), we use one middle layer without selection. The selection keeps the stacked mean and standard deviation of its coordinates, which are standardized and projected onto 64 principal components (Appendix § 18.§ 1).
Logit features (L) are nine of 224 candidates from seven per-token statistics of the next-token distribution, e.g., the answer token’s minimum probability, kept by recursive feature elimination (Appendix § 18.§ 2).
Selection and training per dataset and proxy
Each dataset–proxy pair refits the scalers and projections on its training split and selects hyperparameters without test labels. For A, the number of heads is chosen by the validation AUROC of A alone and reused in every set that contains A. For A, the number of sink values per head is chosen for each pair by grouped five-fold cross-validation on its training split and reused in AH. Every feature set serves as an input to a class-balanced regularized logistic regression with regularization strength chosen by validation AUROC.
Main results
Attention features (Q4). In every one of the 12 dataset–proxy pairs, the feature set with the best F1 contains A or A (Table 2), and so does the
@page 7/28 starts_mid=0 ends_mid=1
| Features | RAGTruth QA 0.6B | RAGTruth QA 1.7B | RAGTruth QA 4B | RAGTruth QA 8B | HaluBench 0.6B | HaluBench 1.7B | HaluBench 4B | HaluBench 8B | TRIVIA+ 0.6B | TRIVIA+ 1.7B | TRIVIA+ 4B | TRIVIA+ 8B | |
| A | 7 | .573 | .567 | .503 | .550 | .615 | .639 | .631 | .637 | .531 | .524 | .545 | .527 |
| L | 9 | .440 | .444 | .467 | .433 | .633 | .627 | .642 | .665 | .545 | .523 | .518 | .576 |
| AL | 16 | .566 | .532 | .541 | .546 | .642 | .643 | .656 | .675 | .555 | .560 | .543 | .578 |
| H | 64 | .557 | .559 | <u>.566</u> | .557 | .697 | .734 | .742 | .742 | .627 | .638 | .634 | <u>.670</u> |
| AH | 71 | .637 | .581 | .547 | .600 | .698 | .729 | .744 | .746 | .613 | .638 | .639 | .645 |
| HL | 73 | .614 | .559 | .543 | .533 | .697 | .736 | .749 | .754 | .599 | <u>.641</u> | .641 | .647 |
| AHL | 80 | <u>.621</u> | .563 | .528 | .563 | .702 | .726 | .755 | .756 | .641 | .643 | <u>.646</u> | .667 |
| A | 64 | .593 | <u>.577</u> | .583 | .592 | .727 | .718 | <u>.769</u> | <u>.768</u> | .631 | .634 | .616 | .656 |
| AH | 128 | .601 | .529 | .566 | <u>.594</u> | <u>.724</u> | .746 | .776 | .791 | <u>.636</u> | .640 | .674 | .671 |
| Best LLM judge | .623 | .755 | .655 |
Table 2 (PDF p. 7, fourth). Test F1 by feature set and Qwen3 proxy size. A: cheap attention features; A: all-head sink values; H: compact hidden states; L: logit features; combinations concatenate blocks (Section 5.2). : number of classifier inputs. Bold: best in column; <u>underlined</u>: second best. Bottom: the best of nine LLM judges of 4–9B parameters, Qwen3.5-9B on every dataset (Table 13).
Table 2 reports test F1 with validation-selected threshold, because a deployed detector must label each answer; AUROC is in Table 10 of Appendix § 18.
Feature blocks
One proxy forward yields three feature blocks: hidden states and logits from the forward pass, and attention features added by our kernels in two variants, A and A. Feature sets concatenate one or more blocks (e.g., AH). We select the A and L features and the H pooling and projection recipe once, using the highest mean AUROC on the TRIVIA+ and reuse it across all experiments with the details of the protocol in Appendix § 18. Each per-token quantity, i.e., an attention-head statistic, a logit statistic, or a hidden-state coordinate, is pooled over answer tokens by its mean, standard deviation, minimum, and maximum, producing distinct pooled features.
Cheap attention features (A) use the strongest induction heads, which attend to earlier input tokens (Olsson et al., 2022). Each head yields 22 candidate features, averaged across the heads: four pooled features for each of five per-token statistics, the T2 BOS sink rate, and the log-diagonal. Feature selection retains the seven in bold: maximum weight (mean, std, min, max), effective support (mean, std, min, max), entropy (mean, std, min, max), the lookback ratio built from prompt mass and the previous-token weight (mean, std, min, max), the BOS sink rate, and the log-diagonal.
All-head sink values (A) are the richest attention features our kernels provide. Following SinkProbe (Binkowski et al., [5]), we keep, for every head of every layer, its largest sink values from T3, the normalized column sums (Appendix § 8), concatenate them, and project them onto 64 principal components, matching the size of H without selection.
Compact hidden states (H) are the standard probe input. Following prior work (Azaria and Mitchell, [3]; Chen et al., [7]), we use one middle layer without selection. The selection keeps the stacked mean and standard deviation of its coordinates, which are standardized and projected onto 64 principal components (Appendix § 18.§ 1).
Logit features (L) are nine of 224 candidates from seven per-token statistics of the next-token distribution, e.g., the answer token’s minimum probability, kept by recursive feature elimination (Appendix § 18.§ 2).
Selection and training per dataset and proxy
Each dataset–proxy pair refits the scalers and projections on its training split and selects hyperparameters without test labels. For A, the number of heads is chosen by the validation AUROC of A alone and reused in every set that contains A. For A, the number of sink values per head is chosen for each pair by grouped five-fold cross-validation on its training split and reused in AH. Every feature set serves as an input to a class-balanced regularized logistic regression with regularization strength chosen by validation AUROC.
Main results
Attention features (Q4). In every one of the 12 dataset–proxy pairs, the feature set with the best F1 contains A or A (Table 2), and so does the set with the best AUROC (Table 10). With only 150–546 test groups, uncertainty in F1 differences remains substantial. After Holm correction, adding significantly improves F1 for all four proxies on RAGTruth QA when combined with logits, and for two proxies when combined with hidden states (Table 11). Adding to hidden states yields significant improvements for the 4B and 8B proxies on HaluBench (Table 12). Thus, overall attention features provide improvements if compared to variants without them.
| Addition | RAGTruth QA | HaluBench | TRIVIA+ | ||||||||||
| 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | ||
| F1 | H→AH | +.080 | +.022 | −.020 | +.043 | +.001 | −.005 | +.002 | +.004 | −.014 | .000 | +.005 | −.025 |
| F1 | L→AL | +.126 | +.088 | +.074 | +.114 | +.009 | +.015 | +.014 | +.009 | +.011 | +.038 | +.025 | +.002 |
| F1 | HL→AHL | +.007 | +.005 | −.016 | +.030 | +.006 | −.010 | +.006 | +.002 | +.042 | +.002 | +.005 | +.020 |
| , Holm-12 | H→AH | .005 | .557 | .605 | .017 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| , Holm-12 | L→AL | <.001 | .004 | .002 | <.001 | 1 | 1 | .503 | 1 | 1 | .317 | 1 | 1 |
| , Holm-12 | HL→AHL | 1 | 1 | .885 | .065 | 1 | .458 | 1 | 1 | .174 | 1 | 1 | .477 |
Table 11. Change in test F1 when A is added, with two-sided -values from 100,000 paired bootstrap resamples of test groups (seed 42; models, regularization, and thresholds fixed), Holm-corrected over the 12 dataset–proxy pairs of an addition (Holm-12). A gain is significant if and the corrected ; bold: significant gain. No addition gives a significant loss.
| Addition | RAGTruth QA | HaluBench | TRIVIA+ | ||||||||||
| 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | 0.6B | 1.7B | 4B | 8B | ||
| F1 | H→AH | +.044 | −.030 | −.001 | +.037 | +.027 | +.012 | +.035 | +.050 | +.009 | +.002 | +.040 | +.001 |
| , Holm-12 | H→AH | .201 | .324 | 1 | .269 | .198 | 1 | .027 | <.001 | 1 | 1 | .189 | 1 |
Table 12. Change in test F1 when A is added to H (Section 5.4), with two-sided -values from 100,000 paired bootstrap resamples of test groups as in Table 11, Holm-corrected over the 12 dataset–proxy pairs (Holm-12). Bold: significant gain. No change is a significant loss.
Which attention features (Q5). Alone, beats in all 12 pairs in both F1 and AUROC, which supports the heavier T3 path when attention is the main signal, although also has more inputs and covers every head. With hidden states, wins on HaluBench and TRIVIA+ with every proxy, while on RAGTruth QA wins with three of four. The cheap features thus remain useful on some datasets alongside T3 sinks.
Proxy size (Q6). The benefit of larger proxies depends on the benchmark and feature representation. On HaluBench and TRIVIA+, larger models improve detectors using hidden states, logits, or all-head sink features. On RAGTruth QA, even the smallest proxy remains competitive. These results favour selecting proxy size and features jointly on validation data with small 0.6B proxy showing strong performance in multiple settings.
LLM judges (Q7). Table 13 compares our proxy detectors with nine instruction-tuned LLM judges of 4–9B parameters ((Zheng et al., 2023)); evaluation details are in Appendix § 18.§ 4. Against Qwen3.5-9B, the strongest evaluated judge, a 4B proxy achieves higher observed F1 on HaluBench and TRIVIA+, and a 0.6B proxy does so on RAGTruth QA. Our probes are also competitive with the specialized grounding checkers MiniCheck-7B ((Tang et al., 2024)) and HHEM-2.1 ([26]). The most consistent advantage is within the same backbone: achieves higher F1 and AUROC than prompting the corresponding Qwen3 model in all 12 dataset–proxy pairs. When task-specific training data are available, supervised probing therefore offers an effective way to build compact detectors that outperform prompting the same models and compete with larger judges.
| Judge | Prompt | AUROC | F1 | ||||
| RAGTruth | HaluB. | TRIVIA+ | RAGTruth | HaluB. | TRIVIA+ | ||
| Qwen3.5-9B | Strict few-shot | .909 | .859 | .786 | .623 | .755 | .655 |
| Gemma-4-E4B | Evidence | .878 | .855 | .774 | .617 | .751 | .621 |
| Granite-4.2-8B | Strict | .843 | .848 | .755 | .547 | .753 | .645 |
| Ministral-3-8B | Strict | .823 | .817 | .735 | .517 | .721 | .613 |
| Falcon-H1-7B | Strict few-shot | .752 | .834 | .747 | .434 | .726 | .624 |
| Llama-3.1-8B | Strict | .688 | .754 | .688 | .363 | .684 | .564 |
| GLM-4-9B | Strict few-shot | .725 | .753 | .683 | .399 | .678 | .587 |
| Phi-4-mini | Claims | .550 | .771 | .664 | .306 | .693 | .566 |
| Command-R7B | Evidence | .501 | .604 | .624 | .302 | .634 | .536 |
| Qwen3-8B, zero/few-shot | Strict few-shot | .814 | .835 | .752 | .521 | .742 | .638 |
| Qwen3-4B, zero/few-shot | Strict few-shot | .769 | .799 | .753 | .439 | .724 | .631 |
| Qwen3-1.7B, zero/few-shot | Claims | .443 | .510 | .433 | .309 | .622 | .492 |
| Qwen3-0.6B, zero/few-shot | Claims | .469 | .473 | .495 | .306 | .622 | .516 |
| Bespoke-MiniCheck-7B | – | .881 | .822 | .751 | .578 | .717 | .616 |
| HHEM-2.1-Open | – | .852 | .703 | .726 | .563 | .663 | .604 |
| Qwen3-0.6B, A₇H₆₄L₉ | – | .873 | .800 | .781 | .621 | .702 | .641 |
| Qwen3-4B, A₇H₆₄L₉ | – | .877 | .848 | .799 | .528 | .755 | .646 |
| Qwen3-0.6B, A₆₄H₆₄ | – | .866 | .814 | .796 | .601 | .724 | .636 |
| Qwen3-4B, A₆₄H₆₄ | – | .875 | .877 | .820 | .566 | .776 | .674 |
Table 13. LLM judges on the test splits of Table 7 with F1 at the threshold selected on validation. Top: nine instruction-tuned LLMs prompted as judges. Middle: the four Qwen3 proxy backbones prompted as judges and two specialized grounding checkers. Bottom: our proxy detectors for reference.
Cost of feature extraction
A proxy detector adds a linear classifier to one proxy forward, so it costs one forward with features. Figure 1 times forwards of the largest and smallest proxies, Qwen3-8B and Qwen3-0.6B, with all kernel statistics for every head and layer, against the same forwards without features (Appendix § 14). From 2K to 35K tokens, the overhead falls from 16% to 1.4% for Qwen3-8B and from about 170% to 6% for Qwen3-0.6B, whose whole forward at 2K still takes under 100 ms. On shorter inputs, Python-side CPU overhead sets the floor. In peak memory above the model weights (Figure 6), the features add about 28 KiB per response token for Qwen3-8B and 11 KiB for Qwen3-0.6B, mostly the stored statistics (22.5 and 8.75 KiB; Appendix § 15).
Conclusion
Attention statistics are an active basis for hallucination detection ([10, 5, 24]). We confirmed that many those statistics can be extracted without materializing attention matrices. Our paper classifies these statistics by how they are computed, clarifying which can reuse the attention pass and which require additional lookups or a second pass over the scores. Our Flash Attention-compatible backend implements these paths with memory linear in sequence length. In our H100 NVL benchmarks at batch size one, extracting the statistics underlying five detectors adds just 16% to Qwen3-8B forward latency at 2K tokens and 1.4% at 35K. This implementation supports attention features used by existing detectors and their use with small, frozen proxy models. Our experiments show that supervised detectors built on these proxies can compete with larger prompted judges. Reducing Python overhead and synchronization with the GPU would further improve extraction speed on short inputs.
Limitations
We do not claim that our tiers list every attention statistic that can be computed efficiently. A tier is the path our implementation uses (§ 2.3.1): a statistic in T4 may admit an efficient exact kernel that we did not write, and we do not claim that our algorithms are optimal.
We write our kernels in Triton, which is portable across GPUs but can be slower than specialized CUDA kernels: our response-stage kernel is faster than FA2 on Hopper but slower than cuDNN. Nothing prevents computing the same statistics inside such a kernel. Our Python wrapper also adds a fixed host cost of 47–60 ms per forward. Little of it is GPU work, which grows by only 5 ms on short Qwen3-8B inputs (Appendix § 14), so a compiled host implementation with CUDA graphs could remove most of it.
Our implementation is not yet a production kernel. It computes the statistics of a complete response in one call. Computing them token by token during generation would need a split-KV decoding kernel, which is possible because the T1 accumulators merge associatively, but which we have not implemented. It supports neither sliding-window nor soft-capped attention, takes only a padding mask, and covers head dimensions 64, 128, and 256, so it does not yet serve an arbitrary model. Our wrapper also runs the prompt stage in the same layer call and copies both stage outputs into one tensor. This copy does not raise the peak of a whole forward (Appendix § 15) and is avoidable: since our statistics cover response rows only, the prompt can go through a separate prefill whose key–value cache the response stage reads, as serving systems do ([25]).
The proxy requires an auxiliary forward pass and labeled probe-training examples. A small proxy may miss evidence available to a larger generator. We assess support relative to supplied context, not general factual truth. Scores require separate calibration before interpretation as error probabilities. Dataset artifacts, label disagreements, truncation, and domain shift can affect results.
Ethical Considerations
Our work aims to make hallucination detection cheap enough to check every response of a retrieval-augmented system. Like any detector, it can miss unsupported answers or flag supported ones, so in high-stakes settings it should complement human review rather than replace it. All experiments use public benchmarks under their terms of use; we collect no new data and involve no human subjects.
Guide to the appendices
The appendices follow the order of the main text.
Related work. Appendix A.
Method (Sections 2–3). Definitions, tiers, and users of every statistic the kernels compute (Appendix B); proof of Lemma 1 and the accumulator’s merge and stability (Appendix C); pseudocode and kernel implementation (Appendix D).
Kernel benchmark (Section 4). Hardware, software, and timing protocol (Appendix E); numerical accuracy, Q1 (Appendix F); cost per tier and length scaling, Q2 (Appendix G); whole-model latency, Q3 and Figure 1 (Appendix H); memory (Appendix I); a per-layer comparison with dense attention on short inputs (Appendix J).
Proxy detection (Section 5). Datasets, HaluBench filtering, and text-only baselines (Appendix K); feature recipes, logit features, training and significance tests, full AUROC results, and LLM judges (Appendix L); extraction cost (Appendices H and I).
Additional experiment. Cross-domain transfer of attention detectors on HaluBench (Appendix M).
Judge prompts. The four prompt templates of the LLM judges (Appendix N).
Related Work
Online softmax, its associative merge, and its fusion with other reductions such as top- are established [15] (Milakov and Gimelshein 2018; Rabe and Staats 2021; Liu et al. 2024), and the separable row statistics of § 2.4 follow directly from it; recovering a weight from the stored LSE is how the FlashAttention backward pass recomputes attention [12]; and attending from a block of new queries to a cached prefix with a shifted causal mask is the key–value-cache append that serving systems and their kernels already support [25, 2] (Ye et al. 2025). Column sums of attention over past queries are the eviction scores of key–value-cache compression: HO sums over all past queries and SnapKV over an observation window [27] (Zhang et al. 2023). Similar fused kernels appear as implementation details elsewhere: an online entropy accumulator in FlashAttention for visual generation [8, 28], and a second key-major pass for column sums over a short query window in VL-Cache (Tu et al., 2025).
Several hallucination detectors read attention: Lookback Lens uses context-versus-answer attention ratios [10], LLM-Check studies internal signals of an auxiliary model (Sriramanan et al., 2024), SinkProbe probes attention-sink scores [5], TOHA uses graph structure in attention [4], and INTRYGUE gates predictive entropy by the sink rates of induction heads [24]. These methods motivate our feature families.
Outside hallucination detection, guard models such as WildGuard and Aegis2.0 moderate the responses of other models with 7–8B decoders [19, 17]. Our proxies follow the same setup for contextual hallucinations and read their own attention rather than generating a verdict.
Taken together, efficient-attention work fuses reductions into the pass to produce the attention output or to rank keys for eviction, while attention-based detectors read their statistics from the materialized attention matrix. We connect the two: we map detector statistics to exact paths that avoid the matrix, measure their cost, and use them in small proxy detectors.
Statistics computed by the kernels
Table 3 defines every statistic the response-stage kernels compute and the detectors that use it. Notation follows § 2 and § 2.3: a response row sees the keys , which are the prompt keys and the response keys minus padding; is the number of response keys it sees, including itself, and . The kernels return per-row or per-column statistics for each head; the host turns them into the features of the last column in or time per head, and a detector recipe reduces these over response rows and selected heads (Section 5.2). For the fixed sink we write for the per-row weight, for its column sum, and for the normalized sink rate. Qwen3 defines no beginning-of-sequence token; we call its first non-padded token, which opens the chat template, BOS.
Statistics only on response rows. Every statistic our detector reads is indexed by a response query row, and its column statistics sum over response rows only (Section 5.2). We therefore run the prompt stage with any production kernel and compute statistics only in the response stage. For most published features this changes nothing: the lookback ratio of Lookback Lens and the previous-token weight of RAUQ are defined on generated tokens ([10] (Vazhentsev et al. 2026)). Two features change. LLM-Check averages over all tokens ((Sriramanan et al., 2024)), and SinkProbe averages a key’s weight over all later tokens ([5]); we restrict both to response rows (Table 3). On long contexts this keeps the prompt from dominating both averages, but it is a different feature, and we have not compared the two versions in detection.
| Statistic | Definition (per head) | Tier | Shape | Kernel computation | Derived feature and use |
| Log-sum-exp | Base | after the last key tile, as in FlashAttention | none; normalizer reused by T2 and T3 | ||
| Entropy | T1 | with , | . Use: ours (A7) | ||
| Effective support | T1 | with , | Use: ours (A7) | ||
| Maximum weight | T1 | , no accumulator | Use: ours (A7) | ||
| Prompt mass | T1 | with , | lookback ratio. Use: Lookback Lens (Chuang et al., [10]) | ||
| Response mass | T1 | , derived; no extra state | lookback ratio. Use: Lookback Lens | ||
| Log-diagonal | T2 | mean over response rows. Use: LLM-Check (Sriramanan et al., 2024), adapted | |||
| Previous-token weight | T2 | Use: RAUQ (Vazhentsev et al., 2026) | |||
| Fixed-sink weight | for a fixed key , e.g. the first non-padded token (BOS) | T2 | ; the host sums it into | BOS sink rate . Use: ours (A7) | |
| Column sum | for every key | T3 | key-major rescoring with LSE | top- sink rate, A64. Use: SinkProbe (Binkowski et al., [5]), adapted; INTRYGUE (Kuleshova et al., [24]); ours (A64) |
Table 3. Statistics computed by the response-stage kernels. Tier: computation path (§ 2.3.1); Base: written by the statistics-off forward. Shape: kernel output per layer for one sequence, with query heads, response rows, keys, and fixed sink keys. is the T1 accumulator of Equation (3) for the given and after the last key tile, and the running sum of the online softmax. Derived features are defined in the text; “adapted”: restricted to response rows.
Features built from the statistics. Normalized entropy divides by , the entropy of uniform attention over the visible keys, so rows at different positions are comparable. The lookback ratio of Lookback Lens compares the mean weight per prompt key with the mean weight per response key ([10]):
The log-diagonal feature is the per-head mean , with each term clamped at . It is the attention score of LLM-Check ((Sriramanan et al., 2024)), the log-determinant of a head’s attention matrix, which for a causal, hence lower-triangular, matrix is the sum of over its rows. The previous-token feature is on each response row, set to zero on the first response row, which has no previous response token; RAUQ reads it on selected heads ((Vazhentsev et al., 2026)). Attention sinks are keys that receive a large share of attention regardless of content ((Xiao et al., 2024)); sink rates measure how much attention response rows put on a single key ([18]). Each column sum is divided by the number of response rows that see its key, , so is the mean weight on key . The BOS sink rate is for the first non-padded key , which T2 obtains without the full column sums when every sequence in the batch has the same padding; otherwise, and for any other sink definition, the kernels fall back to T3. The top- sink rate is the mean of the largest ( by default). SinkProbe uses the same per-key sink score, the mean weight a key receives from later tokens, and feeds the largest scores of every head to a probe ([5]). INTRYGUE gates the entropy of the next-token distribution, which comes from the logits rather than the attention, by the top-1 sink rates of induction heads, computed over response rows as here ([24]).
Not computed by our kernels. Stored attention maps, the attention-graph divergence MTopDiv ([4]), and row top- mass are computed from the materialized response block. Row top- mass needs state per row, which we keep out of the pass, so T1 does not contain every bounded-state reduction. Threshold counts and column entropy fit T3 but are not implemented.
Separable row reductions
Proof of Lemma 1. By induction over key tiles, Equation (4) keeps equal to Equation (3). After the last tile, , so
Thus each , and any fixed function of these values and the LSE, is available after the pass with the stated state and work. □
Merge and stability. Two accumulator states over disjoint key sets merge as
an associative operation that also permits keys to be split across kernel instances or devices (Liu et al., 2024; Feng et al., [15]; Ye et al., 2025). Since and , the rescaling factors in Equation (4) lie in , so no exponential overflows. The maximizing key contributes one, giving and .
Implementation
Statistics in the pass. The response-stage kernel applies the update of Equation (4) inside its loop, next to the FlashAttention update (Figure 2b). A response query tile stays resident while key/value tiles stream across it, and each score tile updates both the FlashAttention state and the statistic accumulators before the next tile is loaded; nothing is retained per key. Algorithm 1 gives the pseudocode for all three kernels.
Entropy uses the unshifted score rather than , since . Non-linearity alone is not the boundary of T1: remains separable. The maximum weight $1/\ell_i$ requires to be the exact running maximum; a kernel that defers rescaling when the maximum grows would have to track it separately. The state is $N_s
Algorithm 1 Attention with statistics: pseudocode for Figure 2b–Figure 2c. Black lines are the unchanged FlashAttention-2 forward (blue in Figure 2); green lines are our additions, tagged with their tier. Each kernel instance handles one query tile (or, in T3, one key tile ) of one head; , , hold one entry per query row. A key tile is visible to a query tile if some row of may attend to some key of ; the mask removes padded keys and, on tiles that cross the diagonal, future keys. , and is an optional set of fixed sink columns, whose weights the host sums over rows into . The LSE is part of the unchanged forward and belongs to no tier.
1: O<P ← CausalAttn(Q<P, K<P, V<P) ▷ any kernel
2: for each response query tile I ⊆ R do
3: m ← −∞, ℓ ← 0, O ← 0
4: Au ← 0 for u = 1, . . . , Ns T1
5: for each key tile J visible to I do
6: S ← τQIK⊤
J ; mask
7: m′ ← max(m, rowmax(S))
8: a ← e^{m−m′}; P̃ ← e^{S−m′}
9: Au ← a^{αu}Au + rowsum(P̃^{αu} ⊙ Gu)
10: O ← aO + P̃VJ; ℓ ← aℓ + rowsum(P̃)
11: m ← m′
12: end for
13: write O/ℓ and LSE ← m + log ℓ
14: write F^{(u)} from LSE, ℓ, Au/ℓ^{αu} T1
15: end for
16: for each response row i ∈ R do
17: log p_{ii} ← s_{ii} − LSE_i T2
18: p_{i,i−1} ← exp(s_{i,i−1} − LSE_i)
19: p_{is} ← exp(s_{is} − LSE_i) for s ∈ S
20: end for
21: for each key tile J do
22: c_J ← 0 T3
23: for each response query tile I that sees J do
24: W ← exp(τQIK⊤
J − LSE_I); mask
25: c_J ← c_J + colsum(W)
26: end for
27: write c_J
28: end for
numbers per row for scalar accumulators, independent of , and writing them for heads costs memory traffic.
Kernels and attention backend. A Hugging Face attention backend, installed only on the scored layers, splits each layer call into the two stages. The prompt stage calls the model’s original attention backend (in our runs, PyTorch SDPA with the FlashAttention-2 or cuDNN backend). The response stage is a Triton kernel ((Tillet et al., 2019)) derived from the FlashAttention-2 causal forward, with query rows, keys, and the causal mask shifted by ; it accumulates the T1 statistics and writes the LSE. T2 is a separate kernel that reads , , and the LSE. It does not depend on which T1 statistics are compiled into the response-stage kernel, it works after any forward kernel that writes the LSE, and its positions are runtime arguments, so any set of sink columns can be read without recompiling. T3 is a key-major kernel modeled on the FlashAttention-2 backward: column sums are its value-gradient step, for the attention weights and the output gradient , with replaced by a column of ones on response rows. Each kernel instance owns one key tile, visits the response query tiles that see it, and writes its column sums once, without atomic additions. All kernels support grouped-query attention, bf16/fp16/fp8-e5m2 inputs, head dimensions 64/128/256, and a key keep mask; statistic families are compile-time flags. The kernels do not support sliding-window or soft-capped attention, both elementwise changes to the mask and the scores; layers that use them run the model’s default attention without statistics.
Kernel benchmark setup
All timed runs use a single NVIDIA H100 NVL (Hopper, 94 GB, power-capped at 270 W; CUDA 12.9, PyTorch 2.11, Triton 3.6, cuDNN 9.17, Transformers 5.5) in bf16. The production baselines are PyTorch SDPA with the flash backend (FlashAttention-2) and the cuDNN backend; FlashAttention-3 is not installed, and cuDNN is the Hopper-specific baseline. Besides the Qwen3-8B shapes, uses the same head counts and uses 8/4 heads (Gemma-3 global layers). Kernel tiles are autotuned once per head dimension at , and reused for every shape. Timings are medians over 100 repetitions after 25 warm-up runs with an L2 flush (configuration sweep), 15–80 repetitions depending on length (length scaling), or 20 repetitions after 3 warm-ups (per-layer comparison, Appendix § 16). Appendix § 15 describes how we measure memory. Sink positions are resolved outside the timed region. The host is shared, but no other process ran on the measured GPU.
Dense baseline. Every comparison with materialized attention uses the path of detectors that read output_attentions: the attention weights of the response rows are computed as an fp32 softmax cast to bf16 and reduced in PyTorch.
Numerical accuracy (Q1)
Unit tests compare the kernels against a dense PyTorch reference across dtypes (including fp8e5m2), head dimensions, GQA ratios, padding masks, prompt/response splits, and statistic sets. Against an fp64 reference computed from the materialized matrix (row-chunked at 32K), we measure the absolute error on response rows of (i) the dense bf16 path (Appendix § 11) and (ii) our kernels (T1 in the pass, T2 lookups, T3 column sums over the response rows), on random Gaussian , , (response fraction 0.3) and on real , , from four Qwen3-8B layers (2, 16, 24, 34) on the longest input of the PHANTOM 20K set (Ji et al., [22]), its prompt truncated so that the input has 2K, 8K, or 32K tokens, with a response of at most 156 tokens. Random inputs give near-uniform attention and hide sinks and peaked heads; the real inputs do not.
The dense path rounds each probability to bf16 (8 bits of mantissa) before reducing, while the kernels reduce fp32 probabilities that never leave registers. The T2 lookups and T3 column sums reuse the stored LSE, so moving a statistic out of the pass costs time, not accuracy. Both paths rank heads by their per-head means over response rows as fp64 does, with Spearman correlation 1.000 for our kernels and at least 0.998 for the dense path. The entropy accumulator uses the unshifted score (Appendix § 10); its per-head mean error stays below even for heads with at 32K, where the dense error reaches .
Cost per tier and length scaling (Q2)
Notes on Table 5. Base runs the response rows on our kernel, which is faster than FlashAttention-2 on Hopper and slower than cuDNN, so as grows, Base gains on full FA2 and loses to full cuDNN. On the response stage alone, T3 takes 1.7–1.8 the time of Base at and 2.1–2.2 at ; the key-major T3 kernel does not spill registers, so this cost is the arithmetic of a second pass over the response block, not register pressure. Inputs of 4K tokens are excluded: a layer then takes 0.3–1.0 ms, and its ratios reflect the fixed host time per call (Appendix § 14).
Length scaling.
Figure 3b–Figure 3c times the same layer at 20 geometrically spaced lengths from 1K to 100K tokens, at (32 query heads, 8 KV heads, batch 1) and : full FlashAttention-2 and cuDNN without statistics, and the split layers Base, T2 (with a fixed BOS sink), and T3, with the prompt on cuDNN. From 15K to 100K tokens, each overhead stays within a band that does not grow with . At , T2 adds 3–14% over Base, T3 adds 32–47%, and Base takes 4–14% longer than cuDNN; at , the same overheads are −2 to +13%, 9–22%, and −2 to +8%. Below about 4K tokens, the split layer stays at 0.3–0.5 ms down to 1K tokens, against 0.04–0.07 ms for SDPA; this floor is host time per call (Appendix § 14).
Whole-model latency and extraction cost (Q3)
Setup of Figure 1. Figure 1 and the figures of this appendix time one forward of Qwen3-8B (all 32 heads of all 36 layers) and of Qwen3-0.6B (all 16 heads of all 28 layers) on PHANTOM and TRIVIA+ inputs. Our kernels compute the statistics underlying Lookback Lens, LLM-Check, RAUQ, INTRYGUE, and SinkProbe; the baseline is the same forward without features. Attention outside our kernels runs on SDPA with FlashAttention-2 for prompts up to 8K tokens and with its default cuDNN backend for longer ones, the same in both forwards; Q3 uses FlashAttention-2 throughout. Means are taken per length bin, and bins with fewer than 12 samples are omitted. Batch 1, H100 NVL, bf16.
Data for Q3. From RAGTruth QA, Q3 takes the 989 responses of Llama-2-70B-chat, median 0.5K and at most 1.0K tokens. From PHANTOM, it takes the split of the 10-K filings set that PHANTOM labels 2,000 tokens, with the answer-bearing passage in the middle: 980 samples with median 2.6K and at most 8.4K Qwen3 tokens. Token counts include the prompt template.
Dense baseline for Q3. Dense (Appendix § 11) takes each layer’s output from SDPA, then re-computes the attention weights of the response rows for all 32 heads at once, reduces them, and frees them before the next layer. Keeping every layer’s full weights from the forward, as output_attentions does, would take 152 GiB at 8.4K tokens, more than the GPU holds; Dense instead trades one recomputation of and the softmax per layer for the memory of one layer’s response block, weights. Taking the response output from the materialized weights instead would avoid scoring the response rows twice but add a product with .
Fixed host cost on short inputs. Figure 5 repeats Figure 1 without the 2K cut, with one panel per model. Below about 600 tokens for Qwen3-8B and 3K for Qwen3-0.6B, a forward with features takes the same time at every length: the features add a fixed 60 and 47 ms, about 1.7 ms per scored layer for both models, although a Qwen3-0.6B layer does a fraction of the work of a Qwen3-8B layer. This cost is host time, not GPU work (Table 6). For every scored layer, the wrapper runs Python code, launches 88 more kernels than the plain layer, most of them small element-wise operations that turn row statistics and column sums into features, and reads ten values back from the GPU: the prompt length, response length, and padding of the sample, twice; a check for padding in the prompt block; and three index lists for the selected heads. Each read stalls the host until the GPU queue drains. Under the Python profiler, launching our three kernels takes 0.8 ms per layer, assembling features another 0.8 ms, and copying the configuration of every scored layer to switch its attention backend 9 ms per forward. None of this grows with the input. The ten values could be computed once per forward, and capturing the scored layers in a CUDA graph would remove the launch cost. A split layer called on its own, as in Appendices § 13 and § 16, pays only its setup and the 19 kernel launches for all row statistics, about 0.3–0.6 ms of host time per call. The layer must return all rows, so it copies them into one output-sized tensor while both are still allocated. The attention matrix of the same layer would take 64 GiB at 32K.
| Per forward | Floor | Ours |
| Latency (ms) | 33 | 108 |
| GPU busy (ms) | 13 | 18 |
| GPU kernels | 2,005 | 5,173 |
| Host–device syncs | 1 | 361 |
Table 6. Where the time of a short forward goes: Qwen3-8B on five TRIVIA+ inputs of 90–253 tokens, all 36 layers scored, FlashAttention-2, H100 NVL. GPU busy is the summed device time of all kernels (PyTorch profiler); syncs are counted with PyTorch’s synchronization debug mode.
Figure 5. Figure Figure 1 at every length, for Qwen3-8B (left) and Qwen3-0.6B (right, all 16 heads of all 28 layers), with the overhead on a log scale. Dotted line: the 2K cut of Figure 1. Same inputs, backends, and binning; batch 1, H100 NVL, bf16.
Memory
Measurement. All memory numbers count PyTorch allocations: max_memory_allocated after reset_peak_memory_stats, minus the memory allocated before the measured call. They exclude memory that the caching allocator has reserved but not handed out, so nvidia-smi shows more. A buffer counts only if it is allocated at the moment of the peak. For one layer (Q2 and Appendix § 16), , , and are allocated before the call, so the extra peak is what the layer allocates: its output, the statistics, and temporary buffers. For a whole forward (Q3 and Figure 6), the weights and inputs are allocated before the call, so the extra peak covers activations and features but not the weights.
One attention layer (Q2). At 32K and , the extra peak of a layer is 520–532 MiB in every configuration, against 256 MiB for SDPA on the whole sequence, and 1.6 against 0.8 GiB at 100K. Our kernel allocates the statistic outputs even with statistics off, so Base has the same peak; the statistics take 7.6–20 MiB of it, 1.5–4%. Most of the difference from SDPA is the concatenation of the two stage outputs: the layer must return all rows, so it copies them into one output-sized tensor while both are still allocated. The attention matrix of the same layer would take 64 GiB at 32K.
Whole forward (Q3). The concatenated copy is freed within its layer and does not reach the peak of a whole forward. Over the floor, our extra peak grows by 26–32 KiB per response token and not with the prompt (least-squares fit on each dataset), whereas an output-sized copy at the peak would add 8 KiB per token of the sequence. The excess is mostly the extracted statistics, 22.5 KiB per response token for Qwen3-8B, which stay on the GPU until the forward returns. Dense holds the response block of one layer, weights, at a time (Appendix § 14). Ours adds at most 3.2% to the floor on PHANTOM, whose prompts all exceed 1.1K tokens, and 6% at the median and up to 17% on the short inputs of RAGTruth QA.
Longer inputs. Figure 6 extends the whole-forward measurement to 35K tokens, on the runs of Figure 1 (Appendix § 14). Without features, a forward peaks at 104.5 KiB per token above the weights for Qwen3-8B and 26.6 KiB for Qwen3-0.6B. Our features store 20 bytes per head, layer, and response token, the five per-token features in fp32 (22.5 and 8.75 KiB per response token), plus 1.0 and 0.5 MiB that the wrapper holds between forwards; the measured peak grows by about 28 and 11 KiB per response token (least-squares fit over these runs). On short inputs this is a larger share of a smaller forward, up to 14% for Qwen3-8B below 100 tokens.
Below about 1K tokens, the peaks of Qwen3-0.6B jump between levels at multiples of 128 tokens in both forwards. This matches the scratch buffer that FlashAttention-2 sizes by the number of query tokens when it splits a short input across more thread blocks: the plain forward attends with all queries and ours runs the prompt with , so near a step the two can land on different levels, by up to 31 MiB, independently of the features.
Reducing memory further. The concatenation is avoidable. If the prompt goes through a separate prefill, or its key–value cache is reused from generation, the response stage reads the cached keys and values and returns only its rows, so nothing is concatenated; the price is that the prompt cache stays allocated across all layers. The per-token features stay on the GPU until the forward returns; reducing them to per-head aggregates within each layer would make their memory independent of the response length. Finally, we compare with dense end to end only up to 8.4K tokens, where a dense pipeline still fits; a long-context end-to-end comparison is future work.
Per-layer comparison on short inputs
Q3 compares whole forwards; here we time a single attention layer with statistics, ours against dense materialization, on the short real inputs of Figure 4, and check that both give the same features.
We use the 989 RAGTruth QA inputs of Q3 (Appendix § 14; response fraction ), on which every method, including dense materialization, fits in memory. We capture , , of 48 samples (16 per length tercile) from 11 Qwen3-8B layers between layers 3 and 24 and time each method per layer call, for all 32 heads, at batch 1 and at batch 8 with padding and a keep mask. Dense materializes the attention matrix for all heads at once (Appendix § 11); Dense-loop does the same one head at a time, as the dense fallback of our pipeline does by default; Ours is our split layer (prompt rows on SDPA, response rows on our kernels). Every method obtains the attention output from the same PyTorch SDPA call and computes, on response rows only, the T1 and T2 statistics (entropy group, prompt mass, BOS sink, diagonal, previous token) and the full T3 column sums, from which the sink values of are read.
Latency and memory. At these lengths both methods are bound by host time, not GPU work: profiling a 1K-token layer with all row statistics shows 0.62 ms of host time to enqueue 19 kernels that together run for 0.10 ms on the GPU, against 0.06 ms for one cuDNN call. Dense is therefore slightly faster than ours at batch 1, with a median of 1.19 against 1.26 ms per layer call (ours/Dense = 1.04–1.09 in every length tercile), and batching amortizes the host time (Appendix § 14), so ours is faster at batch 8, 4.71 against 7.60 ms. Dense-loop takes 35.9 ms at batch 1; most of this gap is its loop overheads, not materialization, so we use batched Dense as the dense baseline. The extra peak memory (Appendix § 15) of a layer call is 14 MiB for ours against 116 MiB for Dense at batch 1, and 136 MiB against 1.4 GiB at batch 8. Appendix § 13 gives the dependence on .
Feature agreement. Ours differs from Dense by a mean relative 0.04% (the log-diagonal feature of LLM-Check, Appendix § 8) to 1.6% (previous-token weight). The largest absolute difference, 6.8, is on effective support (typical values ); against fp64, the mean error of effective support is 5.3 for Dense and 5.9e−3 for ours (Table 4).
Data
Table 7 gives the splits of the three benchmarks of § 4.
| Dataset | Train | Val | Test | Hal. | Grp. |
| RAGTruth QA | 3921 | 971 | 875 | 160 | 150 |
| HaluBench | 4206 | 898 | 904 | 409 | 546 |
| TRIVIA+ | 2263 | 316 | 645 | 224 | 358 |
Table 7. Splits used in Section 5. Hal.: hallucinated test answers; Grp.: test groups for the bootstrap.
RAGTruth QA (Niu et al., 2024): the question-answering subset, with the answers of quality good from all six generators. We keep the official test split and divide the training answers 80/20 by query into training and validation (seed 42); groups are queries.
HaluBench (Ravi et al., 2024): 14,900 answers from six sources: HaluEval (10,000); DROP, CovidQA, PubMedQA, and FinanceBench (1,000 each); and RAGTruth (900). We filter and split it ourselves (below); the transfer experiment of Appendix M uses the same split.
TRIVIA+ (Chen et al., [9]): the original training, validation, and test splits; groups are normalized source articles.
Within each dataset, every feature set and proxy uses the same training, validation, and test examples, and groups never cross splits. The datasets may overlap with each other, which does not matter here because no detector is applied across datasets.
HaluBench filtering and splitting. In HaluEval, faithful answers are mostly short entity names and hallucinated ones long sentences, so the answer length in words alone reaches an AUROC of 0.970 on its 10,000 answers and 0.720 on all 14,900. We therefore subsample HaluEval to equally many faithful and hallucinated answers at every answer length in words, which keeps 1,108 of its answers and 6,008 in total; after this, length gives an AUROC of 0.500 on HaluEval and 0.586 overall, where shorter answers are slightly more often hallucinated. We then group near-duplicate contexts within each source: two contexts are linked if at least 30% of the word 5-grams of the shorter one occur in the other, and two FinanceBench filings also if their word sets have a Jaccard similarity of at least 0.6 or they share at least six numbers of four or more digits other than years. Groups are the connected components of these links; whole groups are assigned to splits to approach 70/15/15% within every source and label (seed 42), and they are the units of the bootstrap.
Text-only baselines. To measure how much of each label the answer text reveals without the context, we score the test answers by their length and by a TF–IDF classifier on the answer alone (word unigrams and bigrams, the logistic regression of
| RAGTruth | HaluBench | |||
| Baseline | QA | TRIVIA+ | filtered | unfiltered |
| AUROC | ||||
| Words | .702 | .574 | .580 | .727 |
| Characters | .720 | .598 | .568 | .725 |
| TF–IDF | .726 | .658 | .663 | .842 |
| F1 | ||||
| Words | .408 | .515 | .631 | .781 |
| Characters | .426 | .515 | .628 | .785 |
| TF–IDF | .390 | .529 | .642 | .755 |
Table 8. Text-only baselines on the test splits of Table 7: answer length in words or characters, and TF–IDF of the answer alone. The last column uses a split of HaluBench built the same way without the length filtering (2,231 test answers, 1,075 hallucinated). The 95% group-bootstrap intervals of AUROC are at most ±0.05.
Section 5.3, with regularization and threshold chosen on validation); Table 8 gives the results. On unfiltered HaluBench, TF–IDF on the answer alone reaches 0.842 AUROC: much of the label can be predicted without the context, so the unfiltered benchmark is too easy a test of contextual hallucination detection. Compared with Table 10, every proxy detector beats the text-only baselines on RAGTruth QA, where hallucinated answers are longer; on HaluBench and TRIVIA+, alone stays within 0.04 of TF–IDF, whereas and every set with hidden states exceed it by more than 0.1.
Proxy detection: details
Feature recipes
We format each input using the proxy model’s native chat template, retain the full context, question, and answer without truncation, and run inference with thinking mode disabled. We selected the feature subsets for and and the pooling and dimensionality reduction settings for once, independently for each block, using grouped five-fold cross-validation on the TRIVIA+ training split with Qwen3-4B. Because the benchmarks can share source questions and contexts, we first excluded 61 TRIVIA+ training groups containing examples whose parts exactly matched the corresponding field of a test example in another benchmark. This left 2,079 training examples for the search and avoided using overlapping test content to select subsequently evaluated configurations. For each block, we chose the variant with the highest mean AUROC across the five folds, breaking ties in favor of fewer features, simpler representations, and smaller . These feature definitions and preprocessing choices are then reused across all other datasets and proxy models without repeating the selection.
Cheap attention features (). The heads of each proxy are ranked once by their induction score, without hallucination labels, and reads the first heads of this ranking.
The induction score of a head is its mean attention weight from each token of a repeated sequence to the token that followed its first occurrence, the weight an induction head puts on the token it copies (Olsson et al., 2022), averaged over 128 sequences (seed 42), each a beginning-of-sequence token followed by 64 random tokens twice. The ranking is a one-time preparation step and is not part of the measured extraction time.
The 22 candidate features of Section 5.2, each averaged over the selected heads, were searched with by recursive elimination of one feature at a time. The seven kept features defined in Appendix B are the maximum weight (mean, standard deviation, and maximum over answer tokens), effective support (minimum), entropy normalized by (mean and standard deviation), and the BOS sink rate. BOS is typically the top-1 sink of the selected heads.
Validation selects , 16, 32, and 16 on RAGTruth QA for the 0.6B, 1.7B, 4B, and 8B proxies correspondingly, and on HaluBench with every proxy and on TRIVIA+ except with 8B ().
All-head sink values (). For each head, we divide each column sum by the number of answer rows that see its key, , and keep its largest values in descending order, without their positions. Concatenated over all heads and layers, standardized, and projected onto 64 principal components, they form . The number is chosen jointly with a provisional regularization of alone by five-fold grouped cross-validation on the training split, with the scaler and projection refit in every fold; the chosen is 1–4, except 9 for TRIVIA+ with 1.7B. keeps that and reuses the projection of ; the final regularization and threshold of and are chosen on validation as for every other set.
Compact hidden states (). The block takes decoder layer 14 for 0.6B and 1.7B and layer 18 for 4B and 8B (counting from 1; hidden sizes 1024, 2048, 2560, and 4096), concatenates the per-coordinate mean and population standard deviation over answer tokens, standardizes them, projects them onto the first 64 components of a randomized PCA, and standardizes again; the scalers and the PCA are fit on the training split of each dataset and proxy. The selection compared three poolings (mean; mean and standard deviation; mean, standard deviation, minimum, and maximum) with 16, 32, 64, 128, 256, or 512 principal components or no projection. The layer itself is not selected: following prior work on hidden-state hallucination signals [3, 7], we take a middle layer.
Logit features
The 224 candidate features, the four pooled features of each statistic of Table 9, were searched by recursive feature elimination as for . The block keeps the standard deviation and minimum of the Zipf slope, the minimum Jensen–Shannon divergence, the mean and minimum answer-token probability, the minimum of the fourth-largest probability, and the maxima of the 7th, 10th, and 49th largest, 9 in total.
| Statistic | Definition (per answer token ) | Shape |
| Answer-token probability | ||
| Answer-token rank | ||
| Top- probabilities | for each rank | |
| Entropy | ||
| Effective vocabulary size | ||
| Zipf slope | least-squares slope of against , | |
| Jensen–Shannon divergence | between consecutive positions; of the first answer token is the last prompt position |
Table 9. Logit statistics computed per answer token from the proxy’s next-token distribution. Shape: output for one sequence with answer tokens.
Logit features
The logit block reads the proxy’s output logits in the same forward as the attention statistics. A hook on the final normalized hidden states applies the language-model head only at the positions that predict answer tokens, plus the one before them, so the full vocabulary distribution is never formed for the prompt. Let be the next-token distribution at the position that predicts answer token , the vocabulary, and the -th largest probability of . Table 9 defines the seven per-token statistics. Their mean, standard deviation, minimum, and maximum over the answer tokens, taken for the top- probabilities separately at each rank , are the 224 candidate features of Appendix L.1.
Training and significance tests
The regression uses liblinear with balanced class weights. For each dataset, proxy, and feature set, is chosen by validation AUROC and the threshold by validation F1, with ties broken toward smaller and and, for the threshold, toward the higher one (Section 5.3). Models are not refit on training and validation data together. To test an addition of an attention block, we draw 100,000 paired bootstrap resamples of test groups (Table 7; seed 42), keeping models, regularization, and thresholds fixed. The two-sided -value of an observed difference is the share of centered bootstrap differences at least as large in absolute value, with , and we Holm-correct these -values over the 12 dataset–proxy pairs of each addition. With only 150–546 test groups, the intervals are wide, so only large gains stay significant. Table 11 tests each addition of , and Table 12 tests .
Full results
Table 10 gives the test AUROC of every detector of Table 2. Table 11 and Table 12 test the additions of and (Appendix § 18.§ 2.3); bold marks the gains that stay significant after correction over the 12 pairs of an addition. The significant gains fall where each block helps most, and no tested addition significantly lowers F1.
LLM judges
We follow a typical protocol for LLM judges. Each judge receives the context, question, and candidate answer using one of the four prompt templates in Appendix § 20. With thinking disabled, it produces one token, restricted to True (hallucinated) or False (supported). We use the probability assigned to True as the hallucination score. The templates contain either no demonstrations or eight labeled demonstrations. For each of the nine judges, we select the template using the three training splits combined and select the decision threshold by validation F1, as for the proxy detectors.
The four Qwen3 proxy models are prompted as judges with each template, and scored like the judges. For each model we keep the template with the best mean validation AUROC (Strict few-shot for 4B and 8B, Claims for 0.6B and 1.7B). Bespoke-MiniCheck-7B (Tang et al. (2024)) and HHEM-2.1-Open (Li et al. [26]) estimate the probability that a premise supports a claim. We use one minus this probability as the hallucination score. MiniCheck splits long premises into chunks and keeps the highest support, and we do the same for HHEM above 8,192 tokens. MiniCheck is trained on ANLI and synthetic data; the training data of HHEM is not disclosed.
The nine judges are Qwen3.5-9B (Qwen Team (2026)), Gemma-4-E4B (Gemma Team [16]), Granite-4.2-8B (IBM Granite Team [21]), Ministral-3-8B (Liu et al. [29]), Falcon-H1-7B (Zuo et al. (2025)), Llama-3.1-8B (Dubey et al. [14]), GLM-4-9B (Team GLM (2024)), Phi-4-mini (Abouelining et al. (2025)), and Command-R7B (Cohere Labs [11]). We report results for them in Table 13.
Cross-domain transfer on HaluBench
§ 4 fits and tests each detector within one dataset. Attention detectors that use few or no labels, however, are meant to work on domains they were not tuned on. We test whether they do across the six sources of HaluBench, with five published detectors: Lookback Lens, LLM-Check, RAUQ, and INTRYGUE, whose statistics our kernels compute (Table 3), and TOHA, which needs the materialized response block, plus the sink-rate term of INTRYGUE alone.
Protocol. Qwen3-8B reads the context, question, and existing answer of every example in our filtered HaluBench split (Appendix § 17), teacher-forced with its chat template and thinking off. One forward extracts the features of all methods, with our kernels for the statistics of Table 3 and the materialized response block for TOHA (T4); we then fit and test them on CPU. Each of the six sources has 138–166 test examples. RAUQ needs no labels (Vazhentsev et al., 2026). INTRYGUE [24], its sink-rate term alone, TOHA [4], LLM-Check (Sriramanan et al., 2024), and our variant of Lookback Lens, which averages the lookback ratios of at most 10 heads instead of training a probe on all heads [10], choose one setting by AUROC on the validation split of the fitting sources, about 150 labels per source: the number of induction heads, the layer, or the heads.
Each method is fit on one source and tested on all six, fit on the five sources other than the test domain (leave-one-source-out), and fit on all six. Table 14 gives the test AUROC of every setting; 95% bootstrap intervals use 1,000 resamples of individual test examples rather than of the context groups used in § 4, so they are somewhat narrower than group intervals would be.
| Fit on | Method | RAGTruth | CovidQA | PubMedQA | FinanceBench | DROP | HaluEval | Mean |
| RAUQ (no fitting) | .58 | .67 | .66 | .52 | .66 | .85 | .66 | |
| RAGTruth | INTRYGUE | .89 | .77 | .55 | .48 | .41 | .92 | .62 |
| RAGTruth | Sink rate | .80 | .72 | .53 | .49 | .56 | .91 | .64 |
| RAGTruth | LLM-Check | .59 | .58 | .62 | .53 | .53 | .75 | .60 |
| RAGTruth | TOHA | .68 | .59 | .44 | .46 | .61 | .80 | .58 |
| RAGTruth | Lookback Lens | .88 | .56 | .47 | .51 | .49 | .73 | .55 |
| CovidQA | INTRYGUE | .89 | .77 | .55 | .48 | .41 | .92 | .65 |
| CovidQA | Sink rate | .51 | .62 | .52 | .44 | .55 | .78 | .56 |
| CovidQA | LLM-Check | .44 | .55 | .61 | .45 | .56 | .59 | .53 |
| CovidQA | TOHA | .68 | .59 | .44 | .46 | .61 | .80 | .60 |
| CovidQA | Lookback Lens | .31 | .65 | .40 | .47 | .53 | .57 | .45 |
| PubMedQA | INTRYGUE | .89 | .75 | .55 | .47 | .40 | .92 | .69 |
| PubMedQA | Sink rate | .51 | .62 | .52 | .44 | .54 | .82 | .59 |
| PubMedQA | LLM-Check | .65 | .60 | .68 | .44 | .59 | .71 | .60 |
| PubMedQA | TOHA | .39 | .59 | .50 | .53 | .51 | .43 | .49 |
| PubMedQA | Lookback Lens | .80 | .40 | .53 | .52 | .50 | .48 | .54 |
| FinanceBench | INTRYGUE | .82 | .70 | .54 | .47 | .38 | .86 | .66 |
| FinanceBench | Sink rate | .51 | .62 | .52 | .44 | .54 | .82 | .60 |
| FinanceBench | LLM-Check | .42 | .61 | .49 | .45 | .56 | .78 | .57 |
| FinanceBench | TOHA | .68 | .54 | .44 | .48 | .57 | .55 | .55 |
| FinanceBench | Lookback Lens | .68 | .45 | .41 | .51 | .54 | .37 | .49 |
| DROP | INTRYGUE | .82 | .70 | .54 | .47 | .39 | .87 | .68 |
| DROP | Sink rate | .72 | .68 | .54 | .44 | .56 | .86 | .65 |
| DROP | LLM-Check | .44 | .63 | .45 | .47 | .58 | .81 | .56 |
| DROP | TOHA | .66 | .52 | .41 | .49 | .61 | .59 | .54 |
| DROP | Lookback Lens | .66 | .40 | .37 | .53 | .58 | .41 | .47 |
| HaluEval | INTRYGUE | .89 | .75 | .55 | .47 | .40 | .92 | .61 |
| HaluEval | Sink rate | .73 | .74 | .51 | .49 | .56 | .93 | .61 |
| HaluEval | LLM-Check | .59 | .63 | .50 | .46 | .57 | .88 | .55 |
| HaluEval | TOHA | .68 | .59 | .44 | .46 | .60 | .81 | .56 |
| HaluEval | Lookback Lens | .79 | .52 | .39 | .52 | .42 | .82 | .53 |
| Other five | INTRYGUE | .89 | .77 | .55 | .48 | .41 | .92 | .67 |
| Other five | Sink rate | .80 | .72 | .53 | .49 | .56 | .91 | .67 |
| Other five | LLM-Check | .59 | .63 | .45 | .46 | .56 | .71 | .57 |
| Other five | TOHA | .68 | .59 | .44 | .46 | .60 | .55 | .55 |
| Other five | Lookback Lens | .71 | .54 | .40 | .47 | .53 | .52 | .53 |
| All six | INTRYGUE | .89 | .77 | .55 | .48 | .41 | .92 | .67 |
| All six | Sink rate | .80 | .72 | .53 | .49 | .56 | .91 | .67 |
| All six | LLM-Check | .59 | .63 | .50 | .46 | .57 | .88 | .60 |
| All six | TOHA | .68 | .59 | .44 | .46 | .60 | .81 | .60 |
| All six | Lookback Lens | .36 | .54 | .40 | .52 | .60 | .48 | .48 |
Table 14. Cross-domain transfer on HaluBench (Qwen3-8B reader): test AUROC of each method fit on the source of its row group and tested on each source. Shaded: same source. Other five: fit on the five sources other than the test domain (leave-one-source-out); All six: fit on all six sources (pooled). Mean: over the five other test domains for a single fitting source, over all six for the last two groups. RAUQ fits nothing and scores the same for every fitting source. Bold: best method of the group in each column (ties marked alike). Each test domain has 138–166 examples; the 95% bootstrap intervals span at the median ( to ).
Results. RAUQ and INTRYGUE transfer; detectors that select heads or a layer on one source do not. Averaged over the six fitting sources, RAUQ and INTRYGUE lose at most 0.01 AUROC from the fitting source to the other five, and the sink rate 0.04, whereas LLM-Check loses 0.05, TOHA 0.06, and Lookback Lens 0.15, which falls to chance (0.51). Fitting on more sources does not help much, since each detector still selects only one setting. Two domains defeat every method: a fixed-direction score cannot adapt where its direction reverses, so INTRYGUE stays at 0.38–0.41 on DROP from every source, and no method exceeds 0.53 on FinanceBench.
LLM judge prompts
Each judge of Table 13 reads one of the four templates below, given verbatim. ### system and ### user open the system and user messages of the judge’s chat template; {context}, {question}, and {response} are filled with the example. Every template asks for the verdict True (hallucinated) or False (supported).
Evidence (Gemma-4-E4B, Command-R7B).
### user
You are assessing a candidate answer to a question.
You are given the question, reference evidence,
and one candidate answer.
# Question
{question}
# Reference evidence
{context}
# Candidate answer
{response}
Definition. A hallucinated answer contains
information that is incorrect, fabricated, or
not supported by the evidence: for example, it
misreads the question, reverses a finding,
invents a mechanism, or adds specifics absent
from the source. A supported answer is fully
consistent with the evidence.
Is the candidate answer hallucinated? Answer with
exactly one word: True if it is hallucinated or
unsupported, False if it is fully supported.
Claims (Phi-4-mini).
### system
You check model responses against a source
document. Use only the document, never outside
knowledge. A response passes only if every
factual claim in it is stated in, or directly
entailed by, the document. Any invented,
altered, or unverifiable detail makes it fail,
even if the rest is correct. Leaving
information out does not make it fail.
### user
Document:
"""
{context}
"""
Request: {question}
Response:
"""
{response}
"""
Does the response contain any claim that the
document does not support? Answer True (it
does, the response is hallucinated) or False
(every claim is supported).
Strict (Granite-4.2-8B, Ministral-3-8B, Llama-3.1-8B) is Strict few-shot without its block of examples, from Examples: up to Output format:.
Strict few-shot (Qwen3.5-9B, Falcon-H1-7B, GLM-4-9B). The prompt contains eight author-written illustrative examples: four hallucinated and four faithful.
### system
You are an expert evaluator specialized in
detecting hallucinations. Use only the CONTEXT,
never outside knowledge.
Your task is to determine whether the RESPONSE
contains any information that the CONTEXT does
not support, or answers the QUESTION
incorrectly according to the CONTEXT.
A response is faithful only if every factual claim
in it is stated in, or directly entailed by,
the context. Any invented, altered, or
unverifiable detail makes it hallucinated, even
if the rest of the response is correct.
True means HALLUCINATED:
- At least one claim is not stated in or entailed
by the context, including plausible but
unstated details and claims more specific than
the context allows.
- The response invents or alters entities, numbers,
dates, policies, events, or relationships.
- The response gives a number, name, or date that
differs from what the context implies for this
question, including wrong counting or
arithmetic over values in the context.
- The response answers a different question than
the one asked (wrong entity, team, period, or
unit).
- The response refuses to answer although the
context clearly contains the answer.
False means FAITHFUL:
- Every factual claim is supported by the context
and the response correctly answers the
question.
- The response declines to answer because the
context does not contain the required
information; such a refusal is faithful.
Important rules:
- One unsupported or incorrect claim is enough to
mark the response as hallucinated.
- Leaving information out is not a hallucination.
- A plausible or well-known fact is still
hallucinated if the context does not support
it.
- For short answers, recompute or re-locate the
answer in the context and compare exactly.
Examples:
<context>The museum opened in 1998 and has three
floors of galleries.</context><question>
When did the museum open?</question>
<response>The museum opened in 1998 and attracts
over a million visitors a year.</response>
Answer: True
(The visitor number is not in the context: an added
unsupported detail.)
<context>In the first half the Hawks scored 14
points and the Owls scored 10. In the second
half the Hawks scored 7 and the Owls scored
21.</context><question>How many points did the Owls score in
total?</question>
<response>24</response>
Answer: True
(10 + 21 = 31: wrong arithmetic over the context.)
<context>Maria Lopez founded the company in 2004.
Her brother Diego joined as CFO in
2010.</context><question>Who founded the company?</question>
<response>Diego Lopez founded the
company.</response>
Answer: True
(The response names the wrong person, contradicting
the context.)
<context>The trial found that the drug lowered
blood pressure in 62% of patients but had no
effect on heart rate.</context><question>What effect did the drug have on heart
rate?</question>
<response>The drug noticeably slowed patients'
↪ heart rate.</response>
Answer: True
(The context says there was no effect: the response
↪ reverses the finding.)
<context>The bridge, completed in 1932, spans 503
↪ meters and carries both trains and
↪ cars.</context>
<question>How long is the bridge?</question>
<response>It is about half a kilometer long, 503
↪ meters.</response>
Answer: False
(A faithful paraphrase with an equivalent unit.)
<context>The library offers free Wi-Fi, study
↪ rooms, a children's section, and a
↪ cafe.</context>
<question>What services does the library
↪ offer?</question>
<response>The library has free Wi-Fi and study
↪ rooms.</response>
Answer: False
(Incomplete but every stated claim is supported;
↪ omissions are not hallucinations.)
<context>The report covers the company's sales in
↪ Europe for 2021.</context>
<question>What were the company's sales in Asia in
↪ 2021?</question>
<response>The context does not contain information
↪ about sales in Asia.</response>
Answer: False
(A correct refusal: the answer is not in the
↪ context.)
<context>Team A won 3 games in March and 5 games in
↪ April.</context>
<question>How many games did Team A win in March
↪ and April combined?</question>
<response>8</response>
Answer: False
(3 + 5 = 8: correctly derived from the context.)
Output format:
- Reply with exactly one word: True or False.
- True = the response is hallucinated; False = the
↪ response is faithful.
- Do not write any explanation, punctuation,
↪ quotes, tags, or other text before or after the
↪ word.
### user
<context>
{context}
</context>
<question>
{question}
</question>
<response>
{response}
</response>
Answer:
Use of scientific artifacts
Table Table 15 lists the licences of the datasets and models we use. We use all of them for non-commercial research, consistent with their terms, and redistribute none of them; this matters for the non-commercial licences and for TRIVIA+, whose licence forbids derivatives. Our anonymized code is released under the MIT licence.
| Artifact | Use | Licence |
| RAGTruth | detection | MIT |
| HaluBench | detection | CC BY-NC 2.0 |
| TRIVIA+ | detection | CC BY-NC-ND 4.0 |
| PHANTOM | kernels | Apache 2.0 |
| Qwen3 0.6B–8B | proxy, judge | Apache 2.0 |
| Qwen3.5-9B | judge | Apache 2.0 |
| Gemma-4-E4B | judge | Apache 2.0 |
| Granite-4.2-8B | judge | Apache 2.0 |
| Ministral-3-8B | judge | Apache 2.0 |
| Phi-4-mini | judge | MIT |
| Llama-3.1-8B | judge | Llama 3.1 License |
| Falcon-H1-7B | judge | Falcon LLM |
| GLM-4-9B | judge | GLM-4 |
| Command-R7B | judge | CC BY-NC 4.0 |
| Bespoke-MiniCheck-7B | checker | CC BY-NC 4.0 |
| HHEM-2.1-Open | checker | Apache 2.0 |
Table 15. Licences of the artifacts we use, as stated by their releases; Falcon LLM and GLM-4 are the custom licences of these models. Detection: § 4; kernels: § 3; judges and grounding checkers (checker): Appendix § 18.§ 4, where the models are cited.
AI assistants were used to proofread and refine the text for clarity.
References
- [2]Amey Agrawal, Nitin Kedia, Ashish Panwar, Jayshree Mohan, Nipun Kwatra, Bhargav S. Gulavani, Alexey Tumanov, and Ramachandran Ramjee. 2024. Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI 24), pages 117–134.arxiv.org/abs/2403.02310
- [3]Amos Azaria and Tom Mitchell. 2023. The Internal State of an LLM Knows When It’s Lying. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 967–976.arxiv.org/abs/2304.13734
- [4]Alexandra Bazarova, Andrei Volodichev, Aleksandr Yugay, Andrey Shulga, Alina Ermilova, Konstantin Polev, Julia Belikova, Rauf Parchiev, Dmitry Simakov, Maxim Savchenko, Andrey Savchenko, Serguei Barannikov, and Alexey Zaytsev. 2026. Hallucination Detection in LLMs with Topological Divergence on Attention Graphs. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 15449–15470.
- [5]Jakub Binkowski, Kamil Adamczewski, and Tomasz Jan Kajdanowicz. 2026. Attention Sinks as Internal Signals for Hallucination Detection in Large Language Models. In Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research, pages 8302–8319.arxiv.org/abs/2604.10697
- [6]Sky CH-Wang, Benjamin Van Durme, Jason Eisner, and Chris Kedzie. 2024. Do Androids Know They’re Only Dreaming of Electric Sheep? In Findings of the Association for Computational Linguistics: ACL 2024, pages 4401–4420.arxiv.org/abs/2312.17249
- [7]Chao Chen, Kai Liu, Ze Chen, Yi Gu, Yue Wu, Mingyuan Tao, Zhihan Fu, and Jieping Ye. 2024. INSIDE: LLMs’ Internal States Retain the Power of Hallucination Detection. In The Twelfth International Conference on Learning Representations, pages 3056–3076.arxiv.org/abs/2402.03744
- [8]Jiayu Chen, Ruoyu Lin, Zihao Zheng, Jingxin Li, Maoliang Li, Guojie Luo, and Xiang Chen. 2026a. ToProVAR: Efficient Visual Autoregressive Modeling via Tri-Dimensional Entropy-Aware Semantic Analysis and Sparsity Optimization. In The Fourteenth International Conference on Learning Representations.arxiv.org/abs/2602.22948
- [9]Wenbo Chen, Veena Padmanabhan, Tooti ya Giyahchi, Elaine Wong, and Leman Akoglu. 2026b. Rethinking Evaluation for LLM Hallucination Detection: A Desiderata, A New RAG-based Benchmark, New Insights. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 14912–14931.
- [10]Yung-Sung Chuang, Linlu Qiu, Cheng-Yu Hsieh, Ranjay Krishna, Yoon Kim, and James R. Glass. 2024. Lookback Lens: Detecting and Mitigating Contextual Hallucinations in Large Language Models Using Only Attention Maps. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 1419–1436.
- [11]Cohere Labs. 2024. Command R7B.
- [12]Tri Dao. 2024. FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning. In The Twelfth International Conference on Learning Representations, pages 35549–35562.arxiv.org/abs/2307.08691
- [13]Tri Dao, Daniel Y. Fu, Stefano Ermon, Artri Rudra, and Christopher Ré. 2022. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness. In Advances in Neural Information Processing Systems, volume 35, pages 16344–16359.arxiv.org/abs/2205.14135
- [14]Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, et al. 2024. The Llama 3 Herd of Models. arXiv preprint arXiv:2407.21783.arxiv.org/abs/2407.21783
- [15]Leo Feng, Frederick Tung, Hossein Hajimirsadeghi, Mohamed Osama Ahmed, Yoshua Bengio, and Greg Mori. 2024. Attention as an RNN. arXiv preprint arXiv:2405.13956.arxiv.org/abs/2405.13956
- [16]Gemma Team. 2026. Gemma 4 Technical Report. arXiv preprint arXiv:2607.02770.
- [17]Shaona Ghosh, Prasoon Varshney, Makesh Narsimhan Sreedhar, Aishwarya Padmakumar, Traian Rebedea, Jibin Rajan Varghese, and Christopher Parisien. 2025. AEGIS2.0: A diverse AI safety dataset and risks taxonomy for alignment of LLM guardrails. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 5992–6026.
- [18]Xiangming Gu, Tianyu Pang, Chao Du, Qian Liu, Fengzhuo Zhang, Cunxiao Du, Ye Wang, and Min Lin. 2025. When Attention Sink Emerges in Language Models: An Empirical View. In The Thirteenth International Conference on Learning Representations.arxiv.org/abs/2410.10781
- [19]Seungju Han, Kavel Rao, Allyson Ettinger, Liwei Jiang, Bill Yuchen Lin, Nathan Lambert, Yejin Choi, and Nouha Dziri. 2024. WildGuard: Open one-stop moderation tools for safety risks, jailbreaks, and refusals of LLMs. In Advances in Neural Information Processing Systems, volume 37, pages 8093–8131.arxiv.org/abs/2406.18495
- [20]Kevin David Hayes, Arka Pal, Haosong Zhang, Tom Goldstein, and Micah Goldblum. 2026. Pinocchio: Fast Uncertainty Estimates for Black-Box Language Models. In Third Conference on Language Modeling.arxiv.org/abs/2609.24881
- [21]IBM Granite Team. 2026. Granite-4.2-8B.
- [22]Lanlan Ji, Dominic Seyler, Gunkirat Kaur, Manjunath Hegde, Koustuv Dasgupta, and Bing Xiang. 2025. PHANTOM: A Benchmark for Hallucination Detection in Financial Long-Context QA. In Advances in Neural Information Processing Systems, volume 38, pages 140939–140968.DOI
- [23]Sanyam Kapoor, Nate Gruver, Manley Roberts, Katherine Collins, Arka Pal, Umang Bhatt, Adrian Weller, Samuel Dooley, Micah Goldblum, and Andrew Gordon Wilson. 2024. Large Language Models Must Be Taught to Know What They Don’t Know. In Advances in Neural Information Processing Systems, volume 37.arxiv.org/abs/2406.08391
- [24]Alexandra Kuleshova, Andrei Volodichev, Daria Kotova, and Alexey Zaytsev. 2026. INTR YGUE: Induction-Aware Entropy Gating for Reliable RAG Uncertainty Estimation. arXiv preprint arXiv:2603.21607. Version 3, 31 August 2026. Accepted to EMNLP 2026 (Main).arxiv.org/abs/2603.21607
- [25]Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient Memory Management for Large Language Model Serving with PageAttention. In Proceedings of the 29th Symposium on Operating Systems Principles, pages 611–626.arxiv.org/abs/2309.06180
- [26]Miaoran Li, Rogger Luo, and Ofer Mendelevitch. 2024a. HHEM-2.1-Open.
- [27]Yuhong Li, Yingbing Huang, Bowen Yang, Bharat Venkitesh, Acyr Locatelli, Hanchen Ye, Tianle Cai, Patrick Lewis, and Deming Chen. 2024b. SnapKV: LLM Knows What You are Looking for Before Generation. In Advances in Neural Information Processing Systems, volume 37, pages 22947–22970.arxiv.org/abs/2404.14469
- [28]Cheng Liang, Haoxian Chen, Liang Hou, Qi Fan, Gangshan Wu, Xin Tao, and Limin Wang. 2026. VMonarch: Efficient Video Diffusion Transformers with Structured Attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4613–4623.arxiv.org/abs/2601.22275
- [29]Alexander H. Liu, Kartik Khandelwal, Sandeep Subramanian, et al. 2026. Ministral 3. arXiv preprint arXiv:2601.08584.arxiv.org/abs/2601.08584





