Calibrating Language Models with Adaptive Temperature Scaling

Johnathan Xie, Annie S. Chen, Yoonho Lee, Eric Mitchell, Chelsea Finn
9/29/2024
cs.LGcs.AIcs.CL

No official code found. Best implementation: Johnathan-Xie/adaptive-temperature-scaling (7 stars, Apache-2.0, last commit 2025-06-12).

Abstract

The effectiveness of large language models (LLMs) is not only measured by their ability to generate accurate outputs but also by their calibration-how well their confidence scores reflect the probability of their outputs being correct. While unsupervised pre-training has been shown to yield LLMs with well-calibrated conditional probabilities, recent studies have shown that after fine-tuning with reinforcement learning from human feedback (RLHF), the calibration of these models degrades significantly. In this work, we introduce Adaptive Temperature Scaling (ATS), a post-hoc calibration method that predicts a temperature scaling parameter for each token prediction. The predicted temperature values adapt based on token-level features and are fit over a standard supervised fine-tuning (SFT) dataset. The adaptive nature of ATS addresses the varying degrees of calibration shift that can occur after RLHF fine-tuning. ATS improves calibration by over 10-50% across three downstream natural language evaluation benchmarks compared to prior calibration methods and does not impede performance improvements from RLHF.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
72Shell, PythonSep 19, 20241 years agoApache-2.0

Similar Papers

Cite this paper

@article{xie2024calibrating,
  title  = {Calibrating Language Models with Adaptive Temperature Scaling},
  author = {Johnathan Xie and Annie S. Chen and Yoonho Lee and Eric Mitchell and Chelsea Finn},
  year   = {2024},
  eprint = {2409.19817},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.19817v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2409.19817.svg)](https://codeofpaper.com/paper/2409.19817)

Discussion