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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Li, Mingda, Lv, Rundong, Li, Xinyu, Zhang, Weinan, Liu, Ting
Formato: Preprint
Publicado: 2026
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916071718518784
author Li, Mingda
Lv, Rundong
Li, Xinyu
Zhang, Weinan
Liu, Ting
author_facet Li, Mingda
Lv, Rundong
Li, Xinyu
Zhang, Weinan
Liu, Ting
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2605_04638
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Gradients with Respect to Semantics Preserving Embeddings Tell the Uncertainty of Large Language Models
Li, Mingda
Lv, Rundong
Li, Xinyu
Zhang, Weinan
Liu, Ting
Computation and Language
Artificial Intelligence
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.
title Gradients with Respect to Semantics Preserving Embeddings Tell the Uncertainty of Large Language Models
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2605.04638