Search

Search papers and lessons

Epistemic and Aleatoric Uncertainty

Level 3 · 12 min read

A model's uncertainty has two sources: noise in the world that no data removes (aleatoric) and doubt about the model that more data can shrink (epistemic); the two add up to the total spread.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Inference
  • Information theory
  • Safety & alignment
  • ReadReady to readNot yet

TL;DR

When a model predicts something, its uncertainty comes from two places. Aleatoric uncertainty is randomness in the world, such as the noise in a measurement, which stays even if you had the true model. Epistemic uncertainty is doubt about the model itself, which shrinks as you collect more data. Together they make up the total spread of the prediction, and a good system reports both so it knows when to act and when to ask for help.

Builds on: Posterior Predictive Distribution, Mutual Information, Gaussian (Normal) Distribution, Entropy · Leads to: Uncertainty Quantification, Bayesian Neural Network

Where it's used

Active learning. A team labels images for a classifier but can afford only a few hundred labels out of a huge pool. Bayesian Active Learning by Disagreement, introduced by Houlsby and colleagues in 2011, picks the unlabelled images on which the model's members disagree most, because labelling those teaches the model the most. Labels spent on images that are genuinely ambiguous, which carry only aleatoric uncertainty, are wasted.

Self-driving perception. A perception model that has never seen an unusual object, such as an animal on a highway, should report high epistemic uncertainty about it. Kendall and Gal showed in 2017 how to train vision models that report both kinds of uncertainty, and why the two matter differently: aleatoric uncertainty is high where object boundaries are inherently ambiguous, and epistemic uncertainty flags unfamiliar scenes.

Screening candidate molecules. Chemists use models to predict properties of molecules they have not yet made. A prediction with high epistemic uncertainty tells them the model is extrapolating, so the next experiment should test that region. This is a common practice in computational chemistry, and it turns the model's doubt into a plan.

How it works

Take one input and three ensemble members, each a network trained slightly differently. Each member predicts a mean and a noise variance for an output yy. This walkthrough uses one input and round numbers.

  1. Read off each member's prediction. The members give means 2.02.0, 2.42.4, and 1.61.6, and each says the noise variance is 0.250.25. Check: each member gives a mean and a noise level, so three pairs in total.

  2. Average the means. The combined prediction is (2.0+2.4+1.6)/3=2.0(2.0 + 2.4 + 1.6)/3 = 2.0. Check: this is the centre of the prediction the ensemble makes.

  3. Average the noise. Each member has noise variance 0.250.25, so the average is 0.250.25. This is the aleatoric part: every member agrees that the world is noisy by this much. Check: no amount of averaging over members removes it.

  4. Measure how much the members disagree. The deviations of the means from 2.02.0 are 00, 0.40.4, and −0.4-0.4. Their squares average to (0+0.16+0.16)/3≈0.107(0 + 0.16 + 0.16)/3 \approx 0.107. This is the epistemic part: the members disagree about the model, not about the world. Check: if all three means were equal, this number would be zero.

  5. Add the two parts. The total variance is 0.25+0.107=0.3570.25 + 0.107 = 0.357. Check: this matches the spread of the mixture of the three predictive curves, as the plot shows.

  6. Read the answer. About 30 percent of the spread (0.107/0.3570.107 / 0.357) is model disagreement, which more data could shrink. The rest is noise that more data cannot remove.

The plot shows the three members as separate bell curves, and the mixture of all three as the ensemble's predictive distribution. The mixture is wider than any single member, and the extra width is the epistemic part.

00.511.522.533.5400.20.40.60.8output ydensity
  • member 1, mean 2.0
  • member 2, mean 2.4
  • member 3, mean 1.6
  • ensemble mixture
Each member is a narrow bell curve (noise variance 0.25). The ensemble mixture is wider, because the members put their centres in different places.

The math

Definition: Predictive uncertainty split

For an input xx and parameters θ\theta with posterior p(θ∣D)p(\theta \mid \mathcal{D}) after training data D\mathcal{D}, the prediction is the posterior predictive distribution p(y∣x,D)=∫p(y∣x,θ) p(θ∣D) dθp(y \mid x, \mathcal{D}) = \int p(y \mid x, \theta)\, p(\theta \mid \mathcal{D})\, d\theta. Its variance splits exactly into two terms:

Var⁡(y∣x,D)⏟total=Eθ[Var⁡(y∣x,θ)]⏟aleatoric+Var⁡θ(E[y∣x,θ])⏟epistemic.\underbrace{\operatorname{Var}(y \mid x, \mathcal{D})}_{\text{total}} = \underbrace{\mathbb{E}_{\theta}\big[\operatorname{Var}(y \mid x, \theta)\big]}_{\text{aleatoric}} + \underbrace{\operatorname{Var}_{\theta}\big(\mathbb{E}[y \mid x, \theta]\big)}_{\text{epistemic}}.

Here Eθ\mathbb{E}_{\theta} and Var⁡θ\operatorname{Var}_{\theta} are the mean and variance over the parameter values, weighted by the posterior.

In words: the aleatoric term averages the noise each parameter setting predicts, and the epistemic term measures how much the settings disagree about the mean.

Step 1 in symbols: the aleatoric term

For a fixed parameter value θ\theta, the noise is Var⁡(y∣x,θ)\operatorname{Var}(y \mid x, \theta). The expectation over θ\theta averages it. Even with the true θ\theta known, this term remains, so it cannot be removed by more data.

Step 2 in symbols: the epistemic term

For each θ\theta the model has a predicted mean E[y∣x,θ]\mathbb{E}[y \mid x, \theta]. The variance of those predicted means across the posterior is the epistemic term. This is the law of total variance: the total variance of yy equals the average within-θ\theta variance plus the variance of the within-θ\theta means. As the data grows, the posterior concentrates on the parameters that explain the data, and this term shrinks toward zero.

Step 3 in symbols: estimating with samples

In practice the posterior is replaced by MM samples θ1,…,θM\theta_1, \dots, \theta_M, from an ensemble, dropout masks, or a variational approximation. Write μm=E[y∣x,θm]\mu_m = \mathbb{E}[y \mid x, \theta_m] and σm2=Var⁡(y∣x,θm)\sigma_m^2 = \operatorname{Var}(y \mid x, \theta_m). Then

aleatoric≈1M∑m=1Mσm2,epistemic≈1M∑m=1M(μm−μˉ)2,μˉ=1M∑m=1Mμm.\text{aleatoric} \approx \frac{1}{M}\sum_{m=1}^{M} \sigma_m^2, \qquad \text{epistemic} \approx \frac{1}{M}\sum_{m=1}^{M} \big(\mu_m - \bar{\mu}\big)^2, \qquad \bar{\mu} = \frac{1}{M}\sum_{m=1}^{M} \mu_m.

These are the numbers used in the walkthrough.

Step 4 in symbols: classification with entropy

For a classifier whose members output class probabilities pm(y)p_m(y), the same split holds with Entropy in place of variance. The average prediction pˉ(y)=1M∑mpm(y)\bar{p}(y) = \frac{1}{M}\sum_m p_m(y) has total entropy H[pˉ]H[\bar{p}], and

H[pˉ]=1M∑m=1MH[pm]+I(y;θ)⏟epistemic.H[\bar{p}] = \frac{1}{M}\sum_{m=1}^{M} H[p_m] + \underbrace{I(y; \theta)}_{\text{epistemic}}.

The first term is the average entropy of each member, the aleatoric part. The second term is the mutual information between the label and the parameters, which is large exactly when the members disagree with one another.

Worked examples

Example
1. Two members, hand-computable

Two members predict means 1.01.0 and 3.03.0, each with noise variance 11.

  1. Average the means: μˉ=(1.0+3.0)/2=2.0\bar{\mu} = (1.0 + 3.0)/2 = 2.0.
  2. Aleatoric part: average of the noise variances, (1+1)/2=1(1 + 1)/2 = 1.
  3. Epistemic part: the squared deviations are (1.0−2.0)2=1(1.0 - 2.0)^2 = 1 and (3.0−2.0)2=1(3.0 - 2.0)^2 = 1, and their average is 11.
  4. Total: 1+1=21 + 1 = 2.
  5. Check by direct computation: the mixture has mean 22 and, since each component adds its own variance 11 and the means are 11 away from 22, its variance is 1+1=21 + 1 = 2.

Interpretation: half the spread is noise and half is disagreement. Training on more data would pull the two members toward the same mean and cut the second half.

Example
2. A three-member classifier, standard case

Three members give the probability that an input belongs to class "yes": p1=0.9p_1 = 0.9, p2=0.5p_2 = 0.5, p3=0.1p_3 = 0.1. Measure entropy in bits.

  1. Average prediction: pˉ=(0.9+0.5+0.1)/3=0.5\bar{p} = (0.9 + 0.5 + 0.1)/3 = 0.5.
  2. Total entropy: H[pˉ]=H(0.5)=1H[\bar{p}] = H(0.5) = 1 bit, the most uncertain a yes or no answer can be.
  3. Entropy of each member: H(0.9)=−0.9log⁡20.9−0.1log⁡20.1≈0.469H(0.9) = -0.9\log_2 0.9 - 0.1\log_2 0.1 \approx 0.469 bits, and H(0.5)=1H(0.5) = 1 bit, and H(0.1)≈0.469H(0.1) \approx 0.469 bits.
  4. Average member entropy: (0.469+1+0.469)/3≈0.646(0.469 + 1 + 0.469)/3 \approx 0.646 bits, which is the aleatoric part.
  5. Mutual information: 1−0.646=0.3541 - 0.646 = 0.354 bits, which is the epistemic part.

Interpretation: the members are confident one at a time but disagree strongly, so about 35 percent of the one-bit uncertainty is disagreement that more data can address.

Example
3. Choosing what to label (realistic)

A team has three unlabelled images in a pool and can afford one label. Their ensemble gives these epistemic scores, in bits: image A 0.020.02, image B 0.350.35, image C 0.100.10. The scores are a hypothetical pool with round numbers, but the procedure is the one used in practice.

  1. Compute each image's epistemic score from the members, as in Example 2.
  2. Rank the images: B first (0.350.35), then C (0.100.10), then A (0.020.02).
  3. Label image B. Its high score means the members disagree most there, so the new label should move them together.
  4. Interpretation: image A is already well understood, and labelling it would teach the model little. Image C is somewhat uncertain, but not as much.

Try it: an image gets member probabilities 0.50.5, 0.50.5, and 0.50.5. Compute its epistemic score and say how much of its uncertainty is aleatoric. Answer: the members agree, so the mutual information is 1−1=01 - 1 = 0 bits, and all of the one bit of uncertainty is aleatoric. No label will help, because the image itself is a coin flip.

Common mistakes and tradeoffs

It is tempting to think that high agreement among members means the prediction is right. In fact members can agree on a wrong answer, for example when an unusual input looks similar to the training data for every member. Low epistemic uncertainty is a signal that the members share a belief, not a guarantee that the belief is true.

It is tempting to think that more data removes all uncertainty. In fact the aleatoric part is the noise that stays even with the true model, such as the randomness of a coin flip or the measurement error in a sensor. Only the epistemic part shrinks as the data grows.

It is tempting to think a single network's softmax confidence is the uncertainty. In fact a single network gives one set of probabilities that mixes both kinds of doubt, and it is often overconfident on inputs far from its training data. Separating the two needs several parameter settings, through an ensemble, dropout samples, or a Bayesian method.

It is tempting to think the split is clean in practice. In fact the estimates depend on how many members or samples you use, on the model family, and on how well the approximation captures the posterior. With few members, the mutual information is noisy.

When to use it: when a decision depends on whether the model knows enough to answer, such as deferring a case to a person, choosing data to label, or monitoring for unfamiliar inputs. When not to use it: when you only need a point prediction and cannot afford several passes or members, since the cost grows with the number of samples.

MethodHow it gets samplesStrengthWeakness
Deep ensemblesTrain several networks from different startsSimple, strong in practiceCosts several times the training
MC dropoutKeep dropout on and sample many passesNo retrainingApproximate, sensitive to dropout rate
Bayesian neural networkModel a distribution over every weightPrincipledHarder to train and to scale
Single network with a variance outputPredict a noise level directlyOne passCaptures only aleatoric uncertainty

History

Bayesian treatments of neural networks go back to the early 1990s, when David MacKay and Radford Neal showed how to put a probability distribution over the weights and integrate over it. The computations were heavy, so the idea stayed mostly in research. The distinction between the two kinds of uncertainty is older still. In engineering risk analysis, researchers used the terms aleatory and epistemic for decades, and Der Kiureghian and Ditlevsen asked in 2009 whether the distinction changes decisions.

Deep learning made the question urgent. Blundell and colleagues showed in 2015 that weights can be learned as distributions, and Gal and Ghahramani showed in 2015 that ordinary dropout approximates a Bayesian model. Lakshminarayanan and colleagues showed in 2016 that a plain ensemble gives strong uncertainty estimates. In 2017 Kendall and Gal trained vision models that report both kinds of uncertainty, which made the split a common tool.

Recap

  • Total predictive uncertainty is the sum of aleatoric uncertainty (noise) and epistemic uncertainty (model doubt).
  • The aleatoric part is the average noise each parameter setting predicts, and it stays with more data.
  • The epistemic part is how much the parameter settings disagree, and it shrinks as data grows.
  • For classifiers the split is entropy minus average member entropy, which equals the mutual information between the label and the parameters.
  • Use the epistemic part to decide when the model should ask for help or for more data.

Read next: Uncertainty Quantification for the wider toolkit, and Bayesian Neural Network for the model that defines the split most cleanly.

Check yourself

QuestionIn one sentence, what is the difference between aleatoric and epistemic uncertainty, and which one shrinks with more training data?Show answer

Aleatoric uncertainty is randomness in the world, the noise that remains even with the true model. Epistemic uncertainty is doubt about the model's parameters, and it is the part that shrinks as the data grows, because the posterior concentrates on the parameters that explain the data.

QuestionTwo members predict means 4 and 6, each with noise variance 2. What are the aleatoric, epistemic and total variances?Show answer

The average mean is 55. The aleatoric part is the average noise variance, 22. The epistemic part is the average squared deviation, ((4−5)2+(6−5)2)/2=1((4-5)^2 + (6-5)^2)/2 = 1. The total is 2+1=32 + 1 = 3.

QuestionWhy can an ensemble that agrees on a wrong answer still be useful, and what does its agreement not tell you?Show answer

The agreement shows the members share a belief, so the model is not uncertain about its own parameters on that input. It does not show the belief is right: if all members are wrong in the same way, the epistemic term is small and the prediction is still wrong. Agreement is evidence about the model's confidence in itself, not a check against the truth.

QuestionA classifier's three members give probabilities 0.2, 0.2, and 0.2 for a yes answer on a new input. Is more data likely to change the prediction, and why?Show answer

Probably not much. The members agree, so the mutual information is zero and the uncertainty is aleatoric. The true probability of yes looks like about 0.2 for every member, so more data about the model will not change the picture; only data about the world, such as better measurements, could.

Sources