Manuscript Offprint

arXiv:2608.22506

Kernel Token Contradiction: a Fast and Principled Approach for LLM Claim Uncertainty Quantification

Jérémie Dentan, Alexi Canesse, Mahammed El Sharkawy, Sonia Vanier

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

Abstract

Claim-level Uncertainty Quantification (UQ) aims to mitigate the lack of reliability of Large Language Models (LLMs) by evaluating the factuality of each claim in their outputs. We introduce Kernel Token Contradiction (KTC), a lightweight approach to compute claim-level UQ under realistic white-box conditions. KTC represents the candidate tokens involved in LLM generation as a positive semi-definite kernel that integrates both the LLM's conditional distribution and a token contradiction score. We then use the Von Neumann entropy to quantify the uncertainty of this kernel. To estimate token contradiction, we develop a new approach based on frequency statistics from the Wikipedia corpus. Although CPU-only, our approach achieves over an 8.2× speedup compared to state-of-the-art GPU-accelerated methods based on cross-encoders, and over a 65× speedup compared to CPU-only methods with comparable performance. Our evaluation spans two benchmarks across four European languages and 16 different models. KTC not only matches the average performance of existing methods but also outperforms them in high-precision regimes. This combination of computational efficiency and accuracy makes real-time monitoring of LLM outputs practical in production.

1 Introduction

Despite their wide adoption, the reliability of Large Language Models (LLMs) remains an open challenge, as their outputs are prone to contain plausible yet non-factual content, known as hallucinations [16,40,27,18][16, 40, 27, 18]. Uncertainty Quantification (UQ) aims to inform LLM users with an estimation of the model's confidence, with the objective to mitigate the negative consequences of factuality hallucinations. In particular, claim-level UQ [7,9,33][7, 9, 33] provides a fine-grained view of the factuality of each claim in LLMs' outputs. This enables the user to be cautious on the uncertain parts without rejecting the whole answer, which is costly in terms of computation and user experience.

State of the art claim-level UQ methods are known to have major limitations, highlighted by the MUCH benchmark [7]. First, their recall in high-precision regimes is insufficient. For instance, top-performing methods such as CCP [9] only achieve an average precision of 69% at recall ≤ 20%, which is largely insufficient to effectively mitigate hallucinations. Second, they rely on Natural Language Inference (NLI) models to estimate contradiction. These models not only require additional GPU resources, but they are also too slow for realistic monitoring of LLMs' outputs in production, representing up to over 100% of the LLM generation runtime. Finally, these methods rely on NLI models trained on English corpus, which significantly alters their performance in other languages [7].

To mitigate these limitations, we developed a principled approach to detect contradictions between the candidate tokens emerging at each Next Token Prediction (NTP) step. Manual exploration revealed that these contradiction specifically arise in factuality hallucinations. For instance, when completing

∗^{*}Equal contribution.

Preprint.

Claim-level factuality

Prompt: What was the suggested retail price of the Canon EOS 70D when it was announced in 2013?

LLM completion, split into claims

The suggested retail price

of the Canon EOS 70D

when it was announced

in 2013

was $1,199

for the body

only, and $1,699

with an EF-S 18-55mm

IS STM lens.

Comparing KTC (Ours) and CCP (SOTA) for a given LLM completion

Figure

Figure 1: Example from the MUCH dataset [7]: only one of the nine claims in the LLM generation is incorrect. KTC correctly identifies the wrong price ($1,699), yielding a high uncertainty score for the incorrect claim, while CCP [9] produces several false positives and thus lower precision. Our method computes token-level scores that are aggregated at the claim level (see dashed lines on the plot).

"and 1,"withNTP(seeFigure1),ifthemodelcomputesahighprobabilityforbothtokens"699"and"499",thenitisuncertainaboutthepricebecauseithesitatesbetweentwocontradictinginformation.Ontheopposite,whencompleting"1," with NTP (see Figure 1), if the model computes a high probability for both tokens "699" and "499", then it is uncertain about the price because it hesitates between two contradicting information. On the opposite, when completing "1, 699 with", if the model hesitates between "an" and "the", these two possibilities do not contradict each other and the model simply hesitates between different formulations. Based on this intuition, we developed a new heuristic based on neighbour frequency statistics in the Wikipedia corpus to detect contradicting tokens. This heuristic is orders of magnitude faster than the NLI models used in top-performing methods such as SAR [8] or CCP [9]. Moreover, its setup is much simpler than training an NLI model, requiring only the tokenisation of many Wikipedia pages, which only takes a few minutes of CPU computation.

KTC consists of four steps, presented in Figure 2. It combines predictive uncertainty, derived from the entropy of the LLM output distribution, and semantic uncertainty, derived from contradictions between the meanings of candidate tokens. Steps [B] and [D] are inspired by Kernel Language Entropy (KLE) [25], a generation-level UQ method that represents generation outcomes as PSD kernels and computes their Von Neumann Entropy (VNE). Compared to existing methods, our pipeline introduces three major methodological innovations. First, we adapt the principle of KLE from the generation level to the token level. Second, we replace the NLI model used in CCP or SAR with the neighbour frequency heuristic introduced above (step [A] in Fig. 2). Finally, we scale semantic uncertainty by predictive uncertainty (step [C] in Fig. 2). This scaling is absent in KLE but plays a crucial role in the performance of our approach at the token level (see Section 3.3).

We evaluated KTC on two benchmarks (MUCH [7] and Mu-Shroom [33]) spanning four languages (English, French, German, and Spanish) and 16 LLMs from various families. We compared KTC with comparable white-box claim-level UQ methods, including CCP [9] and SAR [8]. While CCP achieves the best overall performance, KTC ranks second with a small performance gap. Crucially, KTC is significantly more efficient, achieving at least an 8.2×8.2\times speedup and requiring no GPU acceleration. Moreover, KTC clearly outperforms all competing methods in the high-precision regime, achieving an average precision of 78% at recall ≤\leq 20%, compared to 69% for CCP. The computational efficiency and high accuracy of KTC makes it practical for real-time monitoring of LLMs outputs.

Our contributions can be summarised as follows.

• We introduce a new heuristic based on token neighbour statistics to replace NLI models used in state-of-the-art claim-level UQ, with minimal computational and setup overhead;

• We propose a token-level score inspired by KLE [25], integrating the proposed heuristic and a scaling by the LLM predictive distribution that is critical for token-level UQ;

• We evaluate KTC on benchmarks covering four European languages and 16 LLMs, achieving comparable average performance to state-of-the-art methods while being substantially faster, and largely outperforming all methods in the high-precision regime.

• We release all source code and hyperparameter needed to reproduce our experiments. 2^{2}

2^{2}See https://github.com/orailix/kernel_token_contradiction and Appendix E.

Figure

Figure 2: The KTC score is computed for each LLM-generated token. We construct a non-contradiction graph over candidate tokens (step [A]) and represent it as a PSD semantic kernel (step [B]). This kernel is then combined with the predictive kernel containing candidate probabilities (step [C]). Finally, we compute the Von Neumann entropy (VNE) of the combined kernel (step [D]).

References (27)