Tutorial

Beckmann maps, from the ground up

From straight lines between noise and data to a generator that lands on the data in a single network call. Five pictures you can poke, and the equations behind each.

0 · The goal

Learn the endpoint

Flow and diffusion models make an image by integrating a differential equation: a network is called tens or hundreds of times, and each call moves the sample a little closer to the data. A Beckmann map is trained to output the endpoint of that journey directly, so a sample is one network call. This page builds the idea up on a toy in the plane where everything can be drawn. The toy has five data points with weights that sum to one; think of each as one image and of its weight as how often it appears. A perfect generator sends exactly that fraction of all noise onto that point, and nothing anywhere else.

Scroll to explore

1 · Noise to data

Straight lines between noise and data

Noise is cheap: a draw \(x_0 \sim \mu_0 = \mathcal N(0, I)\). Data \(x_1 \sim \mu_1\) is what we have examples of. A generator is a map \(T\) that turns one into the other,

$$T_\#\mu_0 = \mu_1,$$

read “push noise through \(T\) and you get data, with the right frequencies”. Every method on this page starts from the same trick: pair each noise draw with an independent data draw and join them by a straight line,

$$I_t = (1-t)\,x_0 + t\,x_1, \qquad \dot I_t = x_1 - x_0, \qquad t \in [0,1].$$

At \(t = 0\) the population of points \(I_t\) is the noise cloud; at \(t = 1\) it is the data. Write \(\rho_t\) for its density. The pairing itself is random and will never be learned. What every method reproduces, each in its own way, is the population sliding along these lines.

The interpolant \(I_t\) of 300 random pairs
colour = the data point a line ends at; faint lines show 70 of the pairings “Re-pair” redraws the data partners: the lines change, the populations at t = 0 and t = 1 do not

2 · Flow matching

A velocity that changes with time

Flow matching learns the average slope of the lines passing through each point at each time,

$$b_t(x) = \mathbb E\big[\dot I_t \mid I_t = x\big] = \arg\min_{\hat b}\ \int_0^1 \mathbb E\,\big\|\hat b(I_t, t) - \dot I_t\big\|^2\,dt,$$

a regression with a network that takes the position and the time. The population is carried exactly by the ODE \(\dot X_t = b_t(X_t)\), so a sample is made by drawing \(X_0 \sim \mu_0\) and integrating from \(t = 0\) to \(1\), calling the network at every step. In the toy the regression has a closed form: given \(I_t = x\), the partner was \(z_j\) with posterior weight \(\propto p_j \exp\!\big(-|x - t z_j|^2/2(1-t)^2\big)\), and

$$b_t(x) = \frac{\hat z_t(x) - x}{1-t}, \qquad \hat z_t(x) = \mathbb E[x_1 \mid I_t = x].$$

The velocity points from \(x\) toward the current best guess of the endpoint, a denoiser \(\hat z_t(x)\), with a speed that grows as time runs out. Early on the guess is vague and the field points to the middle; late on it has decided. Drag the slider and hover the field.

The field \(b_t(x)\), directions only
hover: the arrow at x and the posterior mean ẑt(x) it points at at t = 0 the posterior is the prior, so ẑ0 is the data mean for every x

That last fact is the whole problem with few steps. One Euler step from \(t = 0\) is \(x_0 + b_0(x_0) = \hat z_0\), the data mean, for every \(x_0\): every sample lands on the same point, the famous blurry “average image”. Flow matching needs many steps because its field keeps changing as \(t\) runs, and the early steps commit to nothing. Section 5 shows this side by side with the map.

3 · Autonomous flows

The Beckmann current

Beckmann Transport Models replace the time-dependent velocity by one field that does not depend on time. Average the flow-matching velocity over time, weighted by how much of the population is at \(x\) at each time:

$$J(x) = \int_0^1 \rho_t(x)\,b_t(x)\,dt, \qquad \nu(x) = \int_0^1 \rho_t(x)\,dt, \qquad b(x) = \frac{J(x)}{\nu(x)}.$$

\(J\) is the current, the net flux of interpolants through \(x\); \(\nu\) is the occupation measure, \(\nu(x)\,dx\) being the expected time an interpolant spends in \(dx\); their ratio \(b\) is the average velocity of whatever passes through \(x\), whenever it passes. And \(b\) is the same regression as before with the time input removed:

$$b = \arg\min_{\hat b}\ \mathbb E_{t,\,x_0,\,x_1}\big\|\hat b(I_t) - \dot I_t\big\|^2.$$

Integrating the continuity equation \(\partial_t\rho_t + \nabla\cdot(\rho_t b_t) = 0\) over \(t\) kills the time derivative except at the two ends, \(\rho_1 - \rho_0 = \mu_1 - \mu_0\), and leaves the flux constraint of Beckmann’s 1952 transportation problem:

$$\nabla\cdot J = \mu_0 - \mu_1 .$$

Noise is a source of current, data a sink. Now the part that matters. The ODE \(\dot X = b(X)\) is autonomous: through each point passes exactly one flow line, and flow lines never cross or bend back as \(t\) runs, because there is no \(t\). Every noise point has a single destination, and the plane splits into basins, one per data point. The flux constraint fixes their size: \(J\) is tangent to a basin’s boundary, so no current crosses it, the integral of \(\nabla\cdot J\) over the basin vanishes, and

$$\mu_0(B_j) = \mu_1(B_j) = p_j .$$

Each basin carries exactly the mass of its data point. That is the push-forward condition, drawn.

The autonomous field \(b = J/\nu\): one field for all times
the 300 noise draws flow along the exact field; colour = the data point each one reaches thin lines: flow lines, which never cross hover to follow the single flow line through a point “Show basins”: the destination of every point of the plane, with the basin masses

4 · The Beckmann map

Learn the endpoint, never integrate

Define \(T(x)\) as the data point at the end of the flow line through \(x\). By construction \(T\) is constant along flow lines, and it fixes the data:

$$J(x)\cdot\nabla T(x) = 0 \quad\text{off the data}, \qquad T(x) = x \quad\text{on the data}.$$

This is the conservation equation of BTM: \(J\cdot\nabla T\) is the derivative of \(T\) in the direction of the current, and it must vanish. The key move is to train a network on these two conditions directly, without ever integrating the flow or computing \(J\). A transport term enforces conservation through a stop-gradient \(\operatorname{sg}\); a boundary term pins the data:

$$\mathcal L(T) = \underbrace{\mathbb E_{t,\,x_0,\,x_1}\Big\|T(I_t) - \operatorname{sg}\!\big(T(I_t) + \dot I_t\cdot\nabla T(I_t)\big)\Big\|^2}_{\text{transport}} \;+\; \lambda\,\underbrace{\mathbb E_{x_1}\big\|T(x_1) - x_1\big\|^2}_{\text{boundary}} .$$

Read the transport term as a rule: look a little way downstream along the line you are on, and move your prediction toward the prediction there. Its gradient is \(-2\,(\dot I_t\cdot\nabla T)\,\partial_\theta T\), so the update stops exactly when the directional derivative \(\dot I_t\cdot\nabla T(I_t)\) averages to zero at every point. Averaging \(\dot I_t\) over all pairs passing through \(x\) at all times is what produced the current in the first place:

$$\mathbb E\big[\dot I_t\cdot\nabla T(I_t)\,\big|\,I_t = x\big]\ \text{ averaged over } t \text{ with weight } \rho_t \;=\; \frac{J(x)\cdot\nabla T(x)}{\nu(x)} .$$

So the stopped update on random straight lines enforces \(J\cdot\nabla T = 0\), and nobody ever computes \(J\). The ODE never appears, in training or in sampling: a sample is \(T(x_0)\), one call. Hover or tap the map.

The basins are the map: \(x \mapsto T(x)\)
solid arrow: what the map does, one call from x to its data point dotted line: the flow line the ODE would have followed to get there the map is constant along every flow line, so the arrow can start anywhere on the dotted line and end at the same point
Algorithm training a Beckmann map (no guidance)
for each training step:
    draw x0 ~ N(0, I),  x1 ~ data,  t ~ U(0, 1)
    I = (1 - t) x0 + t x1;   v = x1 - x0
    L_tr = | T(I) - sg[ T(I) + DT(I) v ] |^2      # DT(I) v: a forward-mode
    L_bd = | T(x1) - x1 |^2                        #   Jacobian-vector product
    θ ← θ - η ∇θ ( L_tr + λ L_bd )

sample:  x = T(x0)                                 # one network call

5 · One call versus many

The same noise, two generators

Left: flow matching, Euler’s method with \(N\) equal steps from the same 300 noise draws, each step one network call. Right: the Beckmann map, one call. Pick \(N\) and press generate. With one step, flow matching puts every sample on the data mean; with a few, between data points; the map lands on them.

Flow matching, N Euler steps
Beckmann map, one call
grey = still moving; colour = the nearest data point at the endmean distance = average distance of a sample to its nearest data point (0 is perfect)

The map here is the exact endpoint map of the toy’s autonomous flow. The notebook trains one with the algorithm above, on a CPU, in about a minute, and checks that its basins match these.

6 · Going further: what SBM adds

Guidance, built into training

Real models are conditional: the map takes a class label or a text prompt \(c\), and through condition dropout the same network also learns a null branch \(T_\emptyset\) that ignores it. Multistep models owe much of their quality to classifier-free guidance, which pushes a sample away from the null prediction and toward the conditional one with a strength \(\omega \ge 1\). A map has no velocity or score to guide, only endpoint predictions. The observation behind Scalable Beckmann Maps is that the current is a denoising field,

$$J_c(x) = h_c(x)\,\big(\bar z_c(x) - x\big), \qquad h_c > 0,$$

with \(\bar z_c\) a weighted posterior mean of the data, so classifier-free guidance applies to the current as it does to a velocity. Substituting the map’s own conditional and null predictions for the two denoisers gives the guided transport direction, used in place of \(\dot I_t\) in the transport loss, with the matching correction on the boundary target:

$$\dot I_t^{\,\omega} = \dot I_t + \frac{1-\omega^{-1}}{1-t}\,\big(T(I_t, c) - T_\emptyset(I_t)\big), \qquad x_1 \;\to\; x_1 + (1-\omega^{-1})\big(T(x_1, c) - T_\emptyset(x_1)\big).$$

No second network, and sampling is still one call. Where the conditional and null predictions disagree, the current is bent toward the mode the condition favours and the basin boundaries move: the condition’s typical modes gain mass, the ambiguous ones lose it. At \(\omega = 1\) everything reduces to the plain Beckmann map. The two-atom picture below is Figure 1 of the paper, live; drag \(\omega\).

(a) One SBM training step
One SBM training step on the two-atom toy: the unguided transport direction, the conditional-null correction and the guided direction at the interpolant point
one pair (x0, x1 = −e1) at S = 0.3
(b) Beckmann map, ω = 1
(c) SBM, ω = 2.00
sent to +e1 sent to −e1 reassigned by guidance T(·, c) ≠ T(·, ∅) unguided separatrix SBM separatrix null separatrix

The paper proves that the guided stopped update is consistent with a guided conservation equation under the assumptions of its Theorem 2, characterizes the bias of substituting map predictions for denoisers, and shows that the implicit correction keeps the variance of the unguided target where an explicit guided target multiplies it by \(\omega^2\).

7 · Keep going

From the toy to ImageNet

The recipe that trains maps with hundreds of millions of parameters keeps exactly the two losses above and adds engineering around the stop-gradient: a frozen copy of the network for the stopped targets, a per-row normalization of the transport term, an adaptive balance between the transport and boundary gradients, a mixture of interpolation times, and a boundary level that lets the boundary term see slightly noisy data. With those, a Beckmann map trained from scratch in the latent space of a representation autoencoder reaches a one-step FID of 1.6 on ImageNet 256, a GenEval score of 0.86 in text-to-image generation, and beats DriftWorld on two robot world-modelling benchmarks, with one network evaluation per sample and no teacher.

Notebook.

The same five steps in code: train flow matching and a Beckmann map on this toy, compare them at one call, and fine-tune a conditional map with guidance. CPU only, a few minutes. Open in Colab or read it on GitHub.

Project page.

Headline numbers, samples, the animations, the full tables, and a live text-to-image demo of a map trained at scale. Scalable Beckmann Maps improve one-step generation.

Names.

BTM, Beckmann Transport Models, is the framework: the autonomous current, the conservation law, and both ways to use them. The Beckmann map is the endpoint map \(T\) trained directly through the losses above, sampled in one call. SBM scales that map.