HomeStatisticsVariational Inference: Watching a Posterior Get Approximated

Variational Inference: Watching a Posterior Get Approximated

Interactive 3D variational-inference lab: a diagonal Gaussian climbs the ELBO by stochastic gradient ascent (reparameterization trick) to approximate a true log-posterior landscape, live, across unimodal, bimodal and banana-shaped targets.

Statistics3DAdvanced60 FPS📱 Mobile-adapted⇄ 2D version
ds-topic-45 ↗ Open standalone

Instead of sampling a posterior distribution point by point the way MCMC does, variational inference turns Bayesian inference into an optimization problem: fit a simple distribution q(θ) — here a diagonal Gaussian — to the true posterior by maximizing the Evidence Lower Bound (ELBO). This simulator renders a real 2D parameter space as a 3D log-density landscape and runs genuine stochastic gradient ascent on the ELBO, using the reparameterization trick to differentiate through Monte-Carlo samples, exactly as libraries like Pyro or Stan's ADVI do. Switch between a single correlated Gaussian mode, a bimodal target and a curved "banana" posterior to see variational inference's real behavior: fast convergence, but mode-seeking collapse whenever the true posterior has more structure than the Gaussian family can represent.

⚙ Under the hood

A diagonal Gaussian climbs the ELBO via stochastic gradient ascent with the reparameterization trick, live, to approximate a true log-posterior landscape — switch between unimodal, bimodal and banana-shaped targets to see variational inference's mode-seeking behavior.

bayesianvariational-inferenceELBOstatisticsmachine-learningposterior

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)