AI Glossary / Graphs and symbolic AI / Advanced
Variational posterior
Definition
A variational posterior is a distribution fitted through variational inference to approximate a model's posterior distribution after observing data. It represents uncertainty about unknown quantities within a chosen family of distributions. Its accuracy depends on that family's flexibility and on the fitting procedure.
What it means
The word posterior identifies what is being approximated: uncertainty conditional on the observations and model. The word variational identifies how the approximation is obtained. A fitted distribution can provide means, intervals, and probabilities, but those summaries inherit its limitations. It is important to ask which questions the approximation answers accurately, rather than treating the label as an assurance of correctness.
How it works
Choose a distribution family, fit its parameters using a variational objective, and use the resulting distribution q in place of the exact posterior for calculations. Mean-field approximations impose independence between selected components of q. This does not establish independence in the target posterior. A richer family can retain more dependence, although fitting remains a separate challenge. Posterior predictive calculations additionally combine uncertainty in the unknown quantities with the model for future observations.
Three practical examples
- A fictional warehouse models uncertain demand adjustments for two product groups. Their individual average adjustments may be estimated well while the uncertainty in their combined requirement is inaccurate. A joint stocking decision therefore needs a check on the total, not only two separate means.
- A fictional sensor team estimates two signed calibration offsets. If those offsets tend to move together, the uncertainty in their difference can be smaller than the uncertainty suggested by an independent approximation. The direction of the error depends on the quantity being calculated.
- A fictional forecasting service adds observation noise to uncertainty about a latent signal. Using only the fitted posterior mean omits the signal's uncertainty. Drawing or integrating over the variational posterior includes that uncertainty approximately, while still requiring a check on the approximation itself.
Think of it this way
Think of a joint weather outlook for two neighboring locations. Two separate summaries can miss whether rain at one location tends to coincide with rain at the other. Likewise, posterior means and individual spreads do not fully describe joint uncertainty. A variational posterior should be judged against the joint questions that the intended decision requires.
Worked example
Consider an invented exact posterior for two real-valued quantities z1 and z2. It is a joint normal distribution with both means zero, both variances 1, and covariance 0.8. Its covariance matrix has rows (1,0.8) and (0.8,1), with determinant 0.36.
Approximate it by independent normals with means m1 and m2 and variances v1 and v2, minimizing KL(q||p). For this Gaussian case, the minimizing means are zero. The diagonal entries of the target's inverse covariance matrix are both 1/0.36. Differentiating the objective with respect to each variance gives one half of [1/0.36 - 1/vi], so the optimum is v1=v2=0.36.
Thus q has the right means but narrower marginal variances and zero covariance. The divergence at this optimum is approximately 0.510826, rather than zero.
Now calculate a sum and a difference. Under the exact posterior, Var(z1+z2)=1+1+2(0.8)=3.6. Under q, it is 0.36+0.36=0.72. For the difference, the exact variance is 1+1-2(0.8)=0.4, while q again gives 0.72.
The approximation understates uncertainty about the sum but overstates uncertainty about the difference. This is why saying that every derived uncertainty is necessarily underestimated would be incorrect, even though both marginal variances are underestimated in this example.
Illustrative case study
In a fictional forecasting review, the two quantities in the example represent signed corrections to a baseline. A new observation is modeled as Y=z1+z2+epsilon, where epsilon is independent normal noise with mean zero and variance 1.
The exact posterior predictive variance is 3.6+1=4.6. Integrating the same observation model against q gives 0.72+1=1.72. Substituting only the posterior means gives variance 1, because it keeps observation noise but discards uncertainty about both corrections.
All three predictions have mean zero, yet their spreads differ substantially. The team records whether a forecast uses exact inference, the fitted variational posterior, or a mean-only substitution. It also separately evaluates the difference between the two corrections, whose uncertainty q overstates.
The example therefore tests more than whether a mean looks plausible. It checks how the approximation affects the actual quantity being forecast. The numbers are a constructed demonstration, not evidence of performance for a deployed forecasting product.
Common misconceptions and mistakes
A variational posterior is not the prior: it is fitted to approximate uncertainty after conditioning on observations.
Independence in q is a representational restriction, not a discovery that the underlying unknown quantities are independent.
Correct means do not establish correct uncertainty. The worked example has exact means but incorrect variances for both the sum and the difference.
The posterior distribution of latent quantities is not itself the posterior predictive distribution of future observations. The case study adds an observation model and its noise.
A richer representation does not remove the need to verify fitting. However, a full-covariance Gaussian family contains the exact target in this particular example.
Business use
Before selecting an approximation, list the actual outputs needed: an average, a total, a contrast, an interval, or a tail probability. Construct small reference cases with known answers for those outputs. In the example, validation of means alone would miss all three variance discrepancies. Reports should identify the approximate distribution and distinguish latent uncertainty from future observation noise. Use domain-specific decision checks alongside distributional checks, rather than assuming one accurate summary validates every downstream use.
People also ask
Can a variational posterior equal the true model posterior?
Yes, when the chosen family contains it and fitting reaches that solution.
Does drawing many samples from q fix its approximation error?
No. More samples can estimate properties of q more accurately without making q equal the target.
Does mean-field independence imply independent data?
No. It is a restriction on the approximate distribution of the selected unknown quantities.
Check your understanding
What covariance does the fitted q use in the example?
Answer: Zero.
What is its variance for z1+z2?
Answer: 0.72, compared with the exact value 3.6.
Why is the predictive variance 1.72 rather than 0.72 under q?
Answer: The observation model adds independent noise with variance 1.
Related terms
- Variational parameters
- Mean field approximation
- Covariance
- Posterior predictive distribution
- Approximate inference
- Posterior distribution
- variational inference
- KL divergence
- uncertainty quantification
Learn next
Repeat the sum and difference calculations with target covariance -0.8. Notice which derived quantity now has the larger exact variance. Then study a full-covariance approximation and verify that representing the missing covariance restores the correct calculations for this normal target.
More in Graphs and symbolic AI
- Type signature - A type signature specifies the types of inputs and outputs associated with a function or operation.
- UCB1 - UCB1 is a multi-armed bandit algorithm that selects an action using its average observed reward plus an exploration bonus.
- UCT - UCT is a method for guiding Monte Carlo tree search by applying upper-confidence-bound ideas at decision nodes.
- Łukasiewicz logic - Łukasiewicz logic is a family of many-valued logics associated with Jan Łukasiewicz.
- Unary constraint - A unary constraint is a rule that restricts the allowed values of one variable in a constraint satisfaction problem.
- Unbounded cost search - Unbounded-cost search seeks a valid solution without requiring its cost to fall below a specified threshold or within a specified factor of the best...
Sources
Jordan, Ghahramani, Jaakkola, and Saul, An Introduction to Variational Methods for Graphical Models, discussion of factorized approximations: https://people.eecs.berkeley.edu/~jordan/papers/variational-intro.pdf Kucukelbir and colleagues, Automatic Differentiation Variational Inference, Section 3.1 on Gaussian approximation accuracy: https://jmlr.org/papers/volume18/16-107/16-107.pdf The covariance matrix, calculations, and forecasting scenario here are original illustrations.
Previous: Variational parameters Next: Variational recurrent neural network