Multi-Head Multi-Loss Model Calibration

Adrian Galdran, Johan Verjans, Gustavo Carneiro, Miguel A. González Ballester

TL;DR

This paper introduces Multi-Head Multi-Loss (MHML) models, a "simplified ensembling" technique that achieves state-of-the-art model calibration without the massive computational overhead of training multiple deep neural networks. By equipping a single backbone with multiple output heads—each supervised by a unique, weighted loss function—the authors create a diverse "committee" that provides highly reliable uncertainty estimates, particularly in challenging medical imaging tasks.

What Problem Does This Paper Address?

In safety-critical fields like medicine, it isn't enough for an AI to be right; it needs to know when it might be wrong. This is the essence of model calibration: a model’s predicted confidence should match its actual accuracy. If a model says it is 80% sure, it should be correct exactly 80% of the time.

Modern deep neural networks are notoriously overconfident. While "Deep Ensembles" (training multiple independent models and averaging them) are the gold standard for fixing this, they are computationally expensive to train and slow to run. Other "training-time" fixes often trade away accuracy for better calibration. The authors sought a middle ground: a way to get ensemble-level calibration within a single model's training budget.

Methods

The core idea is to replace the standard single "head" (the final linear layer) of a network with a set of $M$ parallel heads.

A schematic of the MHML architecture where a single backbone feeds into multiple heads, each supervised by a different weighted loss.

To prevent these heads from simply learning the exact same thing (which would defeat the purpose of an ensemble), the authors introduce Multi-Loss diversity:

  1. Weighted Cross-Entropy: Each head is assigned a different weight vector for the classes. For example, in a 4-class problem, Head 1 might be "specialized" to focus more on classes A and B, while Head 2 focuses on C and D.
  2. Joint Optimization: The total loss is the sum of the individual head losses plus a loss on the final averaged prediction.
  3. Gradient Diversity: The paper mathematically proves that using different weights forces the gradients for each head to diverge, ensuring the heads remain diverse throughout training.

Datasets

The authors evaluated their method on three challenging medical datasets:

  • Chaoyang: A colon histopathology dataset (4 classes) characterized by high "aleatoric" uncertainty—meaning the images themselves are often ambiguous even to experts.
  • Kvasir: An endoscopic image dataset with 23 classes and significant class imbalance, making it a difficult test for standard calibration methods.
  • PathMNIST: A large-scale histopathology benchmark (9 classes) used for further validation in the appendix.

Key Insights and Ideas

  • Diversity is Mandatory: Simply adding more heads isn't enough; without the diverse loss functions, the heads "collapse" into a single solution, losing the calibration benefits.
  • The "Free" Ensemble: MHML provides the benefits of an ensemble (diversity of opinion) while sharing the same "body" (the feature extractor), drastically reducing the computational heavy lifting.
  • Robustness to Imbalance: Interestingly, the authors found that popular techniques like Label Smoothing actually degraded calibration on the imbalanced Kvasir dataset, whereas MHML remained robust.
  • No Post-Hoc Tuning Needed: Unlike "Temperature Scaling," which requires a separate validation set to tune confidence after training, MHML models are "inherently" well-calibrated right out of the box.

Key Results

The authors tested MHML across three different backbones: ResNet50, ConvNeXt, and Swin-Transformer.

Table showing results on the Chaoyang dataset. 4HML (4 heads) consistently ranks near or at the top.
  • Rivaling the Gold Standard: The 4-head version (4HML) consistently matched or even outperformed Deep Ensembles in terms of Expected Calibration Error (ECE) and Negative Log-Likelihood (NLL).
  • Accuracy Preservation: Unlike many calibration techniques that lower accuracy to improve "honesty," MHML often maintained or slightly improved the baseline accuracy.
  • Superiority on Kvasir: On the complex 23-class Kvasir dataset, 4HML achieved significantly lower ECE than Deep Ensembles across all tested architectures.
Table showing results on the Kvasir dataset, where 4HML achieves the best calibration (lowest ECE) in all cases.

Limitations and Future Work

While powerful, the current MHML approach has a few constraints:

  • Head-to-Class Ratio: The current weighting scheme assumes the number of heads is less than or equal to the number of classes ($M \le K$). Adapting this for binary classification or very few classes might require a different weighting strategy.
  • Logit vs. Softmax Averaging: The authors note that MHML averages softmax probabilities rather than logits. This makes it slightly less compatible with standard Temperature Scaling, though they provide a workaround in the appendix.
  • Domain Expansion: The study focused on medical image classification. Future work could explore how this multi-head diversity performs in object detection or segmentation tasks.

Summary updated

BibTeX
@inproceedings{galdran2023multi,
  author = {Adrian Galdran and Johan Verjans and Gustavo Carneiro and Miguel A. González Ballester},
  title = {{Multi-Head Multi-Loss Model Calibration}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2023},
  doi = {10.1007/978-3-031-43898-1\_11},
}
Figure