Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Gradients with Respect to Semantics Preserving Embeddings Tell the Uncertainty of Large Language Models

About

Uncertainty quantification (UQ) is an important technique for ensuring the trustworthiness of LLMs, given their tendency to hallucinate. Existing state-of-the-art UQ approaches for free-form generation rely heavily on sampling, which incurs high computational cost and variance. In this work, we propose the first gradient-based UQ method for free-form generation, SemGrad, which is sampling-free and computationally efficient. Unlike prior gradient-based methods developed for classification tasks that operates in parameter space, we propose to consider gradients in semantic space. Our method builds on the key intuition that a confident LLM should maintain stable output distributions under semantically equivalent input perturbations. We interpret the stability as the gradients in semantic space and introduce a Semantic Preservation Score (SPS) to identify embeddings that best capture semantics, with respect to which gradients are computed. We further propose HybridGrad, which combines the strengths of SemGrad and parameter gradients. Experiments demonstrate that both of our methods provide efficient and effective uncertainty estimates, achieving superior performance than state-of-the-art methods, particularly in settings with multiple valid responses.

Mingda Li, Rundong Lv, Xinyu Li, Weinan Zhang, Ting Liu• 2026

Related benchmarks

TaskDatasetResultRank
Correctness PredictionTriviaQA
AUROC0.8649
113
Predicting answer correctnessTruthfulQA
AUROC0.7272
48
Generation correctness predictionSciQ
AUROC77.99
42
Generation correctness predictionTriviaQA (test)
AURC30.77
42
Generation correctness predictionTruthfulQA (test)
AURC56.15
42
Generation correctness predictionSciQ (test)
AURC23.34
42
Showing 6 of 6 rows

Other info

Follow for update