§19.4.1 Discrete latent variables
Mean field is at its simplest when the latents are discrete. For binary , a factorial is just a vector of probabilities, . We optimize those probabilities to maximize — and because this optimization sits in the inner loop of learning, it must be fast. Rather than gradient descent, we iterate fixed-point equations fixed-point equations Iterated updates solving ∂L/∂ĥᵢ = 0 one variable at a time to find the mean-field q quickly in a learning inner loop; the mean-field update is itself a recurrent inference network. defined in ch. 19 — open in glossary : solve for one at a time (eq 19.18) and cycle until convergence.
The running example is binary sparse coding. An input is the sum of components, each switched on/off by a hidden unit, plus Gaussian noise:
The binary sparse coding model (eqs 19.19–19.20)
| each component is present with a prior probability set by a learnable bias bᵢ | Bernoulli | |
| the active components sum into a reconstruction — a linear decoder | n | |
| learnable diagonal noise precision. Together these make p(h|v) intractable | n × n |
Why the posterior is intractable. Every pair are co-parents of the same visibles, so observing activates a path between every pair of hidden units — the posterior is a complete graph over (fig 19.2). No variable-elimination shortcut helps; the maximum-likelihood gradient’s expectation over is brute-force expensive.
Mean field to the rescue. Assume (eq 19.28). The ELBO (eqs 19.29–19.36) becomes a handful of arithmetic operations, and solving gives a closed-form update for each unit:
The mean-field fixed-point update (eq 19.44)
| the fixed input drive: how well unit i's weights match the input. Constant during inference | scalar | |
| INHIBITION: unit i is suppressed by every other active unit j, in proportion to their weight overlap. This is the recurrent, changing message | scalar | |
| squashes to a probability. Iterating this for i = 1…m IS a recurrent inference network | probability |
The inhibition term is the whole story: two units whose weight vectors align inhibit each other, so only the one that best explains the input survives. Iterate the competition:
High alignment (overlapping weights) makes the two units compete: each inhibits the other, so cyclic updates drive one to 1 and the other to 0 — the mean-field attempt at explaining away. The true posterior is bimodal (either unit could explain v), but a factorial q can only capture one mode. Drop alignment and both stay active.
Sparse coding as an iterative autoencoder
Rewriting the update (eq 19.45), unit ‘s drive becomes — the residual left over once the other units’ contributions are subtracted. So each unit tries to encode what the others missed: sparse coding runs as an iterative autoencoder, repeatedly encoding and decoding to fix the reconstruction. But because the factorial cannot be bimodal, the explaining-away explaining away At a V-structure (a, b both parents of c), observing c (or a descendant) makes the two causes DEPENDENT: learning one cause explains the effect and lowers the other's probability. defined in ch. 16 — open in glossary competition (which really produces a multimodal posterior) is collapsed onto a single mode — the same reverse-KL behavior as fig 3.6.
One update touches a single unit. Some models (deep Boltzmann machines) let you solve for many at once; binary sparse coding does not, so we fall back on damping damping A heuristic block update for mean field: solve each ĥᵢ optimally, then move all of them a small step in that direction (not guaranteed to increase L, but works in practice). defined in ch. 19 — open in glossary — solve every unit’s optimal value, then move them all a small step that way. It no longer guarantees an increase in each step, but works well in practice. Next: the continuous case and the tool behind it — calculus of variations, and learned inference.
Check yourself — discrete mean-field inference
1.Why is the posterior p(h|v) of the binary sparse coding model intractable, even though the generative model p(h,v) is sparse?
2.Why are mean-field parameters computed with fixed-point equations rather than gradient descent?
3.In the mean-field update ĥᵢ = σ(drive − Σⱼ≠ᵢ (weight overlap)·ĥⱼ), what does the sum term do?
4.The true posterior of two aligned competing units is bimodal (either unit could explain v). What does the factorial mean-field q do?
5.Predict the outcome — in MeanFieldLab you set a high weight alignment and click 'iterate' several times. What happens to ĥ₁ and ĥ₂?