Bayes' Theorem in AI — Priors, Posteriors, and Uncertainty
One line of math — Bayes' theorem — turns into three workhorse tools in real AI systems: probability calibration, active learning, and Bayesian optimization. Starting from a positive medical test, we build up priors, posteriors, and uncertainty with zero background assumed.
On Calibration of Modern Neural Networks
Primary source — what this article is built on
undefined2026-08-13
On Calibration of Modern Neural NetworksarXiv:1706.04599Paper page·PDFPractical Bayesian Optimization of Machine Learning AlgorithmsarXiv:1206.2944Paper page·PDF
You test positive. How worried should you be?
Suppose you take a test for a disease that affects 1 in 1,000 people, and the result comes back positive. The test catches 99% of people who have the disease, and falsely flags 1% of people who don't. What's the probability you're actually sick?
Intuition wants to say "about 99%." The right answer is roughly 9%. Count it out with 100,000 people: 100 of them have the disease, and 99 of those test positive. The other 99,900 are healthy, and 1% of them — 999 people — get a false positive anyway. So 1,098 people are holding a positive result, but only 99 of them are actually sick. 99 ÷ 1,098 ≈ 9%.
Why did intuition fail? Because it ignored the prior information that the disease is rare in the first place. Bayes' theorem is the formula that mixes "what we knew beforehand" with "the evidence in front of us" in exactly the right proportions. And in AI, this single line of math answers some remarkably practical questions: can we trust the model's confidence? Which data point should we label next? Where should we spend our next expensive experiment?
Intuition: Bayes' theorem is a rule for updating beliefs
In one sentence, Bayes' theorem is a rule that takes your belief before seeing evidence (the prior), weights it by how well each hypothesis explains the evidence (the likelihood), and produces your belief after seeing the evidence (the posterior).
Picture a detective story. At the start of the investigation, the detective holds a hunch about each suspect — that set of hunches is the prior distribution. Then new evidence turns up: a footprint at the scene. For each suspect, the detective asks, "if this person were the culprit, how natural would this footprint be?" That's the likelihood. Multiply prior suspicion by explanatory power, renormalize so everything adds up, and you get an updated set of hunches — the posterior distribution. Every new piece of evidence repeats the update, and the distribution gradually sharpens.
The crucial point is that the answer comes out not as a verdict ("A did it") but as a probability distribution. A sharp distribution means high confidence; a flat one means "we don't know yet." Being able to carry uncertainty around as a number is the single biggest advantage of thinking in Bayesian terms.
The machinery: one line of math
In words: is a hypothesis (you have the disease; this image is a cat), and is the observed data (the test was positive; these were the pixels). is the prior — your belief before seeing data. is the likelihood — the probability of seeing that data if the hypothesis were true. is the evidence — the probability of that data regardless of hypothesis (a normalizing constant, summed over all hypotheses, that makes the answers add up to 1). The left side, , is the posterior — your belief after seeing the data.
Swap every symbol for an everyday word and, in words, the line reads: what you should believe now = how well the hypothesis predicted what you saw × how believable it was before you saw anything ÷ how ordinary that observation was. That last division is what the opening example turns on: a positive result is not rare — 1,098 people in 100,000 walk away holding one — so a large drags the answer back down to 9%.
Since the denominator exists only to normalize, practitioners usually remember the proportional form:
Which says: posterior ∝ likelihood × prior. Your updated belief is proportional to how well the hypothesis explains the evidence, times how plausible it was to begin with. Said in words with the symbols stripped out: explain the evidence, but stay believable. The two factors multiply, so a hypothesis scoring near zero on either one is finished no matter how well it does on the other. The medical test at the top and the detective's investigation are both just this multiplication.
A classifier's output has the same shape. When a model says "cat: 0.92, dog: 0.08," that's a kind of posterior distribution over classes. How sharp such a distribution is — and what it feels like to tune that sharpness — is exactly what the temperature slider below demonstrates. Lower the temperature and the mass piles onto one answer (strong conviction); raise it and the distribution flattens toward "no idea."
Comments
Sign in to comment