Data: y = |x| + noise, none for −0.5 < x < 0.5. You fit x as a function of y by least squares. What does it predict at y = 0.75?

Generative model: a model of the probability distribution of the data, good enough to draw new samples from it, and sometimes to evaluate the density at a point.
| Discriminative (L8–L14) | Generative | |
|---|---|---|
| Learns | ||
| Asks | inputs → outputs | any variables given any others |
| Returns | a number, or one distribution | samples, every mode included |
| Must model | how |
that, and how |

Gaussian mixture model: a density written as a weighted sum of
n_init)Dempster, Laird and Rubin (1977), doi:10.1111/j.2517-6161.1977.tb01600.x; Bishop, PRML ch. 9
Fix the known block



scipy's SLSQP finds
| Method | The map | Trained by | Catch |
|---|---|---|---|
| Normalizing flow | stack of invertible layers | max likelihood | layers must be invertible, cheap Jacobian |
| Continuous flow | ODE |
max likelihood | ODE solve every training step |
| Diffusion | learned reverse of a noising process | denoising regression | many sampling steps |
| Flow matching | ODE |
plain regression | sampling still integrates an ODE |
Papamakarios et al. 2021 · Chen et al. 2018 · Ho et al. 2020 · Song et al. 2021 · Lipman et al. 2023
Flow matching: regress a velocity field onto the velocities of straight lines from noise to data, then generate by integrating it from noise.


| Gaussian mixture | Conditional flow matching | |
|---|---|---|
| Learns | density | velocity field (network) |
| Training | EM, seconds | gradient descent: seconds here, hours at scale |
| Sampling | exact draw | ODE, ~100 network calls |
| Conditioning | any variables, after training | only what the network was trained on |
| Density at a point | exact | not directly |
| Dimension | tens | up to millions |
You trained a GMM and a conditional flow-matching model to sample reactor inputs given outputs. Now you need outputs given inputs. Which can answer without retraining?
| Solver on a model | Discriminative surrogate | Generative model | |
|---|---|---|---|
| Needs | a model | data | data |
| Direction | as posed | inputs → outputs | any |
| Several solutions | one per start | averages them | all, as samples |
| Accuracy | solver tolerance | surrogate error | surrogate error + sampling |
| New value of the condition | new solve | one evaluation | one batch of samples |
| Optimality certificate | KKT | none | none |
Goodfellow et al. 2014 · Kingma and Welling 2013 · Rombach et al. 2022 · Esser et al. 2024
Gómez-Bombarelli et al. 2018 · Hoogeboom et al. 2022 · Corso et al. 2023 · Watson et al. 2023 · Abramson et al. 2024
l16-generative-optimization.ipynb: regression failure, GMM chosen by BIC and conditioned by hand, conditional flow matching in PyTorch, the gap, Peng–Robinson roots by three models with Newton polishing, and the batch-reactor optimumNicknames only. Everyone who skipped one still counted in every bar you saw.
torch and scikit-learn, both already on Colablectures/l16/notes.md70 minutes of lecture, then the notebook and questions.
5 min
Let the room read the plot before the clicker. Do not say the answer.
D is the answer people want; regression cannot give two numbers.
10 min
Name family 3 and leave it. Do not preview a later lecture.
15 min
Play the EM iterations at K = 2 (the default, BIC's choice). Then K = 4 and K = 1. Then drag y* into the gap (below 0.5).
Talk through the two GMM panels here; come back to the flow-matching panels later.
20 min
The field is the exact minimizer of the loss for these points (kernel-weighted in y); a network learns a smooth version. Then set y* = 0.3: the exact field snaps to the nearest data, near y = 0.5; the trained network in the notebook gives -0.41 / +0.33.
Same cloud at every t (readout), different paths. Rectified flow and OT pairing straighten them.
5 min
The paper says plainly it does not replace mathematical programming.
10 min. For each: what is generated, conditioned on what, checked how?
5 min