โ† back to index

Bayesian Lenses and Statistical Games

Toby St Clere Smithe ยท 2021 ยท arxiv arXiv:2109.04461

Prereqs: ๐Ÿž Fritz 2020 (Markov categories, Bayesian inversion). ๐Ÿž Hedges 2018 (compositional games) helps but isn't required.

A Bayesian lens pairs a forward channel (prediction) with a backward channel (Bayesian update). Composing lenses gives you a system that predicts and then corrects โ€” wpactive inference falls out as the equilibrium of a statistical game.

Lenses: forward and backward

A lens is a pair: a get (forward pass, observation) and a put (backward pass, update). In the Bayesian setting, get is a likelihood channel and put is the Bayesian inverse โ€” the posterior update given new evidence.

Bayesian Lens observation (inference) --> prior predict observation posterior (learning) --> evidence update posterior inference → ← learning forward: predict from beliefs. backward: Bayesian update.
Scheme
Python

Bayesian inversion as the backward pass

The backward channel is the wpBayesian inverse: given a prior and an observation, compute the posterior. This isn't an arbitrary update โ€” it's the unique channel that makes the joint distribution factor correctly.

Scheme
Python

Composing lenses

Two Bayesian lenses compose: the forward passes chain (predict through both stages), and the backward passes chain in reverse (update flows back). This is the categorical structure of lenses โ€” composition is well-defined and associative.

Scheme
Python

Free energy as the game's objective

A statistical game has players that minimize wpvariational free energy โ€” the gap between their model's predictions and the actual observations. The equilibrium of the game is active inference: each agent updates its beliefs to minimize surprise.

Scheme
Python

Notation reference

Paper Scheme Meaning
(f, fโ€ )(make-lens fwd bwd)Bayesian lens (forward, inverse)
fโ€ (bayes-update ...)Bayesian inverse channel
F(free-energy ...)Variational free energy
Lโ‚ โŠ™ Lโ‚‚(compose-lens L1 L2)Lens composition
BayesLens(C); category of Bayesian lensesCategory with Bayesian backward passes
Neighbors

Other paper pages

Foundations (Wikipedia)

Translation notes

The Bayesian update examples use finite hypothesis spaces with explicit probability tables. Smithe works with Bayesian inversions in arbitrary Markov categories, where the backward channel is defined via a universal property (the wpdisintegration). For example: the coin-bias update on this page shifts a point estimate by ยฑ0.1. In the paper, the backward channel is the exact Bayesian posterior computed via disintegration of the joint measure โ€” a construction that works over continuous parameter spaces and requires measure-theoretic conditioning. The predict-then-update structure is identical. The exactness of the inversion is not.

Every example is Simplified.

Ready for the real thing? arxiv Read the paper. Start at ยง3 for Bayesian lenses, ยง5 for statistical games and free energy.

Framework connection: The backward pass of a Bayesian lens corresponds to the Natural Framework's Consolidate stage โ€” the policy update that reads from persistent memory. (jkThe Natural Framework)