arXiv:2610.19996cs.CLOct 2026

Manuscript Offprint

arXiv:2610.19996

Gray-Box Hallucination Detection in LLMs with Token Identities

Shaked Goldshtein, Yitzchak Grunbaum, Fabrizio Frasca, Guy Bar-Shalom, Haggai Maron

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Large language models often produce fluent but factually incorrect output. Gray-box detectors identify such hallucinations from the token-probability statistics emitted during generation, avoiding the need for white-box access to hidden states that frontier models do not provide. These detectors, however, typically rely only on probability-derived representations and ignore the identities of the candidate tokens. They can therefore observe how uncertain the model is, but not what it is uncertain about. Consequently, they cannot distinguish between a model that is torn between “big” and “small” and one that is torn between “big” and “huge” when the two pairs receive the same probability distribution. We introduce GURI (Gray-box Uncertainty Representations with Identity), a lightweight gray-box hallucination detector that combines candidate-token probabilities with per-token vector identifiers. This exposes which alternatives the model considered while preserving the accessibility and transferability of the gray-box setting. Across three open-weight models and three question-answering benchmarks, GURI increases mean test ROC-AUC from 72.09% to 79.09% over a probability-only baseline. On the closed-source GPT-4.1 model, mean ROC-AUC increases from 67.39% to 71.84%. Among the three open-weight models, GURI outperforms transferred probability-only baseline in 17 of 18 directed cross-model transfers without fine-tuning. For the three open-weight models, cross-dataset transfer between HotpotQA and TriviaQA with the model held fixed improves mean ROC-AUC over transferred LOS-Net by 3.76 points.

1 INTRODUCTION

Large language models can produce fluent but factually incorrect responses, motivating methods for detecting hallucinations (Ji et al., 2023; Huang et al., 2025; Maynez et al., 2020). White-box detectors use internal model signals, whereas black-box methods assess generated text, often using additional model calls. Gray-box detection uses token probabilities exposed during generation and can operate without internal activations or additional sampling (OpenAI, n.d.; Google, n.d.).

Probability-only gray-box methods range from summary statistics of actual-token probabilities (Malinin & Gales, 2020; Ren et al., 2022) to learned detectors such as LOS-Net (Bar-Shalom et al., 2026), which processes actual-token probabilities and ranked candidate distributions across the response. Its formulation can approximate a broad family of probability-based scoring functions.

A blind spot in probability-only representations. Despite this progression, probability-only gray-box detectors use probability values while discarding the identities of the tokens carrying them. Consequently, they reveal how uncertain the model is, but not what it is uncertain about. Two decoding states may have the same numerical probability profile while assigning that probability mass

∗^{*}Equal contribution to entirely different tokens. A probability-only detector maps these states to the same representation, discarding potentially useful information about the alternatives considered by the model.

Figure 1 illustrates this problem. Both decoding states have exactly the same ranked candidate token probabilities. They differ only in the tokens carrying those probabilities: one (left panel) contains competing factual answers, whereas the other (right panel) contains alternative, yet semantically equivalent, ways to complete the sentence – potentially indicating a lower risk of hallucination. This distinction is visible only when candidate token identities are taken into account and is currently absent from all previous gray-box detectors that rely on probability-only representations.

Hallucination

The capital of France is ___

Non-hallucination

The building is extremely ___

Figure

identical token

prob. distribution

Figure

Figure 1: Identical numerical profiles can conceal different candidate structures. Both cases share the same token distribution, so a probability-only detector receives the same input. Candidate identities reveal competing factual answers on the left and paraphrastic alternatives on the right. The emitted token is shown in bold.

Our approach. GURI is a lightweight gray-box detector that combines token identity codes with their probabilities and aggregates the resulting representations across the answer. The fusion and prediction components are trained jointly for answer-level hallucination detection.

Code vectors may be pretrained, learned, or fixed random. We use fixed random codes by default, as they match or outperform pretrained embeddings (Section 4.4.1). To support cross-model transfer, we retokenize candidate strings with a shared external tokenizer and aggregate their subtoken vectors into identity codes. This common encoding also supports closed-source models exposing candidate strings and probabilities, without requiring their tokenizer or embedding table. See Section 3 for encoding and architecture details and Figure 2 for the pipeline.

Results. Across three open-weight models and three question-answering benchmarks, GURI outperforms both the Confidence baseline and LOS-Net in all nine model–dataset combinations. Mean test ROC-AUC increases from 72.09% for LOS-Net to 79.09% for GURI (Table 1). On GPT-4.1, mean ROC-AUC increases from 67.39% to 71.84%, with an 8.14-point gain on NQ-WC (Table 2). Among the three open-weight models, GURI outperforms transferred LOS-Net in 17 of 18 directed cross-model transfers without target fine-tuning. For the three open-weight models, cross-dataset transfer between HotpotQA and TriviaQA with the model held fixed improves mean ROC-AUC over transferred LOS-Net by 3.76 points (Section 4.3). Channel ablations with random codes further show that retaining only non-actual candidate identities preserves the performance of the full detector.

Contributions. Our contributions are threefold: (1) We identify token identity as a missing signal in probability-only gray-box detection. (2) We introduce GURI, a token-identity aware, transferable, gray-box detector applicable to both open- and closed-source models. (3) We demonstrate consistent empirical gains and show that identities provide predictive information beyond token probabilities.

References (48)