TL;DR
Catching hallucinations in Large Language Models (LLMs) usually requires running a whole second neural network just to fact-check the first one—a bottleneck that kills real-time applications. This paper introduces Kernel Token Contradiction (KTC), a clever, CPU-only math trick that spots factual uncertainty on the fly by checking how candidate tokens behave on Wikipedia. It runs over 8× faster than GPU-accelerated baselines while actually catching hallucinations more accurately when precision matters most.
What Problem Does This Paper Address?
LLMs hallucinate—confidently weaving false facts into otherwise stellar paragraphs. Throwing out an entire response because one detail is shaky wastes compute and frustrates users. Enter claim-level Uncertainty Quantification (UQ), which scores the model’s confidence on each individual factual claim so you know specifically which part to distrust.
Here’s the catch: simple probability checks fail because they confuse creative phrasing (aleatoric uncertainty, like hesitating between "an" and "the") with actual ignorance (epistemic uncertainty, like hesitating between "$499" and "$699"). To separate the two, current state-of-the-art methods run secondary Natural Language Inference (NLI) neural networks to check if candidate tokens contradict each other. However, NLI models demand extra GPUs, can double generation latency, struggle outside of English, and still suffer from too many false positives in production.
Methods
The authors introduce Kernel Token Contradiction (KTC), a white-box method (meaning it peeks at the LLM's internal token probabilities) that computes uncertainty for every generated token in four lightweight steps, before multiplying them together to score a claim:
- Wikipedia Neighbor Heuristic [New]: Instead of a heavy NLI model, KTC pre-counts which tokens appear right next to each other across Wikipedia (taking just minutes on a CPU). If two candidate tokens share the exact same frequent neighbors—think
"499"and"699"appearing after"$"—they can swap places in a sentence, meaning they likely contradict each other! KTC maps these relationships into a "non-contradiction graph." - Semantic Heat Kernel [Adapted]: Borrowing from generation-level methods like Kernel Language Entropy, KTC turns that graph into a matrix called a heat kernel (which models how information diffuses across connected nodes). A tightly connected graph means the model is just debating synonyms; a disconnected graph means conflicting facts.
- Predictive Scaling [New]: A sparse graph doesn't matter if the model is 99.9% sure about its top choice. KTC scales the semantic kernel by the LLM’s actual token probabilities—acting as a mathematical gate so uncertainty only spikes when both token probability spread and semantic contradiction are high.
- Von Neumann Entropy [Standard]: Finally, KTC calculates the Von Neumann Entropy (quantum physics' matrix version of Shannon entropy) of the combined kernel to spit out a clean uncertainty score.
Datasets
No new benchmarks were created, as KTC requires zero training—just a quick, one-time tokenization of Wikipedia to build neighbor frequency tables for each LLM's vocabulary.
For evaluation, the authors tested 16 open-weights LLMs across four languages (English, French, German, Spanish) using two existing claim-level hallucination benchmarks:
- Main Dataset: The human-annotated subsets of MUCH and Mu-SHROOM (698 samples segmented into 9,359 claims), chosen to ensure high-precision measurements aren't muddied by noisy labels.
- Validation Dataset: 4,673 unannotated (automated) samples from MUCH (19,884 claims) to verify hyperparameter generalization at scale.
Key Insights and Ideas
- Distributional similarity implies contradiction at the token level: Usually, words sharing contexts are treated as similar. Here, the authors flip that intuition: when an LLM predicts the exact next token, candidates with identical immediate neighborhoods (like numbers, dates, or rival proper nouns) are mutually exclusive facts. Checking neighbor overlap captures contradiction without any neural inference.
- Language-agnostic by design: Because you can count token neighbors in any language's Wikipedia dump, KTC bypasses the English-centric bias baked into standard NLI models.
- Multiplicative gating beats simple averaging: Scaling the semantic matrix directly by token probabilities (
SCALE) handily beat taking a weighted average of the two (COMB). Both probability spread and conflicting meanings must agree to ring the alarm.
Key Results
- Massive Speedups: Running purely on a CPU, KTC adds just a 5.6% runtime overhead to LLM generation. That is over 8.2× faster than GPU-accelerated CCP (the top NLI baseline, which adds a 46% overhead) and 65× faster than CCP on CPU (369% overhead).
- Superior High-Precision Accuracy: In real-world monitoring, false alarms are exhausting, so high precision at low recall is king. At recall $\le 20\%$, KTC dominates every baseline, hitting 0.78 PR-AUC compared to 0.69 for CCP.
- Competitive Overall: Across the full curve, KTC ranks a close second to CCP in overall ROC-AUC while generalizing smoothly across English, French, German, and Spanish.
Limitations and Future Work
- White-box requirement: KTC needs access to top candidate token probabilities, locking out closed-source APIs that hide log-probs. Adapting KTC to black-box or partial log-prob settings is a key next step.
- Dataset scope: Relying on high-quality human annotations kept the primary testbed relatively modest (698 samples), and reliance on MUCH’s claim-splitter restricted testing to four European languages.
- Regime trade-offs: While KTC wins in high-precision settings and speed, heavy NLI methods like CCP still edge it out if you need high recall across the entire ROC curve.
Summary updated