Do Not Design, Learn: A Trainable Scoring Function for Uncertainty Estimation in Generative LLMs

Duygu Nur Yaldiz, Yavuz Faruk Bakman, Baturalp Buyukates, Chenyang Tao, Anil Ramakrishna, Dimitrios Dimitriadis, Jieyu Zhao, Salman Avestimehr

Abstract

Generative Large Language Models (LLMs) are prone to hallucinations, necessitating robust Uncertainty Estimation (UE) to ensure reliability in critical domains. Traditional UE methods rely on manually designed scoring functions that aggregate token-level probabilities into a single score. However, these heuristics often fail to capture semantic nuances and model-specific biases. We introduce LARS (Learnable Response Scoring), a supervised transformer-based approach that replaces fixed formulas with a trainable RoBERTa model. By encoding token probabilities into a high-dimensional space and processing them alongside textual context, LARS achieves significant performance gains, outperforming state-of-the-art methods by up to 16% in AUROC and 45% in Prediction Rejection Ratio (PRR).

Introduction

The utility of LLMs is often hampered by their tendency to generate factually incorrect information with high confidence. To mitigate this, researchers use scoring functions to estimate the likelihood of a response's correctness. Common heuristics, such as Length-Normalized Scoring (LNS), attempt to normalize probabilities to account for answer length but suffer from three primary limitations:

  1. Entity Bias: Models often assign disproportionately high probabilities to specific entity types (e.g., dates) regardless of factual accuracy.
  2. Contextual Ignorance: Heuristics treat tokens as independent units, failing to recognize semantic markers of uncertainty like "perhaps" or "might."
  3. Linguistic Rigidity: Many tools are optimized for English, making them difficult to adapt to other languages.

Methodology: The LARS Framework

LARS shifts the paradigm from manual design to supervised learning. Instead of a fixed mathematical formula, LARS utilizes a RoBERTa-base model (125M parameters) to predict the probability of correctness based on the question, the generated answer, and the associated token probabilities.

The LARS pipeline architecture, illustrating the integration of question, answer tokens, and encoded probability vectors into a learnable scoring model.

Key Innovations

  • Few-hot Probability Encoding: To bridge the gap between scalar probabilities and high-dimensional text embeddings, LARS partitions the [0, 1] range into $k$ quantiles. Each probability is represented as a "few-hot" vector, allowing the transformer to process numerical confidence as a distinct feature.
  • Sequential Input Processing: The model receives a sequence where each answer token is immediately followed by its corresponding encoded probability vector, preserving the local relationship between content and confidence.
  • Supervised Calibration: LARS is trained on a calibration set of question-answer pairs. Correctness labels are generated using a "teacher" model (e.g., GPT-3.5-turbo), and LARS is optimized using binary cross-entropy loss.

Experimental Evaluation

LARS was evaluated across diverse benchmarks, including TriviaQA, NaturalQA, WebQA, and GSM8K (mathematical reasoning). The training data consisted of thousands of generations from open-source models such as Llama-2, Llama-3, and Mistral.

Key Insights and Results

The primary advantage of LARS lies in its ability to recalibrate based on observed model biases. For instance, analysis of Llama-2-7b revealed that the model consistently assigns higher average probabilities to "DATE" entities compared to "PERSON" entities, even when their actual accuracy is comparable.

Comparison of average token probabilities versus actual accuracy across different entity types, highlighting the inherent biases that LARS learns to mitigate.

LARS demonstrated exceptional cross-model generalization; a scorer trained on Llama-2 data remained highly effective when applied to Llama-3 or Mistral. Furthermore, LARS maintained its performance lead in multilingual settings (Turkish, German, Spanish), proving more adaptable than English-centric heuristics.

Conclusion and Future Work

LARS represents a significant step forward in making LLMs reliable. By learning the complex relationship between text, probability, and correctness, it provides a more accurate and robust uncertainty measure than traditional heuristics. While currently limited by the sequence length constraints of BERT-style architectures and the need for a labeled calibration set, LARS offers a practical, computationally efficient solution for real-world deployment. Future research will explore scaling LARS to longer sequences and its integration into real-time abstention systems.

Summary updated

BibTeX
@inproceedings{yaldiz2025do,
  author = {Duygu Nur Yaldiz and Yavuz Faruk Bakman and Baturalp Buyukates and Chenyang Tao and Anil Ramakrishna and Dimitrios Dimitriadis and Jieyu Zhao and Salman Avestimehr},
  title = {{Do Not Design, Learn: A Trainable Scoring Function for Uncertainty Estimation in Generative LLMs}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.41},
}
Figure