Conjugate Priors
Special prior-and-likelihood pairings where the posterior stays in the same family as the prior, turning Bayesian updating into simple arithmetic on counts. The exact, closed-form corner of Bayesian statistics.
Prerequisites: Bayes' Theorem, Bayesian Inference
Bayesian updating, in general, means multiplying a prior by a likelihood and then wrestling with an ugly normalizing integral to get the posterior. Conjugate priors are the happy exception where that integral has a clean answer, because the prior and the likelihood are chosen to fit together so that the posterior comes out in the very same family as the prior. When that happens, updating your beliefs stops being calculus and becomes bookkeeping: you just add the new data to a running count.
The idea
A prior is conjugate to a likelihood if the resulting posterior belongs to the same family, only with updated parameters. The classic pair is the Beta prior with the Binomial likelihood. If your belief about a success probability is a Beta distribution with parameters and , and you then observe successes and failures, the posterior is simply
That is the whole update: add the successes to , add the failures to . No integral. The parameters and act like pseudo-counts, imaginary successes and failures you are pretending to have seen before the real data arrived, which is a wonderfully intuitive way to encode a prior.
A prior is conjugate when the posterior lands in the same family, so Bayesian updating reduces to arithmetic. For Beta–Binomial: plus successes and failures becomes .
The common conjugate pairs
A handful cover most textbook cases:
| Data / likelihood | Conjugate prior | Posterior update |
|---|---|---|
| Bernoulli / Binomial (rate ) | Beta | Beta |
| Poisson (rate ) | Gamma | Gamma |
| Exponential (rate ) | Gamma | Gamma |
| Normal, known variance (mean ) | Normal | precision-weighted blend of prior and data means |
| Multinomial (probs ) | Dirichlet | Dirichlet |
In every row, the posterior is the prior's family with data folded into the parameters.
Worked example: a biased coin
You suspect a coin is roughly fair but are not sure, so you set a mild prior of , which peaks gently at and encodes the weak belief "as if I had already seen 2 heads and 2 tails." Now you flip it 10 times and get 8 heads, 2 tails. The posterior is
Its mean is . Compare the three numbers: the prior mean was , the raw data (maximum-likelihood) estimate is , and the posterior mean sits between them, pulled toward the data but held back by the prior. That shrinkage is the entire value of the Bayesian view, and here you can read exactly how much the prior weighed in: its 4 pseudo-observations against the data's 10 real ones.
Read the prior parameters as pseudo-observations: a prior is "2 imaginary heads and 2 imaginary tails." The more real data you gather, the more those imaginary counts get swamped and the closer the posterior mean drifts to the raw data estimate.
Where conjugacy misleads
- Convenience is not correctness. A conjugate prior is chosen because the math is clean, not because it is the right description of your beliefs. Do not let tractability quietly dictate your prior.
- Small data, strong prior. With few observations the prior can dominate the answer. Beta would barely have budged from after those same 10 flips, always ask how much your prior is doing.
- Most real models are not conjugate. The moment you add a hierarchy, an unknown variance alongside an unknown mean, or a nonstandard likelihood, closed-form conjugacy breaks. That is exactly when you reach for MCMC, which samples the posterior without needing it in closed form.
Conjugacy is a mathematical convenience, not a modeling truth. If a conjugate prior does not honestly reflect your beliefs, or the model is too rich for any conjugate pair, do not force it, use MCMC instead of distorting the prior to keep the algebra tidy.
Conjugate priors are the exactly-solvable base case of Bayesian inference, a direct application of Bayes' theorem, and the natural contrast to MCMC, which takes over precisely where the clean formulas run out.
Related concepts
Practice in interviews
Further reading
- Gelman et al., Bayesian Data Analysis (Ch. 2)
- Murphy, Machine Learning: A Probabilistic Perspective (Ch. 3–5)
- Bishop, Pattern Recognition and Machine Learning (Ch. 2)