Conjugacy and Exponential Family
Probability and Distributions
In Bayesian inference, we update a prior p(theta) with a likelihood p(mathcal{D} mid theta) to get a posterior p(theta mid mathcal{D}) propto p(mathcal{D} mid theta)p(theta). The posterior is generally messy — but for certain conjugate prior-likelihood pairs, the posterior has the same functional fo
Conjugate priors yield posteriors in the same family — inference reduces to parameter updates.
No exponential family → no scalable VI, no GLMs, no clean theory of EM.
In Bayesian inference, we update a prior with a likelihood to get a posterior . The posterior is generally messy — but for certain conjugate prior-likelihood pairs, the posterior has the same functional form as the prior. This turns inference from integral calculus into parameter arithmetic.
Classical conjugate pairs: Beta prior + Bernoulli/Binomial likelihood → Beta posterior; Gaussian prior (known variance) + Gaussian likelihood → Gaussian posterior; Dirichlet prior + Multinomial → Dirichlet posterior; Gamma prior + Poisson → Gamma. The math reduces to updating 'effective counts' or 'natural parameters', avoiding integration entirely.
The deeper reason these exist: the exponential family of distributions. A family has exponential-family form if , where are the sufficient statistics, are natural parameters, and is the log-partition function. Gaussian, Bernoulli, Poisson, Beta, Dirichlet, Gamma, and categorical distributions are all exponential families.
Exponential families have beautiful properties. Sufficient statistics carry all information from the data about — you can throw away the raw data. The MLE comes from matching the expected sufficient statistics to the empirical ones. Any exponential family has a conjugate prior of a specific form. And the family is closed under multiplication (so posteriors stay in it).
In ML, this framework clarifies many methods. Logistic regression and Poisson regression are exponential families with the linear predictor feeding the natural parameter — hence generalized linear models (GLMs). Variational inference with exponential family approximations becomes coordinate-wise parameter updates. Even modern energy-based models are unnormalized exponential families. Seeing the family lurking behind a model is a shortcut to both theory and efficient algorithms.
Worked example — Beta-Binomial conjugacy: Start with prior (weak belief centered at 0.5). Observe 7 heads in 10 flips. The posterior is . Its mean is — shifted from the prior mean of 0.5 toward the data frequency 0.7, but pulled back a little by the prior.
Worked example — exponential-family form of Bernoulli: rewrites as . So the natural parameter is (the logit), the sufficient statistic is , and . This is exactly the logit used in logistic regression.
Exercises
Put your understanding to the test. Score + streak + speed all count.
Confirm you've got it
3 quick questions. Get 2 right to mark this lesson complete.