Beyond Post-Hoc Temperature Scaling: Bilevel Optimization for LLM Calibration

Ruochen Jin, Zhanliang Wang, Zongyu Dai, Jiancong Xiao, Bojian Hou
8/7/2026
cs.LG

No confident code implementation found for this paper.

Abstract

Preference alignment often makes large language models (LLMs) overconfident and poorly calibrated. Traditional post-hoc temperature scaling is inherently domain-dependent: a temperature fitted on one domain does not generalize across domains.

Show full abstract

This motivates us to modify model parameters during training to improve calibration. We propose maximizing the entropy of predictive distributions as the calibration objective, which directly targets overconfidence by discouraging overly concentrated predictions. Inspired by temperature scaling, we realize this through a bilevel optimization formulation, where the lower level trains the model under a parametric loss and the upper level selects loss hyperparameters to maximize entropy. To make the framework practical at LLM scale, we adopt an efficient first-order approximation that avoids explicit second-order computation. Across both multiple-choice and open-ended generative question answering, experiments demonstrate that our method yields well-calibrated LLMs with particular advantages in out-of-domain generalization.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{jin2026beyond,
  title  = {Beyond Post-Hoc Temperature Scaling: Bilevel Optimization for LLM Calibration},
  author = {Ruochen Jin and Zhanliang Wang and Zongyu Dai and Jiancong Xiao and Bojian Hou},
  year   = {2026},
  eprint = {2608.07419},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.07419v1}
}

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/2608.07419.svg)](https://codeofpaper.com/paper/2608.07419)

Discussion