Flow-Based Generative Models · UFRJ · 2026.2
Today is none of those. Today is the foundation all three stand on.
We prove one result. Then we announce, on one slide, the three later sessions that use it.
When each of those three moments arrives, I will point back at this board.
Everything else in this session exists so that the promise can be stated precisely.
\(m(y)\) is a value · \(m\) is a function · \(m(Y) = \mathbb{E}[X \mid Y]\) is a random variable. Ask it of every conditional expectation you meet: which panel is this?
Let \(m(y) = \mathbb{E}[X \mid Y = y]\), and write \(f^{*} := m\). For every square-integrable \(f(Y)\): \[ \begin{aligned} &\mathbb{E}_{(x, y) \sim p_{XY}}\big[\, \Vert f(y) - x \Vert^{2} \,\big] \\[2pt] &\qquad\;=\; \mathbb{E}_{(x, y) \sim p_{XY}}\big[\, \Vert m(y) - x \Vert^{2} \,\big] \;+\; \mathbb{E}_{y \sim p_Y}\big[\, \Vert f(y) - m(y) \Vert^{2} \,\big] . \end{aligned} \] So \(m\) minimizes the population risk: \(m(Y)\) is the unique minimizer, \(\mathbb{P}\)-a.s.; \(m(y)\) is unique \(p_Y\)-a.e.
Square-integrable, throughout: \(\mathbb{E}_{x \sim p_X}[\Vert x\Vert^{2}] < \infty\) and \(\mathbb{E}\Vert f(Y)\Vert^{2} < \infty\).
The proof is on the board: one expansion, and one cross term that dies.
The vertical edge is the irreducible \(L^{2}\) error among predictors that use only \(Y\). The horizontal edge measures how far the chosen predictor is from the optimal one.
\(\psi_{\#}\, p\) is the law of \(\psi(x)\) when \(x \sim p\): \[ \mathbb{E}_{y \sim \psi_{\#} p}\big[ g(y) \big] = \mathbb{E}_{x \sim p}\big[ g(\psi(x)) \big] \quad \text{for every bounded measurable } g . \]
It also gives the sampling rule: draw \(x \sim p\) and return \(\psi(x)\); the result has law \(\psi_{\#}\, p\). As a set formula, \((\psi_{\#} p)(A) = p(\psi^{-1}(A))\) — a probability law always, a density not necessarily.
You built one in the primer: \(x = \mu + \sigma\varepsilon\) is \(\mathcal{N}(\mu, \sigma^2) = \psi_{\#}\,\mathcal{N}(0,1)\).
The symbol \(\psi_{\#}\) is the course standard, after (Lipman et al. 2024) §3.3 — which states it for diffeomorphisms; any measurable \(\psi\) will do here.
\[ p_\theta = \big(\psi^{\theta}\big)_{\#}\, p_0 , \qquad p_0 = \mathcal{N}(0, I_d) \]
With \(\mathcal{J}(\theta) = \mathbb{E}_{x_1 \sim q}[\log p_\theta(x_1)]\) and \(C_q = \mathbb{E}_{x_1 \sim q}[\log q(x_1)]\), \[ \begin{gathered} \mathrm{KL}\big(q \,\Vert\, p_\theta\big) \;=\; C_q - \mathcal{J}(\theta) , \\[2pt] \text{so}\quad \operatorname*{arg\,max}_{\theta}\; \mathcal{J}(\theta) \;=\; \operatorname*{arg\,min}_{\theta}\; \mathrm{KL}\big(q \,\Vert\, p_\theta\big) . \end{gathered} \]
Under: \(q\) and \(p_\theta\) with densities; \(q \ll p_\theta\) (necessary for a finite KL, not sufficient); \(C_q\) and \(\mathcal{J}(\theta)\) finite. Two lines: expand the divergence; the term with no \(\theta\) is \(C_q\). The empirical MLE objective is the sample average of \(\mathcal{J}\).
The data sits in the first argument — mass-covering pressure, in the primer’s restricted-family heuristic.
But maximum likelihood needs \(\log p_\theta(x_1)\), and the pushforward definition alone gives no tractable way to evaluate it.
Three distinct things: the density exists (assumed above) · it has an expression · it can be evaluated tractably. The objective needs the third.
| Unit | Strategy | The price |
|---|---|---|
| U1 Normalizing Flows | invertible by construction: inverse and Jacobian tractable | architectural restriction |
| U2 Continuous NFs | flow map of a Neural ODE; invertibility from well-posedness; volume change tracked continuously | numerical integration, everywhere |
| U3 Flow Matching | change the objective: regress a velocity field on targets you can sample | no likelihood needed for training — the Lemma returns, three times |
Sampling: draw from the source and transport the sample. Density evaluation: track how probability density changes under that transport.
\(X \sim \mathcal{N}(\mu_0, \sigma_0^{2} I_d)\), and \(Y = X + \sigma\varepsilon\).
(a) Compute \(\mathbb{E}[X \mid Y = y]\) and \(\operatorname{Cov}(X \mid Y = y)\) in closed form, from the toolkit sheet.
(b) In \(d = 1\): train a small network on samples \((y_i, x_i)\) with the empirical square loss. Plot it against \(m(y) = 0.8\, y\) on the evaluation grid.
(c) Replace the target \(X\) by \(Z = X + \eta\), \(\eta \sim \mathcal{N}(0, \tau^{2})\), \(\eta \perp (X, Y)\). On paper: \(\mathcal{L}_Z = \mathcal{L}_X + \tau^{2}\), and the finite-sample difference is not a constant. Then several seeds, two sample sizes: same population target; summarize the finite-sample behaviour across seeds.
This exercise has a secret identity, to be revealed in U3.