SpanUQ

Span-Level Uncertainty Quantification for Large Language Model Generation

0.939
AUROC (Span-Level)
10-20×
Faster than Sampling
~25M
Probe Parameters
Paper Code Model Dataset

Abstract

Uncertainty estimation is essential not only for the trustworthy deployment of large language models (LLMs) but also as a foundation for self-refinement in LLM generation. However, existing approaches operate at suboptimal granularities: token-level scores lack semantic coherence, while sequence-level scores fail to localize errors.

We formalize Span-Level Uncertainty Estimation (SLUE), a new task that targets the natural granularity for uncertainty: semantically coherent text spans, each conveying a single assessable unit of meaning. To address this task, we introduce SpanUQ, a lightweight (~25M parameter) probe that distills the uncertainty knowledge from expensive multi-sample inference into a single forward pass over LLM hidden states.

SpanUQ employs a DETR-style span decoder to simultaneously detect spans and estimate their uncertainty via a Mixture of Beta distribution, trained with a principled combination of Beta NLL regression and contrastive ranking objectives. We construct SpanUQ-Benchmark, the first span-level uncertainty benchmark comprising 20K prompts, ~293K annotated spans, and continuous soft labels derived from multi-sample claim verification.

Experiments on five LLM backbones show that SpanUQ consistently achieves the best span-level uncertainty quality (AUROC 0.908–0.944, MAE 0.110–0.129), outperforming the strongest probe baseline and all sampling-based methods while being 10–20× faster. Its DETR-based span detector attains 0.910 F1, surpassing the best heuristic by 39.4%, enabling precise error localization that sequence-level methods cannot provide.

Why Span-Level?

Comparing uncertainty estimation granularities on an LLM response with a factual error

Query: "Who is Marie Curie?"

Response: Marie Curie was a Polish physicist who won the Nobel Prize in 1901.

(a) Token-Level Uncertainty — hard to interpret
Marie Curie was a Polish physicist who won the Nobel Prize in 19 01 .
(b) Sequence-Level Uncertainty — cannot localize which part is unreliable
Marie Curie was a Polish physicist who won the Nobel Prize in 1901. u = 0.52
(c) Span-Level Uncertainty (Ours) — interpretable and localizable
Marie Curie was a Polish physicist u=0.08 who won the Nobel Prize u=0.12 in 1901 u=0.81 .

Architecture Overview

A lightweight probe that distills multi-sample uncertainty into a single forward pass

🧊
Frozen LLM
Hidden states
🔀
Multi-Layer Fusion
3 layers, mean
Token Encoder
Project + Transformer
🎯
DETR Decoder
32 span queries
📊
Prediction Heads
Boundary + MoB
🔄
UCIR
Iterative refinement
SpanUQ Span Query Lifecycle: End-to-end process from initialization through token encoding, DETR decoding, prediction heads, to final output with UCIR refinement

Figure: Span query lifecycle in SpanUQ — from initialization through token encoding, DETR decoding, prediction heads, to final output with UCIR refinement.

Key Components

Each component addresses a specific challenge in span-level uncertainty estimation

Multi-Layer Fusion

Different LLM layers encode different aspects of uncertainty. We fuse hidden states from peak-zone layers (e.g., layers 22, 24, 26 of Qwen3-14B) where uncertainty information is maximized.

DETR-Style Span Decoder

32 learnable span queries attend to token features via cross-attention, enabling parallel detection of overlapping spans without the limitations of BIO tagging. Achieves 0.910 F1.

Mixture of Beta (MoB)

Models span uncertainty with K=3 Beta components, capturing the bimodal nature of uncertainty (certain vs. hallucinated) and intermediate cases. Nearly self-calibrated (ECE = 0.020).

Iterative Refinement (UCIR)

Feeds Round-1 uncertainty estimates back through the shared decoder for a second pass, correcting systematic biases with less than 15% overhead. Improves ranking correlation by 3%.

Results

Evaluated across five LLM backbones spanning two model families and both dense and MoE architectures

0.939
AUROC (Span-Level, Qwen3-14B)
0.910
Span Detection F1
0.110
MAE (lowest)
0.948
Seq-Level AUROC@0.3
Method Qwen3-14B Qwen3-8B Qwen3-4B Qwen3-30B-A3B Mistral-7B
AUROC↑MAE↓ρs AUROC↑MAE↓ρs AUROC↑MAE↓ρs AUROC↑MAE↓ρs AUROC↑MAE↓ρs
Token Entropy 0.6030.2300.097 0.5800.2260.111 0.5750.2720.119 0.5920.1960.097 0.5690.2310.109
MLP Probe* 0.8810.1390.575 0.8840.1490.612 0.8730.1790.626 0.8930.1200.575 0.8630.1460.562
Verbalized Conf. 0.5930.1870.131 0.5740.2170.155 0.5950.2670.141 0.5980.1670.117 0.4980.171−0.026
SelfCheckGPT-NLI 0.8080.1580.471 0.8010.1820.473 0.7820.2150.479 0.8130.1470.455 0.8160.1540.499
P(True) 0.5260.1970.087 0.5460.2330.121 0.5290.2730.122 0.5410.1940.123 0.5050.1990.005
FActScore 0.6250.1780.181 0.7620.1970.405 0.7140.2330.390 0.7010.1690.306 0.6610.1820.297
SpanUQ (Ours) 0.9390.1100.685 0.9300.1290.692 0.9440.1260.754 0.9360.1100.647 0.9080.1260.637

Span-level uncertainty estimation across five LLM backbones. Token-level methods aggregate token scores within each span; sequence- and claim-level methods broadcast a single score to all spans. *MLP Probe uses ground-truth span boundaries (oracle setting).

Authors

Yimeng Zhang1*
Yingying Zhuang1
Ziyi Wang2
Yuxuan Lu2
Pei Chen1
Aman Gupta1
Zhe Su1
Ming Tan1
Zhilin Zhang1
Qun Liu1
Manikandarajan Ramanathan1
Rajashekar Maragoud1
Edward Vul1
Jing Huang1
Dakuo Wang2
1 Amazon 2 Northeastern University * Corresponding author
BibTeX
@article{zhang2025spanuq,
  title={SpanUQ: Span-Level Uncertainty Quantification for Large Language Model Generation},
  author={Zhang, Yimeng and Zhuang, Yingying and Wang, Ziyi and Lu, Yuxuan and Chen, Pei and Gupta, Aman and Su, Zhe and Tan, Ming and Zhang, Zhilin and Liu, Qun and Ramanathan, Manikandarajan and Maragoud, Rajashekar and Vul, Edward and Huang, Jing and Wang, Dakuo},
  journal={arXiv preprint arXiv:2607.05721},
  year={2025}
}