Manuscript Offprint

arXiv:2610.13693

Calibration in One Go: Jointly Learning Accurate and Calibrated Neural Networks

Nektarios Kalampalikis, Pablo M. Olmos, Isabel Valera

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

ABSTRACT

Neural networks (NNs), while highly flexible and versatile, are often poorly calibrated. Post-hoc calibration methods adjust the outputs of an already trained model using a separate calibration dataset and additional calibration parameters. This process adds overhead that requires separate optimization of the calibrator and subsequent model selection. In this paper, we show that standard (post-hoc) calibrators can be trained end-to-end with the backbone via a bilevel Stackelberg formulation. This formulation eliminates the need for a separate calibration set or a dedicated calibration loss by jointly optimizing accuracy and calibration using cross-entropy, introducing only one additional hyperparameter: the calibrator learning rate. Although our framework supports calibrators ranging from temperature and matrix scaling to NN layers, our results show that using the final classification layer itself as the calibrator yields accurate, well-calibrated models with no additional parameters. Our approach outperforms SOTA calibrators with minimal added complexity, while also avoiding the multiplicative overhead of separate calibration components in settings such as multi-task learning.

1 INTRODUCTION

Machine learning, and neural networks in particular, have become an important part of modern society, with their predictions increasingly informing downstream decision making. In many classification settings, however, the predicted class alone is insufficient: downstream systems may instead rely on the predicted probability of each outcome as a measure of uncertainty. Such probabilities play an important role in high-stakes applications, including healthcare (Ricci Lara et al., 2023), fair decision-making (Gupta et al., 2026), and machine learning-based risk assessment (Brito et al., 2023), among others (Wang, 2023; He et al., 2026). Beyond supporting decision making, predictive probabilities can also provide insight into what a model is unsure about, thus offering an additional layer of model understanding and human-AI collaboration (Tomsett et al., 2020).

However, for the predicted class probabilities to be useful in these settings, they must accurately reflect the model's predictive uncertainty. In practice, machine learning models, and neural networks in particular, are often miscalibrated (Guo et al., 2017). Classifier calibration aims to address this issue by aligning a classifier's predicted probabilities with the observed likelihood of the corresponding outcomes (Platt, 2000; Guo et al., 2017; Murphy, 2023). For instance, among predictions assigned 90% probability to class C, class C should be correct 90% of the time. For example, as illustrated by the reliability diagram in Fig. 1a, a perfectly calibrated classifier lies along the diagonal, whereas deviations from the diagonal indicate calibration error (Guo et al., 2017). Various approaches have been proposed to calibrate models, including train-time methods and post-hoc methods (Wang, 2023). Train-time approaches often incorporate additional calibration-related terms into the training objective, whereas post-hoc approaches train a separate model on the output of a trained model (Guo et al., 2017), as illustrated in Fig. 1b.

*kalampalikis@cs.uni-saarland.de

Figure

(a)

(b)

(c)

Figure 1: (a) Reliability diagrams on CIFAR-100 for the baseline, COG, and temperature scaling, with COG achieving the best calibration. (b) Post-hoc calibration: the model is trained and frozen before fitting a calibrator. (c) Our framework, COG, integrates the calibrator into the training procedure and constrains its learning rate to be slower than that of the model.

Although effective, these approaches introduce additional complexity into the model development pipeline. Train-time methods require the model designer to choose and tune additional terms or use a calibration-specific objective, while post-hoc methods require training an additional model and, typically, a separate held-out calibration set. On top of this, both of these families of methods come with their own complexity. For example, post-hoc calibrators can themselves overfit, motivating their regularization (Berta et al., 2025; 2026a;b) or using simpler calibrators such as Temperature Scaling (Guo et al., 2017). This pipeline complexity is particularly pronounced in settings like Multi-Task Learning (MTL) (Caruana, 1997; Javaloy & Valera, 2022), where a shared model serves multiple tasks, potentially requiring a separate calibrator for each. Moreover, the richer annotation requirements of MTL make reserving additional data exclusively for calibration particularly costly. Despite these challenges, calibration in MTL remains comparatively underexplored.

Motivation. In this paper, we aim to obtain neural networks that are simultaneously accurate and well calibrated in a single training procedure, while retaining the efficiency of standard training and avoiding a separate post-hoc calibration stage or additional calibration data. To this end, we formulate calibration as a bilevel optimization (BLO) problem (Dempe, 2002; Beck et al., 2027), where standard model training is the follower and the calibrator acts as the leader, as shown in Fig. 1c. We efficiently solve the resulting Stackelberg problem with a single forward and backward pass per iteration, jointly updating model and calibrator parameters within the same training step using separate learning rates. This introduces one additional hyperparameter beyond standard training: the calibrator learning rate.

The resulting framework integrates calibration directly into end-to-end training while retaining the efficiency of standard training: (i) it requires neither a calibration-specific loss nor a separate calibration dataset; (ii) it imposes no additional architectural constraints and accommodates calibrators ranging from temperature and matrix scaling to neural layers, adding at most the trainable parameters of the corresponding post-hoc calibrator; and (iii) it introduces only one additional hyperparameter, namely the calibrator learning rate.

Empirically, our approach achieves accuracy and calibration competitive with substantially more complex state-of-the-art methods while limiting the additional calibration overhead to a single hyperparameter. Remarkably, additional calibration parameters are unnecessary: using the final classification layer itself as the calibrator yields accurate, well-calibrated models, as demonstrated by the example in Fig. 1a. We further show that this single-stage, low-overhead formulation extends naturally to more complex settings such as MTL, where conventional calibration is cumbersome.

References (85)