Foundation Lab

Normalizing Flows: Exact Likelihood via Invertible Transforms

Flows provide exact likelihood (unlike GANs) and exact sampling (unlike EBMs)—the "best of both worlds"

Concept 39 of 100Generative ModelsPhase 4
#39FlowsGenerative Models
key equation
log⁡px(x)=log⁡pz(f−1(x))+log⁡∣det⁡∂f−1∂x∣\log p_x(x) = \log p_z(f^{-1}(x)) + \log \left| \det \frac{\partial f^{-1}}{\partial x} \right|
Reading map and next steps

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 39 of 100FlowsGenerative Models / Phase 4: Generative modeling families
Current question

The challenge is making f invertible AND having tractable Jacobian determinant—this drives architecture choices (coupling layers, autoregressive flows)

log⁡px(x)=log⁡pz(f−1(x))+log⁡∣det⁡∂f−1∂x∣\log p_x(x) = \log p_z(f^{-1}(x)) + \log \left| \det \frac{\partial f^{-1}}{\partial x} \right|
PredictionCommit before the demo.

Ask what should change when the equation is manipulated, then use the linked notebook demo to test that expectation.

EvidenceCompare the linked witness and source.

Use the linked notebook demo, this key equation, and canonical papers as separate witnesses for the same object.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue in the newer notebook.

This atlas page has no local demo; the domain notebook carries the interactive witness and the fuller Intuition -> Math -> Code -> Demo sequence.

Why It Matters for Modern Models

  • Flows provide exact likelihood (unlike GANs) and exact sampling (unlike EBMs)—the "best of both worlds"
  • The mathematical foundation for flow matching/rectified flows which are replacing traditional diffusion
  • Understanding Jacobian determinants and invertibility constraints illuminates architectural design choices

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • The challenge is making f invertible AND having tractable Jacobian determinant—this drives architecture choices (coupling layers, autoregressive flows)
  • Unlike VAEs, no variational bound: you get exact log p(x), but at the cost of architectural constraints
  • Modern flow matching avoids the Jacobian entirely by learning velocity fields—converges to OT map

Visualization Status

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation here and the linked notebook demo. Come back here for the full walkthrough.

Key Equation
log⁡px(x)=log⁡pz(f−1(x))+log⁡∣det⁡∂f−1∂x∣\log p_x(x) = \log p_z(f^{-1}(x)) + \log \left| \det \frac{\partial f^{-1}}{\partial x} \right|

Normalizing flows transform a simple base distribution pz(z)p_z(z) through an invertible function ff:

x=f(z),z∼pzx = f(z), \quad z \sim p_z

The change of variables formula gives exact log-likelihood:

log⁡px(x)=log⁡pz(f−1(x))+log⁡∣det⁡∂f−1∂x∣\log p_x(x) = \log p_z(f^{-1}(x)) + \log \left| \det \frac{\partial f^{-1}}{\partial x} \right|

Composition of flows: f=fK∘⋯∘f1f = f_K \circ \cdots \circ f_1 with log-det Jacobian summing:

log⁡px(x)=log⁡pz(z0)+∑k=1Klog⁡∣det⁡∂fk∂zk−1∣\log p_x(x) = \log p_z(z_0) + \sum_{k=1}^K \log \left| \det \frac{\partial f_k}{\partial z_{k-1}} \right|

Canonical Papers

Variational Inference with Normalizing Flows

Rezende & Mohamed2015ICML
Read paper →

Glow: Generative Flow with Invertible 1×1 Convolutions

Kingma & Dhariwal2018NeurIPS
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.