Course contents

Generative Models / Variational Autoencoders

Variational Autoencoders

Latent-variable modeling, the evidence lower bound and the reparameterization trick.

Prerequisites

Probability · Maximum likelihood · KL divergence

A variational autoencoder is a latent-variable model with a learned approximate posterior. It turns otherwise difficult posterior inference into a differentiable optimization problem.

Evidence lower bound

For observation xx and latent variable zz, introduce qϕ(z∣x)q_\phi(z\mid x) as an approximation to pθ(z∣x)p_\theta(z\mid x). Then

log⁡pθ(x)≥Eqϕ(z∣x)[log⁡pθ(x∣z)]−DKL(qϕ(z∣x) ∥ p(z)).\log p_\theta(x) \ge \mathbb{E}_{q_\phi(z\mid x)}[\log p_\theta(x\mid z)] - D_{\mathrm{KL}}(q_\phi(z\mid x)\,\|\,p(z)).

The first term rewards reconstruction under the decoder. The second regularizes the approximate posterior toward the prior. Their balance shapes both fidelity and latent-space organization.

Reparameterization

For a diagonal Gaussian posterior,

z=μϕ(x)+σϕ(x)⊙ϵ,ϵ∼N(0,I).z = \mu_\phi(x) + \sigma_\phi(x) \odot \epsilon, \qquad \epsilon \sim \mathcal{N}(0,I).

Randomness is isolated in ϵ\epsilon, leaving a differentiable path through μϕ\mu_\phi and σϕ\sigma_\phi. This is the reparameterization trick.