TL;DR
A neural network that outputs one answer is usually too sure of itself. Lakshminarayanan, Pritzel and Blundell propose a recipe with three ingredients: train each network with a proper scoring rule so that its stated probabilities are honest, add Adversarial Training so the predictions change smoothly, and average several networks trained from different random starts. The method needs no change to the usual training code, and the authors report that it matches or beats approximate Bayesian neural networks on the uncertainty measures they test.
Builds on: Proper Scoring Rule, Maximum Likelihood Estimation, Ensemble Learning, Adversarial Training · Leads to: Uncertainty Quantification, Bayesian Neural Network (the baseline it competes with)
Why it mattered
The paper gave the field a strong non-Bayesian baseline for predictive uncertainty. Before it, the common route to honest uncertainty from a neural network was a Bayesian treatment, which needs a prior over weights, an approximate posterior and more compute. The discussion says it was surprising to the Bayesian deep learning community that a non-Bayesian, yet probabilistic, method could perform as well as Bayesian networks, and it hopes to encourage other non-Bayesian approaches.
The problem
Neural networks trained to be accurate tend to give overconfident predictions. Their top probability is often high even when they are wrong, and the failure is most dangerous on inputs unlike the training data. The paper frames the goal as two properties:
- Calibration. Among the cases where the network says 0.8, about 80 percent should turn out to be correct. The paper measures this with proper scoring rules, the log predictive probability and the Brier score.
- Robustness to dataset shift. On inputs from a different distribution, the network should say it is unsure instead of confidently wrong.
Two earlier options were in the way. A Bayesian neural network gives good uncertainty only if its approximation is good and its prior is reasonable, and it is harder to implement and slower to train. A single network trained by maximum likelihood is easy to train but tends to be overconfident. The paper asks for a method with the simplicity of the second and the uncertainty quality of the first.
How it works
Take a regression task with one input and one target . Each network outputs a predicted mean and a predicted variance , which together describe a Gaussian over .
- Train one network with a proper score. The training loss is the negative log-likelihood of the observed target under the predicted Gaussian. For a single training point the paper writes it as Lower is better. Minimising this maximises the log score, which is proper. Check: a network that is far off must either widen its variance or pay a large squared-error term.
- Make the predictions smooth with adversarial examples. For each training input, build a nearby perturbed input , where is 1 percent of the input range in each dimension. Train on the sum . This pushes the network to give the correct label high likelihood throughout a small neighbourhood of each training point. Check: the perturbation is small, so should look like to a human, and its label is still .
- Train M networks independently. The paper uses by default. Each network starts from different random weights and sees the whole training set in a different random order. Bagging was tried and made results worse in their experiments. Check: the networks do not talk to each other during training, so the five runs can happen in parallel on five machines.
- Average the predictions. The ensemble predicts the uniform mixture . For classification this averages the probability vectors. For regression, the mixture is summarised by a single Gaussian. Check: averaging probabilities keeps the total at 1, so the result is still a valid distribution.
A concrete instance of step 4. At one test point, three networks predict pairs of , and . The ensemble mean is . The ensemble variance has two parts: the average of the individual variances, , plus the spread of the means, . The total is , larger than the average member variance of , because the members disagree. The diagram shows how the pieces fit together.
flowchart LR D["training set"] --> N1["network 1<br/>scoring rule + adversarial"] D --> N2["network 2"] D --> NM["network M = 5"] N1 --> A["average the predictions"] N2 --> A NM --> A A --> U["mean and uncertainty"]
The math
Stage 1: the scoring rule
The paper defines a scoring rule that is higher when the predicted distribution is better, and a proper rule as one whose expected value is largest when , the true distribution. Training minimises . The log likelihood, , is proper by Gibbs' inequality. The paper also notes that the Brier score, which is the squared error between a one-hot label and the predicted probability vector, is proper, so the common practice of training a classifier on squared error is justified. Step 1 of the walkthrough is this loss with a Gaussian .
For the tiny instance: a training point with , and a network predicting . Compare two variances. With , the loss is (dropping the constant). With , it is . The narrower variance has the lower loss because it is right about the spread. The constant is the same in both, so the ranking does not change.
Stage 2: adversarial smoothing
The fast gradient sign step is . The gradient points in the direction that raises the loss most per unit of max-norm change, so is the nearby input where a linear approximation of the loss rises fastest. Training on both and asks the predicted distribution to stay close to the label across the whole -neighbourhood. The paper argues that this smooths the predictive distribution. Its experiments show gains on MNIST for every ensemble size, while on SVHN the gain is clear for a single network and fades as grows.
Stage 3: independent members
Each member has its own parameters , and each is trained on the full data with its own random initialisation and shuffling. No term couples the members, which is why training parallelises trivially.
Stage 4: the mixture
The ensemble is the uniform mixture . For regression, each member is Gaussian with mean and variance , and the mixture is approximated by one Gaussian with
The second formula is the mixture variance: the average of each member's second moment , minus the square of the mean. Rearranged, it equals the average individual variance plus the spread of the means, which is the split used in the concrete instance above. The paper uses the Gaussian approximation so that quantiles and predictive probabilities are easy to compute.
Results
The paper reports regression on standard benchmark datasets using the protocol of Hernandez-Lobato and Adams: 20 train-test splits for most datasets, 5 for protein and a single split for Year Prediction MSD, with one hidden layer, 50 hidden units for the smaller datasets and 100 for the larger ones, and 5 networks in the ensemble. The table gives a subset of the numbers from its Table 1, with the authors' mean and standard deviation.
| Dataset | RMSE, PBP | RMSE, MC-dropout | RMSE, Deep Ensembles | NLL, PBP | NLL, MC-dropout | NLL, Deep Ensembles |
|---|---|---|---|---|---|---|
| Boston housing | 3.01 ± 0.18 | 2.97 ± 0.85 | 3.28 ± 1.00 | 2.57 ± 0.09 | 2.46 ± 0.25 | 2.41 ± 0.25 |
| Energy | 1.80 ± 0.05 | 1.66 ± 0.19 | 2.09 ± 0.29 | 2.04 ± 0.02 | 1.99 ± 0.09 | 1.38 ± 0.22 |
| Naval propulsion plant | 0.01 ± 0.00 | 0.01 ± 0.00 | 0.00 ± 0.00 | -3.73 ± 0.01 | -3.80 ± 0.05 | -5.63 ± 0.05 |
| Yacht | 1.02 ± 0.05 | 1.11 ± 0.38 | 1.58 ± 0.48 | 1.63 ± 0.02 | 1.55 ± 0.12 | 1.18 ± 0.21 |
What this means. On NLL, the measure that depends on the predicted uncertainty, the ensemble is best or tied on most of the datasets in the table, and the gap is large on Energy and Naval. On RMSE, the ensemble is sometimes worse, for example on Yacht (1.58 against 1.02 for PBP). The authors attribute this to optimising NLL instead of squared error. The results are on small, standard benchmarks with one hidden layer, so they say little about large models by themselves.
For classification, the paper uses MNIST with a 3-hidden-layer MLP of 200 units per layer, and SVHN with a convolutional network. Its figures show that increasing improves accuracy, NLL and Brier score, and that the ensemble beats MC-dropout on all three. The text gives no table of numbers for these, so this lesson does not quote any. On out-of-distribution data (MNIST networks tested on NotMNIST letters), the predictive entropy of the ensemble rises faster with than MC-dropout's, so the ensemble is less confident on unseen classes. On a mix of MNIST and NotMNIST inputs, where the network is wrong on the unseen letters, the paper's accuracy-versus-confidence curves show that the ensemble is significantly more robust than MC-dropout: MC-dropout gives confident wrong answers that the ensemble does not.
Limits the paper itself states or implies. The ensemble has times as many parameters as one network, which matters for memory. The authors suggest distilling the ensemble into a simpler model for that reason. Adversarial training helps on some datasets and metrics but is not always necessary, and on SVHN its benefit fades as grows. The Gaussian likelihood for regression may be too restrictive for some targets; the paper points to mixture density networks as one extension.
Reading guide
The paper has a short main text and a long set of appendices. Read the sections in this order, with the prerequisite lessons each one needs.
- Section 1, Introduction. Needs Proper Scoring Rule for the Brier score and log predictive probability it names as calibration measures, and Bayesian neural networks as the competing approach. The introduction sets up the claims the paper then tests.
- Section 2.1 and 2.2, setup and proper scoring rules. Needs Proper Scoring Rule and Maximum Likelihood Estimation. Read the Gibbs inequality step carefully; it is what makes the log score proper.
- Section 2.2.1, regression criterion. Needs Gaussian (Normal) Distribution and Mean Squared Error, since the paper contrasts the Gaussian NLL with MSE. It names mixture density networks as a possible extension.
- Section 2.3, adversarial training. Needs Adversarial Examples, Fast Gradient Sign Method and Backpropagation for the gradient with respect to the input.
- Section 2.4, ensembles. Needs Ensemble Learning, Bagging and Bootstrap Sampling. The paper argues bagging hurts here, and the reasons depend on the bootstrap's roughly 63 percent unique samples.
- Section 3, experiments. Needs Softmax for the classification outputs and Stochastic Gradient Descent for the optimiser family the networks are trained with. The tables are easiest to read after the Results section above.
- Section 4, Discussion. Needs Bayesian Neural Network to see what "as good as Bayesian" means in practice.
Check yourself
QuestionWhy does the paper train each network with a proper scoring rule rather than just an accuracy-based loss?Show answer
A proper rule is maximised, on average, by the true predictive distribution, so the network is pushed to report honest probabilities. An accuracy-based loss only cares which label is top and gives no incentive to report calibrated confidence. The paper's calibration and uncertainty measures are proper scores, so training on one aligns the training objective with what is evaluated.
QuestionA network predicts mean 1.5 and variance 0.25 for a target that equals 2. Compute the variance-dependent part of the Gaussian loss, , ignoring the constant.Show answer
, and . The total is .
QuestionThree members of an ensemble predict means 2.0, 2.4 and 1.6 with variances 0.5, 0.9 and 0.4. What is the ensemble variance?Show answer
The average variance is . The spread of the means around 2.0 is . The total is about 0.707. Using the formula gives the same value.
QuestionApplied scenario: a team wants a model whose probabilities can be trusted on inputs unlike its training data, but cannot afford to run a Bayesian method. The paper's ensemble uses 5 networks. Name one cost the team should expect, and one reason the paper gives for why the members should be trained independently.Show answer
Cost: the ensemble has about five times as many parameters as one network, and prediction runs five networks, so memory and inference time both rise. Reason for independence: the paper uses random initialisation and shuffling instead of bagging, because bagging gave worse results for deep networks in their experiments, and independent training lets the members run in parallel.
Sources
- Lakshminarayanan, Pritzel and Blundell (2016), Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles: https://arxiv.org/abs/1612.01474
- Gneiting and Raftery (2007), Strictly Proper Scoring Rules, Prediction, and Estimation: https://doi.org/10.1198/016214506000001437
- Scoring rule (Wikipedia): https://en.wikipedia.org/wiki/Scoring_rule