TL;DR
Standard uncertainty estimation methods for Large Language Models (LLMs) treat every generated token and sentence equally, allowing filler words (like "of" or "an") to misleadingly inflate uncertainty. Shifting Attention to Relevance (SAR) fixes this "generative inequality" by re-weighting uncertainty based on the semantic importance of individual tokens and the mutual consistency of generated sentences, significantly improving hallucination detection across diverse LLMs and question-answering benchmarks.
What Problem Does This Paper Address?
When auto-regressive LLMs hallucinate or produce factual errors, we need reliable Uncertainty Quantification (UQ) to know when to trust their outputs. However, in free-form generation, traditional entropy-based uncertainty measurements treat every token as equally informative.
In natural language, most tokens exhibit "linguistic redundancy"—function words like prepositions and articles carry little semantic weight compared to nouns or verbs. If an LLM exhibits high predictive entropy on an irrelevant word (e.g., being unsure whether to say "density of an object" vs. "density in an object"), standard predictive entropy marks the entire generation as highly uncertain, even when the model is completely confident and correct about the core fact ("density"). This generative inequality leads to poor uncertainty calibration.
Methods
The authors propose SAR (Shifting Attention to Relevance), which re-allocates uncertainty weights at both the token and sentence levels:
-
Token-Level Shifting ($\text{TOKEN}\text{SAR}$): Measures the semantic importance of each token by evaluating the semantic similarity drop (using a cross-encoder, such as RoBERTa-large) when the token is removed from the sequence. The predictive entropy of each token is then scaled by its normalized relevance score, suppressing noise from function words.
-
Sentence-Level Shifting ($\text{SENT}\text{SAR}$): When sampling multiple candidate answers, standard methods use arithmetic averages or discrete semantic clustering (e.g., Semantic Entropy). $\text{SENT}\text{SAR}$ instead uses continuous ("soft") pair-wise sentence similarity weighted by generation probabilities. Sentences that are semantically consistent with other generations have their uncertainty penalized less.
-
Unified SAR: Combines both mechanisms by feeding token-shifted generation probabilities directly into the sentence-level relevance weighting equation.
Datasets
The authors evaluate SAR on five free-form question-answering benchmarks across general and specialized domains (no new datasets were introduced):
- CoQA: Conversational reading comprehension.
- Trivia QA: Open-domain, trivia-style fact retrieval.
- SciQ: Crowdsourced science exam questions.
- MedQA & MedMCQA: Real-world multiple-choice medical examination questions adapted for free-form QA.
Evaluations span pre-trained models (OPT up to 30B, LLaMA up to 13B) and instruction-tuned models (Vicuna-13B/33B, WizardLM-13B, and LLaMA-2-chat-13B).
Key Insights and Ideas
- Irrelevant tokens dominate total uncertainty volume: Analyzing OPT-13b on CoQA revealed that while semantically rich tokens have slightly higher average entropy, the sheer volume of filler tokens causes irrelevant words to dominate the total uncertainty signal.
- "Soft" similarity outperforms brittle entailment: Earlier methods like Semantic Entropy (SE) rely on discrete Natural Language Inference (NLI) entailment models to group responses into semantic clusters. The authors found that ~36.7% of bidirectional entailment predictions failed on long responses (>20 tokens). Continuous semantic similarity avoids this brittleness.
- Token- and sentence-level weightings are complementary: Combining token relevance and sentence consistency yielded better AUROC than either mechanism on its own.
Key Results
The primary metric used is AUROC for distinguishing between correct and incorrect answers (evaluated via ROUGE-L and semantic similarity thresholds):
- Outperforming State-of-the-Art: On instruction-tuned models across TriviaQA and SciQ, SAR outperformed Semantic Entropy (SE) by an average of +7.1% AUROC (and up to +11.9% on Vicuna-13B on TriviaQA).
- Pre-trained LLM Gains: On OPT and LLaMA models, SAR achieved the highest AUROC across nearly all model sizes on CoQA (reaching 0.753 on OPT-13B vs. 0.726 for SE).
- High Generation Efficiency: SENTSAR using only 2 sampled generations achieved higher AUROC (0.708 average) than baseline methods like PE (0.692) and SE (0.673) using 5 generations, while cutting overall computation runtime by more than half (2.64s vs. 6.78s).
Limitations and Future Work
- Computational Overhead of Similarity Scans: Determining token-level relevance requires computing semantic changes via an external sentence transformer / cross-encoder, introducing inference latency.
- White-Box Requirement: SAR requires access to internal token probabilities and logits, meaning it cannot currently be applied to black-box commercial LLM APIs (e.g., standard ChatGPT or Claude endpoints without logit access).
Summary updated