WorksComputer Science
A statistical measure of trust in generative AI
Abstract
Trustworthiness is a crucial issue for generative AI, as modern models can produce convincing and confident responses even when their outputs are incomplete, unsupported, or wrong. The frequent absence of ground-truth knowledge or labels complicates verification of generative AI outputs. To address this issue, we propose a trustworthiness framework grounded in model-internal confidence calibrated against an external expert reference. We estimate per-token trustworthiness of a student generative model as the statistical typicality of each generated token relative to an expert model's distribution, where the expert is used as a distributional reference rather than as a source of factual verification labels. To this end, we introduce an AI ontology calibrator that leverages the student model's internal latent features and token-level output statistics to compute expert-reference acceptance scores. Combined with traditional token-level confidence, entropy, and perplexity statistics, calibrator scores yield a compact set of response-level indicators for correctness classification. Evaluated across BF program generation, mathematical problem solving, and medical question answering, combined calibrator and traditional indicators provide complementary reliability signal which could be used to build detectors of untrustworthy outputs and hallucinations. Remarkably, our experiments show that these detectors are transferable across domains, although transferability is not always symmetric.
Introduction
Generative AI has become a common component of modern computational systems, supporting coding, text processing, search, learning, and decision making. As these systems are increasingly used in consequential domains, the problem of trustworthiness becomes central. This is particularly visible for Large Language Models (LLMs), which can produce fluent and confident responses even when the underlying content is incomplete, unsupported, or wrong.
Current gold standard approaches to trustworthiness in LLMs emphasize factual incorrectness [4, 24, 42], unfaithfulness to input context [46, 9], or internal inconsistency [30]. They presuppose access to some notion of ground truth, such as an external knowledge base, a reference document, an objective fact, or a set of internally consistent statements [20]. Dependence on ground truth introduces a practical limitation. In open-domain settings, long-tail knowledge may be unavailable or poorly documented. In domains such as medicine, correctness can be context-dependent, and accepted standards may evolve over time. These constraints motivate methods that estimate trustworthiness without requiring verified factual labels at inference time.
Our goal is circumvent this issue by showing learnability of alternative confidence-style reliability signals in a student-expert framework enabling to ensure statistical trustworthiness. There a smaller generative model constitutes a student. A larger expert model can be used offline during calibration. The expert is not treated as an oracle and does not define absolute truth. Instead, it provides a distributional reference against which the student’s token-level behavior can be calibrated. At deployment time, the resulting trustworthiness indicators are computed from the student model’s own internal states and token-level statistics.
To this end, we propose an AI ontology calibrator. By ontology we denote a task domain, an operational representation of its outputs, and evaluation protocol. The calibrator compares student hidden representations and token-level output with expert-reference acceptance scores. The scores estimate if a generated token agrees with the expert reference under chosen alignment criteria.
We evaluate the framework on three ontologies of increasing complexity. In BF program generation, correctness can be verified by executing a generated program and comparing its output to the requested behavior. In mathematical reasoning, correctness is evaluated using reference-based and ProcessBench-style labeling protocols, reflecting the fact that multiple solution paths may be valid. In medical multiple-choice question answering, we evaluate several student LLMs using response-level labels obtained through an automated annotation pipeline, and interpret detector outputs as reliability or routing signals rather than clinical validation. Our theoretical analysis gives a finite-sample justification for the calibration step. Empirical results show that calibrator-derived indicators provide information complementary to standard confidence features.
Our specific contributions are as follows:
We frame trustworthiness estimation through the lens of confidence, distinguishing it from uncertainty and consistency. Complementary to approaches looking for factual errors, we treat unreliable generations as outputs whose token-level internal signals are atypical relative to an expert-reference calibration criterion.
We propose an AI ontology calibrator – a tool for estimating token-level trustworthiness of a student generative model using an expert model as an offline distributional reference.
As part of the AI ontology calibrator, we introduce expert-reference acceptance scores: confidence-style token-level statistics grounded in the typicality of generated tokens relative to the expert reference. These scores are supported by bounds on threshold-defined acceptance and rejection probabilities.
We construct a small set of 15 response-level indicators by aggregating calibrator scores with traditional token-level confidence, entropy, and perplexity statistics. These indicators can be used to train supervised classifiers for discriminating correct and incorrect responses under ontology-specific labeling protocols.
We evaluate the proposed indicators across BF program generation, mathematical problem solving, and medical question answering. The combined calibrator and traditional indicators provide complementary reliability signal, with the clearest gains in Medicine and BF and more mixed behavior in Math.
We analyze transfer across models within the same ontology and across different ontologies. The results show selected improvements from calibrator-derived features, but transfer remains heterogeneous rather than universal.
Related Work
An overview of classical approaches such as consistency-based, retrieval-based, and model-based are discussed in Appendix A. Since our method studies trustworthiness through the lens of confidence, we concentrate here on confidence-based and internal-signal methods.
Low-confidence validation methods monitor minimum token probabilities, token entropy, or related scalar statistics to flag candidates for external verification [41]. Length-Normalized Token Probability (LNTP) [6] is a representative example: it aggregates token probabilities into a length-normalized sequence-level score, providing a strong and efficient baseline that avoids multiple generations. However, such approaches usually rely on raw intrinsic confidence signals and remain vulnerable to miscalibration, especially after instruction tuning, where aleatoric ambiguity and epistemic ignorance can become conflated [38].
To better isolate epistemic uncertainty, ensemble-based estimation has been proposed. Input clarification ensembling generates semantic rephrasings, while Monte Carlo Dropout approximates Bayesian posterior variance via stochastic forward passes [19, 15, 45]. These methods can provide richer uncertainty estimates, but they incur linear overhead in the number of samples or stochastic passes and typically operate at the sequence or concept level rather than as token-level reliability scores available from a single generation. Beyond scalar probability and entropy measures, hidden-state and logit-based methods aim to use richer internal model information. INSIDE Chen et al., [8] and related probing approaches leverage hidden states across transformer layers via eigenvalue analysis or learned classifiers, while energy-based methods such as Semantic Energy use pre-softmax logits to mitigate entropy saturation Ma et al., [27]. These methods show that internal representations contain reliability-relevant information, but they are often framed as out-of-distribution or uncertainty detectors and do not directly calibrate token-level student behavior against an external expert reference.
Our work occupies a complementary position. Like confidence-based methods, it uses model-internal signals and can produce lightweight indicators from a single student generation. Unlike raw confidence proxies, however, the proposed AI ontology calibrator uses an expert model offline as a distributional reference to calibrate student hidden states and token-level statistics. The resulting expert-reference acceptance scores are not factuality guarantees, but calibrated reliability features that can be aggregated with traditional confidence, entropy, and perplexity-style statistics for supervised response-level correctness prediction.
Overall Approach
In what follows, a generative model whose trustworthiness is being assessed will be referred to as a student. We assume that the student’s generation process can be decomposed into individual steps and at each step the student generates a token. Since we focus on LLMs, tokens include whole words, subword units, or single characters as determined by the underlying LLM tokenizer.
At the core of our approach is the observation that a statistically grounded measure of a student model’s token-level behavior, relative to what an expert would produce in the same context and ontology, correlates with human judgments of the quality and factuality of the student’s overall response [44, 14]. We build on this by treating such a measure as a signal, among others, for detecting whether a response can be trusted.
In order to test and assess our method, we consider three ontologies of increasing complexity, BF, Math, and Medicine, and their corresponding trustworthiness/correctness definitions:
BF program generation (BF): a student-LLM generated program is considered trustworthy if it compiles, executes, and produces correct intended output.
Math problem solving (Math): a generated solution is considered trustworthy if it correlates with reference solution according to an agreed metric. Reference solution constitutes solution provided by an external expert, a human or another AI system. Technical details explaining how we compared student’s and expert’s responses are provided in § 4.3.
Medical question answering (Medicine): student LLMs answer multiple-choice questions with all reasoning traces, and expert responses are taken as a reference. In this paper, we treat all inaccuracies as equally important. A promising direction for future research is to introduce semantic-context awareness, where errors are weighted by their clinical significance. A variant of labeling accounting for context criticality is presented in Appendix § 12.§ 3.
Before diving into details of the method, we want to distinguish between three related but fundamentally different concepts for evaluating statistical trustworthiness of a model:
Uncertainty is a problem-level property that characterizes the spread of the answer space for a given prompt, regardless of any particular output.
Consistency measures behavioral stability across multiple outputs, requiring at least two generations or inputs to compare.
Confidence, by contrast, is an instance-level property of a single prediction – it reflects how strongly internal or expressed signals point to correctness for that specific answer.
Our framework is specifically designed to estimate trustworthiness through a single generation pass and with no ground truth information required. This contrasts with consistency measures which require at least two outputs or inputs to be compared. Regarding remaining two measures, we prefer confidence over uncertainty for two complementary reasons. First, uncertainty is a prompt-level property shaped by factors external to the prediction itself such as training data distribution, prompt ambiguity, and the overall spread of the answer space. Confidence, by contrast, is an instance-level signal reflecting the model’s internal conviction about a specific generated element, independently of these distributional factors and without any knowledge of the model’s training data. Second, in many real-world ontologies, ground truth is neither static nor universally accessible: medical treatment protocols are revised as evidence accumulates, scientific consensus shifts, and accepted best practices change over time. By grounding our framework in the model’s own internal confidence signals, we obtain a formulation that remains feasible in absence of external ground truth stability.
Methodology
Our framework comprises two components: (1) measuring statistical confidence of each generated token, relative to that of expert’s through a single generation pass without accessing expert’s own confidence, uncertainty and state, and without ground truth information; and (2) determining whether the generated response as a whole is trustworthy, by aggregating per-token indicators that combine our proposed statistical confidence scores with traditional measures. The resulting workflow is illustrated in Figure 1, whose components are described in detail in the following sections.

Figure 1. Our workflow. Solid lines indicate the necessary steps for building an AI ontology calibrator; dashed lines correspond to the proposed procedure for obtaining indicators and evaluating how well they reflect response correctness; the dotted line highlights the optional use of reference answers for labeling the student’s correctness for classifier training.
Framework component 1: AI ontology calibrator
The AI ontology calibrator’s aim is to assess each student token’s typicality with respect to the conditional distribution induced by the reference answer. The process of its construction is further illustrated with solid lines in Figure 1. Reference answers are responses provided by expert models – SOTA models of much larger size than the student models. For each token position we learn token-conditional generation probability with expert’s response taken as a reference.
More formally, let be a generative AI model mapping inputs to finite output sequences , , where is the length of generated sequence and represents a token. In this paper, we consider the map represents an LLM, while our method can be implemented to other generative models. Let us denote the set of possible tokens by . Since output sequences are generated sequentially, generation decomposes into individual steps. For each step of the generation, generates many objects, including the vector of probabilities for all possible tokens and the vector of features . Here we use outputs of the last fully connected layer before the heads as features, albeit other model variables could be used too.
The response generation process of an AI model proceeds as follows. Let us denote input corresponding to generation of the first token as . Output of the first step of generation is a dimensional vector of probabilities , and the vector of features is , where is the dimension of the last fully connected layer before the heads. Based on the values of , the system selected one token . At the next step, the model’s input becomes , and the process repeats. As a result, generation of a single token in the output sequence can be modelled as a map from the set of inputs (inputs are different for different steps) to a finite set of outputs :
To distinguish different steps of generation, input at the -th step is denoted as .
In what follows student model will be denoted as , and expert (a model judge or a human) will be referred to as . In response to the same initial input these models produce two sequences of tokens: (expert) and (student). For the student, we assume access to its vector of features . For the expert model, this is not required.
Our goal is to estimate the probability of correctness of token . Token is deemed correct if , and it is considered incorrect otherwise. If , then all tokens with are deemed wrong. This enables posing the task of identifying “correct” generations as a classical classification problem at the level of each individual token : we need to find a map accepting or rejecting tokens produced by with some inferrable confidence. This map could formally be defined as:
where is the label corresponding to rejected tokens.
As a measure of model confidence relative to expert’s response we consider conditional probabilities (or suitable proxies of):
where is map discussed above, and is the token’s position. Low values of these probabilities indicate disagreement between ’s outputs and the target distribution, and therefore insufficient trust. We also can estimate the probability of the opposite event that token produced by is in position does not match that of :
If the distribution underpinning the above data generation process would have been known then these probabilities could be computed. However, in most practically-relevant instances, this is not the case, and hence we need to learn or estimate the corresponding probabilities from empirical data.
In this work, we introduce a tool to estimate these probabilities which we are referring to in the text as an AI ontology calibrator. To form/build the calibrator, we assume access to a dataset, which we will refer to as the forming dataset:
The forming dataset is further partitioned into , where each such set is non-empty. For each , partition into:
that are assumed not empty, with cardinalities and . Let be a class of measurable projection functions . Each function defines empirical cumulative distribution functions:
and is the indicator function of the set . Detailed theoretical background and justification of the calibrator’s capability to learn desired probability estimates from empirical data are presented in Appendix § 11.
In general, we have several attributes for each token: the output token itself , the vector of output probabilities (softmaxes in standard models) , and the vector of features , is the position in the generated sequence. The vectors are used as feature vectors for the calibrator. These vectors could be used ‘as is’ without any pre-processing. For each token with rich enough forming set (in this study we consider only tokens that occur at least 1,000 times in the dataset) we computed three arrays: (1) projection functions , which for simplicity have been chosen as functionals projecting data onto normalized direction of the corresponding Fisher discriminants; (2) thresholds of acceptance (score representation of ), where ; (3) the vector of the adjusted lower bounds on the probabilities of acceptance for the corresponding threshold . Calculation (estimation) of the probability of correct acceptance of the token with feature vector can be computed as follows. Calculate dot product of feature vector with corresponding projection function . Define the maximal , such that . Take as answer. For each generated token , compute the following quantities:
the probability of correct acceptance (or its lower bound), hereafter referred to as calibrator probabilities;
the maximum softmax probability of the generated token (where are sorted in the descending order), i.e., the probability assigned to the model’s top-predicted token at position , hereafter referred to as softmaxes;
the Shannon entropy of the predictive distribution , hereafter referred to as entropies;
the log-probability of the next generated token under the model’s predictive distribution at position , , where indicates the position of the actual token in the sorted softmaxes list; hereafter referred to as token log-probabilities.
Quantities (1)-(3) are collectively used to construct a set of indicators for training trustworthiness classifiers, while quantities (4) are utilized for baseline indicators (baselines) calculation. Details on indicator construction and classifier training are provided in the following section.
Framework component 2: determining response correctness
For each generated response of an LLM, we obtain four per-token quantities described in § 4.1. To determine trustworthiness of responses, we aggregate quantities into indicators, and train a classifier mapping indicators of each generated sequence to a probability that the response/generation is correct (trustworthy). We thus now deal with a binary classification task where labels are available. During training, responses whose probability of being correct are considered correct (see § 4.3 for details).
Our set of indicators for each generated sequence includes the following:
Mean (), standard deviation (), and geometric mean () aggregations of calibrator probabilities (), softmaxes (), and entropies ().
Entropy-like () and perplexity-like () values of calibrator probabilities and softmaxes.
Pearson () and Spearman () correlation coefficients between calibrator probabilities and entropies.
The complete set of indicators comprises 15 quantities:
Among these indicators, we have two traditional confidence measures, namely, Mean Token Entropy () and LNTP [6][6](), along with the newly proposed ones. Moreover, two of our indicators coincide with standard baselines under greedy decoding: Mean Token Probability () and Geomean Token Probability () . Note also that LM Perplexity () . We also consider MSP, Max Token Probability Max (), and Min Token Probability (min ()) as baselines. A diagram illustrating computation of all provided indicators and baselines based on quantities from § 4.1 is shown in Figure 2.

Figure 2. Sources of derivation of quantities, indicators, and baselines. Entropies provide both indicators and baselines, token log-probabilities – only baselines, calibrator probabilities and softmaxes – only indicators. Green arrows highlight indicators produced by our proposed calibrator probabilities, blue arrows – traditional indicators. – indicators of mixed category: to calculate them, both calibrator probabilities and traditional indicators are needed.
Specifics of our framework and the considered ontologies
For math, we use the first 5, 000 problems to build the calibrator and train classifiers in the following settings: (V1) concatenate the first 5, 000 problems with the second 5, 000 problems and train classifiers via 20-fold cross-validation; and (V2) train classifiers on the first 5, 000 problems and test them on the second 5, 000 problems. As Figure 1 shows, using reference answers when labeling students’ responses is not always necessary. For math, we compare two labeling strategies: (1) LLM-Judge labeling with Qwen2.5-32B, which uses expert answers, and (2) ProcessBench labeling with DeepSeek-V3.2, which does not require expert answers. For the (V1) and (V2) settings described above, we use only those problems from the first 5,000 and the second 5,000 that have both LLM-Judge and ProcessBench labels. For BF and medicine, we build calibrators on the full datasets and train classifiers via 20-fold cross-validation. For BF labeling, we select 10,000 programs and label them by compiling each program and comparing its output with the desired output: programs whose outputs match are assigned label 1 (correct), while those that do not are assigned label 0 (incorrect). For medical question answers, we apply the ProcessBench technique with GLM-4.7.
Experiments
Table 1 details experimental setups for all ontologies and the statistics of built calibrators. Full implementation is available in [2].
Ontology 1: BF. We consider the problem of developing a program in the BF language that produces a specified output. BF is a Turing-complete language consisting of only eight possible symbols. We chose BF due to its simplicity and the straightforward process of verifying the correctness of a generated program. The dataset comprises 433,688 program-output pairs. Programs are constrained to a maximum of 18 commands, while outputs are limited to 256 character codes. A detailed description of BF is presented in Appendix § 12.1.1. Details regarding the model architecture and training procedure are provided in Appendix § 12.1.2. Ontology 2: Math. In this setup, we consider mathematical tasks from [29]. Since the tasks are open-ended mathematical problems requiring full reasoning traces rather than just final answers, evaluation of their correctness cannot be reduced to simple answer matching. Manual annotation of such responses would be both time-consuming and costly – particularly given that most tasks admit multiple valid solution paths. To address this, we employ an LLM to generate reference solutions (as described in § 4.1), offering a practical balance between annotation quality and scalability. Our aim is not to establish absolute ground truth, but to validate a general method for assessing student-model quality in a regime where expert’s answers can be treated as references. Specifically, as an expert, we use DeepSeek R1 [10] (671B parameters), one of the strongest publicly available LLMs [17], generating a single reference solution per task, while as a student we use Qwen3-8B [33], which is a relatively small LLM. To evaluate the correctness of the student’s solutions, we employ two techniques. Details about labeling strategies and their comparison are provided in Appendix § 12.§ 2.
Ontology 3: Medicine. We use Medical-Reasoning-SFT-GPT-OSS-120B dataset [32]. From the original collection, we sample and curate 12, 369 questions, focusing on multiple-choice items that require reasoning about human biology and medicine. To improve topical consistency, we apply a series of filters and exclude: (i) animal-related questions, (ii) questions about medical legal procedures, (iii) ecology- and taxonomy-focused questions, (iv) non-English questions, (v) plant and marine biology questions, (vi) questions centered on organizations (e.g., WHO, UNICEF), and (vii) microbiology questions (e.g., bacteria-related items). We found that a subset of slightly more than 12, 000 questions provides sufficient coverage for our experiments while keeping evaluation and analysis tractable. Most questions focus on medical conditions and diagnosis, as well as the biological processes underlying diseases and broader aspects of human biology. As the dataset has already provided the results of GPT-OSS-120B generations, we consider them as the expert’s answers. As student LLMs, we consider four models:
MedGemma-1.5-4B [36] is a multimodal instruction-tuned variant of Gemma 3, specifically trained on medical text and images;
Qwens [33, 34]: two representatives of the Qwen3 family – Qwen3-8B and Qwen3-0.6B – and one from the more recent Qwen3.5 small series, Qwen3.5-0.8B.
To annotate correct answers we use ProcessBench labeling [48] with GLM-4.7.
Results: prediction of generations correctness. As described in § 4.2, for each student from each ontology, we obtain a set of 15 indicators and six baselines: MSP, , , , , and . Feature correlations across all considered ontologies are provided in Appendix § 13.§ 1, and classifier technical details in Appendix § 14. Notably, several papers [22, 26] report a correlation between generation correctness and the model’s self-assessment labels; our results on medical ontology show no such correlation (see Appendix § 13.§ 2).
Table 2 presents the classifiers’ results. Logistic Regression was trained only on the provided cases, while MLPs were trained on all possible combinations of the 15 indicators, with only the best results reported here. The table shows that our proposed indicator set consistently outperforms traditional confidence measures. Even using features derived from calibrator probabilities alone provides reasonable quality across all ontologies. This also supports the validity of using the same data for classifier training and calibrator construction, since cross-validation relies on stratified 20-fold splitting and a weighted loss function. MLPs’ results show that the best results were obtained on the indicators subsets including at least one derived from calibrators. The poor performance on Math, V2 reflects a train/test distribution mismatch rather than weaker classifier quality – particularly for ProcessBench labeling, where the class ratio is inverted between train and test.
| Indicators | MedGemma | Qwen3-8B | Qwen3-0.6B | Qwen3.5-0.8B | Custom Transformer | LLM-Judge | ProcessBench | LLM-Judge | ProcessBench |
| Individual (ours) | 0.5681±0.0299 | 0.5131±0.0433 | 0.5674±0.0403 | 0.4922±0.0562 | 0.7179±0.1410 | 0.5049±0.0730 | 0.4798±0.0221 | 0.5026/0.5220 | 0.5162/0.4777 |
| 0.5779±0.0329 | 0.5281±0.0416 | 0.5564±0.0396 | 0.5263±0.0718 | 0.5709±0.1358 | 0.5397±0.0832 | 0.5676±0.0674 | 0.5101/0.5055 | 0.5217/0.4691 | |
| 0.6701±0.0377 | 0.4857±0.0392 | 0.7890±0.0518 | 0.5311±0.0486 | 0.5509±0.2132 | 0.6511±0.0725 | 0.5134±0.0570 | 0.6004/0.7610 | 0.5379/0.5463 | |
| 0.6693±0.0361 | 0.5708±0.0356 | 0.6375±0.0447 | 0.5154±0.0483 | 0.5028±0.2195 | 0.6528±0.0831 | 0.4985±0.0540 | 0.6080/0.7349 | 0.5390/0.5244 | |
| 0.5019±0.0025 | 0.5098±0.0180 | 0.6180±0.0350 | 0.5107±0.0077 | 0.6365±0.1184 | 0.5531±0.1048 | 0.5910±0.1169 | 0.4927/0.5034 | 0.4953/0.4967 | |
| Mixed (ours and traditional) | 0.5231±0.0309 | 0.5017±0.0466 | 0.5869±0.0369 | 0.5189±0.0438 | 0.5314±0.1194 | 0.4338±0.0579 | 0.5703±0.0784 | 0.5453/0.5163 | 0.5120/0.5096 |
| 0.5161±0.0239 | 0.5359±0.0261 | 0.5406±0.0542 | 0.4818±0.0611 | 0.5235±0.0934 | 0.5238±0.0524 | 0.5118±0.0500 | 0.5036/0.5267 | 0.4992/0.5108 | |
| 12 indicators 0.7081±0.0366 | 0.7245±0.0414 | 0.8432±0.0313 | 0.6626±0.0514 | 0.7813±0.1483 | 0.6529±0.0892 | 0.7099±0.2264 | 0.6115/0.5323 | 0.5739/0.4985 | |
| 15 indicators 0.7197±0.0320 | 0.7276±0.0485 | 0.8426±0.0305 | 0.6634±0.0557 | 0.7815±0.1403 | 0.6523±0.0901 | 0.7095±0.2275 | 0.6121/0.5233 | 0.5709/0.4954 | |
| Traditional (included into our indicators’ set) | 0.5892±0.0284 | 0.5680±0.0509 | 0.8087±0.0361 | 0.5026±0.0037 | 0.6921±0.2067 | 0.6099±0.1639 | 0.6723±0.2059 | 0.5482/0.4997 | 0.5485/0.4991 |
| 0.5507±0.0296 | 0.5940±0.0456 | 0.8203±0.0298 | 0.5367±0.0510 | 0.6807±0.1161 | 0.6179±0.1918 | 0.6935±0.2198 | 0.5304/0.4980 | 0.5259/0.4967 | |
| 0.6009±0.0343 | 0.5494±0.0504 | 0.7394±0.0441 | 0.5305±0.0443 | 0.7049±0.1976 | 0.5968±0.1190 | 0.6324±0.1675 | 0.5456/0.4997 | 0.5365/0.4997 | |
| 0.5761±0.0311 | 0.4839±0.0659 | 0.7525±0.0426 | 0.5026±0.0037 | 0.6842±0.2050 | 0.6016±0.1594 | 0.6611±0.1954 | 0.5448/0.5127 | 0.5520/0.4991 | |
| 0.5815±0.0312 | 0.4292±0.0567 | 0.8108±0.0327 | 0.549±0.0543 | 0.6957±0.1446 | 0.6280±0.1823 | 0.6837±0.2147 | 0.5447/0.5044 | 0.5405/0.4981 | |
| 0.6815±0.0349 | 0.6835±0.0352 | 0.7873±0.0508 | 0.5026±0.0037 | 0.6861±0.1634 | 0.6359±0.0938 | 0.5409±0.0408 | 0.6023/0.7501 | 0.5367/0.5580 | |
| 0.6825±0.0333 | 0.5669±0.0355 | 0.6337±0.0491 | 0.5026±0.0037 | 0.6861±0.1634 | 0.6506±0.1003 | 0.6289±0.0422 | 0.6054/0.7650 | 0.5349/0.5352 | |
| Baselines | 0.5757±0.0293 | 0.5510±0.0516 | 0.7884±0.0350 | 0.5026±0.0037 | 0.6867±0.2047 | 0.6129±0.1640 | 0.6651±0.1989 | 0.5491/0.5087 | 0.5534/0.4990 |
| 0.6531±0.0303 | 0.5685±0.0380 | 0.6635±0.0531 | 0.5976±0.0673 | 0.6853±0.1494 | 0.6317±0.0861 | 0.6135±0.1575 | 0.6011/0.5289 | 0.5454/0.4978 | |
| 0.5362±0.0274 | 0.6036±0.0412 | 0.8224±0.0327 | 0.5300±0.0469 | 0.5026±0.0037 | 0.6012±0.1823 | 0.6148±0.1866 | 0.5188/0.5000 | 0.5367/0.5000 | |
| 0.5409±0.0217 | 0.4892±0.0548 | 0.7404±0.0321 | 0.5270±0.0292 | 0.6679±0.1637 | 0.6286±0.2203 | 0.7147±0.2466 | 0.5380/0.5000 | 0.5004/0.5000 | |
| 0.5552±0.0293 | 0.5740±0.0498 | 0.8124±0.0311 | 0.5026±0.0037 | 0.7126±0.2022 | 0.6148±0.1866 | 0.6884±0.2165 | 0.5357/0.4998 | 0.5437/0.5002 | |
| 0.4971±0.0223 | 0.6225±0.0311 | 0.5074±0.0391 | 0.4945±0.0567 | 0.4996±0.0094 | 0.5302±0.0644 | 0.5478±0.0548 | 0.5060/0.4998 | 0.5059/0.5002 | |
| 0.5370±0.0265 | 0.5862±0.0338 | 0.8019±0.0362 | 0.5026±0.0037 | 0.4930±0.0333 | 0.6277±0.2206 | 0.7148±0.2438 | 0.5087/0.5000 | 0.5370/0.5000 | |
| Const = 1 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.5000 | 0.5000/0.5000 | 0.5000/0.5000 | |
| Const = 0 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.0000 | 0.5000±0.5000 | 0.5000/0.5000 | 0.5000/0.5000 | |
| Rand. 0.5 0.5018±0.0304 | 0.5000±0.0400 | 0.5000±0.0340 | 0.5110±0.0360 | 0.5200±0.0000 | 0.5380±0.0000 | 0.5000±0.5000 | 0.5020/0.5035 | 0.5000/0.5188 | |
| Rand. major 0.4935±0.0320 | 0.5099±0.0329 | 0.5108±0.0221 | 0.5040±0.0485 | 0.4877±0.0007 | 0.4965±0.0084 | 0.5150±0.0046 | 0.4898/0.5099 | 0.5016/0.4859 | |
| Best results MLP | 0.7141±0.0286 | 0.7284±0.0417 | 0.8604±0.0354 | 0.7035±0.0357 | 0.8299±0.1130 | 0.6389±0.2116 | 0.7153±0.2354 | 0.6148/0.7823 | 0.5309/0.5703 |
Table 2. Mean ± standard deviation of balanced accuracy of Logistic Regression and MLP across 20 folds for all ontologies. For MLP, we provide only the best results with the subset of indicators used for training. For Math, V2, we provide train/test balanced accuracy. “15 indicators” denotes using all proposed indicators, whereas “12 indicators” refers to the first 12 indicators defined in Equation (4). For each ontology, top-1 scores are in bold, top-2 in bold underlined, and top-3 in bold italic. We also provide results for four naive baselines: constant predictions of ones (Const = 1) and zeros (Const = 0), and random predictions where the probability of predicting 1 is either fixed at 0.5 (Rand. 0.5) or set to the majority class proportion (Rand. major).
Experiments demonstrating transferability of our trustworthiness detectors across different domains and models are provided in Appendix § 16.
Conclusion
In this work we considered the problem of assessing the trustworthiness of outputs of generative AI models. The major challenge of this task is that the ground truth data or gold-standard methods for checking the correctness of responses are not always available. Sometimes, it may not even be possible to expect that such information could be provided. To mitigate this issue, we ”calibrate” outputs of generative models with that of experts models, representing intended model outputs to given inputs. We also introduced a metric of trust characterising probabilities of the model’s correct generations conditional on the generations of expert models or agents. These estimated probabilities (calibrator probabilities) are statically grounded and together with a set of traditional features, after aggregations form a set of 15 indicators that may constitute a new basis for AI reliability evaluation. Our results demonstrate that classifiers trained on these 15 indicators can discriminate correct and incorrect answers. Our experiments illustrate this across three ontologies: the BF programming language, math problems, and medical question answering. In all settings, subsets including probability-based indicators yielded better discrimination than subsets comprising traditional indicators. Moreover, adding probability-based indicators to the traditional ones either improves transferability or leaves it nearly unchanged, both across models within the same ontological class and across ontologies entirely. Where the subsets of only traditional indicators transfer better, the margin is small.
Limitations
While the proposed framework is theoretically applicable to diverse generative AI modalities – for instance, by treating image patches as discrete tokens – the empirical validation in this study was limited to generative language models. The observed transferability of the trust measure within and across ontologies suggests that universal patterns underlying hallucinations may exist across language model outputs. However, since the indicators are predicated on probability distributions derived from an ontology-specific calibrator, adapting the classifier to a novel ontology (including alternative language model architectures) necessitates construction of a new calibrator for the target ontology. Calibrator-based probabilities improve performance only in combination with the traditional indicators (see Appendix § 16), and the most effective combination may differ across ontologies.
AI USE STATEMENT
In this work, we used generative AI tools for text checking on grammatical issues. We have not used generative AI tools for research ideas generation, experiment setup and run, making conclusions.
REPRODUCIBILITY STATEMENT
The code for all experiments is provided in our repository [2]. § 4 provides a detailed methodological descriptions of our framework, Appendix § 14 – technical details for experiments reproducing.
Related work
In this Section, we review existing work on hallucination detection and mitigation in LLMs, with a particular focus on approaches that motivate or relate to our proposed framework.
Consistency-based detection
Consistency-based methods detect hallucinations by identifying contradictions or instability within a model’s outputs or across multiple generations. These approaches rely on internal agreement rather than external knowledge, making them applicable in black-box settings.
Self-contradiction detection generates paired sentences or internal claims and employs automated checking (via prompting or classification) to identify logical inconsistencies. Constrained prompting techniques elicit comparable sentence pairs that can be systematically evaluated for contradictions [30]. Self-contradiction methods, however, only detect internal contradictions; many factual hallucinations produce no internal contradiction. Moreover, these methods require generating multiple outputs or auxiliary prompts, which increases computational cost and introduces sensitivity to the prompting strategy used to elicit contradictions.
Self-consistency and Best-of-N sampling approaches sample multiple outputs (n-best) and measure agreement through majority voting or semantic similarity. Outputs with low agreement across samples are flagged as potentially hallucinated [46, 47]. These methods are computationally expensive, requiring multiple forward passes; they may miss consistently repeated hallucinations that appear across all samples.
External verification and retrieval-based methods
External verification methods ground model outputs in retrieved sources or knowledge bases, enabling detection of unsupported claims through comparison with authoritative information.
Retrieval-Augmented Generation (RAG) and grounding conditions generation on retrieved documents or knowledge snippets, allowing outputs to be traced to sources. Detection involves comparing generated claims to retrieved evidence or enforcing grounding constraints during decoding [25]. However, retrieval noise, stale sources, or biased corpora can propagate errors. Incorrect alignment between retrieved passages and claims can produce grounded-but-incorrect outputs.
Fact-checking with reward models and rejection sampling. Fine-grained reward or classifier models are trained on human annotations marking hallucinations. These models score generations, enabling rejection sampling or fine-tuning to prefer non-hallucinatory outputs [16]. The approach requires substantial annotated data, which is costly to obtain. It inherits annotator biases and coverage limitations. Furthermore, generalization to out-of-distribution ontologies can be limited.
Knowledge base verification and benchmarks verify model statements by querying structured knowledge bases or curated benchmarks to identify unsupported facts [24]. Their drawbacks include limited recall when knowledge bases lack coverage for the ontology. Also, mapping free-text claims to structured knowledge base queries is non-trivial.
Model-based and prompt-based detection
This category encompasses training separate classifiers to detect hallucinations and using prompt engineering to elicit self-verification from the model itself.
Separate detector models and classifiers. A classifier or detector model is fine-tuned on annotated examples to predict whether generated content is hallucinated. Detectors can operate at token, span, or full-answer levels [1, 16]. The methods are heavily dataset-dependent and require costly annotation efforts.
Prompted self-verification and Chain-of-Thought (CoT) checks. The model is prompted to list supporting evidence, explain its reasoning chain, or directly judge whether a generated claim is supported (self-critic approach) [30, 25]. Models, however, can produce plausible but fabricated supporting evidence. Self-verification may fail when models lack knowledge to judge their own outputs.
Counterfactual perturbations and intervention methods
These methods intentionally alter claims or model components to measure sensitivity, using behavioral responses to distinguish hallucinations from robust knowledge.
Counterfactual probing and perturbation sensitivity generate counterfactual variants of a claim (introducing subtle factual changes), and the model’s confidence or output consistency is measured. Hallucinated content is expected to show inconsistent sensitivity compared to grounded knowledge [13]. The challenge, however, is that generating high-quality counterfactuals is non-trivial and may require ontology knowledge. False conclusions can arise if counterfactuals are unnatural or easily distinguished. Computational cost increases with the volume of counterfactuals tested.
Component interventions during generation target specific model components (attention heads, MLP layers, residual streams) to identify causal factors in hallucination generation. Steering pre-hallucination signals can prevent hallucinations, informing detection strategies [37]. Intervention success varies by component and may harm language modeling quality. It also requires extra computational resources. Importantly, findings may not generalize across model architectures.
Summary
Despite the breadth and depth of the repertoire of methods, approaches and tools assisting the identification of trusted AI generations, several issues remain open. Common limitations across detection approaches include:
Dataset and ontology sensitivity: Detectors and reward models rely on annotated distributions and can fail under ontology shift [1, 37].
Overconfidence problem: Model confidence is an imperfect proxy for factuality, producing both false negatives (overconfident hallucinations) and false positives (uncertain correct outputs) [41].
Computational cost: Many effective methods (ensemble sampling, retrieval, counterfactual generation) impose significant computational overhead [46, 13].
Sentence-level detection: Most methods only support sentence- or response-level hallucination detection, which can jeopardize the perceived reliability of the entire answer even when it is largely correct.
Theoretical justification
In what follows we provide a theoretical justification of the possibility to learn ontology-calibrated confidence from expert’s data. We do so by showing that the probability bounds on threshold-defined acceptance or rejection events, specified by in Algorithm 1, can indeed be inferred from empirical calibration. In fact these bounds converge to true probabilities as the size of the calibration sets grow. For simplicity, the results are presented in two steps. In Section B.1 we show how these bounds can be derived within standard i.i.d. setting. This enables a clear and focused explanation of main theoretical machinery supporting our approach. In Section B.2 we demonstrate how the results can be extended to more practical setups in which i.i.d. assumptions could be violated.
Simplified settings
Let elements of the set be independent samples drawn from the same, albeit unknown, distribution. In this case conditional probabilities of confidence judges’ acceptance or rejection of AI model’s output at thresholds could be estimated from empirical data. Moreover, when subsets and are sufficiently large, these estimates converge to true conditional probabilities. The results are formally stated in Theorem 1.
Theorem 1. *Let measurable maps , , feature map , and confidence judges’ training set be defined as in (1) – (2). Suppose that the elements of are independently sampled from the
Algorithm 1 Confidence Judge
Require: Generative model , feature map , forming dataset , projectors , and parameters , , defining the judge’s confidence grid.
for to do
Compute , and functions , (as defined in (3)).
Define the class-wise calibrators
The map is defined as
end for
Define global calibrators
Ensure: calibrator maps .
(unknown) data distribution , that and are not empty, and that , and are chosen independently of . Pick .
For each class index , select from independently of , and let be the outputs of Algorithm 1 with inputs , , , and .
Then, for a new independent sample and each , conditional on the realized the following hold:
With probability at least
over the draw of
Similarly, with probability at least
over the draw of
where
Proof of Theorem 1. Given that , are measurable and elements in are independently sampled from the distribution , we can conclude that and , are independent samples from their corresponding conditional distributions , , and . Moreover, since is chosen independently of and that and are measurable, we may conclude that elements of the multi-sets
are independent samples from the respective conditional probability distributions induced on by .
To proceed with the proof we will need the following lemma.
Lemma 1. Let , , and be a finite multi-set whose elements are sampled independently from some unknown probability distribution. Let , and be defined as follows:
Let be a new independent sample from the same distribution and consider the events:
Then, conditional on the realized , with probability at least
over the draw of
and
where is the principal branch of the Lambert function.
Proof of Lemma 1. Let be the cumulative distribution function associated with the unknown probability distribution from which both the multi-set and were independently drawn. It is clear that
Introduce the auxiliary event
and its complement : not . The Dvoretzky-Kiefer-Wolfowitz inequality ([12, 28]) states that, for any ,
and therefore, event occurs with probability at most over the draw of . Similarly, event occurs with probability at least over the draw of .
Now, consider the following equation
Its solution is
Given that the Dvoretzky-Kiefer-Wolfowitz inequality holds true for any , it is certainly true for . Substituting into the bounds and recalling that completes the proof. □
Proof of Theorem 1 continued. By the construction of in Algorithm 1, the probability that the confidence judge correctly accepts the label assigned by the underlying AI system is:
Since , as defined in (3), is empirical cumulative distribution function of the conditional distribution , bounds (6) for event from Lemma 1 apply (with , , ).
Turning to the probability of the confidence judge correctly rejecting an incorrect label assigned by the underlying AI system, we observe that
Similarly to the previous case, we note that the conditional distribution admits a cumulative distribution function with empirical approximation which is used by Algorithm 1. Therefore bounds (5), for the event from Lemma 1 apply (with , , , and observing that ).
Finally, we note that for any , the principal branch of the Lambert function satisfies [18]
Combining this with bound stemming from Lemma 1 completes the proof.
Generalization beyond i.i.d. assumptions
Theorem 1 explicitly assumes that 1) elements of the set are all drawn independently from the same distribution, and 2) a new measurement is sampled independently from the same distribution. Here we show how these results could be generalised to dependent samples.
In order to do so, we need to introduce notion enabling quantification of various degrees of dependencies. For LLMs the most relevant framework concerns dependencies in sequences and sequential data. Therefore, consider , a strictly stationary sequence of real-valued random variables defined on a common probability space . For integers , let
denote the -algebras of the past up to time and the future from time onward, respectively.
Definition 1 (Strong-mixing coefficient). The strong-mixing (or -mixing) coefficient at lag is
The sequence is said to be -mixing (or strongly mixing, in the sense of Rosenblatt [35]) if as .
We say that the mixing is geometric (or that the sequence is geometrically -mixing) if there exists such that as .
The mixing is polynomial of order if there exist constants and such that
The -mixing coefficient measures essentially how far the probability of the joint event deviates from the product .
We note that for stationary sequences the supremum over in Definition 1 is redundant and may be replaced by any single value of . We also note that the notion of mixing presented in Definition 1 is the least constrained amongst other classical mixing notions. Indeed it is implied by -mixing (absolute regularity) and -mixing (uniform mixing), with . See Bradley [7] for details, Eqns. (1.11)–(1.18)).
At the heart of the proof of Theorem 1, and the sole place where independence of samples is required, is Lemma 1. There the independence is needed to appropriately invoke the Dvoretzky–Kiefer–Wolfowitz inequality [12, 28]. Hence if a suitable replacement to the classical Dvoretzky–Kiefer–Wolfowitz inequality is used that does not require independence, then Lemma 1 and Theorem 1 could be generalized to dependent settings too.
Geometric mixing
The replacement follows immediately from [31].
Lemma 2 (Naaman 2021, Lemma 4.3, ). Let be a stationary -mixing sequence of real-valued random variables with marginal CDF , and suppose for some . Let be a non-decreasing positive integer sequence satisfying
Then for every and all sufficiently large,
The sequence trades off the polynomial pre-exponential factor against the rate inside the exponent in (11). With the choice for any fixed , the conditions in (10) are satisfied, and the exponent in (11) becomes
while the prefactor remains . As , the exponential rate approaches , almost matching (up to constants and the polynomial prefactor) the exponential rate of the classical Dvoretzky–Kiefer–Wolfowitz inequality.
Polynomial mixing
When the mixing is polynomial, the dependencies have longer tails and convergence of empirical estimates of the cumulative distribution function to the true one may no longer follow exponential law. Yet, for large enough data samples the convergence still occurs, as is shown in the theorem below.
Theorem 2. Let be strictly stationary and -mixing with polynomial rate (9) for some and . For every there exists a constant such that for every and every ,
Proof of Theorem 2. The proof proceeds in three steps: a moment bound for partial sums via Yokoyama’s inequality (step 1), a pointwise tail via Markov inequality (step 2), followed by a standard deterministic grid reduction (step 3).
Recall that
In what follows we will use the standard notation for the left limit of a non-decreasing function at :
It is clear that
with the gap equal to the atom mass of at (which vanishes when is continuous at ). Both and are right-continuous and non-decreasing, so all left limits exist and lie below the corresponding values: and .
Step 1 (Accounting for dependencies via the Yokoyama’s moments inequality). Fix and define two centred indicator processes
Observe that , and , . That is, both sequences are bounded by 1 in absolute value and centred. Moreover, they are measurable functions of and as such inherit the -mixing of with coefficients no larger than . To see this, note first that the maps and are Borel-measurable functions : they are indicators of the Borel sets and respectively. By the measurability of compositions (Billingsley, 1995, Theorem 13.1, p. 182), and are themselves measurable random variables on the underlying probability spaces , (see Definition 1).
Let denote the Borel -field on . Recall that the -field generated by a random variable on is the -field of preimages . For , and
where stands for the corresponding sigma-fields, and the inclusion uses , i.e. Borel-measurability of . Therefore, all three -fields , and are sub--fields of the same ambient . Hence the -field monotonicity of the mixing coefficient in Definition 1 implies that the same mixing coefficient is inherited by .
Observe that both and are bounded. This implies that their -th moments, are all defined and bounded. By Yokoyama’s moment inequality [43 Theorem 1], for every such that
there exists a constant , depending only on and on the sum in (13), such that
Under polynomial mixing (9), condition (13) reduces to , i.e. , equivalently .
Step 2 (point-wise tail bounds). Set . According to Markov’s inequality and (14), we obtain that for any ,
Step 3 (Bounding the probability of supremum over ). For an integer , define the grid via the standard quantile function:
Note, that the grid points , satisfy , but they are not necessarily all distinct (consider e.g. distributions comprising a single atom containing all probability mass).
Right-continuity of , combined with the definition of the infimum, yields
For any , monotonicity of and ensures that
and from (16) the oscillation of on this interval is bounded by
Combining,
Since is the cumulative density function of a probability measure, its atom set is at most countable: for each , atoms of mass are at most in number, and the atom set is the countable union over of these finite sets. The function is càdlàg, and its discontinuities are contained in the (at most countable) union of the atom set of and the data points . Consequently equals its supremum over a countable set and is a well-defined measurable random variable.
Taking the supremum over ,
since at and both and vanish or equal 1 identically.
Fix and choose . Since and , . Then , so , and .
By (17), the event is contained in the union, over , of the events and .
Two of these events occur with probability 0 (at and at ). Boole’s inequality combined with (15) (each applied with in place of ) results in
Noticing that , setting completes the proof, since depends only on and on the mixing-tail sum, which under (9) is bounded by a quantity depending only on and . □
According to Theorem 2, generalization of Theorem 1 to dependent data with dependencies conforming with polynomial mixing, could be achieved by replacing exponential tails with the ones in the rhs of (12). Doing so will loosen then confidence bounds. Yet, the overall principle of learnable inference of relevant probabilities would remain.
Details of building AI ontology calibrators
In the following sections, we provide details on the ontologies for which AI calibrators were built.
Ontology 1: BF
BF programs-outputs generation
Each BF program consists of commands represented by one of eight symbols, detailed in Table 3.
| Symbol(s) | Command description |
| >/< | Increment/decrement the data pointer by one. |
| +/- | Increment/decrement the byte at the data pointer by one. |
| . | Output the byte at the data pointer. |
| , | Accept one byte of input, storing its value in the byte at the data pointer. |
| [/] | If the byte at the data pointer is zero/non-zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] / [ command. |
Table 3. BF commands’ specifications. Our model uses all commands except input (, ) and predicts an end-of-sequence token for program termination.
The initial training data was generated using a genetic algorithm that evolves programs based on their output. This approach enables the generation of diverse program candidates.
We also implement a custom BF interpreter with the following specifications:
Program outputs are represented as ASCII codes (values 0 − 255). The interpreter truncates output sequences exceeding 256 codes.
All output values including zeros produced during execution are preserved in the output sequence.
Programs entering infinite loops during execution are terminated, and a special token
<InfLoop>is outputted.
BF programs prediction
Model’s training and the calibrator application details For model training, we tokenize BF programs by mapping each symbol to a digit and introducing special tokens: beginning-of-sequence (BOS = 1), end-of-sequence (EOS = 2), and padding (PAD = 0). Our programs do not contain the symbol ”,”; however, our model is also expected to generate EOS for each sequence. All programs are padded to length 18 using the PAD token.
Our Transformer architecture comprises a 12-layer encoder followed by two linear projection layers with interleaved dropout and layer normalization (applied twice), and a 12-layer decoder followed by two linear layers with three dropout-normalization stages. Sinusoidal positional encodings are applied to embeddings of both program tokens and output symbols. The training objective combines token-level cross-entropy loss with a set-level term that aggregates probability mass across all valid programs producing identical outputs. We train our Transformer model autoregressively.
We apply the calibrator to the entire dataset and analyse results for the first 10,000 program-output pairs. In 2,328 cases, the model generates programs identical to those in the training data. Surprisingly, in 1,490 cases, it produces functionally equivalent new programs that yield identical outputs to the original training programs. We count these as correct predictions since they satisfy the input-output specification. A length comparison of these novel programs is presented in Figure 3.

Figure 3. The dependence of initial and predicted programs lengths of new BF programs (that differ from the training data). Among 1, 490 new programs, 198 programs are shorter and 1, 061 are longer than in the initial data, and 231 programs of the same length as in the initial data.
As a result, we obtain 3,818 correctly generated programs and 6,182 incorrect ones.
Predicted programs analysis As noted above, our trained Transformer model generates programs that differ from training examples while producing identical outputs. Figure 3 shows the length relationship between initial and predicted programs for these 1,490 cases. Among them, 1,061 programs (71.2%) exceed their training counterparts in length (by up to 15 symbols). Notably, we also observe 231 structurally distinct programs of identical length (15.5%), and 198 shorter programs (13.3%) reduced by a maximum of 6 symbols.
We further analyse the relationship between entropy and the model’s internal statistics. First, we visualise entropy and the calibrator’s probability distributions for presented programs. Figure 4 shows examples for both correctly and incorrectly predicted programs, demonstrating that confidence and entropy may exhibit an inverse linear relationship (e.g., Figure 4a and Figure 4d) or no consistent correlation (e.g., Figure 4b and Figure 4c).

Figure 4. (a) The example of correctly predicted program. Confidence scores and entropy correlate. (b) The example of correctly predicted program. Confidence scores and entropy do not correlate. (c) The example of incorrectly predicted program: the initial program is -[.-.][+<]+. while the predicted program is -[.-.]+]]]+.. Confidence scores and entropy do not correlate. (d) The example of incorrectly predicted program: the initial program is <+...+. while the predicted program is ++...+.-. Confidence scores and entropy correlate. A symbol-level analysis of model confidence and uncertainty (entropy) for program predictions. Each token is visualized with triple encoding: (1) symbols’ foreground colour indicates prediction correctness (green for correct, red for incorrect symbols), (2) background intensity represents confidence scores, and (3) the border colour encodes predictive entropy.
Second, we compute the Pearson correlation coefficient between entropy and the calibrator’s probability across 10,000 program samples. Figure 5 reveals a weak negative linear correlation (, ).

Figure 5. The dependence of the probability acceptance on the entropy. The Pearson correlation equals to −0.37 with p-value < 0.0001.
We also analyse the calibrator’s probability in more detail. Figure 6 characterizes the calibrator’s probability distributions. The histogram for incorrectly predicted programs (left) exhibits a sharp unimodal peak at near-zero probability (, density ), indicating the model’s low confidence in erroneous outputs, with only weak, diffuse elevation (density ) elsewhere in the range. Correctly predicted programs (all, second panel) instead show a clear bimodal distribution: a peak at (density ) and a second mode around reaching a comparable density of , indicating two distinct confidence regimes among correct predictions. Decomposing this by memorization status reveals a clear asymmetry. For programs identical to those seen during training (third panel), the high-confidence mode is in fact the dominant feature, peaking at with density and exceeding the near-zero peak (density ) by roughly – the calibrator is markedly more confident when the correct program matches training data. For correct predictions on programs structurally different from training (right panel), the pattern reverses: the near-zero peak becomes the single largest peak in the entire figure (density ), roughly its own high-confidence region (density at ) and the corresponding near-zero peak in the training-identical subset (third panel).

Figure 6. The histograms of calibrator’s probabilities.
This divergence implies the model develops specialized confidence heuristics for generating functionally equivalent but structurally novel programs. The consistent concentration of all distributions in the low-probability regime () further indicates that high-confidence predictions are rare, aligning with the weak entropy-probability correlation observed in Figure 5.
Ontology 2: math problems
To assess the correctness of math problem solutions, we employ two techniques:
the LLM Judge – motivated by the impracticality of manual annotation at scale ([40, 21]). We use Qwen2.5-32B ([39]) as the judge. Each answer (from both the expert and the student) is split into double-newline-delimited fragments (”sentences”), which are assembled into a structured prompt asking the checker to align each sentence from the expert’s trace to one or more sentences in the student’s trace, assigning a confidence of ”high”, ”medium”, or ”low” to each correspondence. The full prompt is provided in Appendix § 12.2.1. Task correctness is then computed as the average confidence score (1, 0.5, or 0, respectively) across all associations and the final verdict is ”correct” (label 1) if the result otherwise ”incorrect” (label 0), following a similar method to ([23]).
the ProcessBench annotation – which reuses the benchmark’s original evaluation protocol ([48]). Answers are split into sentences using the same scheme as above and fed into the ProcessBench evaluator, which identifies the index of the first erroneous sentence in the student’s trace, or signals a fully correct solution. We use DeepSeek-V3.2 as the annotator given its strong performance on math tasks ([11]). Inference was done locally, on NVidia H100 80GB GPUs, full annotation took six hours per dataset.
Prompt for LLM-based checker of the correctness of math problems' solving
The full prompt for comparing the student’s model math problem solving with the expert’s via Qwen2.5-32B is the following:
You are analyzing two chain-of-thought (CoT) reasoning traces for the same math problem. One is from a large model and one is from a small model.
Your task is to map which sentences in the large CoT correspond to which sentences in the small CoT. Some sentences may correspond to multiple sentences, or some may have no clear correspondence.
Question:
{text_of_task_prompt}
Large Model CoT (numbered sentences):
{expert_list_of_sentences}
Small Model CoT (numbered sentences):
{student_list_of_sentences}
Please output a JSON array where each element maps a large_cot sentence index to matching small_cot sentence indices. Use this format:
[
\{
"large_idx": 0,
"small_idx": [0, 1],
"confidence": "high",
"rationale": "Both introduce the problem and set up variables"
\},
\{
"large_idx": 1,
"small_idx": [2],
"confidence": "medium",
"rationale": "Similar equation setup but with different clarity"
\}
]
Confidence levels: ”high” (clear correspondence), ”medium” (likely but not certain), ”low” (weak correspondence)
Output only the JSON array, no additional text.
Results of labeling strategies for math tasks
In this work, we consider only 6, 845 math problems for which we have both labelings: one from an LLM-based checker and one from ProcessBench. The LLM-based checker labeled 6, 453 problems as correctly solved, while ProcessBench labeled only 3, 452. Figure 7 shows that neither labeling yields separable classes under PCA. Nevertheless, we consider the ProcessBench labeling as more reliable, since the LLM-based checker marked almost all problems as correct. Therefore, for medical question answering we use the ProcessBench labeling.

Figure 7. PCA visualization of both labeling strategies.
Ontology 3: medical-related question answering
For medical question answering, we provide the possible addition highlight of six parts of the models’ outputs:
Decision – a clinical, surgical, or scientific action to take or avoid.
Reasoning – a pivotal logical step that drives the conclusion.
Conclusion – the final answer or diagnosis, expressed as a concept rather than a letter.
Caution – a risk, contraindication, warning, or negation that prevents a wrong action.
Mechanism – a biological, pharmacological, or molecular mechanism on which the answer hinges.
Elimination – reasoning that rules out a wrong option (critical for NOT/incorrect/except questions).
To produce these highlights, we use MedGemma (google/medgemma-1.5-4b-it) with the following prompt:
You are a precise annotation judge for science and medicine questions.
Your task is to read a question and a model-generated answer, then identify spans of text that are SEMANTICALLY PIVOTAL – meaning that changing or removing them would either reverse the meaning, lead to the wrong conclusion, or cause a clinically or scientifically dangerous error.
The questions come from a broad range of ontologies:
Molecular and cell biology (mechanisms, pathways, organelles, proteins)
Genetics and genomics (mutations, inheritance, sequencing, gene regulation)
Physiology and anatomy (organ systems, hormones, homeostasis)
Neuroscience (synapses, neurotransmitters, brain function)
Ecology and evolution (selection, population dynamics, symbiosis)
Clinical medicine (diagnosis, treatment, surgical indications, patient management)
Pharmacology (drug targets, mechanisms of action, resistance)
Research methods (PCR, sequencing, microscopy, assays)
Healthcare systems and policy (EHR, public health, technology)
Semantically pivotal spans include:
Direction or magnitude words whose reversal flips the answer: ”increase” vs ”decrease”, ”inhibits” vs ”activates”, ”proximal” vs ”distal”
A negation that inverts the meaning of a claim: ”not”, ”except”, ”unlikely”, ”absent”
A specific named entity the answer critically depends on: a drug name, enzyme, gene, pathway, or anatomical structure
A key quantity, threshold, or relationship: ”above pH 7”, ”half-life of 8 days”, ”binds competitively”
The clause that eliminates a distractor in NOT/incorrect/except questions:
the reasoning that rules out a wrong option, not just the option letter
Do NOT highlight:
Bare answer labels in isolation (”answer D”, ”option C”) – highlight the reasoning or concept that justifies the choice instead
Connector words alone (”because”, ”therefore”, ”however”) – highlight the clause they introduce if that clause is pivotal, not the connector itself
Background or contextual sentences that do not affect the correctness of the answer if removed
If the answer contains only a bare label with no reasoning, return an empty highlights list and note this in the summary.
Return ONLY a valid JSON object (no markdown fences, no extra text):
{
"highlights": [
{
"span": "<exact substring copied character-for-character from the answer>",
"type": "<one of: decision | reasoning | conclusion | caution | mechanism | elimination>",
"reason": "<one sentence explaining why changing this span would make the answer wrong>"
}
],
"summary": "<2-3 sentence summary of what is semantically pivotal in this answer>"
}
Type definitions: decision - a clinical, surgical, or scientific action to take or avoid reasoning - a pivotal logical step that drives the conclusion conclusion - the final answer or diagnosis, expressed as a concept not a letter caution - a risk, contraindication, warning, or negation that prevents a wrong action mechanism - a biological, pharmacological, or molecular mechanism the answer hinges on elimination - reasoning that rules out a wrong option (critical for NOT/incorrect/except questions)
Rules:
”span” must be an exact character-for-character substring of the answer text
Highlight every span that is semantically pivotal – neither more nor less
Do not add spans to reach a minimum count
Do not drop spans to stay under a maximum count
A short answer may have 1-2 highlights; a long reasoning chain may have more
Spans may overlap; that is fine
Do NOT include any text outside the JSON object.”
Figure 8 shows an example containing three types of highlights: reasoning (”providing the first step in glucose catabolism”), conclusion (”B: Glycolysis”), and mechanism (”takes place in the cytoplasm” and ”converts glucose into pyruvate”).

Figure 8. Visualization comparing the expert’s and the student’s answers to the following question: which of the following metabolic pathways primarily occurs in the cytoplasm and is responsible for the initial breakdown of glucose to pyruvate? A: Citric Acid Cycle; B: Glycolysis; C: Beta-oxidation; D: Electron Transport Chain; E: Pentose Phosphate Pathway; F: Urea Cycle; G: Calvin Cycle; H: Glycogenolysis; I: Gluconeogenesis; J: Fatty Acid Synthesis.
These highlights help identify which parts of a reasoning trace deserve closer attention. While a mistake on the example shown here would be inconsequential, this is not the case for many other medical questions, where an incorrect answer could cause real harm. These highlights can also be used in the labeling process: for example, an answer may be marked incorrect if an error appears in any span belonging to one of these six categories.
Positional biases of calibrators
To build the AI ontology calibrator, we need to label each student token as correct or not. This token-level correctness is a fundamentally ill-defined, almost philosophical question: there is no principled way to decide which individual token is correct or incorrect. In this paper, we implement a simple technique: we compare all student tokens with the expert tokens at the same positions and label a student token as correct if the student and the expert have the same token at that position, and as incorrect otherwise.
To ensure this approach does not introduce any biases, we additionally conduct the following experiment: we plot the distributions of normalized indices of tokens from . Figure 9 shows the results for Qwen3-8B on Math and MedGemma on Medicine. In both cases, the distribution is nearly uniform, so no positional bias is found. Nevertheless, even if it is present, it does not harm our theory.

Figure 9. Distribution of the relative position of tokens in within the student generation, index()/len(generation), for (a) Math with Qwen3-8B and (b) Medicine with MedGemma as the student. The distributions are approximately uniform, showing that tokens labeled as correct are not concentrated at the beginning, middle, or end of the response.
Relations of derived indicators for classifiers
Analysis of indicators and baselines on all ontologies
To analyse the relations between the 15 indicators and six baselines used for training classifiers, we calculate pairwise Spearman correlations, including correlations with the target label for all our domains, labelings, and students. Figure 10 presents feature pairs with a statistically significant (p-value ) absolute correlation coefficient exceeding 0.6 for all models and ontologies. The calibrator-based probability indicators provide signals largely independent from the entropies- and softmaxes-based indicators. In general, the following indicators provide their unique signals with no correlations with others: , , , , , , . In this list, we did not include and as they correlate with each other, which is expected (will be additionally mentioned below).

Figure 10. Statistically significant strong Spearman correlations (absolute coefficient > 0.6, p-value ) between the 15 classifier indicators and the target label, aggregated across all ontologies and models. Only pairs for which all correlations satisfy both criteria are shown. The target labels are presented with .
The obtained correlations can be divided into the following groups:
Mathematically trivial: the correlation coefficient is not an empirical finding but a mathematical identity or a consequence of a monotone transformation. The correlated pairs of , , are the monotone transformations.
Information theory: the correlation is fully predicted by information theory. Two distinct sub-patterns appear here. First, confidence-proxy convergence: , , and . aggregates the probability of the single most likely token at each position, regardless of what token was actually produced, while aggregates the probability the model assigns to the token it actually generated; the two are identical under greedy decoding and remain strongly correlated otherwise, since sequences where the model’s best guess is confident also tend to be sequences where the realised token was highly probable. Second, the entropy–probability inverse relationship: , , , , , and . A peaked (low-entropy) distribution necessarily places more mass on its top token, so any entropy-side statistic is inversely related to any probability-side statistic; these six pairs are the same relationship instantiated across the arithmetic/geometric aggregation choices on each side.
Aggregation robustness: , , and confirm that switching from the arithmetic to the geometric mean of the same underlying per-token quantity (entropies, softmaxes, or calibrator probabilities) does not change the ranking of instances, i.e. the results are not artefacts of the choice of aggregator.
Bounded Support Artifact: the correlation arises from the bounded range that top-1 softmax values are confined to, not from a deep property of model behavior. Since each top-1 softmax value is bounded above, sequences that are consistently confident cluster near the ceiling and sequences that are consistently uncertain cluster near the floor ; in both regimes the values are compressed and is low, so and move in opposite directions: . Only an unstable mix of confident and uncertain positions yields a high . The pair is not an independent finding: it follows by transitivity from combined with the aggregation-robustness identity .
Surprising / Non-Obvious: within a single token position, a more peaked softmax distribution mechanically implies both a higher top-1 value and a lower entropy – a negative relationship. The non-obvious finding is that, across instances, the sign flips: is positively correlated – instances that are uncertain on average (high ) also the instances whose top-1 confidence is most unstable across positions (high ), rather than uniformly low, reflecting instance-level difficulty where some positions remain confident while others do not, inflating the variance of . This aligns with a second, distinct pair, : instances with high positional variability in top-1 confidence also show low average softmaxes on the tokens actually produced, i.e. the model is simultaneously
erratic in its best guess and less committed to its actual output. Combined, these compose into : average per-token uncertainty positively correlated with low realised-token confidence, mediated by .
In can also be noted that none of the provided indicators correlate with the target label.
Analysis of indicators including verbalized confidence on medical ontology
Some papers ([22, 26]) report a correlation between generation correctness and the model’s self-assessment labels. To verify this claim, we additionally prompt our students on the medical ontology data to label the correctness of their answers and assess their confidence on a scale from 1 to 10.
For self-correctness assessment, we tried to follow the technique from [22] and reuse their prompt; however, our models produced outputs whose verdicts were almost impossible to parse. Therefore, for self-correctness assessment we used the following prompt:
I will give you a question and a possible answer with reasoning traces. Please output whether the possible answer is correct or not. Output only a single word: ”correct” or ”wrong”.
Question:
{text_of_prompt}
Possible Answer:
{text_of_student_response}
The possible answer is:
The prompt used for self-confidence assessment is as follows:
I will give you a question and your answer with reasoning traces. Please output whether you are confident in the provided answer. Output only a single value from 1 to 10, where 1 means you are not confident and 10 means you are completely confident.
Question:
{text_of_prompt}
Your Answer:
{text_of_student_response}
Confidence score is:
Figure 11 presents the correlation of indicators with baselines and self-assessment labels: assessment of response correctness () and assessment of confidence in a response (). For self-correctness and self-confidence assessment, we considered the responses labeled with ProcessBench. As shown in Figure 11, only about half of such data have self-assessment labels for the considered students: MedGemma – 58.7% (3,509 responses with both self-assessment labels out of 5,978 labeled with ProcessBench), Qwen3-8B – 40.8% (1,308 out of 3,207), Qwen3-0.6B – 38.6% (1,415 out of 3,663), and Qwen3.5-0.8B – 31.5% (615 out of 1,954). Nevertheless, we only consider responses from which self-assessment labels can be easily obtained: if a response contained a label but its parsing was difficult, it was not included in our list. Overall, unlike what is reported in other papers, we do not observe strong correlations of either or with .

Figure 11. Spearman correlation matrices for four students on the medical ontology data. ProcessBench labels are denotes as .
Technical details of built classifiers
In Section 5 we provide the metrics of trained Logistic Regression (with default hyperparameters (with random_state=123) on each of our 15 indicators, six baselines, and two cases of several indicators usage: all 15 indicators and the first 12 indicators (the set of all indicators without -based). We additionally conduct the training of XGBoost with default hyperparameters (with random_state=123) and MLP with the architecture presented in Figure 12 on all possible combinations of our 15 indicators. The classifiers were trained on an internal cluster, consisting of NVidia Tesla H200 141GB and NVidia RTX 4090 96GB GPUs. Total training time was around 96 hours for both ablations and the final training run.
Figure 12. The scheme of the MLP architecture.
For the MLP, we use block, a hidden dimension of , and a dropout rate of .
All classifiers are trained on 20-folds cross-validation with stratification w.r.t. target labels. For XGBoost and MLP, we used weighted BCEWithLogitsLoss loss function (with pos_weight = ) for all the ontologies. For MLP, we additionally choose 20% of training part on each fold for validation and normalise the data. We also use AdamW optimizer with learning rate = and weight decay = . ReduceLROnPlateau scheduler maximizing F1 score with patience = 5, factor = 0.5. EarlyStopping with patience = 7 and delta = . We train all out MLPs with 300 epochs for each features set.
Figure 13 shows the training process of XGBoost and MLP classifiers on the medical ontology with MedGemma. Although both classifiers achieve comparable ROC AUC scores on the test data, XGBoost exhibits clear overfitting, as its training score is substantially higher and is close to the ideal value of 1. We observe similar behavior across the other ontologies. Therefore, in the paper, we focus on MLP and in § 5 we present only the results for the best MLPs.

Figure 13. Training and testing ROC AUC of classifiers trained on MedGemma features.
Statistical significance of the classifiers' results
We additionally conducted the statistical tests to check whether adding the calibrator-based indicators significantly improves correctness classification. For this, we ran a one-tailed paired -test with : , where is the fold and , where denotes balanced accuracy. The test parts of the folds do not overlap, but the training sets do. We therefore also applied the Nadeau-Bengio corrected -test, and Table 4 reports these results for BF ontology. We adjusted -values with the Holm method, separately for the two comparison groups (traditional indicators with and without geometric means). A result is significant if and .
| Indicators | Test mean ± std Balanced Accuracy | vs traditional [95% CI] | |
| Traditional | reference | — | |
| The first 12 indicators; with -based | [ | ||
| The first 12 indicators; with -based | [ | ||
| The first 12 indicators; with -based | [ | ||
| Traditional | reference | — | |
| The first 15 indicators; with -based | [ | ||
| The first 15 indicators; with -based | [ | ||
| The first 15 indicators; with -based | [ | ||
| 22 indicators (traditional + all probabilities) | [ | ||
| Traditional + | [ |
Table 4. Statistical significance of the balanced accuracy gain from adding calibrator-based indicators to traditional indicators, on the BF ontology with the Custom Transformer student. Balanced accuracy is reported as mean ± std over 20 folds. is the mean per-fold balanced accuracy difference relative to the traditional baseline, with a one-sided 95% confidence interval. Calibrator indicators are computed from the probability of rejection (), the probability of acceptance (denoted as in Section 4), or the combined probability of two previous ones (). All presented entries are significant ( and ).
For Medicine, the effect is more dependent on how many tokens in an answer can be calibrated. Some questions and answers contain rare, domain-specific terms, whereas we build calibrators only for tokens observed at least 1, 000 times. Figure 14 shows the distribution of the fraction of calibrated tokens per answer for MedGemma. Although the largest group of answers has 70–80% calibrated tokens, a non-trivial fraction has lower coverage. We therefore performed an additional analysis in which, for each training fold, we retained only training examples whose calibrated-token fraction exceeded a threshold . We considered in increments of 0.05, as well as no filtering (). This analysis is intended to characterize how coverage affects the usefulness of the indicators.

Figure 14. Distribution of the fraction of calibrated tokens per answer for MedGemma on the medical dataset. Most answers have 70–80% of their tokens calibrated.
In Figure 15, stars indicate statistically significant improvements for the comparisons shown. For MedGemma, the gains become statistically significant at the higher calibrated-token coverage threshold () for the indicated comparisons. This result suggests that the contribution of calibrator-based indicators depends on coverage and should be interpreted conditionally, rather than as a uniform improvement across all medical examples.

Figure 15. Gain in balanced accuracy (%) as a function of the minimum calibrated-token fraction (threshold ) kept in the training folds, for MedGemma. means no filtering. “T3” is three traditional indicators (), “T8” is all eight traditional indicators (), “W[recv]” and “W[lowctx]” denote attention-weighted versions, and , and denote the probabilities of acceptance, rejection and the combined probability. Stars mark statistically significant improvements.
Transferability of classifiers
For a subset of indicators, we evaluate the transferability of all trained MLP-based classifiers across all ontology–model combinations. Figure 16 and Figure 17 compares the classifiers’ transfer across ontologies in two settings: using the set of traditional indicators with one replaced by our and using the traditional indicators only; the same number of indicators is therefore used in both settings. As the figures show, replacing with improves the transfer quality in most cases, while in the cases where the traditional indicators perform better, the maximum difference in their favor is only 0.036 ROC AUC (0.052 F1).

Figure 16. (a) . (b) Difference between mean ROC AUC scores of and mean F1 scores of . Figure 16: Aggregated transfer results (method IDs as in Table 1). Each of the 20 classifiers from 20-fold cross-validation is transferred to the whole data of each ontology; we report the mean and standard deviation of the ROC AUC score. In both heatmaps, rows denote the training ontology and columns the test ontology. Left: classifiers using the indicators given in the subcaption. Right: difference in mean ROC AUC between classifiers on and on (traditional indicators only), where ; 25 of 49 (51 %) transfers favor the indicators with our .

Figure 17. (a) . (b) Difference between mean F1 scores of and mean F1 scores of . Figure 17: Aggregated transfer results (method IDs as in Table 1). Each of the 20 classifiers from 20-fold cross-validation is transferred to the whole data of each ontology; we report the mean and standard deviation of the F1 score. In both heatmaps, rows denote the training ontology and columns the test ontology. Left: classifiers using the indicators given in the subcaption. Right: difference in mean F1 between classifiers on and on (traditional indicators only), where ; 26 of 49 (53 %) transfers favor the indicators with our .
However, using more calibrator-based indicators does not necessarily improve transfer quality. Figure 18 provides the results for classifier transfer using the first 12 features (), calibrator-only indicators (), and calibrator-only and mixed indicators (). The results show that the indicator sets provided in Figure 18 have lower transferability than those provided in Figure 16, despite the fact that Figure 16a contains only one calibrator probability.

Figure 18. (a) The first 12 indicators. (b) Calibrator-only indicators. (c) Calibrator-only and mixed indicators. Aggregated transfer results (method IDs as in Table 1). Each of the 20 classifiers from 20-fold cross-validation is transferred to the whole data of each ontology; we report the mean and standard deviation of the ROC AUC score. In all heatmaps, rows denote the training ontology and columns the test ontology.
| Ontology | BF | Math | Medicine | |
| Data for building calibrators | Custom 433,688 pairs of (program, output) | Open-source 5,000 pairs of (problem, solution) – batch 1 | Open-source 12,369 pairs of (problem, answer) | |
| Expert | BF compiler | DeepSeek-R1 | GPT-OSS-120B | |
| Student (N params) if not mentioned in model name | Custom Transformer (22M) | Qwen3-8B | MedGemma (4B) Qwen3-8B Qwen3-0.6B Qwen3.5-0.8B | |
| Unique tokens | 8 | 18,089 | 38,926 29,481 27,783 29,826 | |
| Unique calibrated tokens | 8 | 808 | 851 1,061 1,058 1,010 | |
| Classifiers | 20-fold cross-validation (V1) | Total: 10,000 1s: 3,818 0s: 6,182 | Two concatenated batches (batch 1 and batch 2) – Total: 6,845 LLM-Judge (Qwen2.5-32B) 1s: 6,453 0s: 392 ProcessBench (DeepSeek-V3.2) 1s: 3,452 0s: 3,393 | All data from 12,369 question-answer pairs, successfully labeled with ProcessBench (DeepSeek-V3.2) Total: 5,978 1s: 3,919 0s: 2,059 Total: 3,207 1s: 2,326 0s: 881 Total: 3,663 1s: 564 0s: 3,099 Total: 1,954 1s: 595 0s: 1,359 |
| ID for transfer experiment | A | B C | D E F G | |
| Train/test (V2) | - | Train – batch 1 Total: 3,493 1s: 3,200 0s: 293 1s: 1,029 0s: 2,464 Test – batch 2 Total: 3,352 1s: 3,253 0s: 99 1s: 2,423 0s: 929 | - - - - |
Table 1. Experimental setups, naming convention, and the statistics on the built calibrators and the classifier data for all ontologies. In the classifiers category, we indicate the total number of considered responses with labels of correctness (denoted as “Total”), the number of correct (“1s”) and incorrect (“0s”) responses. “-” means the absence of an experiment for an ontology.
Additional classifiers' results
Our objective is broader than response-correctness prediction alone: we aim to construct ontology-specific, token-level typicality indicators with finite-sample guarantees, and then test whether their aggregation helps predict response correctness. A direct probe addresses the downstream prediction task, but it does not provide the same token-level statistics or acceptance/rejection bounds. Nevertheless, it is an important complementary baseline, and we added a SAPLMA-style comparison.
A SAPLMA-style probe [3] is a supervised classifier that predicts response correctness from the model’s hidden activations at the last answer token. Unlike the original, which uses a small feed-forward network and compares several layers, our probe is a Logistic Regression classifier (standardized inputs and class weighting, i.e., the same classifier family as ours) trained on the last-layer hidden state, with fixed hyperparameters and no layer, pooling or model selection. The last-layer state is the input of the LM head, the same representation that our method reads, but our method reads it at every answer token, whereas the probe reads it only at the last one. The probe is trained on the same MedGemma student answers, with the same correctness labels and the same 20-fold stratified cross-validation as our classifier.
We have also added a comparison of indicators computed from the lower bounds on the probabilities of correct acceptance () and correct rejection (), and from their combination (). Results are in Table 5. The SAPLMA-style probe ranks among the top seven methods judged by balanced accuracy; however, unlike our method, it provides no guarantees on the probabilities of correct acceptance and rejection. Moreover, our method yields token-level statistics that reflect how typical each generated token is, and their aggregation reflects the correctness of the whole generation. The SAPLMA-style probe, as proposed, reads the activation of a single token and returns one response-level score, so it provides no per-token characteristics.
| Probability type | Indicator group | Indicators | Balanced Accuracy |
| Probability of rejection | Individual | 0.5189 ± 0.0210 | |
| Probability of rejection | Individual | 0.5412 ± 0.0263 | |
| Probability of rejection | Individual | 0.6668 ± 0.0367 | |
| Probability of rejection | Individual | 0.6674 ± 0.0413 | |
| Probability of rejection | Individual | 0.5479 ± 0.0239 | |
| Probability of rejection | Individual | 0.6764 ± 0.0390 | |
| Probability of rejection | Individual | 0.6787 ± 0.0331 | |
| Probability of rejection | Mixed | 0.5866 ± 0.0255 | |
| Probability of rejection | Mixed | 0.5546 ± 0.0305 | |
| Probability of rejection | Mixed | 12 indicators | 0.7218 ± 0.0301 |
| Probability of rejection | Mixed | 15 indicators | 0.7292 ± 0.0260 |
| Probability of acceptance | Individual | 0.5248 ± 0.0318 | |
| Probability of acceptance | Individual | 0.5484 ± 0.0275 | |
| Probability of acceptance | Individual | 0.6665 ± 0.0356 | |
| Probability of acceptance | Individual | 0.6665 ± 0.0413 | |
| Probability of acceptance | Individual | 0.5488 ± 0.0296 | |
| Probability of acceptance | Individual | 0.6690 ± 0.0377 | |
| Probability of acceptance | Individual | 0.6695 ± 0.0378 | |
| Probability of acceptance | Mixed | 0.5280 ± 0.0327 | |
| Probability of acceptance | Mixed | 0.5272 ± 0.0336 | |
| Probability of acceptance | Mixed | 12 indicators | 0.7211 ± 0.0321 |
| Probability of acceptance | Mixed | 15 indicators | 0.7271 ± 0.0217 |
| Combined probability | Individual | 0.5313 ± 0.0187 | |
| Combined probability | Individual | 0.5537 ± 0.0262 | |
| Combined probability | Individual | 0.6662 ± 0.0364 | |
| Combined probability | Individual | 0.6669 ± 0.0413 | |
| Combined probability | Individual | 0.5298 ± 0.0177 | |
| Combined probability | Individual | 0.6779 ± 0.0378 | |
| Combined probability | Individual | {p_{comb},\operatorname{std}(p_{comb}),E_{p_{comb}},PP_{p_{comb}},\bar{G}_{p_{comb}},PCC,SCC} | 0.6758 ± 0.0350 |
| Combined probability | Mixed | 0.5853 ± 0.0299 | |
| Combined probability | Mixed | 0.5395 ± 0.0329 | |
| Combined probability | Mixed | 12 indicators | 0.7233 ± 0.0333 |
| Combined probability | Mixed | 15 indicators | 0.7284 ± 0.0251 |
| Several probabilities | Mixed | 22 indicators (traditional + all probabilities) | 0.7286 ± 0.0244 |
| Several probabilities | Mixed | 0.6858 ± 0.0326 | |
| Several probabilities | Mixed | 21 indicators (all with , , and ) | 0.6924 ± 0.0333 |
| Traditional | Individual | 0.6123 ± 0.0243 | |
| Traditional | Individual | 0.6579 ± 0.0235 | |
| Traditional | Individual | 0.6079 ± 0.0340 | |
| Traditional | Individual | 0.5907 ± 0.0265 | |
| Traditional | Individual | 0.6113 ± 0.0222 | |
| Traditional | Individual | 0.6767 ± 0.0367 | |
| Traditional | Individual | 0.6747 ± 0.0418 | |
| Traditional | Individual | 0.5952 ± 0.0241 | |
| Traditional | Mixed | 0.7211 ± 0.0325 | |
| Traditional | Mixed | 0.7291 ± 0.0245 | |
| Traditional + Ours | Mixed | Best combination: | 0.7319 ± 0.0260 |
| Baselines | SAPLMA | 0.7247 ± 0.0202 | |
| Baselines | MSP | 0.6637 ± 0.0339 | |
| Baselines | LM Perplexity | 0.5977 ± 0.0245 | |
| Baselines | Max Token Entropy | 0.6648 ± 0.0259 | |
| Baselines | Mean Token Probability | 0.5911 ± 0.0264 | |
| Baselines | Min Token Probability | 0.6376 ± 0.0353 | |
| Baselines | Geomean Token Probability | 0.5959 ± 0.0221 | |
| Baselines | Const = 1 | 0.5000 ± 0.0000 | |
| Baselines | Const = 0 | 0.5000 ± 0.0000 | |
| Baselines | Random – fair coin | 0.5018 ± 0.0304 | |
| Baselines | Random – of major class | 0.4935 ± 0.0320 |
Table 5. Mean ± standard deviation of balanced accuracy of Logistic Regression across 20 folds for MedGemma. Top-1 scores are in bold, top-2 in bold underlined, and top-3 in bold italic.
Moreover, it is necessary to isolate the contribution of calibrator-based indicators from that of traditional confidence indicators. To address this concern, we conducted an additional ablation study comparing three feature sets: (1) the eight traditional indicators, (2) the five calibrator-based indicators together with the two mixed indicators, and (3) the complete set of 15 indicators used in the submitted paper. For each setting, we report the best-performing feature combination under the experimental selection procedure. This comparison separates the performance of traditional indicators alone from that of calibrator-derived and combined indicators. Table 6 presents the mean and standard deviation of balanced accuracy obtained by an MLP across 20 folds for all seven student/domain settings.
| Medicine | BF | Math, V1 | |||||
| MedGemma | Qwen3-8B | Qwen3-0.6B | Qwen3.5-0.8B | Custom Transformer | LLM-Judge | Process Bench | |
| Best combination among eight traditional indicators | 0.7068±0.0106 | 0.7259±0.0159 | 0.8556±0.0101 | 0.6971±0.0360 | 0.6238±0.1339 | 0.6357±0.2082 | 0.7128±0.2361 |
| Best combination among five calibrator indicators + two mixed | 0.6724±0.0135 | 0.6744±0.034 | 0.8514±0.019 | 0.5827±0.029 | 0.6323±0.0164 | 0.6236±0.1954 | 0.6891±0.2167 |
| Best combination among all 15 indicators (from our submitted paper) | 0.7141±0.0286 | 0.7284±0.0417 | 0.8604±0.0334 | 0.7035±0.0557 | 0.8299±0.1130 | 0.6389±0.2116 | 0.7153±0.2354 |
Table 6. Mean ± standard deviation of balanced accuracy of MLP across 20 folds for all students. Top-1 scores are in bold, top-2 in bold underlined.
The results show that traditional indicators alone provide strong baselines, while calibrator-based indicators alone generally achieve lower performance. During training, the softmaxes are configured so that the overall generation is correct. Obviously, ours do not have to be correct, because we focus on typicality, not correctness. When combined, there is a cumulative effect that traditional indicators do not show. Where there is ground truth (BF), correctness is linked to typicality, and our metrics are better than the traditional ones. These results suggest that the calibrator-based indicators provide complementary information to traditional confidence indicators, rather than simply replacing them. The combined feature set consistently achieves higher mean balanced accuracy than the best combination of traditional indicators alone.
Licenses on used data, models and software
In the paper the following models, software and licences are used:
Qwen-2.5 – Apache 2.0 license;
DeepSeek V3.2 – MIT license;
MedGemma-2.5-4B – health-ai-developer-foundations license;
SGLang inference server – Apache 2.0 license;
XGBoost algorithm – Apache 2.0 license;
Societal impacts
The proposed framework aims to improve the reliability of generative AI systems by providing lightweight indicators of atypical and potentially incorrect outputs, which could be valuable in high-stakes ontologies such as medicine, software engineering and decision support. If used appropriately, such methods may highlight fluent but unreliable generations and help route unreliable cases to stronger verification pipelines. At the same time, the method should not be interpreted as a guarantee of factual correctness: false negatives may induce false confidence, while false positives may suppress useful outputs. These risks are particularly important in medical ontology, where detector scores should serve only as additional evidence rather than as expert judgment. Careful ontology-specific calibration, transparent reporting of detector non-confidence, and validation under distribution shift are necessary before deployment.
References
- [1]Vibhor Agarwal, Yulong Pei, Salwa Alamir, and Xiaomo Liu. Codemirage: Hallucinations in code generated by large language models. arXiv preprint arXiv:2408.08333, 2024. doi: 10.48550/arxiv.2408.08333. Published: 2024-08-14.DOI
- [3]Amos Azaria and Tom Mitchell. The internal state of an LLM knows when it’s lying. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 967–976, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-emnlp.68. URL https://aclanthology.org/2023.findings-emnlp.68/.DOI
- [4]Alexandra Bazarova, Aleksandr Yugay, Andrey Shulga, Alina Ermilova, Andrei Volodichev, Konstantin Polev, Julia Belikova, Rauf Parchiev, Dmitry Simakov, Maxim Savchenko, Andrey Savchenko, Serguei Barannikov, and Alexey Zaytsev. Hallucination detection in llms with topological divergence on attention graphs, 2025. URL https://arxiv.org/abs/2504.10063.
- [6]Dylan Bouchard and Mohit Singh Chauhan. Uncertainty quantification for language models: A suite of black-box, white-box, llm judge, and ensemble scorers. arXiv preprint arXiv:2504.19254, 2025.arxiv.org/abs/2504.19254
- [7]Richard C Bradley. Basic properties of strong mixing conditions. a survey and some open questions. Probability Surveys, 2:107–144, 2005.
- [8]Chao Chen, Kai Liu, Ze Chen, Yi Gu, Yue Wu, Mingyuan Tao, Zhihang Fu, and Jieping Ye. Inside: Llms’ internal states retain the power of hallucination detection. arXiv preprint arXiv:2402.03744, 2024.
- [9]Manuel Cossio. A comprehensive taxonomy of hallucinations in large language models. arXiv preprint arXiv:2508.01781, 2025. doi: 10.48550/arxiv.2508.01781. Published: 2025-08-03.
- [10]DeepSeek-AI. Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning, 2025a. URL https://arxiv.org/abs/2501.12948.
- [11]DeepSeek-AI. Deepseek-v3.2: Pushing the frontier of open large language models. arXiv preprint arXiv:2512.02556, 2025b.arxiv.org/abs/2512.02556
- [12]A. Dvoretzky, J. Kiefer, and J. Wolfowitz. Asymptotic minimax character of the sample distribution function and of the classical multinomial estimator. Ann. Math. Statist., 27(3):642–669, 1956.
- [13]Yijun Feng. Counterfactual probing for hallucination detection and mitigation in large language models. arXiv preprint arXiv:2508.01862, 2025. doi: 10.48550/arxiv.2508.01862. Published: 2025-08-03.
- [14]Jinlan Fu, See Kiong Ng, Zhengbao Jiang, and Pengfei Liu. Gptscore: Evaluate as you desire. In Proceedings of the 2024 conference of the north american chapter of the association for computational linguistics: Human language technologies (volume 1: Long papers), pp. 6556–6576, 2024.arxiv.org/abs/2302.04166
- [15]Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059. PMLR, 2016.arxiv.org/abs/1506.02142
- [16]Anish Gunjal, Jihan Yin, and Erhan Bas. Detecting and preventing hallucinations in large vision language models. arXiv preprint arXiv:2308.06394, 2023. doi: 10.48550/arxiv.2308.06394. Published: 2023-08-11.arxiv.org/abs/2308.06394
- [17]Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Peiyi Wang, Qihao Zhu, Runxin Xu, Ruoyu Zhang, Shirong Ma, Xiao Bi, et al. Deepseek-r1 incentivizes reasoning in llms through reinforcement learning. Nature, 645(8081):633–638, 2025.DOI
- [18]Abdolhossein Hoorfar and Mehdi Hassani. Inequalities on the lambert w function and hyperpower function. J. Inequal. Pure and Appl. Math, 9(2):5–9, 2008.
- [19]Bairu Hou, Yujian Liu, Kaizhi Qian, Jacob Andreas, Shiyu Chang, and Yang Zhang. Decomposing uncertainty for large language models through input clarification ensembling. arXiv preprint arXiv:2311.08718, 2023.arxiv.org/abs/2311.08718
- [20]L Huang, W Yu, W Ma, W Zhong, Z Feng, H Wang, Q Chen, W Peng, X Feng, B Qin, et al. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions (arxiv: 2311.05232). arxiv, 2023.DOI
- [21]Florian A Huber and Roman Guggenberger. Ai msk clinical applications: spine imaging. Skeletal Radiology, 51(2):279–291, 2022.DOI
- [22]Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022.arxiv.org/abs/2207.05221
- [23]Minsuk Kahng, Ian Tenney, Mahima Pushkarna, Michael Xieyang Liu, James Wexler, Emily Reif, Krystal Kallarackal, Minsuk Chang, Michael Terry, and Lucas Dixon. Llm comparator: Interactive analysis of side-by-side evaluation of large language models. IEEE Transactions on Visualization and Computer Graphics, 2024.DOI
- [24]Junyi Li, Jie Chen, Ruiyang Ren, Xiaoxue Cheng, and Wayne Xin Zhao. The dawn after the dark: An empirical study on factuality hallucination in large language models. arXiv preprint arXiv:2401.03205, 2024. doi: 10.48550/arxiv.2401.03205. Published: 2024-01-06.DOI
- [25]Mengfei Liang, Archish Arun, Zekun Wu, Cristian Munoz, and Jonathan Lutch. Thames: An end-to-end tool for hallucination mitigation and evaluation in large language models. arXiv preprint arXiv:2409.11353, 2024. doi: 10.48550/arxiv.2409.11353. Published: 2024-09-17.DOI
- [26]Stephanie Lin, Jacob Hilton, and Owain Evans. Teaching models to express their uncertainty in words. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https://openreview.net/forum?id=8s8K2UZGTZ.arxiv.org/abs/2205.14334
- [27]Huan Ma, Jiadong Pan, Jing Liu, Yan Chen, Joey Tianyi Zhou, Guangyu Wang, Qinghua Hu, Hua Wu, Changqing Zhang, and Haifeng Wang. Semantic energy: Detecting llm hallucination beyond entropy. arXiv preprint arXiv:2508.14496, 2025.arxiv.org/abs/2508.14496
- [28]P. Massart. The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality. Ann. Probab., 18(3):1269–1283, 1990.DOI
- [29]Justus Mattern, Sami Jaghouar, Manveer Basra, Jannik Straube, Matthew Di Ferrante, Felix Gabriel, Jack Min Ong, Vincent Weisser, and Johannes Hagemann. Synthetic-1: Two million collaboratively generated reasoning traces from deepseek-r1, 2025. URL https://www.primeintellect.ai/blog/synthetic-1-release.
- [30]Niels Mündler, Jingxuan He, and Martin Vechev. Self-contradictory hallucinations of large language models: Evaluation, detection and mitigation. arXiv preprint arXiv:2305.15852, 2023. doi: 10.48550/arXiv.2305.15852. Published: 2023-05-25.
- [31]Michael Naaman. On the tight constant in the multivariate dvoretzky–kiefer–wolfowitz inequality. Statistics & Probability Letters, 173:109088, 2021.DOI
- [32]Maziyar Panahi. Medical-reasoning-sft-gpt-oss-120b datasets/OpenMed/Medical-Reasoning-SFT-GPT-OSS-120B. https://huggingface.co/datasets/OpenMed/Medical-Reasoning-SFT-GPT-OSS-120B, 2025. Hugging Face Dataset.
- [33]Qwen Team. Qwen3 technical report, 2025. URL https://arxiv.org/abs/2505.09388.
- [34]Qwen Team. Qwen3.5: Towards native multimodal agents, February 2026. URL https://qwen.ai/blog?id=qwen3.5.
- [35]Murray Rosenblatt. A central limit theorem and a strong mixing condition. Proceedings of the national Academy of Sciences, 42(1):43–47, 1956.pubmed.ncbi.nlm.nih.gov/16589813
- [36]Andrew Sellergren, Chufan Gao, Fershteh Mahvar, Timo Kohlberger, Fayaz Jamil, Madeleine Traverse, Alberto Tono, Bashir Sadjad, Lin Yang, et al. Medgemma 1.5 technical report. arXiv preprint arXiv:2604.05081, 2026.
- [37]Adi Simhi, Jonathan Herzig, Idan Szpektor, and Yonatan Belinkov. Constructing benchmarks and interventions for combating hallucinations in llms. arXiv preprint arXiv:2404.09971, 2024. doi: 10.48550/arxiv.2404.09971. Published: 2024-04-15.DOI
- [38]Linwei Tao, Yi-Fan Yeh, Minjing Dong, Tao Huang, Philip Torr, and Chang Xu. Revisiting uncertainty estimation and calibration of large language models. arXiv preprint arXiv:2505.23854, 2025.arxiv.org/abs/2505.23854
- [39]Qwen Team. Qwen2.5: A party of foundation models, September 2024. URL https://qwenlm.github.io/blog/qwen2.5/.
- [40]Hasimah Ibrahim Teo and Amilah Shari. Enhance fake review detection: A hybrid approach of implicit absa and imbalanced dataset handling. Journal of Theoretical and Applied Information Technology, 103(13), 2025.
- [41]Neeraj Varshney. A stitch in time saves nine: Detecting and mitigating hallucinations of llms by validating low-confidence generation. arXiv preprint arXiv:2307.03987, 2023. doi: 10.48550/arxiv.2307.03987. Published: 2023-07-08.DOI
- [42]Hongbin Ye, Tong Liu, Aijia Zhang, Wei Hua, and Weiqiang Jia. Cognitive mirage: A review of hallucinations in large language models. arXiv preprint arXiv:2309.06794, 2023. doi: 10.48550/arxiv.2309.06794.DOI
- [43]Ryozo Yokoyama. Moment bounds for stationary mixing sequences. Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete, 52(1):45–57, 1980.DOI
- [44]Weizhe Yuan, Graham Neubig, and Pengfei Liu. Bartscore: Evaluating generated text as text generation. Advances in neural information processing systems, 34:27263–27277, 2021.arxiv.org/abs/2106.11520
- [45]Tal Zeevi, Rajesh Venkataraman, Lawrence H Staib, and John A Onofrey. Monte-carlo frequency dropout for predictive uncertainty estimation in deep learning. In 2024 IEEE International Symposium on Biomedical Imaging (ISBI), pp. 1–5. IEEE, 2024.DOI
- [46]Yue Zhang, Yafu Li, Leyang Cui, Deng Li Cai, and Lemao Liu. Siren’s song in the ai ocean: A survey on hallucination in large language models. arXiv preprint arXiv:2309.01219, 2023. doi: 10.48550/arxiv.2309.01219. Published: 2023-09-03.arxiv.org/abs/2309.01219
- [47]Yue Zhang, Yafu Li, Leyang Cui, Cai Deng, and Lemao Liu. Siren’s song in the ai ocean: A survey on hallucination in large language models. Computational Linguistics, 2025. doi: 10.1162/coli_a_16. Published: 2025-07-07.arxiv.org/abs/2309.01219
- [48]Chujie Zheng, Zhenru Zhang, Beichen Zhang, Runji Li, Keming Lu, Bowen Yu, Dayiheng Liu, Jingren Zhou, and Junyang Lin. Processbench: Identifying process errors in mathematical reasoning. In The 63rd Annual Meeting of the Association for Computational Linguistics, 2025.arxiv.org/abs/2412.06559
