Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Generative Models via Transportation

The preceding gradient-flow calculus is variational. Modern machine-learning models often use the same transportation language more broadly: one may prescribe an interpolation and regress its velocity, fit a one-step generator to a descent field, or view network depth as a continuous transport of token measures. The examples below separate what is genuinely a Wasserstein gradient flow from what is a transportation dynamics with a useful geometric interpretation.

Generative Models via Flow Matching

Flow matching constructs a generative map by learning the velocity field of an interpolation. The key computational insight is that a constrained continuity-equation problem can be trained by an unconstrained regression.

Generative models aim to build a transportation map TT between a reference distribution α\alpha (typically an isotropic Gaussian) and the target data distribution β\beta. Since such reference measures are non-atomic, a measurable map with Tα=βT_\sharp\alpha=\beta exists on standard Borel spaces, for instance by identifying both probability spaces with the unit interval and using a quantile-type rearrangement. This abstract existence statement is much weaker than having an explicit and numerically stable construction of TT. Optimal transport is one approach to achieving this, but it is computationally expensive and raises questions about how to estimate it from samples. A different route is to prescribe an interpolation between noise and data, learn its velocity, and obtain TT by integrating a time-dependent vector field vtv_t. This point of view sits at the meeting point of two literatures, surveyed from a transport perspective in Peyré, 2025. The diffusion branch builds on score matching Hyvärinen, 2005, denoising score matching Vincent, 2011, nonequilibrium noising chains Sohl-Dickstein et al., 2015, denoising diffusion probabilistic models Ho et al., 2020, score-based generative modeling Song & Ermon, 2019, and the continuous-time score-SDE/probability-flow formulation Song et al., 2021. The deterministic regression branch was introduced, essentially in parallel, under three closely related names: flow matching Lipman et al., 2023, rectified flow Liu et al., 2023, and stochastic interpolants Albergo et al., 2025. In all three cases, the computational object is a velocity field whose regression loss avoids simulating the learned ODE during training. This vector field vtv_t is obtained by constructing an interpolation αt\alpha_t and then finding vtv_t using the least-squares formula of the dynamic chapter. As we will explain, for a specific class of interpolation (obtained by a parametric push-forward), this vtv_t can be obtained by avoiding explicitly inverting a Laplacian and instead computing a simple conditional expectation. This conditional expectation can itself be estimated by solving another least-squares problem, but this time unconstrained, making the estimation feasible from finite samples of α\alpha and β\beta.

Stochastic interpolant.

The word “stochastic” can hide two different levels of randomness. We first use the simpler one: after drawing a latent variable UπU\sim\pi, the path tPt(U)t\mapsto P_t(U) is deterministic and differentiable. The randomness only comes from the initial draw of UU; after taking the push-forward law, αt=(Pt)π\alpha_t=(P_t)_\sharp\pi is a deterministic curve of measures and obeys an ordinary continuity equation. This is the setting behind the stochastic-interpolant construction recalled in Remark Remark: Static-noise stochastic interpolants, and behind the flow-matching and rectified-flow regressions below. Genuine temporal noise, where the path itself has Brownian fluctuations, is different and is discussed in Remark Remark: Brownian realizations of interpolant marginals.

We assume first that αt\alpha_t is obtained by pushing a latent distribution πP(Rd)\pi \in \Pp(\RR^{d'}) through a time-dependent map Pt:RdRdP_t : \RR^{d'} \to \RR^d; the latent dimension dd' may be larger than the data dimension dd:

t[0,1],αt:=(Pt)π.\forall t \in [0,1], \quad \alpha_t := (P_t)_\sharp \pi.

The basic two-endpoint construction already covers most flow-matching paths used in practice.

If π=αβ\pi = \alpha \otimes \beta and α=1niδxi\alpha = \frac{1}{n} \sum_i \delta_{x_i}, β=1mjδyj\beta = \frac{1}{m} \sum_j \delta_{y_j}, then αt\alpha_t consists of n×mn \times m Dirac masses

αt=1nmi,jδPt(xi,yj).\alpha_t = \frac{1}{nm} \sum_{i,j} \delta_{P_t(x_i,y_j)}.

If π=(Id,T)α\pi = (\Id, T)_\sharp \alpha is a Brenier-type coupling, then αt=((1t)Id+tT)α\alpha_t = ((1-t)\Id + tT)_\sharp \alpha is the so-called McCann OT interpolation.

Figure Div separates the effect of the endpoint coupling from the effect of the path joining each paired endpoint.

<IPython.core.display.Image object>

Flow matching interpolants between the same empirical source and target measures. A product-style random pairing produces crossing paths, an OT pairing gives direct displacement rays, and a curved bridge changes the path geometry while keeping the same endpoints. Gray arrows mark representative midpoint velocities tPt\partial_tP_t.

Interactive panel. Use the interpolation and noise controls to compare flow-matching paths between source noise and target structure.

Flow matching formula.

This interpolation is not directly useful for sampling from β\beta, but it can be used to define a flow field vtv_t so that the continuity equation, in Eulerian form, holds. This flow field is computed by solving an unconstrained least-squares problem, or equivalently, it is a conditional expectation.

Proof

We first recall the two equivalent ways of writing the interpolated measure. Formally, one may write

αt(z)=Rdδ(zPt(u))dπ(u),\alpha_t(z)=\int_{\RR^{d'}}\delta(z-P_t(u))\,\d\pi(u),

while the rigorous meaning is that, for every smooth test function φ\varphi,

Rdφ(z)dαt(z)=Rdφ(Pt(u))dπ(u).\int_{\RR^d}\varphi(z)\,\d\alpha_t(z) = \int_{\RR^{d'}}\varphi(P_t(u))\,\d\pi(u).

The minimizer in (4) is the orthogonal projection in L2(π;Rd)L^2(\pi;\RR^d) of the latent velocity tPt(u)\partial_tP_t(u) onto the closed subspace of functions that depend on uu only through Pt(u)P_t(u). This projection is the conditional expectation (5). Formally, this can be read as

vt(z)=1αt(z)Rdδ(zPt(u))[tPt](u)dπ(u),v_t(z)=\frac{1}{\alpha_t(z)} \int_{\RR^{d'}}\delta(z-P_t(u))[\partial_tP_t](u)\,\d\pi(u),

and rigorously it means that, for every smooth test vector field mm,

m(z),vt(z)dαt(z)=m(Pt(u)),[tPt](u)dπ(u).\int \dotp{m(z)}{v_t(z)} \, \d\alpha_t(z) = \int \dotp{m(P_t(u))}{[\partial_t P_t](u)} \, \d\pi(u).

We now prove that this field transports the curve (αt)t(\alpha_t)_t. The weak form of tαt+div(αtvt)=0\partial_t\alpha_t+\diverg(\alpha_t v_t)=0 is that, for every smooth scalar test function φ\varphi,

ddtφ(z)dαt(z)vt(z),φ(z)dαt(z)=0.\frac{\d}{\d t}\int\varphi(z)\,\d\alpha_t(z) - \int\dotp{v_t(z)}{\nabla\varphi(z)}\,\d\alpha_t(z) =0.

Using (7) and differentiating under the integral sign gives

ddtφ(z)dαt(z)=φ(Pt(u)),[tPt](u)dπ(u).\frac{\d}{\d t}\int \varphi(z)\d\alpha_t(z) = \int \dotp{\nabla\varphi(P_t(u))}{[\partial_t P_t](u)}\d\pi(u).

On the other hand, applying (9) with m=φm=\nabla\varphi gives

vt(z),φ(z)dαt(z)=φ(Pt(u)),[tPt](u)dπ(u).\int\dotp{v_t(z)}{\nabla\varphi(z)}\,\d\alpha_t(z) = \int \dotp{\nabla\varphi(P_t(u))}{[\partial_t P_t](u)}\d\pi(u).

Comparing (11) and (12) yields (10), which is the desired continuity equation.

The conditional expectation in (5) has a simple measure-theoretic meaning. Let αt=(Pt)π\alpha_t=(P_t)_\sharp\pi and define the vector-valued flux measure ωt\omega_t on Rd\RR^d by

Rdψ(z),dωt(z):=Rdψ(Pt(u)),[tPt](u)dπ(u)\int_{\RR^d}\dotp{\psi(z)}{\d\omega_t(z)} \eqdef \int_{\RR^{d'}}\dotp{\psi(P_t(u))}{[\partial_tP_t](u)}\d\pi(u)

for every bounded continuous vector field ψ\psi. Since αt(A)=0\alpha_t(A)=0 implies π(Pt1(A))=0\pi(P_t^{-1}(A))=0, one has ωtαt\omega_t\ll\alpha_t. The Radon--Nikodym decomposition of ωt\omega_t with respect to αt\alpha_t is therefore

dωt(z)=vt(z)dαt(z),vt=dωtdαt.\d\omega_t(z)=v_t(z)\d\alpha_t(z), \qquad v_t=\frac{\d\omega_t}{\d\alpha_t}.

In the language of Lebesgue decomposition, ωt\omega_t has only an absolutely continuous part with respect to αt\alpha_t and no singular part; the conditional expectation is precisely its density. This agrees with the flux notation used in the dynamic formulation. Equivalently, disintegrating π\pi with respect to the map PtP_t gives π(du)=πt,z(du)αt(dz)\pi(\d u)=\pi_{t,z}(\d u)\alpha_t(\d z), where πt,z\pi_{t,z} is supported on the fiber {u:Pt(u)=z}\{u\,:\,P_t(u)=z\}, and

vt(z)={Pt(u)=z}[tPt](u)dπt,z(u).v_t(z)=\int_{\{P_t(u)=z\}}[\partial_tP_t](u)\d\pi_{t,z}(u).

Thus the solution of (4) is the conditional expectation of the velocities tPt\partial_t P_t: intuitively, vt(z)v_t(z) is the average velocity of all trajectories passing through zz. Numerically, (x,t)vt(x)(x,t) \to v_t(x) can be parameterized by a neural network (e.g., a U-Net for vision tasks) and estimated using stochastic gradient descent on the objective in (4). For the exact field vtv_t, integrating the ODE x˙=vt(x)\dot{x}=v_t(x) defines a transport map TtT_t. If vtv_t is regular enough, or more generally if the continuity equation has a unique solution for this velocity, then (Tt)α0=αt(T_t)_\sharp\alpha_0=\alpha_t. Thus the same interpolation as (1) is represented by a deterministic flow rather than by the original coupling. The sampling procedure consists in first drawing X0αX_0 \sim \alpha, and then integrating the ODE X˙t=vt(Xt)\dot{X}_t = v_t(X_t) starting with Xt=0=X0X_{t=0} = X_0. In the ideal exact-field limit, the resulting Xt=1X_{t=1} is distributed according to α1=β\alpha_1 = \beta.

Connection with diffusion models.

In the special case where Pt(x,y)=(1t)x+tyP_t(x,y)=(1-t)x+ty is a linear interpolation and π=αβ\pi = \alpha \otimes \beta, the curve αt\alpha_t is a convolution of rescaled versions of α0\alpha_0 and α1\alpha_1. The flow-matching problem (4) becomes

min(vt)tRd×Rdvt((1t)x+ty)(yx)2dα0(x)dα1(y).\min_{(v_t)_t} \int_{\RR^{d} \times \RR^d} \norm{v_t( (1-t)x+t y ) - (y-x) }^2 \, \d\alpha_0(x) \d\alpha_1(y).

When one endpoint is an isotropic Gaussian, this construction is closely related to the probability-flow formulation of diffusion models, up to the usual change of time parametrization Song et al., 2021. This is why flow matching can be viewed both as a deterministic alternative to diffusion training and as a common language for diffusion paths, OT-inspired paths, and rectified paths Lipman et al., 2023Liu et al., 2023Albergo et al., 2025. The next two propositions are written in the noising direction, from a data law α\alpha to a Gaussian; reversing time gives the corresponding sampling flow. They also give an explicit closed form for vtv_t and show that it is a gradient field. In this setting, vtv_t is also the solution of the constrained least-squares problem from the dynamic chapter. The regression (4) is computationally simpler because the continuity equation has already been enforced by the chosen interpolant. To prove this, we rely on Tweedie’s formula Efron, 2011, which expresses the optimal Gaussian denoiser through the score, i.e. the gradient of the log-density.

Proof

Let φσ\varphi_\sigma be the N(0,σ2Id)\Gaussian(0,\sigma^{2}\Id) density. Bayes’ rule gives

E[WZ=z]=1ρσ(z)Rdwφσ(zw)dβ(w).\EE[W\mid Z=z] = \frac{1}{\rho_\sigma(z)} \int_{\RR^{d}} w\, \varphi_\sigma(z-w)\,\d\beta(w).

Differentiating the Gaussian convolution under the integral sign and using zφσ(zw)=σ2(zw)φσ(zw) \nabla_z\varphi_\sigma(z-w) = -\sigma^{-2}(z-w)\,\varphi_\sigma(z-w) yields

ρσ(z)=zφσ(zw)dβ(w)=σ2(zE[WZ=z])ρσ(z).\nabla\rho_\sigma(z) = \int \nabla_z\varphi_\sigma(z-w)\,\d\beta(w) = -\sigma^{-2}\Bigl(z-\EE[W\mid Z=z]\Bigr)\,\rho_\sigma(z).

Rearranging finishes the proof.

Proof

Fix t(0,1)t\in(0,1) and write W=(1t)XW=(1-t)X, σ=t\sigma=t, so that Zt=W+σYZ_t = W + \sigma\,Y matches the setting of Proposition Proposition: Tweedie identity.

Conditional expectations satisfy

v(z,t)=E[YXZt=z]=1tE[ZtWZt=z]11tE[WZt=z]. v^\star(z,t) = \EE[Y-X\mid Z_t=z] = \frac{1}{t}\,\EE[Z_t-W\mid Z_t=z] -\,\frac{1}{1-t}\,\EE[W\mid Z_t=z]. Applying Proposition Proposition: Tweedie identity to E[WZt=z]\EE[W\mid Z_t=z] and

noting E[YZt=z]=tlogρt(z)\EE[Y\mid Z_t=z] = -\,t\,\nabla\log\rho_t(z) gives the claimed formula.

Figure Div shows both directions of this construction: the prescribed interpolation noising the data and the same probability-flow ODE integrated backward for sampling.

<IPython.core.display.Image object>

One-dimensional diffusion bridge for a Gaussian-mixture data law. The forward path Zt=(1t)X+tYZ_t=(1-t)X+tY smooths the red data density toward a blue Gaussian endpoint. Reversing the probability-flow ODE transports a denser set of blue noise samples back toward the data modes, making the splitting of trajectories across mixture components visible.

Interactive panel. Use the noising time and schedule controls to see the one-dimensional forward and reverse diffusion bridge.

The same probability-flow intuition is visible in two dimensions. For a discrete data law, or more generally for a Gaussian mixture, the noising density is a Gaussian mixture whose score can be evaluated explicitly. This makes it possible to draw backward trajectories without training a neural network. In the plots below, the Gaussian endpoint has covariance σ2Id\sigma^2\Id to keep the geometry visible at the scale of the three atoms. For a scalar noising schedule Zt=atX+btYZ_t=a_tX+b_tY, the intermediate law has component centers atcja_t c_j and covariance (btσ)2Id(b_t\sigma)^2\Id. For the linear bridge, pt(z)=jwjN((1t)cj,(tσ)2Id)p_t(z)=\sum_j w_j\Gaussian((1-t)c_j,(t\sigma)^2\Id), with st=logpts_t=\nabla\log p_t, and the scaled Gaussian-endpoint field gives vt(z)=(z+tσ2st(z))/(1t)v_t(z)=-(z+t\sigma^2s_t(z))/(1-t).

In Figure Div, the Gaussian endpoint has covariance σ2Id\sigma^2\Id to keep the geometry visible at the scale of the three atoms.

<IPython.core.display.Image object>

Two-dimensional noising paths from three Dirac masses to a single Gaussian. The linear interpolation Zt=(1t)X+tYZ_t=(1-t)X+tY moves component centers linearly toward the origin and grows covariance like (tσ)2Id(t\sigma)^2\Id. The variance-preserving Ornstein--Uhlenbeck bridge has the same endpoints but a different speed of contraction and noising.

Interactive panel. Use the schedule and time controls to watch two-dimensional samples blur forward and concentrate backward.

When is the induced map optimal?

Integrating the learned velocity gives a deterministic map from α0\alpha_0 to α1\alpha_1, but this map is not automatically the Brenier optimal map. It is optimal only in special cases where the accumulated flow remains the gradient of a convex potential. The Gaussian product-coupling case already shows the precise obstruction: the interpolated covariances are simple, the velocity is affine, but the terminal map can contain a hidden rotational part. This phenomenon, and its extensions to rectified flows and mixtures, is analyzed in depth in Hertrich et al., 2025.

Proof

The conditional-expectation formula gives

vt(z)=E[X1X0Zt=z].v_t(z)=\EE[X_1-X_0\mid Z_t=z].

Since all variables are jointly Gaussian, this conditional expectation is linear and

vt(z)=Cov(X1X0,Zt)Cov(Zt)1z=(tΣ1(1t)Σ0)Σt1z,v_t(z) = \operatorname{Cov}(X_1-X_0,Z_t)\operatorname{Cov}(Z_t)^{-1}z = \bigl(t\Sigma_1-(1-t)\Sigma_0\bigr)\Sigma_t^{-1}z,

which proves (39). To solve the characteristic equation, whiten the source by setting

C=Σ01/2Σ1Σ01/2,Z~t=Σ01/2Zt.C=\Sigma_0^{-1/2}\Sigma_1\Sigma_0^{-1/2}, \qquad \widetilde Z_t=\Sigma_0^{-1/2}Z_t.

In these coordinates the source covariance is Id\Id and

Σ~t=(1t)2Id+t2C.\widetilde\Sigma_t=(1-t)^2\Id+t^2C.

Because Id\Id and CC commute, the affine flow map in whitened coordinates is simply T~t=Σ~t1/2\widetilde T_t=\widetilde\Sigma_t^{1/2}. Indeed,

ddtΣ~t1/2=(tC(1t)Id)Σ~t1/2,\frac{\d}{\d t}\widetilde\Sigma_t^{1/2} = \bigl(tC-(1-t)\Id\bigr)\widetilde\Sigma_t^{-1/2},

which is exactly the equation T~˙t=A~tT~t\dot{\widetilde T}_t=\widetilde A_t\widetilde T_t with T~0=Id\widetilde T_0=\Id. Returning to the original coordinates gives (40), and t=1t=1 gives (41).

Both T1FMT_1^{\rm FM} and TOTT^{\rm OT} push N(0,Σ0)\Gaussian(0,\Sigma_0) to N(0,Σ1)\Gaussian(0,\Sigma_1). The Brenier map between nondegenerate Gaussians is the unique symmetric positive definite linear map with this property. Hence T1FM=TOTT_1^{\rm FM}=T^{\rm OT} if and only if T1FMT_1^{\rm FM} is symmetric positive definite. The map T1FMT_1^{\rm FM} is similar to C1/2C^{1/2}, so if it is symmetric then it is automatically positive definite. It remains to characterize symmetry. Since C1/2C^{1/2} is symmetric positive definite,

(T1FM)=Σ01/2C1/2Σ01/2.(T_1^{\rm FM})^\top = \Sigma_0^{-1/2}C^{1/2}\Sigma_0^{1/2}.

Thus symmetry of T1FMT_1^{\rm FM} is equivalent to Σ0C1/2=C1/2Σ0\Sigma_0 C^{1/2}=C^{1/2}\Sigma_0, hence to Σ0C=CΣ0\Sigma_0 C=C\Sigma_0 by functional calculus. Multiplying this identity on the left and right by Σ01/2\Sigma_0^{1/2} gives Σ0Σ1=Σ1Σ0\Sigma_0\Sigma_1=\Sigma_1\Sigma_0. Conversely, if Σ0\Sigma_0 and Σ1\Sigma_1 commute, they are orthogonally co-diagonalizable, and both (41) and (42) reduce in that basis to the diagonal map with entries λ1,k/λ0,k\sqrt{\lambda_{1,k}/\lambda_{0,k}}. This proves the equivalence.

The Gaussian optimality proposition explains why the statement “flow matching gives an optimal map” is fragile. The same terminal map (41) is obtained for any scalar schedule Zt=atX0+btX1Z_t=a_tX_0+b_tX_1 with the same endpoints, because after whitening the covariance path remains at2Id+bt2Ca_t^2\Id+b_t^2C. Thus changing the speed of a scalar Gaussian bridge, for instance by using an OU schedule, cannot repair the non-optimality created by non-commuting covariances. Commuting covariances reduce the terminal map to independent one-dimensional scalings, whereas non-commuting covariances create a non-symmetric affine map, hence a transport with a rotational or shearing component. More generally, mixture-like paths can create the same obstruction even when every instantaneous velocity looks natural. This distinction is closely related to counterexamples showing that flow maps associated with Fokker--Planck or diffusion-type evolutions do not in general provide optimal transport maps Lavenant & Santambrogio, 2022. In particular, starting from an isotropic Gaussian does not by itself guarantee optimality once the target distribution is non-Gaussian; additional structural assumptions on the path or on the coupling are needed.

Variations on the interpolant.

The geometry of the generated trajectories depends on the chosen interpolant, not only on the two endpoint laws. There is first a harmless ambiguity: a monotone reparametrization Zt=(1λ(t))X+λ(t)YZ_t=(1-\lambda(t))X+\lambda(t)Y of the linear bridge only changes the speed of the flow,

vt(z)=λ(t)vλ(t)lin(z),vrlin(z)=E[YX(1r)X+rY=z].v_t(z)=\lambda'(t)\,v^{\rm lin}_{\lambda(t)}(z), \qquad v^{\rm lin}_{r}(z)=\EE[Y-X\mid (1-r)X+rY=z].

It therefore leaves the spatial integral curves unchanged. Diffusion models use a genuinely different family of noising paths. If

Zt=atX+btY,YN(0,σ2Id),Z_t=a_tX+b_tY,\qquad Y\sim\Gaussian(0,\sigma^2\Id),

then both the mixture centers and the component variances are changed. Writing ptp_t for the density of ZtZ_t and st=logpts_t=\nabla\log p_t, Tweedie’s formula gives, away from times where at=0a_t=0,

vt(z)=atE[XZt=z]+btE[YZt=z]=atatz+(atbt2atbtbt)σ2st(z).v_t(z)=a'_t\,\EE[X\mid Z_t=z]+b'_t\,\EE[Y\mid Z_t=z] =\frac{a'_t}{a_t}z+ \left(\frac{a'_tb_t^2}{a_t}-b'_tb_t\right)\sigma^2s_t(z).

For the linear bridge, at=1ta_t=1-t and bt=tb_t=t, this recovers the formula above. For the variance-preserving Ornstein--Uhlenbeck noising used in diffusion models,

aτ=eτ,bτ=1e2τ,a_\tau=e^{-\tau},\qquad b_\tau=\sqrt{1-e^{-2\tau}},

one obtains the forward probability-flow velocity vτ(z)=zσ2logpτ(z)v_\tau(z)=-z-\sigma^2\nabla\log p_\tau(z). Sampling follows the reverse field z+σ2logpτ(z)z+\sigma^2\nabla\log p_\tau(z) as τ\tau decreases. This is the noising law used in the diffusion trajectory panel below; the trajectories are more curved than for the linear bridge because the centers and variances evolve according to the OU/Fokker--Planck scaling rather than by affine interpolation. Numerically, the integration is stopped at a small positive time before the Dirac endpoint, where the score becomes singular.

The finite-time coefficients at=cos(πt/2)a_t=\cos(\pi t/2) and bt=sin(πt/2)b_t=\sin(\pi t/2) are not a new spatial interpolant: they are exactly the OU coefficients after the time change τ=logcos(πt/2)\tau=-\log\cos(\pi t/2). The schedule comparison below therefore places the OU bridge next to a genuinely different scalar bridge,

at=(1t)(12t),bt=t,a_t=(1-t)(1-2t), \qquad b_t=t,

whose data coefficient changes sign before vanishing. This overshooting bridge is mainly a diagnostic example: it keeps the same endpoints, but its intermediate mixture reflects through the origin and produces visibly different reverse trajectories.

This is the noising law used in the left panel of Figure Div; the trajectories are more curved than for the linear bridge because the centers and variances evolve according to the OU/Fokker--Planck scaling rather than by affine interpolation.

<IPython.core.display.Image object>

Diffusion-style sampling trajectories compared with OT rays in the three-Dirac setting. Red particles are sampled from the centered Gaussian endpoint and transported toward the three blue atoms. The diffusion panel integrates a reverse probability-flow field based on a Gaussian-mixture score, while the OT panel uses straight displacement rays selected by a quadratic matching.

Interactive panel. Use the trajectory and schedule controls to compare curved diffusion sampling paths with straight optimal-transport rays.

Figure Div therefore compares OU with a genuinely different scalar bridge,

<IPython.core.display.Image object>

Effect of the interpolant on the exact reverse flow for the same three-Dirac target and the same Gaussian endpoint. The linear bridge at=1ta_t=1-t, bt=tb_t=t produces almost radial curves. The variance-preserving OU bridge aτ=eτa_\tau=e^{-\tau}, bτ=1e2τb_\tau=\sqrt{1-e^{-2\tau}} changes the relative speed of contraction and noising. The overshooting bridge at=(1t)(12t)a_t=(1-t)(1-2t), bt=tb_t=t is not a time reparameterization of either one and produces a more pronounced bending of the reverse trajectories.

Interactive panel. Use the schedule controls to compare how different noising laws allocate motion over time.

One-Step Generative Models

One-step generative models try to keep the geometric training principle of flows while removing the expensive multi-step integration at sampling time. The idea is to evolve the model distribution during training, but to store the final evolution in a single generator evaluation.

One-Step Models via Parameter-Domain Discrepancy Flows

The most direct one-step strategy is to train the generator parameters themselves by descending a discrepancy between generated and data distributions. Let ζ\zeta be a simple latent distribution, let fθ:ZXf_\theta:\mathcal Z\to\X be a neural generator, and let β\beta be the data distribution. The objective is to find θ\theta such that

(fθ)ζ=β,(f_\theta)_\sharp\zeta=\beta,

or, in practice, such that the generated law is close to β\beta. Given a discrepancy D\mathcal D on probability measures, define

Eβ(γ):=D(γ,β),Hβ(θ):=Eβ((fθ)ζ)=D((fθ)ζ,β).\mathcal E_\beta(\gamma)\eqdef\mathcal D(\gamma,\beta), \qquad H_\beta(\theta) \eqdef \mathcal E_\beta\big((f_\theta)_\sharp\zeta\big) = \mathcal D\big((f_\theta)_\sharp\zeta,\beta\big).

This viewpoint includes Wasserstein GANs, MMD-GANs and Sinkhorn generative models Arjovsky et al., 2017Dziugaite et al., 2015Genevay et al., 2018; when D\mathcal D is written through a dual potential or discriminator, it connects directly with the adversarial formulation in GANs via Duality. The resulting training dynamics is the ordinary Euclidean gradient flow in parameter space,

θ˙t=θHβ(θt).\dot\theta_t=-\nabla_\theta H_\beta(\theta_t).

This parameter flow induces a flow of generated measures, but this induced flow is not intrinsic in general. Set

αt:=(fθt)ζ,Xt=fθt(Z),Zζ.\alpha_t\eqdef(f_{\theta_t})_\sharp\zeta, \qquad X_t=f_{\theta_t}(Z), \qquad Z\sim\zeta .

If tθtt\mapsto\theta_t is smooth and fθf_\theta is differentiable with respect to θ\theta, then

X˙t=θfθt(Z)θ˙t.\dot X_t = \partial_\theta f_{\theta_t}(Z)\dot\theta_t .

For αt\alpha_t-a.e. xx, let ηt,x\eta_{t,x} be the disintegration of the latent law ζ\zeta with respect to the map fθtf_{\theta_t}. Thus ηt,x\eta_{t,x} is supported on the fiber {z:fθt(z)=x}\{z:f_{\theta_t}(z)=x\}, and for every bounded measurable ψ\psi,

ψ(z)dζ(z)=X(ψ(z)dηt,x(z))dαt(x).\int \psi(z)\,\d\zeta(z) = \int_\X\left(\int \psi(z)\,\d\eta_{t,x}(z)\right)\d\alpha_t(x).

The Eulerian velocity of the generated measure is therefore the conditional average

vt(x)=θfθt(z)θ˙tdηt,x(z)=θfθt(z)θHβ(θt)dηt,x(z).v_t(x) = \int \partial_\theta f_{\theta_t}(z)\dot\theta_t\,\d\eta_{t,x}(z) = -\int \partial_\theta f_{\theta_t}(z)\nabla_\theta H_\beta(\theta_t)\,\d\eta_{t,x}(z).

Indeed, for every smooth test function φ\varphi,

ddtφ(x)dαt(x)=φ(x),vt(x)dαt(x),\frac{\d}{\d t}\int \varphi(x)\,\d\alpha_t(x) = \int \langle\nabla\varphi(x),v_t(x)\rangle\,\d\alpha_t(x),

which is the weak form of the continuity equation

tαt+div(αtvt)=0.\partial_t\alpha_t+\operatorname{div}(\alpha_t v_t)=0.

The velocity (60) depends on the parameter value θt\theta_t and on the latent disintegration, not only on the measure αt\alpha_t. If the parametrization is non-identifiable, two different parameters can generate the same measure while inducing different velocities. Thus (56) is a Euclidean gradient flow on parameter space, and only after push-forward a model-dependent flow on measures. It coincides with an intrinsic Wasserstein gradient flow only in special cases where vtv_t agrees with the Wasserstein velocity

δγEβ(γ)γ=αt.-\nabla\delta_\gamma\mathcal E_\beta(\gamma)\big|_{\gamma=\alpha_t}.

More generally, a projected Wasserstein flow on the model manifold would require projecting this intrinsic velocity onto the infinitesimal velocities attainable by variations of θ\theta, using the L2(αt)L^2(\alpha_t) metric. The ordinary Euclidean parameter gradient flow (56) does not perform this projection in general.

In machine learning, however, β\beta is accessed through minibatches. If

β^n=1ni=1nδYi,Yii.i.d.β,\hat\beta_n=\frac{1}{n}\sum_{i=1}^n\delta_{Y_i}, \qquad Y_i\overset{\mathrm{i.i.d.}}{\sim}\beta,

then the implemented update often replaces HβH_\beta by the random objective Hβ^nH_{\hat\beta_n}. For nonlinear discrepancies this is not, in general, an unbiased gradient estimator:

E[θHβ^n(θ)]θHβ(θ).\mathbb E\left[\nabla_\theta H_{\hat\beta_n}(\theta)\right] \neq \nabla_\theta H_\beta(\theta).

The expectation is over the data minibatch. This bias is a finite-sample effect of inserting the empirical measure inside a nonlinear transport or adversarial optimization before differentiating; it is distinct from the optimization noise of stochastic gradient descent. MMD losses admit unbiased UU-statistic variants, but OT and entropic OT objectives generally exhibit the bias--variance phenomena discussed in Bias and Variance of OT.

One-Step Model Using Wasserstein Flow of Discrepancy

This construction keeps the discrepancy-minimization viewpoint of the previous paragraph but changes the dynamics. Instead of following the Euclidean gradient of the discrepancy in parameter space, one prescribes the Wasserstein gradient flow of the generated law and then learns a generator update realizing this motion. This distribution-space, natural-gradient-type dynamics is less tied to a particular parametrization and can have better convergence behavior, in particular by reducing parameter-space traps when the discrepancy has a favorable geometry.

Let ζ\zeta be a simple latent distribution and let αθ=(Gθ)ζ\alpha_\theta=(G_\theta)_\sharp\zeta be the model distribution. Assume that the target data distribution is β\beta. The Wasserstein-flow construction chooses a discrepancy

Eβ(α),\mathcal E_\beta(\alpha),

for instance a smoothed KL(αβ)\KL(\alpha|\beta), an MMD/IPM loss, or the debiased Sinkhorn divergence Lˉcϵ(α,β)\bar\MK_c^\epsilon(\alpha,\beta) introduced in the Sinkhorn divergence section. The associated formal descent is

tαt+div(αtwt)=0,wt(x)=δαEβ(αt)(x).\partial_t\alpha_t+\operatorname{div}(\alpha_t w_t)=0, \qquad w_t(x)=-\nabla\delta_\alpha \mathcal E_\beta(\alpha_t)(x).

Instead of integrating (67) at inference time, one fits, at each training time tt, a parametric residual field UηtU_{\eta_t} along the current model distribution:

minηUη(x)wt(x)2dαt(x).\min_\eta \int \norm{U_\eta(x)-w_t(x)}^2 \,\d\alpha_t(x).

In a particle or generator implementation, the learned residual is then used to update the current generator by

αθ+=(Id+τUηt)αθ,or equivalentlyGθ+(z)=Gθ(z)+τUηt(Gθ(z)).\alpha_{\theta}^{+} = (\Id+\tau U_{\eta_t})_\sharp \alpha_\theta, \qquad\text{or equivalently}\qquad G_\theta^{+}(z)=G_\theta(z)+\tau U_{\eta_t}(G_\theta(z)).

This is an ideal function-space update. A genuine one-step implementation fits the updated outputs back into a fixed generator architecture, or distills the accumulated transport into one network. After many training updates, that fixed-architecture or distilled generator is evaluated once at test time. This is the organizing principle behind recent one-step methods based on Wasserstein gradient flows: W-Flow uses such a construction with the Sinkhorn divergence as a tractable global discrepancy Han et al., 2026, while drifting methods evolve the generated distribution during training through a fitted vector field and also admit one-step inference Deng et al., 2026. The gradient-flow interpretation of drifting models, and its relation to KL, MMD, sliced-Wasserstein and Sinkhorn-type discrepancies, is analyzed in Gretton et al., 2026He et al., 2026. These ideas are also connected to the Sinkhorn-type normalization dynamics used to model attention in Sinkformers Sander et al., 2022.

Sliced-Wasserstein Flow

A particularly transparent instance uses the sliced objective introduced for imaging and barycenters by Rabin, Peyré, Delon and Bernot Rabin et al., 2011. Take

Eβ(α)=12SW22(α,β),\mathcal E_\beta(\alpha)=\frac12\SW_2^2(\alpha,\beta),

with SW2\SW_2 defined in Sliced Wasserstein Distances. With the continuity-equation convention tαt+div(αtwt)=0\partial_t\alpha_t+\operatorname{div}(\alpha_t w_t)=0, the descent velocity points from the current projected law toward the target projected law. More precisely, assume that α\alpha has a density and sufficient moments so that the projected monotone maps are uniquely defined for almost every direction. If TθT_\theta denotes the one-dimensional monotone transport from (Pθ)α(P_\theta)_\sharp\alpha to (Pθ)β(P_\theta)_\sharp\beta, then the formal W2\Wass_2-gradient-flow velocity is

wSW[α,β](x)=Sd1(Tθ(Pθx)Pθx)θdσ(θ).w_{\SW}[\alpha,\beta](x) = \int_{\Sphere^{d-1}} \big(T_\theta(P_\theta x)-P_\theta x\big)\,\theta\,\d\sigma(\theta).

The sign follows from the one-dimensional identity: the first variation of 12W22(ρ,ν)\frac12\Wass_2^2(\rho,\nu) has spatial derivative sT(s)s-T(s), so the descent velocity is T(s)sT(s)-s, and composing with PθP_\theta lifts it in the direction θ\theta.

Thus empirical implementations only require one-dimensional sorting along sampled directions, followed by averaging the lifted projected displacements. This is the sliced-Wasserstein flow studied by Cozzi and Santambrogio Cozzi & Santambrogio, 2024, who prove long-time convergence under their hypotheses when the target is Gaussian and also show that the limiting characteristic map is not, in general, the optimal transport map. When both the evolving law and the target are Gaussian, the averaged velocity is affine and the flow closes on means and covariances; this finite-dimensional closure is revisited in Flows over the Gaussian Manifold, where the sliced objective appears in the Gaussian closure catalogue of Proposition: Gaussian closure catalogue.

The difference between the full W2\Wass_2 descent and its sliced analogue is already visible on a simple shape example. Div compares the exact empirical flow of 12W22(,β)\frac12\Wass_2^2(\cdot,\beta), where one fixed optimal assignment gives straight relaxation curves, with the W2\Wass_2-gradient flow of 12SW22(,β)\frac12\SW_2^2(\cdot,\beta), where the velocity is recomputed from projected monotone rearrangements.

<IPython.core.display.Image object>

Full Wasserstein and sliced-Wasserstein flows from a cat-shaped empirical law to a heart-shaped target. The left panel in each row shows representative particle trajectories colored from red to blue. The five panels on the right render kernel-density estimates of all particles at common normalized times. The W2\Wass_2 flow follows the fixed optimal assignment and therefore straight relaxation rays, whereas the sliced flow averages one-dimensional sorted rearrangements over projection directions, producing curved trajectories and a different transient density evolution.

Interactive panel. Change the slicing angle and samples to compare a global quadratic assignment flow with the coordinatewise flow induced by one projected sliced direction.

Stein Variational Gradient Descent

Stein variational gradient descent (SVGD) is another deterministic particle flow that fits naturally in this one-step viewpoint Liu & Wang, 2016. Its original motivation is Bayesian sampling: given a target probability β=ρβdx\beta=\rho_\beta\,\d x known through its score logρβ=V\nabla\log\rho_\beta=-\nabla V, but not necessarily through its normalizing constant, drive a particle cloud toward β\beta without estimating the score of the current empirical law. Geometrically, this replaces the Wasserstein gradient flow of KL(αβ)\KL(\alpha|\beta), whose tangent norm is L2(α)L^2(\alpha), by the kernelized Benamou--Brenier geometry of Kernelized Benamou--Brenier Distances, whose velocities live in a vector-valued RKHS.

For the formal density-level calculation, assume α=ραdx\alpha=\rho_\alpha\,\d x and β=ρβdx\beta=\rho_\beta\,\d x have smooth positive densities, and let vv be a smooth compactly supported vector field. For the perturbation αϵ=(Id+ϵv)α\alpha_\epsilon=(\Id+\epsilon v)_\sharp\alpha, integration by parts gives

ddϵKL(αϵβ)ϵ=0=(logρβ(x),v(x)+divv(x))dα(x).\left.\frac{\d}{\d\epsilon}\KL(\alpha_\epsilon|\beta)\right|_{\epsilon=0} = -\int \big(\dotp{\nabla\log\rho_\beta(x)}{v(x)}+\operatorname{div} v(x)\big) \d\alpha(x).

The bracket is the Langevin--Stein operator applied to vv and averaged under α\alpha; because it only evaluates vv, divv\operatorname{div}v, and the target score at sample locations, it remains meaningful when α\alpha is empirical. Optimizing this linear functional over the unit ball of Hkd\RKHS_k^d and using the reproducing property gives the RKHS steepest-descent direction,

vαSVGD(x)=(k(y,x)logρβ(y)+yk(y,x))dα(y).v_{\alpha}^{\mathrm{SVGD}}(x) = \int \Big(k(y,x)\nabla\log\rho_\beta(y)+\nabla_y k(y,x)\Big) \d\alpha(y).

The associated mean-field equation is

tαt+div(αtvαtSVGD)=0.\partial_t\alpha_t+\operatorname{div}\bigl(\alpha_t v_{\alpha_t}^{\mathrm{SVGD}}\bigr)=0.

For particles αn=n1iδXi\alpha^\ell_n=n^{-1}\sum_i\delta_{X_i^\ell}, this becomes

Xi+1=Xi+τ1nj=1n(k(Xj,Xi)logρβ(Xj)+Xjk(Xj,Xi)).X_i^{\ell+1} = X_i^\ell + \tau\,\frac{1}{n}\sum_{j=1}^n \Big(k(X_j^\ell,X_i^\ell)\nabla\log\rho_\beta(X_j^\ell) + \nabla_{X_j}k(X_j^\ell,X_i^\ell)\Big).

The first term attracts particles toward increasing target log-density; the second term is a kernel repulsion that prevents immediate collapse. The gradient-flow interpretation and its many-particle limits are studied in Liu, 2017Duncan et al., 2023Nüsken & Renger, 2023. In generative modeling terms, SVGD transports a simple empirical latent law by repeated smooth particle updates. It is therefore close in spirit to the drifting fields above, but its velocity is not learned by regression: it is the closed-form RKHS steepest-descent direction of the KL functional.

The figure below contrasts this RKHS flow with a particle closure of the Wasserstein gradient flow of KL(αβ)\KL(\alpha\mid\beta). The latter evaluates the current score logρα\nabla\log\rho_\alpha by a Gaussian KDE, while SVGD avoids this density estimate and uses the target score together with a kernel repulsion.

Figure Div contrasts this RKHS flow with a particle closure of the Wasserstein gradient flow of KL(αβ)\KL(\alpha|\beta).

<IPython.core.display.Image object>

Particle trajectories for two deterministic descents of relative entropy toward the same three-Gaussian target, whose density is shown by gray contours. The left panel approximates the W2\Wass_2 gradient flow of KL(αβ)\KL(\alpha\mid\beta) by the KDE velocity logρβlogρα,h\nabla\log\rho_\beta-\nabla\log\rho_{\alpha,h}. The right panel uses the RBF-kernel SVGD velocity (73), where target-score attraction is coupled with RKHS repulsion. Both panels use the same initial particles and color trajectory time from red to blue.

Interactive panel. Change the number of particles and integration time to compare a KDE Wasserstein closure with an RKHS Stein-type particle flow.

Self-corrected drifting fields.

Drifting methods need not start from an exact Wasserstein gradient. They often prescribe an attraction-minus-repulsion field and then regress this field in L2(αt)L^2(\alpha_t). A simple continuous version uses a strictly positive kernel Kϵ(x,y)K_\epsilon(x,y) for which the following integrals are finite, and defines, for any probability measure ν\nu,

Bϵ[ν](x):=(yx)Kϵ(x,y)dν(y)Kϵ(x,y)dν(y).B_\epsilon[\nu](x) \eqdef \frac{\int (y-x)K_\epsilon(x,y)\,\d\nu(y)} {\int K_\epsilon(x,y)\,\d\nu(y)}.

For the Gaussian kernel Kϵ(x,y)=exp(xy2/(2ϵ))K_\epsilon(x,y)=\exp(-\norm{x-y}^2/(2\epsilon)), this normalized field is a score of a smoothed density:

Bϵ[ν](x)=ϵlog ⁣(Kϵ(x,y)dν(y)).B_\epsilon[\nu](x) = \epsilon\nabla\log\!\left(\int K_\epsilon(x,y)\,\d\nu(y)\right).

The drifting velocity is then

ut(x)=Bϵ[β](x)Bϵ[αt](x)=ϵlogKϵ(x,y)dβ(y)Kϵ(x,y)dαt(y).u_t(x)=B_\epsilon[\beta](x)-B_\epsilon[\alpha_t](x) = \epsilon\nabla\log \frac{\int K_\epsilon(x,y)\,\d\beta(y)} {\int K_\epsilon(x,y)\,\d\alpha_t(y)}.

The first term pulls samples toward data, while the second term corrects self-attraction and prevents all particles from collapsing onto the same high-density region. For a fixed reference measure, Bϵ[ν]B_\epsilon[\nu] is precisely the Gaussian mean-shift displacement in (112): it moves xx toward the local kernel barycenter of ν\nu. Hence self-corrected drifting can be read as the difference between a target mean-shift field and the current model’s own mean-shift field. Sinkhorn drifting replaces these one-sided kernel normalizations by two-sided entropic OT couplings, so that the cross and self terms are normalized by Sinkhorn scaling rather than by a single denominator He et al., 2026.

Figure Div illustrates why the self term matters: it corrects the collapse created by target attraction alone and improves coverage of separated modes.

<IPython.core.display.Image object>

Drifting trajectories for a small particle generator. The raw kernel drift has weak long-range attraction and can leave particles away from the data modes. The self-corrected field uses the difference Bϵ[β]Bϵ[αt]B_\epsilon[\beta]-B_\epsilon[\alpha_t], so a longer integration brings particles to the blue modes while repelling them from their own current concentration.

Interactive panel. Use the drift and time controls to inspect a learned-looking velocity field and its induced particle trajectories.

Proof

Since αt\al_t and ϕt\phi_t are fixed in the variation with respect to α\alpha, the first variation is

δαRt(ααt)(x)=ϕt(x).\delta_\alpha \mathcal R_t(\alpha|\al_t)(x)=-\phi_t(x).

By Proposition Proposition: Formal Wasserstein Gradient,

Rt(ααt)=δαRt(ααt)=ϕt=ut.\Wgrad \mathcal R_t(\alpha|\al_t) = \nabla\delta_\alpha \mathcal R_t(\alpha|\al_t) = -\nabla\phi_t = -u_t.

The Wasserstein gradient-descent velocity is the negative of this gradient, namely utu_t. Substituting this velocity in the continuity equation gives the claimed flow.

Moment Measures

Moment measures give another way to make a whole distribution from one convex potential. Instead of first fixing a simple source law and then learning a transport map, one asks for a convex function whose own log-concave density is pushed forward by its gradient. This couples sampling and mapping in a rigid way: the same potential defines both the source density and the Brenier map. The reward is a hidden convex structure: after a suitable optimal-transport reformulation, a nonlinear equation on convex functions becomes a convex minimization problem for probability densities. This is one of the cleanest places where optimal transport, Prékopa-type inequalities and convex geometry meet.

The normalization removes additive constants in uu. Translations of the argument are another invariance: if ua(x)=u(xa)u_a(x)=u(x-a), then ηua\eta_{u_a} is the translate of ηu\eta_u, while ua(x)=u(xa)\nabla u_a(x)=\nabla u(x-a), hence M(ua)=M(u)\mathfrak M(u_a)=\mathfrak M(u). A first obstruction is immediate. Formally, if uu is smooth and eue^{-u} decays fast enough for the boundary term to vanish, then

ydM(u)(y)=Zu1u(x)eu(x)dx=Zu1(eu(x))dx=0.\int y\,\d\mathfrak M(u)(y) = Z_u^{-1}\int \nabla u(x)e^{-u(x)}\,\d x = -Z_u^{-1}\int \nabla(e^{-u(x)})\,\d x =0.

Thus moment measures are necessarily centered. The nonsmooth theory uses essentially continuous convex functions: lower-semicontinuous convex functions whose set of discontinuity points has zero Hd1\mathcal H^{d-1} measure. Since a convex function is continuous in the interior of its effective domain, this condition controls only its boundary behavior.

Figure Div shows the forward construction in one dimension. The map uu' is implicit in the push-forward, but the display focuses on the two visible measures: the log-concave source ηu=Zu1eudx\eta_u=Z_u^{-1}e^{-u}\d x and the resulting moment measure M(u)\mathfrak M(u).

<IPython.core.display.Image object>

Forward moment-measure construction in one dimension. Each column shows a convex potential uu chosen so that the moment measure has a prescribed shape: a skewed unimodal density, two bumps, and three bumps with different widths and heights. The top row overlays uu (gray, vertically rescaled) with the density of the log-concave source ηu=Zu1eudx\eta_u=Z_u^{-1}e^{-u}\d x (red), while the bottom row shows M(u)=(u)#ηu\mathfrak M(u)=(u')_{\#}\eta_u (blue); the dashed vertical line marks the zero barycenter.

Interactive panel. Change the convex potential coefficients and watch the same (u) define both the log-concave source measure (\eta_u) and the moment measure obtained by pushing it through the monotone map (u’).

This theorem is due to Cordero--Erausquin and Klartag Cordero-Erausquin & Klartag, 2015. It is a functional analogue of a Minkowski-type problem: the target measure prescribes how the gradient image of a log-concave density should be distributed. The hyperplane condition is the natural non-degeneracy assumption; otherwise the prescribed gradient image lives in a lower-dimensional affine direction and no coercive full-dimensional convex potential can be recovered.

Optimal-transport variational formulation.

Santambrogio Santambrogio, 2016 reformulates the moment-measure problem as a minimization over absolutely continuous probability measures. For a centered αP1(Rd)\al\in\Pp_1(\RR^d), define the maximal-correlation transport functional, with values in R{+}\RR\cup\{+\infty\},

Cα(η):=supπΠ(η,α)Rd×Rdxydπ(x,y).\mathcal C_\al(\eta) \eqdef \sup_{\pi\in\Couplings(\eta,\al)} \int_{\RR^d\times\RR^d} x\cdot y\,\d\pi(x,y).

By Kantorovich duality for the scalar-product cost,

Cα(η)=infv convex{v(x)dη(x)+v(y)dα(y)},\mathcal C_\al(\eta) = \inf_{v\ \mathrm{convex}} \left\{ \int v(x)\,\d\eta(x)+\int v^*(y)\,\d\al(y) \right\},

where the infimum is over convex functions for which both integrals are well defined and vv^* is the Legendre transform. If η,αP2(Rd)\eta,\al\in\Pp_2(\RR^d), then

Cα(η)=12x2dη(x)+12y2dα(y)12W22(η,α).\mathcal C_\al(\eta) = \frac12\int \norm{x}^2\,\d\eta(x) + \frac12\int \norm{y}^2\,\d\al(y) - \frac12\Wass_2^2(\eta,\al).

The variational problem attached to a centered target α\al is

minηP1(Rd){H(η)+Cα(η)},H(rdx):=r(x)logr(x)dx,\min_{\eta\in\Pp_1(\RR^d)} \left\{ \mathcal H(\eta)+\mathcal C_\al(\eta) \right\}, \qquad \mathcal H(r\,\d x)\eqdef \int r(x)\log r(x)\,\d x,

with H(η)=+\mathcal H(\eta)=+\infty when η\eta is not absolutely continuous. The centering of α\al makes this functional invariant under translations of η\eta, since translating η\eta by a vector aa changes xydπ\int x\cdot y\,\d\pi by aydα(y)=0a\cdot\int y\,\d\al(y)=0.

Proof

The existence proof has two ingredients. First, since α\al is centered, translating η\eta does not change either H(η)\mathcal H(\eta) or Cα(η)\mathcal C_\al(\eta), so one can center a minimizing sequence. Second, the assumption that α\al is not supported on a hyperplane gives a coercive lower bound of the form Cα(η)cαxdη(x)\mathcal C_\al(\eta)\geq c_\al\int\norm{x}\,\d\eta(x) for centered absolutely continuous η\eta, with cα>0c_\al>0. Together with the lower-semicontinuity estimates for entropy and maximal correlation, this yields a minimizer Santambrogio, 2016.

Let η=rdx\eta=r\,\d x be a minimizer and let uu be a convex optimizer in the dual formula (94). Keeping uu fixed and varying η\eta in (96) gives the Euler equation

logr(x)+1+u(x)=constanton {r>0},\log r(x)+1+u(x)=\mathrm{constant} \qquad\text{on }\{r>0\},

so η=Zu1eudx\eta=Z_u^{-1}e^{-u}\d x. The optimality condition for the scalar-product transport problem says that an optimal coupling is supported on {(x,y):yu(x)}\{(x,y):y\in\partial u(x)\}. Since η\eta is absolutely continuous and uu is convex, u(x)={u(x)}\partial u(x)=\{\nabla u(x)\} for η\eta-almost every xx, hence α=(u)η\al=(\nabla u)_\sharp\eta.

Conversely, assume η=Zu1eudx\eta=Z_u^{-1}e^{-u}\d x and α=(u)η\al=(\nabla u)_\sharp\eta. Let ν\nu be a smooth compactly supported competitor, and let TT be the Brenier map from η\eta to ν\nu. Along the geodesic ηt=((1t)Id+tT)η\eta_t=((1-t)\Id+tT)_\sharp\eta, the right derivative of the entropy at t=0t=0 is

ddtH(ηt)t=0+=T(x)x,u(x)dη(x),\frac{\d}{\d t}\mathcal H(\eta_t)\Big|_{t=0^+} = -\int \dotp{T(x)-x}{\nabla u(x)}\,\d\eta(x),

where the identity follows by differentiating the Jacobian formula and integrating by parts. The dual optimizer uu gives the upper directional bound

ddtCα(ηt)t=0+T(x)x,u(x)dη(x).\frac{\d}{\d t}\mathcal C_\al(\eta_t)\Big|_{t=0^+} \leq \int \dotp{T(x)-x}{\nabla u(x)}\,\d\eta(x).

Conversely, Santambrogio’s derivative estimate gives

ddtCα(ηt)t=0+T(x)x,u(x)dη(x),\frac{\d}{\d t}\mathcal C_\al(\eta_t)\Big|_{t=0^+} \geq \int \dotp{T(x)-x}{\nabla u(x)}\,\d\eta(x),

because (Id,u)η(\Id,\nabla u)_\sharp\eta is optimal for the scalar-product problem. The two bounds coincide, so the first-order terms cancel. Hence the one-sided derivative of H+Cα\mathcal H+\mathcal C_\al at η\eta in every such direction is zero. Displacement convexity implies global minimality, and approximation removes the smooth compact-support restriction. Strict displacement convexity of entropy gives uniqueness, except for translations; translations do not change Cα\mathcal C_\al because α\al is centered.

It remains to justify the convexity assertion. The entropy term is displacement convex by McCann’s theorem, recalled in Theorem Theorem: McCann Displacement Convexity for Internal Energies. If α\al has finite second moment, identity (95) writes Cα\mathcal C_\al as the sum of the 1-convex moment term η12x2dη\eta\mapsto\frac12\int\norm{x}^2\,\d\eta and the (1)(-1)-convex term η12W22(η,α)\eta\mapsto-\frac12\Wass_2^2(\eta,\al), hence Cα\mathcal C_\al is displacement convex. For a target with only a finite first moment, Santambrogio obtains the same convexity along P2\Pp_2 geodesics by approximation and proves the full variational characterization by lower semicontinuity.

Conjugate moment measures for generation.

The moment-measure factorization suggests a generative recipe: sample XX from the log-concave law Zu1euZ_u^{-1}e^{-u} and output u(X)\nabla u(X). This ties sampling and mapping through the same convex potential. Vesseron, Béthune and Cuturi Vesseron et al., 2025 argue that this direct factorization can be poorly adapted to practical generative modeling, and propose instead the conjugate factorization

β=(w)(Zw1ew(z)dz).\beta = (\nabla w^*)_\sharp \left(Z_w^{-1}e^{-w(z)}\,\d z\right).

Here w\nabla w^* is the Brenier map from the learned log-concave source to the target distribution β\beta. This keeps the single-convex-potential philosophy, but places the transport map on the conjugate side; it can be parameterized by input-convex neural networks and trained using OT solvers. From the viewpoint of this chapter, moment measures are therefore a rigorous convex-analytic prototype for one-step generators based on gradients of convex potentials.

Evolution in Depth of Transformers

Deep residual architectures can be read as time discretizations of ODEs or PDEs. For transformers, the transported objects are token measures and the velocity is induced by attention.

Transformers were introduced as sequence-to-sequence architectures driven by self-attention Vaswani et al., 2017 and have since become a central architecture for language and vision models Brown et al., 2020Dosovitskiy et al., 2021. Their distinctive feature is that each token is updated by a data-dependent average of all other tokens. This makes an attention layer permutation-equivariant before positional encoding, context dependent after conditioning on the input sequence, and naturally compatible with a measure viewpoint in which a prompt is regarded as an empirical distribution of tokens.

The mathematical limit used below concerns depth rather than model scale: one lets the number of residual attention layers grow while each layer makes a small update, as in continuous-depth neural networks Chen et al., 2018. For attention, the resulting velocity is nonlinear in the current token law because it is normalized by the whole context. This measure-theoretic view appears in the analysis of attention as a Lipschitz or interacting-particle operator Vuckovic et al., 2020Geshkovski et al., 2025, in the Sinkhorn-normalized dynamics of Sinkformers Sander et al., 2022, and in recent well-posedness and mean-field-limit results for several attention mechanisms Castin et al., 2025. It also separates the infinite-depth limit studied here from the token-limit question, where one controls how a finite empirical context approximates its limiting attention operator Bohbot et al., 2025.

We now consider very deep transformers, focusing on a single-head attention mechanism for simplicity while ignoring MLP layers, layer normalization, causality, and masking. This stripped-down framework is best suited to modeling encoders and vision transformers; the references above indicate which parts of this simplified picture extend to richer attention mechanisms.

Attention as a context-dependent velocity.

After tokenization, embedding, and positional encoding, each input is represented as a point cloud (xi)i=1n(x_i)_{i=1}^n of nn vectorized tokens. An attention layer with a skip connection and residual scale 1/T1/T, where TT is the depth, transforms the tokens according to

xixi+1TjeQxi,KxjVxjeQxi,Kx,x_i \mapsto x_i + \frac{1}{T} \sum_j \frac{e^{\langle Q x_i, K x_j \rangle} V x_j}{\sum_{\ell} e^{\langle Q x_i, K x_\ell \rangle}},

where θ=(K,Q,V)\theta=(K,Q,V) denotes the three parameter matrices. The conventional factor 1/r1/\sqrt r, with rr the query/key dimension, can be absorbed into QQ or KK and is omitted here.

Token measure evolution.

To handle an arbitrary number of tokens, define α=1niδxi\alpha = \frac{1}{n} \sum_i \delta_{x_i} as the empirical measure of tokens and rewrite the transformer mapping as

xixi+1TΓθ[α](xi),x_i \mapsto x_i + \frac{1}{T} \Gamma_\theta[\alpha](x_i),

where

Γθ[α](x):=eQx,KyVydα(y)eQx,Kzdα(z).\Gamma_\theta[\alpha](x) := \frac{\int e^{\langle Q x, K y \rangle} V y \, \d \alpha(y)} {\int e^{\langle Q x, K z \rangle} \, \d \alpha(z)}.

At the level of the token distribution, the layer uses the context-dependent velocity Γθt[α]\Gamma_{\theta_t}[\alpha] and pushes α\alpha forward by Id+τΓθt[α]\Id+\tau\Gamma_{\theta_t}[\alpha]. This map depends on the whole context α\alpha and on the depth-dependent parameters θt\theta_t. Denoting normalized depth by t[0,1]t\in[0,1] and setting τ=1/T\tau=1/T gives

αt+τ=(Id+τΓθt[αt])αt.\alpha_{t+\tau} = (\Id + \tau \Gamma_{\theta_t}[\alpha_t])_\sharp \alpha_t.

As τ0\tau \to 0, this converges formally to the conservation equation

tαt+div(αtΓθt[αt])=0.\partial_t \alpha_t + \operatorname{div}(\alpha_t \Gamma_{\theta_t}[\alpha_t]) = 0.

L2L^2 attention and mean shift.

A particularly geometric variant replaces the dot-product score Qx,Ky\langle Qx,Ky\rangle by a negative squared Euclidean score sϵ(x,y)=xy2/(2ϵ)s_\epsilon(x,y)=-\norm{x-y}^2/(2\epsilon). Take, for simplicity, the same token space for queries, keys and values, and set

Kϵ(x,y)=exp(xy2/(2ϵ)),ρϵ[α](x)=Kϵ(x,y)dα(y),mϵ[α](x)=yKϵ(x,y)dα(y)ρϵ[α](x).K_\epsilon(x,y)=\exp(-\norm{x-y}^2/(2\epsilon)), \qquad \rho_\epsilon[\alpha](x)=\int K_\epsilon(x,y)\d\alpha(y), \qquad m_\epsilon[\alpha](x) = \frac{\int yK_\epsilon(x,y)\d\alpha(y)} {\rho_\epsilon[\alpha](x)}.

The map xmϵ[α](x)x\mapsto m_\epsilon[\alpha](x) is exactly Gaussian-kernel attention, i.e. normalized kernel regression over tokens; such L2L^2 or Gaussian-kernel scores are used explicitly in transformer variants motivated by Lipschitz control and projection-free attention Kim et al., 2020Kundu et al., 2026. Classical mean shift, however, uses the displacement from the current point to this local barycenter. This gives

Mϵ[α](x):=mϵ[α](x)x=(yx)Kϵ(x,y)dα(y)ρϵ[α](x)=ϵlogρϵ[α](x)M_\epsilon[\alpha](x) \eqdef m_\epsilon[\alpha](x)-x = \frac{\int (y-x)K_\epsilon(x,y)\d\alpha(y)} {\rho_\epsilon[\alpha](x)} = \epsilon\nabla\log\rho_\epsilon[\alpha](x)

and, when α\alpha is empirical, ρϵ[α]\rho_\epsilon[\alpha] is a Gaussian kernel density estimate up to normalization. Thus Mϵ[α]M_\epsilon[\alpha] is the classical Gaussian mean-shift vector Fukunaga & Hostetler, 1975Cheng, 1995Comaniciu & Meer, 2002. If the data measure α\alpha is frozen, the update xmϵ[α](x)x\leftarrow m_\epsilon[\alpha](x) is the usual mode-seeking mean-shift iteration. If instead all support points move and the empirical measure is recomputed after every step, one obtains the self-consistent, or blurring, mean-shift process Chen, 2015. Its damped update is

xik+1=(1τ)xik+τmϵ[αk](xik)=xik+τMϵ[αk](xik)x_i^{k+1} = (1-\tau)x_i^k+\tau m_\epsilon[\alpha_k](x_i^k) = x_i^k+\tau M_\epsilon[\alpha_k](x_i^k)

which is an explicit Euler step of the continuous-time mean-shift equation

tαt+div(αtMϵ[αt])=0.\partial_t\alpha_t+\operatorname{div}\bigl(\alpha_tM_\epsilon[\alpha_t]\bigr)=0.

For τ=1\tau=1 this is discrete blurring mean shift; for small residual steps it becomes a transport PDE that moves each token uphill along the log of the smoothed token density. This distinction between the raw barycentric attention output mϵm_\epsilon and the velocity Mϵ=mϵIdM_\epsilon=m_\epsilon-\Id is important: adding mϵm_\epsilon directly as a residual would produce a different drift. The mean-shift form isolates a purely metric attention mechanism from the learned bilinear geometry of Qx,Ky\dotp{Qx}{Ky}.

Consensus and Markov averaging.

When the averaging measure evolves together with the particles, mean shift becomes a consensus model. The Hegselmann--Krause model updates each opinion by averaging the opinions inside a confidence neighborhood Hegselmann & Krause, 2002; its finite-agent convergence was developed further in Blondel et al., 2009, and a measure-valued Eulerian formulation appears in Canuto et al., 2012. The row-normalized average below is also characteristic of Motsch--Tadmor dynamics Motsch & Tadmor, 2014.

For a positive kernel KK, define

MK[α](x):=(yx)K(x,y)dα(y)K(x,y)dα(y).M_K[\alpha](x) \eqdef \frac{\int (y-x)K(x,y)\,\d\alpha(y)} {\int K(x,y)\,\d\alpha(y)}.

For an empirical law α=i=1naiδxi\alpha=\sum_{i=1}^n a_i\delta_{x_i}, let XRn×dX\in\RR^{n\times d} have rows xix_i^\top, write a=(ai)ia=(a_i)_i, and set

(KX)ij=K(xi,xj),PX:=diag(KXa)1KXdiag(a).(K_X)_{ij}=K(x_i,x_j), \qquad \mathsf P_X \eqdef \operatorname{diag}(K_Xa)^{-1}K_X\operatorname{diag}(a).

The positive matrix PX\mathsf P_X is row-stochastic. Its iith row is the probability law used to average the cloud from xix_i. Figure Div visualizes the corresponding loss of memory for a fixed Markov matrix; mean shift applies the same averaging mechanism to every spatial coordinate, but with a matrix that changes with the cloud. The particle system is

x˙i=jajK(xi,xj)(xjxi)jajK(xi,xj),equivalentlyX˙=(PXIn)X.\dot x_i = \frac{\sum_j a_jK(x_i,x_j)(x_j-x_i)} {\sum_j a_jK(x_i,x_j)}, \qquad\text{equivalently}\qquad \dot X=(\mathsf P_X-I_n)X.

Thus blurring mean shift is a state-dependent Markov averaging process.

Dobrushin contraction from Hilbert geometry.

The Sinkhorn analysis already contains the two geometries needed here. Section Sinkhorn Convergence: Monotone Point of View introduced the variation seminorm of Definition Definition: Variation Seminorm on functions modulo additive constants, while Section Sinkhorn Convergence: Linear Hilbert Metric Rate introduced Hilbert’s metric of Definition Definition: Hilbert Metric on positive vectors modulo multiplication. Logarithmic coordinates identify these quotients exactly:

dH(ez,ez)=zzV.\Hilbert(e^z,e^{z'})=\norm{z-z'}_V.

A row-stochastic matrix P\mathsf P is order preserving and satisfies P(z+s1n)=Pz+s1n\mathsf P(z+s\mathbf1_n)=\mathsf Pz+s\mathbf1_n. It is therefore a linear topical map, so Proposition Proposition: Topical Maps are Variation-Nonexpansive gives nonexpansiveness on the additive quotient. Strict positivity yields more: Birkhoff contraction can be linearized at the constant ray to obtain a strict variation contraction.

Proof

Fix two rows p=(Pij)jp=(\mathsf P_{ij})_j and p=(Pj)jp'=(\mathsf P_{\ell j})_j, and remove their common mass rj=min{pj,pj}r_j=\min\{p_j,p'_j\}. The two residual nonnegative measures have the same mass

1jrj=12jpjpj.1-\sum_jr_j = \frac12\sum_j|p_j-p'_j|.

Their averages of zz can differ by at most this mass times zV\norm z_V. Maximizing over output rows proves the upper bound in (120). Conversely, for a pair of rows attaining the maximum, take zj=1z_j=1 when pjpjp_j\geq p'_j and zj=0z_j=0 otherwise. Then zV=1\norm z_V=1 and the corresponding output difference equals the Dobrushin coefficient, proving equality and hence the variation contraction.

If P>0\mathsf P>0, apply Birkhoff contraction to us=eszu_s=e^{sz} and 1n\mathbf1_n. Since P1n=1n\mathsf P\mathbf1_n=\mathbf1_n,

dH(Pesz,1n)λ(P)dH(esz,1n)=λ(P)szV.\Hilbert(\mathsf P e^{sz},\mathbf1_n) \leq \lambda(\mathsf P)\Hilbert(e^{sz},\mathbf1_n) = \lambda(\mathsf P)|s|\norm z_V.

Moreover, Pesz=1n+sPz+O(s2)\mathsf P e^{sz}=\mathbf1_n+s\mathsf Pz+O(s^2), so log(Pesz)=sPz+O(s2)\log(\mathsf P e^{sz})=s\mathsf Pz+O(s^2). Dividing by s|s| and letting s0s\to0 gives PzVλ(P)zV\norm{\mathsf Pz}_V\leq \lambda(\mathsf P)\norm z_V. Taking the exact quotient norm then yields the comparison. This Hilbert--Hopf--Dobrushin relation extends to Markov operators on general cones Gaubert & Qu, 2015.

By duality, the same coefficient is the exact contraction factor of the adjoint Markov evolution on probability vectors: for p,pΔnp,p'\in\simplex_n,

PpPp1δ(P)pp1.\norm{\mathsf P^\top p-\mathsf P^\top p'}_{\ell^1} \leq \delta(\mathsf P)\norm{p-p'}_{\ell^1}.

Thus (121) contracts observables modulo constants, while the adjoint inequality contracts probability laws in total variation. The proposition also separates two useful constants. The Dobrushin coefficient is sharp but depends on the normalized rows. The Birkhoff coefficient can be looser, but its cross-ratio formula is explicit and invariant under positive diagonal scalings, precisely the invariance used in the Sinkhorn proof of Theorem Theorem: Projective Linear Convergence of Sinkhorn.

For a compact CRdC\subset\RR^d and αP(C)\alpha\in\Pp(C), the corresponding Markov operator is

(Pαh)(x):=Ch(y)pα,x(y)dα(y),pα,x(y):=K(x,y)Zα(x),Zα(x):=CK(x,z)dα(z).(\mathsf P_\alpha h)(x) \eqdef \int_C h(y)p_{\alpha,x}(y)\,\d\alpha(y), \qquad p_{\alpha,x}(y) \eqdef \frac{K(x,y)}{Z_\alpha(x)}, \qquad Z_\alpha(x) \eqdef \int_C K(x,z)\,\d\alpha(z).

Its Dobrushin coefficient is

δ(Pα):=12supx,xsupp(α)Cpα,x(y)pα,x(y)dα(y).\delta(\mathsf P_\alpha) \eqdef \frac12\sup_{x,x'\in\operatorname{supp}(\alpha)} \int_C|p_{\alpha,x}(y)-p_{\alpha,x'}(y)|\,\d\alpha(y).

Writing hV,S=supShinfSh\norm{h}_{V,S}=\sup_S h-\inf_S h, the same common-mass proof gives

PαhV,supp(α)δ(Pα)hV,supp(α).\norm{\mathsf P_\alpha h}_{V,\operatorname{supp}(\alpha)} \leq \delta(\mathsf P_\alpha) \norm h_{V,\operatorname{supp}(\alpha)}.

Define the kernel cross-ratio and its Birkhoff factor by

ηK(C):=supx,x,y,yCK(x,y)K(x,y)K(x,y)K(x,y),λK(C):=ηK(C)1ηK(C)+1.\eta_K(C) \eqdef \sup_{x,x',y,y'\in C} \frac{K(x,y)K(x',y')}{K(x',y)K(x,y')}, \qquad \lambda_K(C) \eqdef \frac{\sqrt{\eta_K(C)}-1}{\sqrt{\eta_K(C)}+1}.

Row normalization does not change cross-ratios. For the empirical matrix,

(PX)ij(PX)r(PX)ir(PX)j=K(xi,xj)K(x,xr)K(xi,xr)K(x,xj).\frac{(\mathsf P_X)_{ij}(\mathsf P_X)_{\ell r}} {(\mathsf P_X)_{ir}(\mathsf P_X)_{\ell j}} = \frac{K(x_i,x_j)K(x_\ell,x_r)} {K(x_i,x_r)K(x_\ell,x_j)}.

Consequently, for every weighted configuration supported in CC,

δ(PX)λ(PX)=λ(KX)λK(C).\delta(\mathsf P_X) \leq \lambda(\mathsf P_X) = \lambda(K_X) \leq \lambda_K(C).

The equality in the middle is the same diagonal-scaling invariance used by Sinkhorn: the normalization diag(KXa)1\operatorname{diag}(K_Xa)^{-1} and the weight matrix diag(a)\operatorname{diag}(a) disappear from every projective cross-ratio.

The integral Birkhoff--Hopf theorem and the same linearization therefore give

δˉK(C):=supαP(C)δ(Pα)λK(C)<1.\bar\delta_K(C) \eqdef \sup_{\alpha\in\Pp(C)}\delta(\mathsf P_\alpha) \leq \lambda_K(C)<1.

If 0<kKk+0<k_-\leq K\leq k_+ on C×CC\times C, then in particular

λK(C)k+kk++k.\lambda_K(C) \leq \frac{k_+-k_-}{k_++k_-}.
Proof

Positivity and Lipschitz regularity on the compact set C0×C0C_0\times C_0 make the characteristic field uniformly Lipschitz in xx and Lipschitz in α\alpha for W1\Wass_1. Moreover, x+MK[α](x)=PαId(x)x+M_K[\alpha](x)=\mathsf P_\alpha\operatorname{Id}(x) belongs to conv(suppα)\operatorname{conv}(\operatorname{supp}\alpha). Hence no characteristic crosses an outward supporting hyperplane, the convex hulls are nested, and the flow is globally well posed.

For every compact SRdS\subset\RR^d,

diam(S)=supθSd1(supxSθ,xinfxSθ,x).\operatorname{diam}(S) = \sup_{\theta\in\mathbb S^{d-1}} \left( \sup_{x\in S}\langle\theta,x\rangle -\inf_{x\in S}\langle\theta,x\rangle \right).

For a finite configuration, set zθ=Xθz_\theta=X\theta. The proposition gives

zθk+1V(1τ)zθkV+τPXkzθkV[1τ(1δ(PXk))]zθkVqτzθkV.\begin{aligned} \norm{z_\theta^{k+1}}_V &\leq (1-\tau)\norm{z_\theta^k}_V +\tau\norm{\mathsf P_{X^k}z_\theta^k}_V\\ &\leq [1-\tau(1-\delta(\mathsf P_{X^k}))]\norm{z_\theta^k}_V \leq q_\tau\norm{z_\theta^k}_V. \end{aligned}

Taking the supremum over directions gives the one-step factor qkq_k; multiplying these factors and using qkqτq_k\leq q_\tau proves the discrete diameter estimate. Since xik+1xikτD(Xk)\norm{x_i^{k+1}-x_i^k}\leq\tau D(X^k), every path is Cauchy; summing the uniform geometric tail gives the pointwise estimate.

For the measure flow, let fθ(x)=θ,xf_\theta(x)=\langle\theta,x\rangle and let wθ(t)w_\theta(t) be the width of the support in direction θ\theta. Its upper Dini derivative satisfies

D+wθ(t)PαtfθV,supp(αt)wθ(t)[1δ(Pαt)]wθ(t).D^+w_\theta(t) \leq \norm{\mathsf P_{\alpha_t}f_\theta}_{V,\operatorname{supp}(\alpha_t)} -w_\theta(t) \leq -[1-\delta(\mathsf P_{\alpha_t})]w_\theta(t).

Gronwall’s lemma and the directional diameter identity give the adaptive estimate. Finally, every characteristic has speed at most D(t)D(t), hence is Cauchy. All limits coincide because D(t)0D(t)\to0, and integrating the exponential tail gives the W\Wass_\infty estimate.

For the Gaussian kernel Kϵ(x,y)=exy2/(2ϵ)K_\epsilon(x,y)=e^{-\norm{x-y}^2/(2\epsilon)},

logKϵ(x,y)Kϵ(x,y)Kϵ(x,y)Kϵ(x,y)=xx,yyϵ.\log\frac{K_\epsilon(x,y)K_\epsilon(x',y')} {K_\epsilon(x',y)K_\epsilon(x,y')} = \frac{\langle x-x',y-y'\rangle}{\epsilon}.

Thus, on a compact convex set of diameter DD,

ηKϵ=eD2/ϵ,λKϵ=tanh ⁣(D24ϵ).\eta_{K_\epsilon}=e^{D^2/\epsilon}, \qquad \lambda_{K_\epsilon}=\tanh\!\left(\frac{D^2}{4\epsilon}\right).

Combining this identity with (131) gives the projectively certified adaptive estimate for the full discrete update,

D(Xk+1)tanh ⁣(D(Xk)24ϵ)D(Xk)D(Xk)34ϵ,D(X^{k+1}) \leq \tanh\!\left(\frac{D(X^k)^2}{4\epsilon}\right)D(X^k) \leq \frac{D(X^k)^3}{4\epsilon},

and the continuous flow obeys

D(t)D(s)exp ⁣(st[1tanh ⁣(D(r)24ϵ)]dr).D(t) \leq D(s)\exp\!\left( -\int_s^t \left[1-\tanh\!\left(\frac{D(r)^2}{4\epsilon}\right)\right]\,\mathrm dr \right).

Strict positivity therefore gives a global exponential rate, while contraction becomes much stronger once the cloud is narrow relative to the bandwidth. These are Birkhoff bounds; the exact Dobrushin factors can be smaller.

Scope of the consensus result.

The projective argument also clarifies what is not conserved and when clustering replaces consensus. Because row normalization makes the coefficients asymmetric, the consensus point need not equal the initial barycenter; that barycenter is conserved for the constant kernel, but not in general. The self-consistent flow should not be confused with classical mode seeking, where the data measure is frozen and different queries may converge to different modes. Finally, one-point consensus can fail for the hard confidence kernel KR(x,y)=1{xyR}K_R(x,y)=\mathbf1_{\{\norm{x-y}\leq R\}}: once the interaction graph disconnects, its Dobrushin and Birkhoff coefficients can equal one. The discrete Hegselmann--Krause dynamics then converges to opinion clusters Blondel et al., 2009; under the Eulerian hypotheses, the limit is a finite combination of Dirac masses separated by at least RR Canuto et al., 2012. For the Gaussian kernel, global positivity eventually forces one Dirac, although 1tanh(D02/(4ϵ))1-\tanh(D_0^2/(4\epsilon)) can be very small and the multimodal transient can be long.

Figure Div visualizes this transient contraction before the eventual consensus guaranteed by Theorem Theorem: Dobrushin consensus for positive mean shift.

<IPython.core.display.Image object>

Continuous-time mean shift for a densely sampled three-Gaussian mixture. Left: initial density level sets, in red, and representative particle paths of x˙=Mϵ[αt](x)\dot x=M_\epsilon[\alpha_t](x), colored from red to blue. Right: four later kernel-density renderings of αt\alpha_t at increasing times, with the same red-to-blue time palette; the initial density is omitted because it is shown on the left. The snapshots show the long multimodal transient before globally positive Gaussian interactions drive the cloud toward the one-point consensus of Theorem Theorem: Dobrushin consensus for positive mean shift.

Interactive panel. Vary the bandwidth, particle count, and integration time to see the mean-shift transport PDE sharpen a three-mode density.

Gradient structure and limitations.

When the token space has dimension dd and the query/key space has dimension rr, take Q,KRr×dQ,K\in\RR^{r\times d} and VRd×dV\in\RR^{d\times d}. If V=QKV=Q^\top K, the field Γθ[α]\Gamma_\theta[\alpha] is a gradient vector field in the token variable. Indeed, define the log-partition potential

Φα(x)=exp(Qx,Ky)dα(y),Uα(x)=logΦα(x).\Phi_\alpha(x) = \int \exp(\dotp{Qx}{Ky})\d\alpha(y), \qquad U_\alpha(x)=\log\Phi_\alpha(x).

Then

xUα(x)=QKyexp(Qx,Ky)dα(y)exp(Qx,Kz)dα(z)=Γθ[α](x).\nabla_x U_\alpha(x) = \frac{\int Q^\top K y\,\exp(\dotp{Qx}{Ky})\d\alpha(y)} {\int \exp(\dotp{Qx}{Kz})\d\alpha(z)} = \Gamma_\theta[\alpha](x).

This proves only that the velocity is an instantaneous gradient in xx; it does not by itself identify a Wasserstein energy. Indeed, the natural scalar candidate

fatt(α)=Uα(x)dα(x)f_{\rm att}(\alpha)=\int U_\alpha(x)\,\d\alpha(x)

has first variation

δfatt(α)(z)=Uα(z)+exp(Qx,Kz)Φα(x)dα(x),\delta f_{\rm att}(\alpha)(z)=U_\alpha(z)+\int\frac{\exp(\dotp{Qx}{Kz})}{\Phi_\alpha(x)}\,\d\alpha(x),

up to an additive constant. The second term is the response of every query normalization to a perturbation of the key distribution, and its spatial gradient is absent from Γθ[α]\Gamma_\theta[\alpha]. Thus, without additional symmetry or integrability conditions, the attention PDE is a transportation dynamics rather than the Wasserstein gradient flow of this fixed scalar functional. Special variants recover additional structure: Sinkhorn attention can be interpreted through doubly stochastic normalization and Wasserstein-type gradient flows Sander et al., 2022Castin et al., 2025, while layer normalization leads naturally to dynamics on the sphere and to modified metrics. The key open difficulty for the present viewpoint is training: after the architecture has been rewritten as a controlled transport equation, learning corresponds to optimizing the time-dependent parameters (θt)t(\theta_t)_t rather than merely analyzing the forward PDE for fixed parameters.

Flows over the Gaussian Manifold

Gaussian measures provide a useful testing ground for the preceding dynamics. They are not invariant under a general Wasserstein gradient flow: a nonlinear velocity usually creates non-Gaussian densities immediately. The useful substitute is to either identify affine velocities, which exactly preserve Gaussianity, or to project the dynamics onto the Gaussian manifold. In both cases the measure PDE reduces to matrix ODEs for the mean and covariance. This viewpoint is emphasized in the survey Peyré, 2025 and is useful for comparing diffusion paths, Wasserstein gradient flows, drifting fields and transformer-type dynamics.

For constrained gradient flows on this family, the covariance equation is the finite-dimensional Bures--Wasserstein gradient flow on positive definite matrices. Thus Gaussian closure is not just a computational shortcut: it is the restriction of Wasserstein geometry to the Gaussian submanifold, where affine gradient fields encode tangent vectors. The following figure first compares three bridge-type Gaussian closures from a source α0\alpha_0 to a target γ\gamma; the exact gradient-flow closures for specified energies f(α)f(\alpha) are catalogued afterwards in Proposition: Gaussian closure catalogue.

Figure Div first compares three bridge-type Gaussian closures from a source α0\alpha_0 to a target γ\gamma; the exact gradient-flow closures for specified energies f(α)f(\alpha) are catalogued afterwards in Proposition Proposition: Gaussian closure catalogue.

<IPython.core.display.Image object>

Gaussian closures from a red source α0\alpha_0 to a blue target γ=N(mˉ,Σˉ)\gamma=\mathcal N(\bar m,\bar\Sigma). The left panel is the constant-speed W2W_2 geodesic, equivalently the displacement interpolation minimizing the Benamou--Brenier action between α0\alpha_0 and γ\gamma. The middle panel is an entropic Sinkhorn/Schrödinger bridge-style closure for the quadratic cost xy2|x-y|^2 and regularization strength ϵ>0\epsilon>0; it is a bridge toward γ\gamma, not the gradient flow of a fixed energy f(α)f(\alpha), and the entropic noise inflates intermediate covariances. The right panel is a prescribed non-variational drifting flow, governed by a continuity equation with an affine Gaussian-preserving velocity, chosen so that the mean follows a curved path while the covariance is moment-matched to the same endpoint γ\gamma.

Interactive panel. Use the anisotropy, angle, regularization, and drift controls to compare Gaussian closures of Wasserstein, Sinkhorn, and drifting dynamics.

Gaussianity preservation.

The first question is invariance: one wants a simple criterion ensuring that the continuity equation does not leave the finite-dimensional Gaussian family.