Quoto

Courses / Simulation and approximation

Variational inference

8 cards2 min readStatistics

Card 1 of 8
  1. Idea: A posterior you cannot afford

    The evidence sums over every and cannot be done; sampling all night is too slow.

    • Variational inference turns the integral into an optimisation
    • Pick a simple family, find the member closest to the posterior
  2. Formula: KL divergence

    Zero only when q matches p. Not symmetric: this one averages over q.

  3. Formula: The evidence lower bound

    Raise the bound and the divergence falls as much. The bound needs only prior times likelihood.

  4. Example: The gap by hand

    Joint , , over values of , and . How many bits is the gap to the evidence?

    1. Evidence: , its log is
    2. Bound:
    3. Gap:
  5. Idea: The price of independence

    Mean-field treats each parameter as independent: fast, with a known bias.

    • It gets the mean right and the variance too small
    • Its divergence punishes mass where p is thin, not parts of p it misses
  6. Quick check: How narrow is it?

    A normal posterior has and . What variance does the mean-field give ?

    Show the answer

    Answer:

    The conditional variance: , less than half the truth.

  7. Common mistake: Trusting a variational error bar

    It is often too narrow, and most confident when correlation is strongest.

    Instead Check against a short sampling run before sizing. Compare bounds only within one model.

  8. Idea: Where it fits

    Monte Carlo is slow but gets there. Variational inference is fast, and its bias stays.

    • Use it for a posterior on a deadline
    • Remember which way it leans: too confident