Large language models (LLMs) have demonstrated remarkable capabilities across diverse tasks. However, the truthfulness of their outputs is not guaranteed, and their tendency toward overconfidence further limits reliability. Uncertainty quantification offers a promising way to identify potentially unreliable outputs, but most existing methods rely on repeated sampling or auxiliary models, introducing substantial computational overhead. To address these limitations, we propose Semantic Token Clustering (STC), an efficient uncertainty quantification method that leverages the semantic information inherently encoded in LLMs. Specifically, we group tokens into semantically consistent clusters using embedding clustering and prefix matching, and quantify uncertainty based on the probability mass aggregated over the corresponding semantic cluster. Our approach requires only a single generation and does not depend on auxiliary models. Experimental results show that STC achieves performance comparable to state-of-the-art baselines while substantially reducing computational overhead.
Figures & tables
Figure 1: Illustration of the proposed method. Token embedding clustering is performed in the pre-computation stage. During inference, we aggregate next-token probability mass over embedding-clustered and prefix-matched tokens to quantify uncertainty.
Figure 2: Performance comparison between our method and baseline approaches across different models and datasets. For clarity, only the top seven methods ranked by performance are shown in each subfigure, with methods ordered by descending performance. Metric: AUROC.
Figure 3: Efficiency comparison across methods. The performance (AUROC) and relative execution time overhead (%) are plotted on the y-axis and x-axis, respectively, illustrating the efficiency of the proposed method. The relative execution time overhead represents the additional execution time required for uncertainty quantification relative to basic inference. For clarity, only the top ten methods ranked by performance are shown in each subfigure.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Model
Time (mm:ss)
Llama-2-7B
01:08
Llama-3-8B
18:24
Mistral-7B
00:48
Qwen2.5-3B
23:46
Qwen2.5-7B
28:05
Qwen2.5-14B
33:46
Appendix
Table 4: Execution time of embedding clustering in the pre-computation stage for different models.
Dataset
Method
Llama-2-7B
Llama-3-8B
Mistral-7B
Qwen2.5-3B
Qwen2.5-7B
Qwen2.5-14B
NQ
Perplexity
0.697
0.705
0.712
0.760
0.744
0.708
Predictive Entropy
0.716
0.730
0.722
0.767
0.763
0.742
LN Entropy
0.702
0.712
0.714
0.764
0.755
0.721
tokenSAR
0.673
0.682
0.683
0.736
0.724
0.708
P(True)
0.550
0.546
0.488
0.680
0.727
0.725
ConU
0.706
0.708
0.715
0.759
0.788
0.748
Appendix
Table 5: Full experimental results for performance comparison across methods. Metric: AUROC.
Dataset
Method
Llama-2-7B
Llama-3-8B
Mistral-7B
Qwen2.5-3B
Qwen2.5-7B
Qwen2.5-14B
NQ
Perplexity
0.442
0.496
0.508
0.502
0.513
0.460
Predictive Entropy
0.500
0.563
0.537
0.559
0.573
0.564
LN Entropy
0.462
0.519
0.514
0.536
0.545
0.501
tokenSAR
0.415
0.446
0.455
0.483
0.490
0.491
P(True)
0.111
0.153
-0.058
0.383
0.512
0.495
ConU
0.381
0.376
0.406
0.413
0.499
0.451
Appendix
Table 6: Full experimental results for performance comparison across methods. Metric: PRR.
Dataset
Method
Llama-2-7B
Llama-3-8B
Mistral-7B
Qwen2.5-3B
Qwen2.5-7B
Qwen2.5-14B
NQ
Perplexity
0.129
0.064
0.075
0.108
0.173
0.148
Predictive Entropy
1373.943
1006.703
1028.696
824.862
863.792
1717.797
LN Entropy
1374.020
1006.781
1028.779
824.943
863.880
1717.879
tokenSAR
50.865
49.245
68.746
51.428
71.280
59.225
P(True)
41.669
41.258
50.507
25.471
47.472
61.176
ConU
1387.134
910.635
1030.129
713.243
747.901
1655.025
Appendix
Table 7: Full experimental results on absolute execution time overhead at inference. Metric: seconds.
Dataset
Method
Llama-2-7B
Llama-3-8B
Mistral-7B
Qwen2.5-3B
Qwen2.5-7B
Qwen2.5-14B
NQ
Perplexity
0.023
0.019
0.021
0.039
0.047
0.024
Predictive Entropy
239.879
302.765
286.607
298.737
235.837
279.658
LN Entropy
239.893
302.789
286.630
298.766
235.861
279.672
tokenSAR
8.881
14.811
19.153
18.625
19.461
9.642
P(True)
7.275
12.408
14.072
9.225
12.961
9.960
ConU
242.183
273.873
287.006
258.312
204.196
269.439
Appendix
Table 8: Full experimental results on relative execution time overhead at inference. Metric: %.