Deep ensembles

Also known as: deep ensemble

On this page 7

Deep ensembles are a method that trains several neural networks independently from different random initializations and averages their predictions to obtain both a more accurate output and a calibrated estimate of predictive uncertainty. Among probabilistic models in artificial intelligence, a deep ensemble is treated as a practical, non-Bayesian approximation to the posterior predictive distribution, and it is widely regarded as one of the strongest baselines for uncertainty quantification.

The approach was popularized in 2017 as a simple and scalable alternative to full Bayesian neural networks. Its appeal lies in requiring no changes to the network architecture and almost no extra hyperparameters, at the price of training and serving several models.

How deep ensembles produce uncertainty

A deep ensemble works because independently trained networks converge to different solutions in a highly non-convex loss landscape. Each member starts from a different random initialization and sees the data in a different shuffled order, so the members settle in distinct modes of the loss surface that fit the training data comparably well but disagree on unfamiliar inputs.

At prediction time, the ensemble forms a uniformly weighted mixture of member outputs. For classification, the softmax probabilities are averaged; for regression, each member typically predicts a mean and a variance, and the mixture is summarized by a single Gaussian with combined moments. The disagreement between members signals epistemic uncertainty, while the variance each member predicts captures aleatoric uncertainty.

The table summarizes the main components of a standard deep ensemble recipe.

ComponentTypical choicePurpose
Number of members5 members, often 3 to 10Balances diversity against compute cost
InitializationIndependent random seedsDrives members toward different modes
Loss functionProper scoring rule such as negative log-likelihoodEncourages calibrated probabilities
Output headSoftmax or Gaussian mean and varianceModels aleatoric uncertainty per member
AggregationEqual-weight averagingApproximates the predictive distribution
Adversarial trainingOptional fast gradient sign perturbationsSmooths predictions near data points
Components of a standard deep ensemble

Measuring the quality of an ensemble

The value of a deep ensemble is measured by predictive performance and calibration together, not by accuracy alone. Members that agree perfectly add cost without information, so practitioners also inspect diversity between members.

The following metrics are standard when comparing a deep ensemble with a single network or another uncertainty method.

MetricWhat it capturesDesired direction
Negative log-likelihoodQuality of the full predictive distributionLower is better
Expected calibration errorGap between confidence and observed accuracyLower is better
Brier scoreSquared error of predicted probabilitiesLower is better
Predictive entropyTotal uncertainty of the averaged predictionHigher on out-of-distribution data
Mutual informationDisagreement among membersHigher on unfamiliar inputs
AUROC for detectionSeparation of in- and out-of-distribution inputsHigher is better
Metrics used to evaluate deep ensembles

Decomposing total entropy into expected member entropy and mutual information separates noise inherent in the data from uncertainty caused by limited knowledge, which helps decide whether more data would actually reduce error.

Deep ensembles compared with Bayesian alternatives

Deep ensembles are often contrasted with Bayesian neural networks that approximate a posterior over weights. Ensembles explore several distant modes, whereas many variational and Laplace methods describe one mode in detail, which explains why ensembles frequently produce better uncertainty under dataset shift.

MethodPosterior coverageInference cost
Deep ensemblesMultiple modes, little within-mode spreadM forward passes
Monte Carlo dropoutWithin one mode, approximateMany stochastic passes of one model
Variational inferenceUsually one mode, mean-fieldSampling from learned weight distribution
Laplace approximationGaussian around a single optimumLow after a Hessian estimate
Hamiltonian Monte CarloAsymptotically exactVery high for large networks
Deep ensembles and related uncertainty methods

Some researchers interpret deep ensembles as approximate Bayesian model averaging with a uniform weighting over modes; others stress that the method lacks an explicit prior. Both views agree that the empirical performance is strong relative to cost.

Variants that reduce cost

Because a full ensemble multiplies training time, memory and inference latency by the number of members, several variants aim to retain most of the benefit at lower cost.

  • Snapshot ensembles save checkpoints along one training run with a cyclic learning rate.
  • BatchEnsemble shares a weight matrix and gives each member a cheap rank-one modulation.
  • Multi-input multi-output networks train several subnetworks inside one model.
  • Distillation compresses the ensemble into a single student network, often losing some uncertainty quality.
  • Hyperparameter ensembles vary learning rates or regularization across members to raise diversity.

These variants typically trade some loss of diversity for speed, so their uncertainty is usually somewhat weaker than that of fully independent members.

Practical guidance and limitations

A deep ensemble is the default choice when reliable uncertainty matters and the compute budget allows several models. Its weaknesses are mostly economic and theoretical rather than empirical.

SituationRecommendationReason
Safety-critical predictionUse five independent membersStrong calibration and shift robustness
Tight latency budgetUse BatchEnsemble or distillationFull ensembles multiply inference time
Large pretrained modelEnsemble fine-tuned heads or adaptersRetraining backbones is too expensive
Active learningUse mutual information to select samplesTargets epistemic uncertainty
Very small datasetConsider Gaussian processes as wellEnsembles may still overfit
When to use deep ensembles

Common mistakes include training members on identical seeds, evaluating only accuracy, and assuming ensembles are calibrated on far out-of-distribution data. Members can agree confidently and still be wrong, especially when the shift affects features all members rely on, so post-hoc temperature scaling is often still worthwhile.

Stripped to the essentials

A deep ensemble asks several separately trained AI models the same question. Then it combines their answers. If they agree, the answer is probably reliable. If they disagree, the system knows it is unsure.

It works like a panel of doctors. Each one studied the same cases in a slightly different way. On a common illness, they all give the same diagnosis. On a rare case, their opinions split. That split is a useful warning sign.

Where it is applied

A hospital research team built a model to flag diabetic retinopathy in retinal photographs. Instead of one network, they trained five convolutional networks with different random seeds on the same 80,000 labeled images and averaged their probabilities.

During a pilot at a clinic that used a different camera model, the ensemble’s mutual information rose sharply on many images. The system routed those cases to ophthalmologists instead of issuing automatic results. Review showed that the single best network would have misclassified a noticeable share of them with high confidence, while the ensemble referred most uncertain cases for human review and kept automated decisions accurate on the rest.