Distance-Based Learning from Errors for Confidence Calibration

Chen Xing, Sercan Ömer Arik, Zizhao Zhang, Tomas Pfister

This ICLR 2020 paper introduces Distance-Based Learning from Errors (DBLE), a training methodology designed to make deep neural networks (DNNs) more "honest" about what they don't know. By rethinking how models represent data and specifically learning from their own mistakes, the authors achieve state-of-the-art confidence calibration without the massive computational overhead of model ensembles.

TL;DR

DBLE improves the confidence calibration of deep neural networks by using distances in a representation space to estimate uncertainty. By training a joint confidence model specifically on misclassified samples, it provides reliable "self-awareness" for AI models, outperforming standard single-model methods and rivaling expensive ensembles.

The Overconfidence Problem

Modern deep neural networks are notoriously overconfident. A "vanilla" model trained with standard softmax cross-entropy might predict a label with 99% confidence even when it is wrong. This lack of confidence calibration—where the predicted probability should ideally match the actual likelihood of being correct—is a major hurdle for deploying AI in high-stakes environments like medical diagnosis or autonomous driving.

Existing solutions have drawbacks: "Temperature Scaling" requires a separate validation set, Bayesian neural networks are often too slow for practical use, and "Deep Ensembles" (running multiple models) are computationally expensive and memory-intensive. The authors sought a way to get ensemble-level calibration within a single, efficient model.

Methods: Distance-Based Learning from Errors

Architecture of the DBLE framework, featuring the main classification model and the auxiliary confidence model.

The authors propose a two-pronged approach to tackle miscalibration:

  1. Prototypical Learning for Classification: Instead of using a standard linear output layer, DBLE uses "prototypical learning." It maps inputs into a representation space where each class has a "center" (a prototype). A sample is classified based on its distance to these centers. The authors discovered that in this space, the distance between a sample and its ground-truth class center is a highly reliable indicator of whether the model will get the answer right.
  2. Learning from Errors: At inference time, we don't know the ground truth, so we can't calculate that distance. To solve this, DBLE trains a small, separate confidence model ($g_\phi$) alongside the main classifier. Crucially, this model is trained primarily on misclassified training samples. Because most training data is "easy" for a DNN, training on everything would cause the confidence model to ignore the rare but critical errors.
  3. Inference via Sampling: When making a prediction, the confidence model predicts a variance ($\sigma$). The system then samples multiple points around the test sample's location in the representation space (using that $\sigma$) and averages the results. If the sample is in a "confusing" part of the space, the averaged confidence score will naturally drop, providing a better-calibrated output.
Visualization of the sampling operation in the representation space, showing how variance captures uncertainty near decision boundaries.

Datasets

The researchers evaluated DBLE across several standard benchmarks to prove its versatility:

  • MNIST: Using a simple Multi-Layer Perceptron (MLP).
  • CIFAR-10: Using the VGG-11 architecture.
  • CIFAR-100: Using ResNet-50.
  • Tiny-ImageNet: Using ResNet-50.

Key Insights

  • Distance is a Gold Standard: The paper shows that L2 distance in a prototypical space is a much more monotonic and reliable signal for error than standard softmax probabilities. As distance to the class center increases, accuracy drops predictably.
  • The "Error" Bias is a Feature: Most machine learning aims to minimize error. DBLE argues that to understand uncertainty, the model must specifically study its failures. By focusing the confidence model on misclassified samples, it prevents the "easy" majority of data from washing out the signal of the "hard" minority.
  • Efficiency Matters: DBLE achieves its results with only a 1%–3% increase in parameter count (the size of the small confidence MLP) and a training time only 1.4x to 1.7x that of a vanilla model—far better than the 4x cost of a 4-model ensemble.

Key Results

DBLE consistently outperformed single-model baselines like Temperature Scaling, Mixup, and Label Smoothing across two key metrics: Expected Calibration Error (ECE) and Negative Log Likelihood (NLL).

  • Calibration Performance: On CIFAR-100, DBLE reduced the ECE from 19.1% (Vanilla) to a mere 1.1%. This actually outperformed a 4-model Deep Ensemble (1.3% ECE).
  • Accuracy Preservation: Importantly, the move to distance-based learning did not hurt the model's raw accuracy. In most cases, DBLE maintained or slightly improved classification performance compared to vanilla training.
  • Robustness to Overfitting: While vanilla models often start "overfitting" their NLL score (becoming more overconfident even as accuracy plateaus), DBLE’s NLL remained stable throughout training.

Limitations and Future Work

  • Training Complexity: DBLE uses "episodic training" (sampling subsets of classes and shots), which is more complex to implement than standard mini-batch gradient descent.
  • Hyperparameter Tuning: The method introduces new hyperparameters, such as the number of classes ($N$) and supports ($K$) per episode, which require careful tuning on a validation set.
  • Future Directions: The authors suggest that more sophisticated confidence models (beyond a simple MLP) or different distance metrics could further refine the calibration. There is also potential to apply this "learning from errors" philosophy to other domains like out-of-distribution detection.

Summary updated

BibTeX
@inproceedings{xing2020distance,
  author = {Chen Xing and Sercan Ömer Arik and Zizhao Zhang and Tomas Pfister},
  title = {{Distance-Based Learning from Errors for Confidence Calibration}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
}
Figure