betaFeedback

WorksMathematics

Mean-field Token Steering

Abstract

We consider stochastic token steering through a deep stack of transformer layers as a mean-field control problem for an interacting particle system on the unit sphere, where interactions arise from the attention mechanism. In the mean-field limit, the token population evolves via a controlled integro-partial differential equation where the feedback control acts as a corrective vector field guiding the population toward an aggregate configuration of tokens in the representation space. We deduce the minimum effort control to accomplish this task over a fixed time horizon interpreted as normalized layer depth. We show that the resulting controlled dynamics for the token population can be understood as a mean-field Schrödinger bridge adapted to the sphere geometry. Building on this, we propose a novel generalization of the dynamic Sinkhorn recursion to compute the consistent token evolution. Numerical experiments confirm that the proposed approach achieves exact steering of the token population.

Introduction

The transformer architecture [57] and the self-attention mechanism [6, 44] within it are now widely used in large language models (LLMs). An important reason behind this wide usage and the significant impact made thereby lies in their ability to capture long-range dependencies in data, such as in prompts with a large number of tokens. Notwithstanding the empirical success, the mathematical understanding of how representations evolve through a deep stack of transformer layers via interactions among the tokens is only beginning to emerge now. Still, there remains a significant theoretical gap in understanding what kind of representations can emerge through such evolutions.

One promising approach toward this understanding is to index the layers by time tt and to consider the evolution of NN interacting tokens in the large-depth limit as a continuous-time dynamical system. Then, the token ensemble evolves as a system of NN interacting particles, where a particle represents an individual token embedding [22, 50, 30] (Lu et al. 2019). Mathematically, this evolution is described by a system of NN coupled ordinary or stochastic differential equations, depending on whether the evolution is deterministic or noisy. Of particular interest is the regime of a large number of tokens (N→∞N \to\infty), referred to as the mean-field limit, in which case the dynamics are governed by a nonlinear integro-partial differential equation (PDE) that describes the evolution of the token distribution over the unit sphere Sd−1\mathbb{S}^{d-1}, where dd is the embedding dimension. The spherical geometry arises from the layer normalization. This integro-PDE is parameterized by the query, key, and value matrices QtQ_t, KtK_t, VtV_t indexed by layer or time index tt, and the inverse temperature β>0\beta> 0 in the self-attention mechanism. Understanding the mean-field limit is of the essence in practice as the context lengths and depths in LLMs continue to increase. For example, both Claude Opus 5.5 and Gemini frontier models feature 1-million-token context windows, while GPT-4o features a 128k-token context window.

Previous studies on the aforementioned integro-PDE found that the token dynamics can lead to the emergence of a single cluster in the long run [29, 30], and dynamic meta-stability with partial clustering at intermediate times [8, 9] (Geshkovski et al. 2024). In practice, the clustering relates to rank or entropy collapse [21, 58] (Girolandino and Goldt 2026), which has been verified empirically as well as via non-mean-field theoretical studies [45, 1] (Cristiciello et al. 2026).

While existing works on mean-field token dynamics have focused on analysis, a natural question is whether it is possible to design an optimal correction of the nonlocal self-attention dynamics to steer the token population toward a desired aggregate configuration. This work shows why and how this is possible.

The optimal correction we derive can be interpreted as additive control of the noisy mean-field interaction between tokens. By standard Lie-Trotter splitting ([32 p. 47]), the corrective drift associated with additive control can be realized through a feedforward layer concatenated to the self-attention layer ([9 Remark 2.1], [35]). To reduce computational cost, it is preferable to achieve such active steering in a fixed time horizon [0,T][0,T] interpreted as normalized layer depth. In this work, we put forth this new perspective of active guidance of the token distribution by shifting focus from mean-field dynamics to mean-field control.

Contributions We formulate and solve the mean-field token steering problem through the lens of stochastic optimal control. Our specific contributions are the following.

  1. We show that the minimum effort control that steers the interacting token ensemble from a given aggregate configuration to another can be understood as a mean-field Schrödinger bridge adapted to the sphere geometry. This establishes a new connection between two lines of literature: mean-field self-attention dynamics and Schrödinger bridges. While Schrödinger bridges and their Riemannian versions are well-known in diffusion-based generative AI ([20, 52, 4]), the variant of the Schrödinger bridge appearing here is far from standard since it involves both nonlocal self-attention as well as the spherical geometry.

  1. Building on the above connection, we derive the mathematical structure of the minimum-effort control and the optimal evolution of the token distribution, in terms of the solution to a system of coupled nonlinear integro-PDE boundary value problems. We emphasize how these results significantly extend the previously known results for Schrödinger bridges.

  1. To numerically solve the derived system of equations for the minimum-effort active token steering, we propose a novel generalization of the dynamic Sinkhorn recursion (also known as the iterative proportional fitting algorithm). We illustrate the proposed algorithm for steering tokens over S1\mathbb{S}^{1} and S2\mathbb{S}^{2}.

The assumptions needed in our development are mild. For instance, we work with normalized self-attention instead of its unnormalized simplification ([49, 35]). Also, we only require the matrices QtQ_t, KtK_t, VtV_t to be continuous in t∈[0,T]t \in[0,T]. In comparison, the mean-field transformer dynamics literature makes stronger assumptions on these matrices with varying degrees of generality. These include e.g., uniformly continuous and bounded QtTKtQ_t^{\mathsf{T}}K_t and Vt≡IV_t \equiv I (identity matrix) in Abella et al. [1], time (i.e., depth) invariance as in Qt≡QQ_t \equiv Q, Kt≡KK_t \equiv K, Vt≡VV_t \equiv V in Geshkovski et al. [29], time-invariant invertible QQ, KK, VV in Bruno et al. [9], QTK=VQ^{\mathsf{T}}K=V symmetric in Sander et al. [50]; Bruno et al. [8]; Geshkovski et al. [30]; Burger et al. [10]; the latter is helpful for a Wasserstein-like gradient flow interpretation but is not needed in our setting.

Related works The idea of identifying layers with time and then deriving a continuous-time flow in the large-depth limit is reminiscent of neural ordinary and stochastic differential equations ([14, 56]). The transformer case differs from that non-interacting setting because long-range interactions among tokens give rise to a mean-field integro-PDE for the token distribution. The transformer then acts as a flow map on P(Sd−1)\mathcal{P}(\mathbb{S}^{d-1}), the space of probability distributions on Sd−1\mathbb{S}^{d-1}.

We note that a mean-field integro-PDE also arises ([47, 17]) in training a feed-forward network with a single hidden layer of infinite width via stochastic gradient descent. Unlike that case, the transformer mean-field dynamics is not induced by training, but instead by the propagation of the distributional state of the tokens.

In this work, we consider noisy nonlocal interactions among tokens: the presence of noise makes the mean-field integro-PDE second-order ([3]), i.e., a McKean-Vlasov-Fokker-Planck PDE ([46, 54]). Prior literature on stochastic transformers has motivated the noise due to random initialization of the value matrix ([25]), or as computational regularization ([36, 35]).

Control in transformers has been used from different viewpoints: as Low Rank Adaptation (LoRA) for the purpose of fine-tuning of pre-trained models ([59]), as positional encoding and prompt prefixes to counteract mode collapse ([34]), and as training over a parametrized family of transformers ([37, 35]). Different from these works, we formulate mean-field token steering as a minimum-effort distributional control problem. In doing so, we make connections with the broader mean-field Schrödinger bridge literature ([5, 60, 23 b]).

Organization In Section 2, we introduce both the uncontrolled and controlled versions of the transformer mean-field dynamics. In Section 3, we present our main results: the problem formulation, mathematical structure of the Schrödinger system that determines the optimal controller for mean-field token steering, and a computational method to solve the same. Numerical experiments are reported in Section 4. Section 5 closes with concluding remarks.

transformer Mean-field Dynamics

To account for layer normalization, we consider token embeddings that evolve on Sd−1\mathbb{S}^{d-1}. Following Rigollet [49]; Shalova and Schlichting [51]; Isobe et al. [35], we model their evolution over a continuum of attention layer depth t∈[0,T]t \in[0,T] as the Itô stochastic differential equation:

dXti=PXti⊥(1Zti∑j=1NΓt(Xti,Xtj)VtXtj)dt+σdBti,(1)\mathrm{d}X_t^i = P_{X_t^i}^{\perp}\left(\frac{1}{Z_t^i}\sum_{j=1}^{N}\Gamma_t(X_t^i,X_t^j)V_tX_t^j\right)\mathrm{d}t+\sqrt{\sigma}\mathrm{d}B_t^i, \tag*{(1)}

where Xti∈Sd−1X_t^i \in\mathbb{S}^{d-1} denotes the embedding (state) of the ii-th token for i∈[N]i \in[N], and Vt∈Rd×dV_t \in\mathbb{R}^{d \times d} is the value matrix.

The kernel Γt:Sd−1×Sd−1→R+\Gamma_t:\mathbb{S}^{d-1}\times\mathbb{S}^{d-1}\to\mathbb{R}_+ denotes the unnormalized attention given by the ii-th token to the jj-th token. The corresponding normalization Zti:=∑j=1NΓt(Xti,Xtj)Z_t^i := \sum_{j=1}^{N}\Gamma_t(X_t^i,X_t^j). Specifically, the unnormalized attention kernel

Γt(x,y)=eβ⟨Qtx,Kty⟩Rdfor x,y∈Sd−1,(2)\Gamma_t(x,y)=e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}}\quad\text{for }x,y\in\mathbb{S}^{d-1}, \tag*{(2)}

where Qt,KtQ_t,K_t are the query and key matrices at layer tt, respectively, and β∈R++\beta\in\mathbb{R}_{++} is a scaling parameter that represents the inverse temperature. Both Qt,KtQ_t,K_t are of size: sequence length×d\times d, so Qt⊤Kt∈Rd×dQ_t^\top K_t\in\mathbb{R}^{d\times d}. In (2) and throughout, ⟨⋅,⋅⟩Rd\langle\cdot,\cdot\rangle_{\mathbb{R}^d} denotes the Euclidean inner product.

In (1), the attention aggregated by the ii-th token amounts to a drift in its own dynamics. The operator PXti⊥P_{X_t^i}^{\perp} projects this drift onto the tangent space TXtiSd−1T_{X_t^i}\mathbb{S}^{d-1}, i.e.,

Px⊥(v):=v−⟨x,v⟩RdxP_x^\perp(v):=v-\langle x,v\rangle_{\mathbb{R}^d}x

for v∈Rdv\in\mathbb{R}^d. Furthermore, BtiB_t^i denotes a Brownian motion on Sd−1\mathbb{S}^{d-1}, and σ\sqrt{\sigma} denotes noise intensity.

Assumptions We assume that

A1. the matricial trajectories t↦Qt,t↦Kt,t↦Vtt\mapsto Q_t,t\mapsto K_t,t\mapsto V_t remain continuous over t∈[0,T]t\in[0,T],

A2. the Brownian motions {Bti}i=1N\{B_t^i\}_{i=1}^{N} are independent.

Mean-field limit To describe the evolution of the token embeddings as a population, we consider the empirical measure

ρtN:=1N∑i=1NδXti.\rho_t^N:=\frac{1}{N}\sum_{i=1}^{N}\delta_{X_t^i}.

where δXti\delta_{X_t^i} denotes the Dirac mass concentrated at XtiX_t^i. In the mean-field limit N→∞N\to\infty, interactions among the tokens through the attention mechanism take place via averaged effects (Bolley et al. [7]). When the initial token states are sampled independently from a distribution ρinitial∈P(Sd−1)\rho_{\mathrm{initial}}\in\mathcal{P}(\mathbb{S}^{d-1}), then by standard propagation-of-chaos arguments (Sznitman [54]; Chaintron and Diez [13]), the empirical (random) measure ρtN\rho_t^N converges to a deterministic probability distribution ρt∈P(Sd−1)\rho_t\in\mathcal{P}(\mathbb{S}^{d-1}) in almost sure sense. Throughout, we use the same symbol ρt\rho_t to denote a probability law in P(Sd−1)\mathcal{P}(\mathbb{S}^{d-1}) and its probability density function, i.e., ρt(dx)=ρt(x)dx\rho_t(\mathrm{d}x)=\rho_t(x)\mathrm{d}x.

As a result of propagation of chaos, (1) converges to the following McKean–Vlasov-type dynamics on Sd−1\mathbb{S}^{d-1} (Pascucci et al. [48]):

dXti=PXti⊥(bt[ρt](Xti))dt+σdBti,t∈[0,T],(3)\mathrm{d}X_t^i=P_{X_t^i}^{\perp}\bigl(b_t[\rho_t](X_t^i)\bigr)\mathrm{d}t+\sqrt{\sigma}\mathrm{d}B_t^i,\quad t\in[0,T], \tag*{(3)}

where

bt[ρt](x):=1Zt[ρt](x)∫Sd−1Γt(x,y)Vtyρt(y) dy,(4)b_t[\rho_t](x):=\frac{1}{Z_t[\rho_t](x)}\int_{\mathbb{S}^{d-1}}\Gamma_t(x,y)V_ty\rho_t(y)\,\mathrm{d}y, \tag*{(4)}

and the attention normalization

Zt[ρt](x):=∫Sd−1eβ⟨Qtx,Kty⟩Rdρt(y) dy.(5)Z_t[\rho_t](x):=\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}}\rho_t(y)\,\mathrm{d}y. \tag*{(5)}

We view the nonlocal vector field btb_t as the attention-induced mean-field velocity for the token embeddings. In the control context, we will treat this as a prior dynamics resulting from self-attention. We proceed by dropping the index ii for brevity.

Controlled dynamics and mean-field integro-PDE Recent work by Isobe et al. [35] studies the competition between the token clustering effected by the attention kernel and the feed-forward term, viewing the latter as a trainable controller that can steer tokens away from the clustered distribution. The present work builds on this perspective. Specifically, we consider the question of how to design a suitable controller that steers potentially clustering token dynamics from a prescribed initial distribution toward a desired target distribution. Our analysis below explicitly identifies the optimal controller to accomplish the steering task.

To this end, we consider the controlled dynamics

dXt=PXt⊥(bt[ρt](Xt)+ut(Xt)) dt+σ dBt,(6)dX_t=P^\perp_{X_t}\left(b_t[\rho_t](X_t)+u_t(X_t)\right)\,dt+\sqrt{\sigma}\,dB_t, \tag*{(6)}

where ut:Sd−1→Rdu_t:\mathbb{S}^{d-1}\to\mathbb{R}^d represents the steering control input. Equivalently, the token distribution satisfies the mean-field integro-PDE

∂tρt(x)+∇⋅(ρt(x)(Px⊥(bt[ρt](x)+ut(x))))=σ2Δρt(x),(7)\partial_t\rho_t(x)+\nabla\cdot\left(\rho_t(x)\left(P^\perp_x\left(b_t[\rho_t](x)+u_t(x)\right)\right)\right)=\frac{\sigma}{2}\Delta\rho_t(x), \tag*{(7)}

where ∇⋅(⋅)\nabla\cdot(\cdot) denotes the spherical divergence, and Δ\Delta is the Laplace-Beltrami operator on Sd−1\mathbb{S}^{d-1}. We interpret ut(Xt)u_t(X_t) as a corrective velocity field for the mean-field token dynamics.

Schrödinger Bridges over Attention Dynamics: Formulation and Results

Problem Formulation

We propose to cast the controlled mean-field token steering as a Schrödinger bridge problem, where the control design is informed by two probability laws ρinitial,ρfinal∈P(Sd−1)\rho_{\mathrm{initial}},\rho_{\mathrm{final}}\in\mathcal{P}(\mathbb{S}^{d-1}). We think of ρinitial,ρfinal\rho_{\mathrm{initial}},\rho_{\mathrm{final}} as given initial and target token distributions.

Our goal is to identify a controlled evolution ρt\rho_t over t∈[0,T]t\in[0,T] that respects the mean-field token distribution dynamics (7), satisfies ρ0=ρinitial,ρT=ρfinal\rho_0=\rho_{\mathrm{initial}},\rho_T=\rho_{\mathrm{final}}, and minimizes the total control effort

∫0T∫Sd−1∥ut(x)∥Rd2ρt(x) dx dt,(8)\int_0^T\int_{\mathbb{S}^{d-1}}\lVert u_t(x)\rVert_{\mathbb{R}^d}^2\rho_t(x)\,dx\,dt, \tag*{(8)}

where ∥⋅∥Rd2\lVert\cdot\rVert_{\mathbb{R}^d}^2 denotes the Euclidean norm. We can interpret the spatial integral

∫Sd−1∥ut(x)∥Rd2ρt(x) dx\int_{\mathbb{S}^{d-1}}\lVert u_t(x)\rVert_{\mathbb{R}^d}^2\rho_t(x)\,dx

as the instantaneous kinetic energy for the token population, and the space-time integral (8) as the total work done due to the population transfer induced by the control utu_t over t∈[0,T]t\in[0,T].

Notice that while Px⊥(ut(x))P^\perp_x(u_t(x)) appears in the token dynamics (6), any component of ut(x)u_t(x) normal to the tangent space of the sphere increases control energy cost. Thus, we can restrict ourselves to controllers that belong to the tangent space. We then let the set of admissible control trajectories be defined as

U(ρ⋅):={[0,T]∋t↦ut:ut(x)∈TxSd−1 for x∈Sd−1, and ∫0T∫Sd−1∥ut(x)∥2ρt(x) dx dt<∞},(9)\mathcal{U}(\rho_\cdot):=\left\{[0,T]\ni t\mapsto u_t:u_t(x)\in T_x\mathbb{S}^{d-1}\text{ for }x\in\mathbb{S}^{d-1},\ \text{and }\int_0^T\int_{\mathbb{S}^{d-1}}\lVert u_t(x)\rVert^2\rho_t(x)\,dx\,dt<\infty\right\}, \tag*{(9)}

where ∥⋅∥\lVert\cdot\rVert denotes the round metric norm.

Letting

D:={[0,T]∋t↦ρt:ρt∈P(Sd−1)},(10)\mathcal{D}:=\left\{[0,T]\ni t\mapsto\rho_t:\rho_t\in\mathcal{P}(\mathbb{S}^{d-1})\right\}, \tag*{(10)}

we now state our main problem as follows.

Determine

(u⋆,ρ⋆)∈(u^\star,\rho^\star)\in
arg min⁡(u⋅,ρ⋅)∈U(ρ⋅)×D 12σ∫0T∫Sd−1∥ut(x)∥2ρt(x) dx dt(11)\underset{(u_\cdot,\rho_\cdot)\in\mathcal{U}(\rho_\cdot)\times\mathcal{D}}{\operatorname{arg\,min}}\ \frac{1}{2\sigma}\int_0^T\int_{\mathbb{S}^{d-1}}\lVert u_t(x)\rVert^2\rho_t(x)\,dx\,dt \tag*{(11)}

subject to

∂tρt(x)+∇⋅(ρt(x)(Px⊥(bt[ρt](x)+ut(x))))=σ2Δρt(x),(12)\partial_t\rho_t(x)+\nabla\cdot\left(\rho_t(x)\left(P^\perp_x\left(b_t[\rho_t](x)+u_t(x)\right)\right)\right)=\frac{\sigma}{2}\Delta\rho_t(x), \tag*{(12)}
ρ0=ρinitial,ρT=ρfinal.(13)\rho_0=\rho_{\mathrm{initial}},\qquad\rho_T=\rho_{\mathrm{final}}. \tag*{(13)}

In what follows, we present the structure of the solution for the constrained variational problem (11).

Identification of the Schrödinger Bridge

The minimizer for problem (11) comprises of the optimal control ut⋆u_t^\star and the optimally controlled ρt⋆\rho_t^\star for t∈[0,T]t\in[0,T]. The optimal control policy is understood as a time-varying feedback, i.e., ut⋆(x)u_t^\star(x) is, in general, non-homogeneous in xx. This means that at any given time, the optimal corrective velocity experienced by one token embedding is different from another.

The following Theorem 1 shows that the minimizing pair t↦(ut⋆,ρt⋆)t\mapsto(u_t^\star,\rho_t^\star) can be recovered by solving a system of coupled nonlinear integro-PDEs with bilinear boundary conditions. The proof for this result is given in the Supplementary Material Section A.

Theorem 1 (Schrödinger System for Mean-field Token-steering). The minimizing tuple (ut⋆,ρt⋆)(u_t^\star,\rho_t^\star) for problem (11) is given by

ut⋆(x)=σ∇log⁡φt(x),(14)u_t^\star(x)=\sigma\nabla\log\varphi_t(x), \tag*{(14)}
ρt⋆(x)=φt(x)φ^t(x),(15)\rho_t^\star(x)=\varphi_t(x)\widehat{\varphi}_t(x), \tag*{(15)}

where x∈Sd−1x\in\mathbb{S}^{d-1}, and the positive real-valued functions φt,φ^t\varphi_t,\widehat{\varphi}_t on Sd−1\mathbb{S}^{d-1} satisfy

∂tφt(x)+⟨∇φt(x),Px⊥(bt[ρt⋆](x))⟩+σ2Δφt(x)=−qt[ρt⋆](x)φt(x),(16)\partial_t\varphi_t(x)+\langle\nabla\varphi_t(x),P^\perp_x(b_t[\rho_t^\star](x))\rangle+\frac{\sigma}{2}\Delta\varphi_t(x)=-q_t[\rho_t^\star](x)\varphi_t(x), \tag*{(16)}
∂tφ^t(x)+∇⋅(φ^t(x)Px⊥(bt[ρt⋆](x)))−σ2Δφ^t(x)=qt[ρt⋆](x)φ^t(x),(17)\partial_t\widehat{\varphi}_t(x)+\nabla\cdot\left(\widehat{\varphi}_t(x)P^\perp_x(b_t[\rho_t^\star](x))\right)-\frac{\sigma}{2}\Delta\widehat{\varphi}_t(x)=q_t[\rho_t^\star](x)\widehat{\varphi}_t(x), \tag*{(17)}

where ⟨⋅,⋅⟩\langle\cdot,\cdot\rangle denotes the inner product induced by the round metric on Sd−1\mathbb{S}^{d-1}, and (14a)–(14b) are subject to the multiplicative endpoint conditions

φ0(x)φ^0(x)=ρinitial(x),(18)\varphi_0(x)\widehat{\varphi}_0(x)=\rho_{\mathrm{initial}}(x), \tag*{(18)}
φT(x)φ^T(x)=ρfinal(x),(19)\varphi_T(x)\widehat{\varphi}_T(x)=\rho_{\mathrm{final}}(x), \tag*{(19)}

where

bt[ρt⋆](x)=1Zt[ρt⋆](x)∫Sd−1eβ⟨Qtx,Kty⟩RdVty ρt⋆(y) dy,b_t[\rho_t^\star](x)=\frac{1}{\mathcal{Z}_t[\rho_t^\star](x)}\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_t x,K_t y\rangle_{\mathbb{R}^d}}V_t y\,\rho_t^\star(y)\,dy,
qt[ρt⋆](x)=∫Sd−1φ^t(y)eβ⟨Qty,Ktx⟩RdZt[ρt⋆](y)⟨Py⊥(Vtx−bt[ρt⋆](y)),∇φt(y)⟩dy,q_t[\rho_t^\star](x)=\int_{\mathbb{S}^{d-1}}\widehat{\varphi}_t(y)\frac{e^{\beta\langle Q_t y,K_t x\rangle_{\mathbb{R}^d}}}{\mathcal{Z}_t[\rho_t^\star](y)}\left\langle P_y^\perp\left(V_t x-b_t[\rho_t^\star](y)\right),\nabla\varphi_t(y)\right\rangle dy,
Zt[ρt⋆](x)=∫Sd−1eβ⟨Qtx,Kty⟩Rdρt⋆(y) dy.\mathcal{Z}_t[\rho_t^\star](x)=\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_t x,K_t y\rangle_{\mathbb{R}^d}}\rho_t^\star(y)\,dy.

Remark 2. The pair (φt,φ^t)t∈[0,T](\varphi_t,\widehat{\varphi}_t)_{t\in[0,T]} is referred to as Schrödinger factors (Caluya and Halder [12]) since they enable a factorization of ρt⋆\rho_t^\star; see (15).

The system described in (14) is a mean-field generalization of the standard Schrödinger systems for the classical bridge problems; see Chetrite et al. [16], Section 5), Léonard [41]. It consists of nonlinear integro-PDEs that are coupled via the nonlocal attention transport bt[ρt⋆]b_t[\rho_t^\star] and the reaction rate qt[ρt⋆]q_t[\rho_t^\star]. This structure differs from the standard Schrödinger bridge in that (14a)–(14b) then becomes a system of linear advection-diffusion PDEs in (φt,φ^t)(\varphi_t,\widehat{\varphi}_t), see e.g., Caluya and Halder [12], Theorem 2.

In the standard (i.e., non-mean-field) Schrödinger bridge, the linearity of (14a)–(14b) can be leveraged in computation via dynamic Sinkhorn recursions (Chen et al. [15], Section 8) over the function pair (φT,φ^0)(\varphi_T,\widehat{\varphi}_0). In that case, the dynamic Sinkhorn (or iterative proportional fitting (De Bortoli et al. [20])) recursion is known to be contractive with respect to Hilbert’s projective metric (Bushell [11]; Georgiou and Pavon [27]).

In contrast, the nonlocal attention structure in btb_t, qtq_t makes (14) nonlinear, and it is not obvious if and how a Sinkhorn-like algorithm can be designed to compute the minimizing pair (12)–(13). Motivated by this, we propose a novel algorithm to obtain self-consistent solutions to (14).

Computational Approach

Building on Theorem 1, we propose a generalized proportional fitting algorithm to compute the solution to the Schrödinger system (14), enabling mean-field token steering. Our computational methodology is detailed in Algorithm 1, which comprises nested fixed-point iterations indexed by jj and kk. Specifically, the inner

Algorithm 1Mean-Field Token Steering Algorithm
Require:β,Qt,Kt,Vt,σ,T,ρinitial,ρfinal, NK, NJ, tol, θ∈(0,1]\beta,Q_t,K_t,V_t,\sigma,T,\rho_{\mathrm{initial}},\rho_{\mathrm{final}},\ N_K,\ N_J,\ \mathrm{tol},\ \theta\in(0,1].
1:Initialize φ[0],φ^[0]\varphi^{[0]},\widehat{\varphi}^{[0]} and ρ(0)=φ[0]φ^[0]\rho^{(0)}=\varphi^{[0]}\widehat{\varphi}^{[0]}.
2:for k=0,…,NKk=0,\ldots,N_K
3:Compute Z[ρ(k)],b[ρ(k)]\mathcal{Z}[\rho^{(k)}],b[\rho^{(k)}].
4:for j=0,…,NJj=0,\ldots,N_J
5:Compute
qt[j][ρ(k)](x)=∫Sd−1φ^t[j](y)eβ⟨Qty,Ktx⟩RdZt[ρt(k)](y)⟨Py⊥(Vtx−bt[ρt(k)](y)),∇φ^t[j](y)⟩dyq_t^{[j]}[\rho^{(k)}](x)=\int_{\mathbb{S}^{d-1}}\widehat{\varphi}_t^{[j]}(y)\frac{e^{\beta\langle Q_t y,K_t x\rangle_{\mathbb{R}^d}}}{\mathcal{Z}_t[\rho_t^{(k)}](y)}\left\langle P_y^\perp\left(V_t x-b_t[\rho_t^{(k)}](y)\right),\nabla\widehat{\varphi}_t^{[j]}(y)\right\rangle dy.
6:Integrate
∂tφt[j+1](x)+⟨∇φt[j+1](x),Px⊥(bt[ρt(k)](x))⟩+σ2Δφt[j+1](x)=−qt[j][ρ(k)](x)φt[j+1](x)\partial_t\varphi_t^{[j+1]}(x)+\left\langle\nabla\varphi_t^{[j+1]}(x),P_x^\perp\left(b_t[\rho_t^{(k)}](x)\right)\right\rangle+\frac{\sigma}{2}\Delta\varphi_t^{[j+1]}(x)=-q_t^{[j]}[\rho^{(k)}](x)\varphi_t^{[j+1]}(x) \hfill (15)
backward in time from φT[j](x)\varphi_T^{[j]}(x).
7:Set
φ^0[j+1](⋅)=ρinitial(⋅)φ0[j+1](⋅)\widehat{\varphi}_0^{[j+1]}(\cdot)=\frac{\rho_{\mathrm{initial}}(\cdot)}{\varphi_0^{[j+1]}(\cdot)}. \hfill (16)
8:Integrate
∂tφ^t[j+1](x)+∇⋅(φ^t[j+1](x)Px⊥(bt[ρt(k)](x)))−σ2Δφ^t[j+1](x)=qt[j][ρ(k)](x)φ^t[j+1](x)\partial_t\widehat{\varphi}_t^{[j+1]}(x)+\nabla\cdot\left(\widehat{\varphi}_t^{[j+1]}(x)P_x^\perp\left(b_t[\rho_t^{(k)}](x)\right)\right)-\frac{\sigma}{2}\Delta\widehat{\varphi}_t^{[j+1]}(x)=q_t^{[j]}[\rho^{(k)}](x)\widehat{\varphi}_t^{[j+1]}(x) \hfill (17)
forward in time from φ^0[j+1](x)\widehat{\varphi}_0^{[j+1]}(x).
9:Set
φT[j+1](⋅)=ρfinal(⋅)φ^T[j+1](⋅)\varphi_T^{[j+1]}(\cdot)=\frac{\rho_{\mathrm{final}}(\cdot)}{\widehat{\varphi}_T^{[j+1]}(\cdot)}. \hfill (18)
10:if max⁡t∈[0,T]max⁡{dH(φt[j+1],φt[j]),dH(φ^t[j+1],φ^t[j])}<tol\max_{t\in[0,T]}\max\left\{d_H\left(\varphi_t^{[j+1]},\varphi_t^{[j]}\right),d_H\left(\widehat{\varphi}_t^{[j+1]},\widehat{\varphi}_t^{[j]}\right)\right\}<\mathrm{tol} then
11:break
12:end if
13:end for
14:Update
ρ(k+1)=θφ[j+1]φ^[j+1]+(1−θ)ρ(k)\rho^{(k+1)}=\theta\varphi^{[j+1]}\widehat{\varphi}^{[j+1]}+(1-\theta)\rho^{(k)}. \hfill (19)
15:if max⁡t∈[0,T]dH(ρt(k+1),ρt(k))<tol\max_{t\in[0,T]}d_H\left(\rho_t^{(k+1)},\rho_t^{(k)}\right)<\mathrm{tol} then
16:break
17:end if
18:Set φ[0]←φ[j+1]\varphi^{[0]}\leftarrow\varphi^{[j+1]} and φ^[0]←φ^[j+1]\widehat{\varphi}^{[0]}\leftarrow\widehat{\varphi}^{[j+1]}.
19:end for
20:return φ[j+1],φ^[j+1]\varphi^{[j+1]},\widehat{\varphi}^{[j+1]}, and ρ(k+1)\rho^{(k+1)}.

Table 1.

iteration index j∈{0,1,…,NJ}j \in\{0,1,\ldots,N_J\}, and the outer iteration index k∈{0,1,…,NK}k \in\{0,1,\ldots,N_K\}. The initial guesses ρ(0)\rho^{(0)}, φ[0]\varphi^{[0]}, and φ^[0]\widehat{\varphi}^{[0]} may be taken as the solution to the corresponding non-interacting Schrödinger bridge problem, obtained by setting the btb_t, qtq_t in (14) to zero.

In essence, the nested structure in Algorithm 1 handles the two sources of nonlinear coupling from the mean-field velocity btb_t and the reaction rate qtq_t separately. Within the outer iteration that is indexed by kk, the quantity ρ⋅(k)\rho^{(k)}_\cdot denotes the kk-th approximation of the marginal flow. This approximation corresponds to mean-field velocity b⋅[ρ(k)]b_\cdot[\rho^{(k)}] and normalization Z⋅[ρ(k)]\mathcal{Z}_\cdot[\rho^{(k)}]. The inner iteration that is indexed by jj entails solving (16)–(19), but with the fixed bt[ρ(k)]b_t[\rho^{(k)}], Zt[ρ(k)]\mathcal{Z}_t[\rho^{(k)}] and the reaction rate determined from the approximated marginal flow and delayed evaluation of the preceding Schrödinger factors.

Inner iteration With these quantities fixed, the backward equation for φt[j+1]\varphi_t^{[j+1]} in (15) and the forward equation for φ^t[j+1]\widehat{\varphi}_t^{[j+1]} in (17) are linear Kolmogorov equations. We use these linear equations for time marching, and update the marched terminal and initial values by imposing the prescribed final and initial marginal densities ρfinal,ρinitial\rho_{\mathrm{final}},\rho_{\mathrm{initial}}, as in (18) and (16), respectively.

Outer iteration After the inner iteration completes, the outer loop updates t↦ρt(k)t \mapsto\rho_t^{(k)} according to (19), using a damped evaluation if found necessary for numerical stability. The nested iterations are repeated until the marginal flow and the Schrödinger pair are jointly self-consistent.

Convergence criteria We take our convergence criteria to be with respect to the Hilbert’s projective metric defined for nonnegative functions f,gf,g in the Banach space L∞(Sd−1)L^\infty(\mathbb{S}^{d-1}) as

dH(f,g):=log⁡sup⁡x∈Ωf(x)g(x)−log⁡inf⁡x∈Ωf(x)g(x).(20)d_H(f,g) := \log\sup_{x\in\Omega}\frac{f(x)}{g(x)}-\log\inf_{x\in\Omega}\frac{f(x)}{g(x)}. \tag*{(20)}

The evaluation is restricted to the common support Ω⊆Sd−1\Omega\subseteq\mathbb{S}^{d-1} of the functions being compared.

Numerical Experiments

We illustrate the proposed mean-field token steering framework on two experiments: one for S1\mathbb{S}^{1} (circle) and the other for S2\mathbb{S}^{2} (2-sphere in R3\mathbb{R}^{3}). In both experiments, we fix the noise strength parameter σ=0.5\sigma= 0.5, inverse temperature β=5\beta= 5, and Algorithm 1 parameters: tol =10−6= 10^{-6}, θ=0.5\theta= 0.5. In both, we perform a unimodal-to-bimodal steering over [0,T]=[0,1][0,T] = [0,1] with

ρinitial(x)∝eκ0⟨μ0,x⟩,ρfinal(x)∝∑i=12wieκT⟨μi,x⟩,\rho_{\mathrm{initial}}(x) \propto e^{\kappa_0\langle\mu_0,x\rangle}, \qquad\rho_{\mathrm{final}}(x) \propto\sum_{i=1}^{2} w_i e^{\kappa_T\langle\mu_i,x\rangle},

for κ0,κT>0\kappa_0,\kappa_T > 0, a convex weight vector (w1,w2)(w_1,w_2), and μ0,μ1,μ2∈Rd\mu_0,\mu_1,\mu_2 \in\mathbb{R}^d for Sd−1\mathbb{S}^{d-1}. In other words, we steer a von Mises–Fisher distribution toward a two-component mixture of von Mises–Fisher distributions. We detail the other parameters and results for the specific experiments below.

S1 Experiment

Setup We use the following parameters for the initial and final distributions: κ0=6\kappa_0 = 6, κT=10\kappa_T = 10, μ0=(cos⁡,sin⁡)T\mu_0 = (\cos,\sin)^\mathsf{T}, μ1=(cos⁡(−1),sin⁡(−1))T\mu_1 = (\cos(-1),\sin(-1))^\mathsf{T}, μ2=(cos⁡(1),sin⁡(1))T\mu_2 = (\cos(1),\sin(1))^\mathsf{T}, w1=0.4w_1 = 0.4, w2=0.6w_2 = 0.6. We use the self-attention parameters: Qt=Kt≡0.5I2\mathbf{Q}_t = \mathbf{K}_t \equiv0.5I_2 (here d=2d=2), and randomly generated

Vt=[0.21800.27480.01300.2177]∀t∈[0,T].V_t = \begin{bmatrix} 0.2180 & 0.2748 \\ 0.0130 & 0.2177 \end{bmatrix} \qquad\forall t \in[0,T].

In using Algorithm 1 for this S1\mathbb{S}^{1} experiment, we time-march the solutions for (15) and (17) using the Lie–Trotter splitting and 600 uniform discretizations of the time horizon [0,1][0,1]. To approximate the spatial derivatives on the circle, we used the finite difference with 150 discretizations of [0,2π)[0,2\pi). To approximate the integrals in nonlocal terms, we used the periodic quadrature method.

In applying Algorithm 1 to this S1\mathbb{S}^{1} experiment, we use NJ=40N_J = 40 inner iterations, and NK=30N_K = 30 outer iterations.

Results For the S1\mathbb{S}^{1} numerical experiment setup described above, Figure 1 shows four snapshots of the optimally controlled density ρt∗\rho_t^* (solid curve) computed using Algorithm 1, together with ρinitial,ρfinal\rho_{\mathrm{initial}},\rho_{\mathrm{final}} (dashed curves). This plot demonstrates that Algorithm 1 effectively steers the mean-field token distribution over the given horizon [0,1][0,1]. On these snapshots, we also superimposed the optimally controlled evolution of 200 token embeddings (hollow circular markers), showing a higher concentration near the modes of ρt∗\rho_t^*, as expected. These token evolutions were computed via Euler–Maruyama simulation of the controlled dynamics (6) with ut∗u_t^* obtained from Algorithm 1 and with the same time discretization as before.

Evolution of optimally controlled token distribution and tokens

Figure 1. Evolution of optimally controlled token distribution and tokens for the S1S^1 experiment in § 4.1.

Figure 2 shows convergence of Algorithm 1 with respect to the Hilbert metric (20), for this S1\mathbb{S}^{1} experiment.

Convergence of Algorithm 1

Figure 2. Convergence of Algorithm 1 for the experiment in § 4.1.

An additional S1\mathbb{S}^{1} experiment is reported in the Supplementary Material Section B.

S2S^2 Experiment

Setup. Here, we use the following parameters for the initial and final distributions: κ0=30\kappa_0 = 30, κT=50\kappa_T = 50, μ0=(sin⁡(1)cos⁡(0.4),sin⁡(1)sin⁡(0.4),cos⁡(1))T\mu_0 = (\sin(1)\cos(0.4),\sin(1)\sin(0.4),\cos(1))^\mathsf{T},

μ1=μccos⁡α+νsin⁡α∥μccos⁡α+νsin⁡α∥2,μ2=μccos⁡α−νsin⁡α∥μccos⁡α−νsin⁡α∥2,\mu_1 = \frac{\mu_c\cos\alpha+\nu\sin\alpha}{\lVert\mu_c\cos\alpha+\nu\sin\alpha\rVert_2},\qquad \mu_2 = \frac{\mu_c\cos\alpha-\nu\sin\alpha}{\lVert\mu_c\cos\alpha-\nu\sin\alpha\rVert_2},

μc:=−μ0\mu_c := -\mu_0, ν\nu is the unit tangent vector at μc\mu_c, α=0.9\alpha= 0.9 rad, w1=0.2w_1 = 0.2, w2=0.8w_2 = 0.8. For the self-attention parameters, we use β=5\beta= 5, fixed Qt=Kt≡I3Q_t = K_t \equiv I_3 (here d=3d = 3), and randomly generated

Vt≡(0.27540.25540.06280.35410.44650.10360.14550.44810.0257)∀t∈[0,T].V_t \equiv \begin{pmatrix} 0.2754 & 0.2554 & 0.0628 \\ 0.3541 & 0.4465 & 0.1036 \\ 0.1455 & 0.4481 & 0.0257 \end{pmatrix} \quad\forall t \in[0,T].

To apply Algorithm 1 for this S2S^2 experiment, we time-march the solutions for (15) and (17) using the Lie-Trotter splitting as before, with 200 uniform discretizations of the time horizon [0,1][0,1]. To approximate the spatial derivatives on S2S^2, we used the finite difference with 32×6432 \times64 discretizations of [0,π]×[0,2π)[0,\pi]\times[0,2\pi). To approximate the integrals in nonlocal terms, we used the weighted quadrature method.

In applying Algorithm 1 to this S2S^2 experiment, we use NJ=50N_J = 50 inner iterations, and NK=60N_K = 60 outer iterations.

Results. For the S2S^2 numerical experiment setup described above, Figure 3 shows four snapshots of the optimally controlled density ρt⋆\rho_t^\star (solid contours) computed using Algorithm 1, together with ρinitial,ρfinal\rho_{\mathrm{initial}},\rho_{\mathrm{final}} (dashed contours), demonstrating the effectiveness of Algorithm 1. To avoid clutter, we suppressed the contour labels. The hollow circular markers in Figure 3 show 160 optimally controlled token embeddings, computed via Euler-Maruyama simulation of (6) with ut⋆u_t^\star obtained from Algorithm 1 and with the same time discretization as before.

Evolution of optimally controlled token distribution and tokens at four time points

Figure 3. Evolution of optimally controlled token distribution and tokens for the S2^{2} experiment in § 4.2.

For this S2S^2 experiment, Figure 4 shows convergence of Algorithm 1 with respect to the Hilbert metric (20).

Convergence plot of Algorithm 1

Figure 4. Convergence of Algorithm 1 for the experiment in § 4.2.

Concluding Remarks

In this work, we have formulated the problem of steering self-attention-driven token dynamics in the mean-field limit with minimum control effort. The formulation, based on the theory of Schrödinger bridges, identifies the minimum-effort control as a feedback law that transports the token distribution between prescribed initial and final configurations over a finite transformer depth horizon. Our analysis characterizes the optimal controller via a forward–backward system of nonlinearly coupled integro-PDEs. To numerically solve such a system, we have proposed a generalized iterative proportional fitting algorithm adapted to the transformer mean-field setting.

Our primary contributions are theoretical: proposing the idea of mean-field token steering via control, connecting the formulation with the mean-field Schrödinger bridge in the presence of attention-induced nonlocal drift, designing a variant of dynamic Sinkhorn recursion to solve the same, and demonstrating the feasibility of computation via simple numerical examples. While we empirically demonstrate local convergence, proving guarantees for the same remains a topic of ongoing research.

This work points towards multiple research avenues and connections within the rapidly evolving theory of transformer dynamics. Connecting the present result to recent analyses of representation collapse and meta-stable multi-clustering [29, 9] is the most direct foreseeable research direction, and may provide a means to preserve the representation structure. Our numerical results support that possibility.

Another connection is the recent line of research on activation steering (see, e.g., Li et al. (2023); Lee et al. [38]; Skifstad et al. [53]; Adila et al. [2]) that aims to guide an LLM during prompt context inference toward a desired semantic direction by modifying the model’s internal representation at selected layers. The work here can be viewed as a distributional analogue of activation steering, where steering is achieved at the level of token-embedding populations. Therefore, an interesting direction for future work is to study how the controller obtained herein can be best realized (or approximated) by sparse interventions at finitely many layers, and how this restriction affects steering performance.

More broadly, extensions of the present framework to finite token populations, discrete layer depths, and multi-head attention indeed constitute an important step toward bridging the current theory with practical transformer architectures.

AI use statement

During the preparation of this work, the authors used generative AI (OpenAI, Anthropic) to assist in developing the code for the numerical solvers and in postprocessing of the figures. The authors reviewed, validated, and edited all the outputs and take full responsibility for the final contents, figures, claims, and artifacts presented here.

PROOF OF THEOREM 1

This section provides the proof of Theorem 1. We start by writing the Lagrangian of Problem (11) as

L(u⋅,ρ⋅,Λ⋅)=12σ∫0T∫Sd−1∥ut(x)∥2ρt(x) dx dt+∫0T∫Sd−1Λt(x)[∂tρt(x)+∇⋅(ρt(x)(Px⊥(bt[ρt](x))+ut(x)))−σ2Δρt(x)] dx dt(21)\mathcal{L}(u_{\cdot},\rho_{\cdot},\Lambda_{\cdot})=\frac{1}{2\sigma}\int_{0}^{T}\int_{\mathbb{S}^{d-1}}\lVert u_t(x)\rVert^2\rho_t(x)\,\mathrm{d}x\,\mathrm{d}t+\int_{0}^{T}\int_{\mathbb{S}^{d-1}}\Lambda_t(x)\left[\partial_t\rho_t(x)+\nabla\cdot\left(\rho_t(x)\left(P_x^{\perp}\left(b_t[\rho_t](x)\right)+u_t(x)\right)\right)-\frac{\sigma}{2}\Delta\rho_t(x)\right]\,\mathrm{d}x\,\mathrm{d}t \tag*{(21)}

where Λt:Sd−1→R\Lambda_t:\mathbb{S}^{d-1}\to\mathbb{R} is a Lagrange multiplier that enforces the dynamical constraint (11b).

Using integration by parts, we write

∫0T∫Sd−1Λt(x) ∂tρt(x) dx dt=∫Sd−1{ΛT(x)ρT(x)−Λ0(x)ρ0(x)} dx−∫0T∫Sd−1ρt(x) ∂tΛt(x) dx dt.(22)\int_{0}^{T}\int_{\mathbb{S}^{d-1}}\Lambda_t(x)\,\partial_t\rho_t(x)\,\mathrm{d}x\,\mathrm{d}t=\int_{\mathbb{S}^{d-1}}\left\{\Lambda_T(x)\rho_T(x)-\Lambda_0(x)\rho_0(x)\right\}\,\mathrm{d}x-\int_{0}^{T}\int_{\mathbb{S}^{d-1}}\rho_t(x)\,\partial_t\Lambda_t(x)\,\mathrm{d}x\,\mathrm{d}t. \tag*{(22)}

Next, define

vt(x):=Px⊥(bt[ρt](x))+ut(x),∀x∈Sd−1.(23)v_t(x):=P_x^{\perp}\left(b_t[\rho_t](x)\right)+u_t(x),\qquad\forall x\in\mathbb{S}^{d-1}. \tag*{(23)}

By the divergence theorem ([39 Theorem 16.48]), we have

∫Sd−1Λt(x)∇⋅(ρt(x)vt(x)) dx=−∫Sd−1ρt⟨vt(x),∇Λt(x)⟩ dx,\int_{\mathbb{S}^{d-1}}\Lambda_t(x)\nabla\cdot\left(\rho_t(x)v_t(x)\right)\,\mathrm{d}x=-\int_{\mathbb{S}^{d-1}}\rho_t\left\langle v_t(x),\nabla\Lambda_t(x)\right\rangle\,\mathrm{d}x,

since Sd−1\mathbb{S}^{d-1} is a closed manifold, i.e., ∂Sd−1=∅\partial\mathbb{S}^{d-1}=\varnothing. Hence, substituting (S3) into the previous equation yields

∫Sd−1Λt(x)∇⋅(ρt(x)(Px⊥(bt[ρt](x))+ut(x))) dx=−∫Sd−1ρt(x)⟨Px⊥(bt[ρt](x))+ut(x),∇Λt(x)⟩ dx,(24)\int_{\mathbb{S}^{d-1}}\Lambda_t(x)\nabla\cdot\left(\rho_t(x)\left(P_x^{\perp}\left(b_t[\rho_t](x)\right)+u_t(x)\right)\right)\,\mathrm{d}x=-\int_{\mathbb{S}^{d-1}}\rho_t(x)\left\langle P_x^{\perp}\left(b_t[\rho_t](x)\right)+u_t(x),\nabla\Lambda_t(x)\right\rangle\,\mathrm{d}x, \tag*{(24)}

recalling that ⟨⋅,⋅⟩\langle\cdot,\cdot\rangle denotes the inner product induced by the round metric on Sd−1\mathbb{S}^{d-1}.

By Green’s second identity ([40 Page 51]), we also obtain that

−σ2∫Sd−1Λt(x)Δρt(x) dx=−σ2∫Sd−1ρt(x)ΔΛt(x) dx.(25)-\frac{\sigma}{2}\int_{\mathbb{S}^{d-1}}\Lambda_t(x)\Delta\rho_t(x)\,\mathrm{d}x=-\frac{\sigma}{2}\int_{\mathbb{S}^{d-1}}\rho_t(x)\Delta\Lambda_t(x)\,\mathrm{d}x. \tag*{(25)}

By (S2), (S4), and (S5), the Lagrangian in (S1) can be rewritten as

L(u⋅,ρ⋅,Λ⋅)=∫Sd−1{ΛT(x)ρT(x)−Λ0(x)ρ0(x)} dx+∫0T∫Sd−1ρt(x)[∥ut(x)∥22σ−∂tΛt(x)−⟨Px⊥(bt[ρt](x))+ut(x),∇Λt(x)⟩−σ2ΔΛt(x)] dx dt.(26)\mathcal{L}(u_{\cdot},\rho_{\cdot},\Lambda_{\cdot})=\int_{\mathbb{S}^{d-1}}\left\{\Lambda_T(x)\rho_T(x)-\Lambda_0(x)\rho_0(x)\right\}\,\mathrm{d}x+\int_{0}^{T}\int_{\mathbb{S}^{d-1}}\rho_t(x)\left[\frac{\lVert u_t(x)\rVert^2}{2\sigma}-\partial_t\Lambda_t(x)-\left\langle P_x^{\perp}\left(b_t[\rho_t](x)\right)+u_t(x),\nabla\Lambda_t(x)\right\rangle-\frac{\sigma}{2}\Delta\Lambda_t(x)\right]\,\mathrm{d}x\,\mathrm{d}t. \tag*{(26)}

Optimization over the controller t↦utt\mapsto u_t

The first-order optimality condition for u⋆u^\star is such that the Gâteaux derivative

ddηL(u⋆+η δu⋆,ρ⋆,Λ)∣η=0=0,(27)\left.\frac{\mathrm{d}}{\mathrm{d}\eta}\mathcal{L}(u^\star+\eta\,\delta u^\star,\rho^\star,\Lambda)\right|_{\eta=0}=0, \tag*{(27)}

for every perturbation t↦δut⋆t \mapsto\delta u_t^\star, with δut⋆(x)∈TxSd−1\delta u_t^\star(x) \in T_x\mathbb{S}^{d-1}, x∈Sd−1x \in\mathbb{S}^{d-1}. This implies

1σ∫0T∫Sd−1ρt⋆(x)⟨ut⋆(x)−σ∇Λt(x),δut⋆(x)⟩ dx dt=0.\frac{1}{\sigma}\int_0^T\int_{\mathbb{S}^{d-1}}\rho_t^\star(x)\left\langle u_t^\star(x)-\sigma\nabla\Lambda_t(x),\delta u_t^\star(x)\right\rangle\,dx\,dt=0.

That is, for almost every t∈[0,T]t \in[0,T],

ut⋆=σ∇Λt,ρt⋆-almost everywhere.(28)u_t^\star=\sigma\nabla\Lambda_t,\qquad\rho_t^\star\text{-almost everywhere}. \tag*{(28)}

Optimization over the marginal flow t↦ρtt \mapsto\rho_t

Let us substitute (S8) into (S6). This yields the following evaluation at the optimizer t↦(ρt⋆,ut⋆)t \mapsto(\rho_t^\star,u_t^\star).

L(ρ⋆,Λ⋅)=∫Sd−1{ΛT(x)ρT⋆(x)−Λ0(x)ρ0⋆(x)} dx+J(ρ⋆,Λ⋅)+∫0T∫Sd−1{ρt⋆(x)[−∂tΛt(x)−σ2∥∇Λt(x)∥2−σ2ΔΛt(x)]} dx dt.(29)\mathcal{L}(\rho^\star,\Lambda_\cdot)=\int_{\mathbb{S}^{d-1}}\left\{\Lambda_T(x)\rho_T^\star(x)-\Lambda_0(x)\rho_0^\star(x)\right\}\,dx +J(\rho^\star,\Lambda_\cdot)+\int_0^T\int_{\mathbb{S}^{d-1}}\left\{\rho_t^\star(x)\left[-\partial_t\Lambda_t(x)-\frac{\sigma}{2}\left\|\nabla\Lambda_t(x)\right\|^2-\frac{\sigma}{2}\Delta\Lambda_t(x)\right]\right\}\,dx\,dt. \tag*{(29)}

where

J(ρ⋆,Λ⋅):=−∫0T∫Sd−1ρt⋆(x)⟨Px⊥(bt[ρt⋆](x)),∇Λt(x)⟩ dx dt.(30)J(\rho^\star,\Lambda_\cdot):=-\int_0^T\int_{\mathbb{S}^{d-1}}\rho_t^\star(x)\left\langle P_x^\perp\left(b_t[\rho_t^\star](x)\right),\nabla\Lambda_t(x)\right\rangle\,dx\,dt. \tag*{(30)}

We let t↦δρt⋆t \mapsto\delta\rho_t^\star be a perturbation of the optimal PDF-valued curve t↦ρt⋆t \mapsto\rho_t^\star, so that

∫Sd−1δρt⋆=0.\int_{\mathbb{S}^{d-1}}\delta\rho_t^\star=0.

Further, since the endpoint optimal PDFs ρ0⋆,ρT⋆\rho_0^\star,\rho_T^\star are fixed as in (13),

δρ0⋆=δρT⋆=0.(31)\delta\rho_0^\star=\delta\rho_T^\star=0. \tag*{(31)}

Then, the first-order optimality condition with respect to ρ⋅\rho_\cdot is such that

ddηL(ρ⋆+ηδρ⋆,Λ⋅)∣η=0=0.(32)\left.\frac{\mathrm{d}}{\mathrm{d}\eta}\mathcal{L}(\rho^\star+\eta\delta\rho^\star,\Lambda_\cdot)\right|_{\eta=0}=0. \tag*{(32)}

Therefore, by (S9)–(S11), we have

−∫0T∫Sd−1δρt⋆(x)[∂tΛt(x)+σ2∥∇Λt(x)∥2+σ2ΔΛt(x)] dx dt+ddηJ(ρ⋆+ηδρ⋆,Λ⋅)∣η=0=0.(33)-\int_0^T\int_{\mathbb{S}^{d-1}}\delta\rho_t^\star(x)\left[\partial_t\Lambda_t(x)+\frac{\sigma}{2}\left\|\nabla\Lambda_t(x)\right\|^2+\frac{\sigma}{2}\Delta\Lambda_t(x)\right]\,dx\,dt+\left.\frac{\mathrm{d}}{\mathrm{d}\eta}J(\rho^\star+\eta\delta\rho^\star,\Lambda_\cdot)\right|_{\eta=0}=0. \tag*{(33)}

Indeed,

ddηJ(ρ⋆+ηδρ⋆,Λ⋅)=−∫0T∫Sd−1{δρt⋆(x)⟨Px⊥(bt[ρt⋆+ηδρt⋆](x),∇Λt(x))⟩+(ρt⋆(x)+ηδρt⋆(x))ddη⟨Px⊥(bt[ρt⋆+ηδρt⋆](x),∇Λt(x))⟩} dx dt.(34)\frac{\mathrm{d}}{\mathrm{d}\eta}J(\rho^\star+\eta\delta\rho^\star,\Lambda_\cdot) =-\int_0^T\int_{\mathbb{S}^{d-1}}\left\{\delta\rho_t^\star(x)\left\langle P_x^\perp\left(b_t[\rho_t^\star+\eta\delta\rho_t^\star](x),\nabla\Lambda_t(x)\right)\right\rangle +\left(\rho_t^\star(x)+\eta\delta\rho_t^\star(x)\right)\frac{\mathrm{d}}{\mathrm{d}\eta}\left\langle P_x^\perp\left(b_t[\rho_t^\star+\eta\delta\rho_t^\star](x),\nabla\Lambda_t(x)\right)\right\rangle\right\}\,dx\,dt. \tag*{(34)}

Notice that

ddη⟨Px⊥(bt[ρt⋆+ηδρt⋆](x),∇Λt(x))⟩=⟨Px⊥(ddηbt[ρt⋆+ηδρt⋆](x),∇Λt(x))⟩.(35)\frac{\mathrm{d}}{\mathrm{d}\eta}\left\langle P_x^\perp\left(b_t[\rho_t^\star+\eta\delta\rho_t^\star](x),\nabla\Lambda_t(x)\right)\right\rangle =\left\langle P_x^\perp\left(\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^\star+\eta\delta\rho_t^\star](x),\nabla\Lambda_t(x)\right)\right\rangle. \tag*{(35)}

Therefore, (S14) and (S15) lead to

ddηJ(ρ⋆+ηδρ⋆,Λ⋅)∣η=0=−∫0T∫Sd−1{δρt⋆(x)⟨Px⊥(ddηbt[ρt⋆+ηδρt⋆]∣η=0(x),∇Λt(x))⟩+ρt⋆(x)⟨Px⊥(ddηbt[ρt⋆+ηδρt⋆]∣η=0(x),∇Λt(x))⟩} dx dt.(36)\left.\frac{\mathrm{d}}{\mathrm{d}\eta}J(\rho^\star+\eta\delta\rho^\star,\Lambda_\cdot)\right|_{\eta=0} =-\int_0^T\int_{\mathbb{S}^{d-1}}\left\{\delta\rho_t^\star(x)\left\langle P_x^\perp\left(\left.\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^\star+\eta\delta\rho_t^\star]\right|_{\eta=0}(x),\nabla\Lambda_t(x)\right)\right\rangle +\rho_t^\star(x)\left\langle P_x^\perp\left(\left.\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^\star+\eta\delta\rho_t^\star]\right|_{\eta=0}(x),\nabla\Lambda_t(x)\right)\right\rangle\right\}\,dx\,dt. \tag*{(36)}

Recall that

bt[ρt∗](x)=1Zt[ρt∗](x)∫Sd−1eβ⟨Qtx,Kty⟩RdVty ρt∗(y) dy,(37)b_t[\rho_t^*](x) = \frac{1}{\mathcal{Z}_t[\rho_t^*](x)} \int_{\mathbb{S}^{d-1}} e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}} V_t y\,\rho_t^*(y)\,dy, \tag*{(37)}
Zt[ρt∗](x)=∫Sd−1eβ⟨Qtx,Kty⟩Rdρt∗(y) dy.(38)\mathcal{Z}_t[\rho_t^*](x) = \int_{\mathbb{S}^{d-1}} e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}} \rho_t^*(y)\,dy. \tag*{(38)}

Let us set

Yt[ρt∗](x):=∫Sd−1eβ⟨Qtx,Kty⟩RdVty ρt∗(y) dy.(39)\mathcal{Y}_t[\rho_t^*](x) := \int_{\mathbb{S}^{d-1}} e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}} V_t y\,\rho_t^*(y)\,dy. \tag*{(39)}

Hence,

bt[ρt∗]=Yt[ρt∗]Zt[ρt∗],b_t[\rho_t^*] = \frac{\mathcal{Y}_t[\rho_t^*]}{\mathcal{Z}_t[\rho_t^*]},
bt[ρt∗+η δρt∗]=Yt[ρt∗+η δρt∗]Zt[ρt∗+η δρt∗].b_t[\rho_t^*+\eta\,\delta\rho_t^*] = \frac{\mathcal{Y}_t[\rho_t^*+\eta\,\delta\rho_t^*]}{\mathcal{Z}_t[\rho_t^*+\eta\,\delta\rho_t^*]}.

Note that by using (S18) and (S19), we can rewrite the previous equation as

bt[ρt∗+η δρt∗]=Yt[ρt∗]+η Yt[δρt∗]Zt[ρt∗]+η Zt[δρt∗].b_t[\rho_t^*+\eta\,\delta\rho_t^*] = \frac{\mathcal{Y}_t[\rho_t^*]+\eta\,\mathcal{Y}_t[\delta\rho_t^*]}{\mathcal{Z}_t[\rho_t^*]+\eta\,\mathcal{Z}_t[\delta\rho_t^*]}.

Thus,

ddηbt[ρt∗+η δρt∗]∣η=0=1Zt[ρt∗](Yt[δρt∗]−bt[ρt∗]Zt[δρt∗]),\left.\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^*+\eta\,\delta\rho_t^*]\right|_{\eta=0} = \frac{1}{\mathcal{Z}_t[\rho_t^*]}\left(\mathcal{Y}_t[\delta\rho_t^*]-b_t[\rho_t^*]\mathcal{Z}_t[\delta\rho_t^*]\right),
ddηbt[ρt∗+η δρt∗]∣η=0(x)=1Zt[ρt∗](x)∫Sd−1eβ⟨Qtx,Kty⟩Rd(Vty−bt[ρt∗](x))δρt∗(y) dy.\left.\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^*+\eta\,\delta\rho_t^*]\right|_{\eta=0}(x) = \frac{1}{\mathcal{Z}_t[\rho_t^*](x)}\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}}\left(V_t y-b_t[\rho_t^*](x)\right)\delta\rho_t^*(y)\,dy.

Additionally,

Px⊥(ddηbt[ρt∗+η δρt∗]∣η=0(x))=1Zt[ρt∗](x)∫Sd−1eβ⟨Qtx,Kty⟩RdPx⊥(Vty−bt[ρt∗](x))δρt∗(y) dy.(40)P_x^\perp\left(\left.\frac{\mathrm{d}}{\mathrm{d}\eta}b_t[\rho_t^*+\eta\,\delta\rho_t^*]\right|_{\eta=0}(x)\right) = \frac{1}{\mathcal{Z}_t[\rho_t^*](x)}\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}}P_x^\perp\left(V_t y-b_t[\rho_t^*](x)\right)\delta\rho_t^*(y)\,dy. \tag*{(40)}

where we have used the fact that Zt[ρt∗](x)\mathcal{Z}_t[\rho_t^*](x) and eβ⟨Qtx,Kty⟩Rde^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}} and scalars for any fixed xx.

Using (S20), we can rewrite (S16) as

ddηJ(ρ∗+η δρ∗,Λ⋅)∣η=0=−∫0T∫Sd−1δρt∗(x)⟨Px⊥(bt[ρt∗](x)),∇Λt(x)⟩ dx dt\left.\frac{\mathrm{d}}{\mathrm{d}\eta}\mathcal{J}(\rho^*+\eta\,\delta\rho^*,\Lambda_\cdot)\right|_{\eta=0} = -\int_0^T\int_{\mathbb{S}^{d-1}}\delta\rho_t^*(x)\left\langle P_x^\perp\left(b_t[\rho_t^*](x)\right),\nabla\Lambda_t(x)\right\rangle\,dx\,dt
−∫0T∫Sd−1ρt∗(x)Zt[ρt∗](x)⟨∫Sd−1eβ⟨Qtx,Kty⟩RdPx⊥(Vty−bt[ρt∗](x))δρt∗(y) dy,∇Λt(x)⟩ dx dt.(41)\qquad-\int_0^T\int_{\mathbb{S}^{d-1}}\frac{\rho_t^*(x)}{\mathcal{Z}_t[\rho_t^*](x)} \left\langle\int_{\mathbb{S}^{d-1}}e^{\beta\langle Q_tx,K_ty\rangle_{\mathbb{R}^d}}P_x^\perp\left(V_t y-b_t[\rho_t^*](x)\right)\delta\rho_t^*(y)\,dy,\nabla\Lambda_t(x)\right\rangle\,dx\,dt. \tag*{(41)}

By exchanging the variables xx and yy in the second integral on the right-hand side of (S21), we obtain

ddηJ(ρ∗+η δρ∗,Λ⋅)∣η=0=−∫0T∫Sd−1{δρt∗(x)⟨Px⊥(bt[ρt∗](x)),∇Λt(x)⟩\left.\frac{\mathrm{d}}{\mathrm{d}\eta}\mathcal{J}(\rho^*+\eta\,\delta\rho^*,\Lambda_\cdot)\right|_{\eta=0} = -\int_0^T\int_{\mathbb{S}^{d-1}}\left\{\delta\rho_t^*(x)\left\langle P_x^\perp\left(b_t[\rho_t^*](x)\right),\nabla\Lambda_t(x)\right\rangle \right.
+∫Sd−1ρt∗(y)eβ⟨Qty,Ktx⟩RdZt[ρt∗](y)⟨Py⊥(Vtx−bt[ρt∗](y)),∇Λt(y)⟩ dy} dx dt.(42)\left. \qquad+\int_{\mathbb{S}^{d-1}}\frac{\rho_t^*(y)e^{\beta\langle Q_ty,K_tx\rangle_{\mathbb{R}^d}}}{\mathcal{Z}_t[\rho_t^*](y)} \left\langle P_y^\perp\left(V_t x-b_t[\rho_t^*](y)\right),\nabla\Lambda_t(y)\right\rangle\,dy\right\}\,dx\,dt. \tag*{(42)}

By substituting (S22) into (S13), we obtain

∫0T∫Sd−1{δρt∗(x)[∂tΛt(x)+σ2∥∇Λt(x)∥2+σ2ΔΛt(x)+⟨Px⊥(bt[ρt∗](x)),∇Λt(x)⟩+qt[ρt∗](x)]} dx dt=0.\int_0^T\int_{\mathbb{S}^{d-1}}\left\{\delta\rho_t^*(x)\left[\partial_t\Lambda_t(x)+\frac{\sigma}{2}\|\nabla\Lambda_t(x)\|^2+\frac{\sigma}{2}\Delta\Lambda_t(x) +\left\langle P_x^\perp\left(b_t[\rho_t^*](x)\right),\nabla\Lambda_t(x)\right\rangle+q_t[\rho_t^*](x)\right]\right\}\,dx\,dt=0.

Since ∫Sd−1δρt⋆(x)=0\int_{\mathbb{S}^{d-1}}\delta\rho_t^\star(x)=0, we deduce that the quantity in brackets must be spatially independent. That is,

∂tΛt(x)+σ2∥∇Λt(x)∥2+σ2ΔΛt(x)+⟨Px⊥(bt[ρt⋆](x)),∇Λt(x)⟩+qt[ρt⋆](x)=f(t)(43)\partial_t\Lambda_t(x)+\frac{\sigma}{2}\lVert\nabla\Lambda_t(x)\rVert^2+\frac{\sigma}{2}\Delta\Lambda_t(x)+\left\langle P_x^\perp\left(b_t[\rho_t^\star](x)\right),\nabla\Lambda_t(x)\right\rangle+q_t[\rho_t^\star](x)=f(t) \tag*{(43)}

where

qt[ρt⋆](x):=∫Sd−1ρt⋆(y)eβ⟨Qty,Ktx⟩RdZt[ρt⋆](y)⟨Py⊥(Vtx−bt[ρt⋆](y)),∇Λt(y)⟩ dy,(44)q_t[\rho_t^\star](x):=\int_{\mathbb{S}^{d-1}}\frac{\rho_t^\star(y)e^{\beta\langle Q_ty,K_tx\rangle_{\mathbb{R}^d}}}{Z_t[\rho_t^\star](y)}\left\langle P_y^\perp\left(V_tx-b_t[\rho_t^\star](y)\right),\nabla\Lambda_t(y)\right\rangle\,dy, \tag*{(44)}

for some f:[0,T]→Rdf:[0,T]\to\mathbb{R}^d.

Since ff depends only on time, we can absorb it into Λt\Lambda_t via the transformation

Λt+∫0tf(s) ds→Λt\Lambda_t+\int_0^t f(s)\,ds\to\Lambda_t

and write the first-order optimality in ρ⋆\rho^\star as the Hamilton–Jacobi–Bellman equation

∂tΛt(x)+σ2∥∇Λt(x)∥2+σ2ΔΛt(x)+⟨Px⊥(bt[ρt⋆](x)),∇Λt(x)⟩=−qt[ρt⋆](x).(45)\partial_t\Lambda_t(x)+\frac{\sigma}{2}\lVert\nabla\Lambda_t(x)\rVert^2+\frac{\sigma}{2}\Delta\Lambda_t(x)+\left\langle P_x^\perp\left(b_t[\rho_t^\star](x)\right),\nabla\Lambda_t(x)\right\rangle=-q_t[\rho_t^\star](x). \tag*{(45)}

Therefore, we can summarize the optimality conditions for Problem (11) as follows.

ut⋆(x)=σ∇Λt(x),(46)u_t^\star(x)=\sigma\nabla\Lambda_t(x), \tag*{(46)}
∂tρt⋆(x)+∇⋅(ρt⋆(Px⊥(bt[ρt⋆](x))+ut⋆(x)))=σ2Δρt⋆(x),(47)\partial_t\rho_t^\star(x)+\nabla\cdot\left(\rho_t^\star\left(P_x^\perp\left(b_t[\rho_t^\star](x)\right)+u_t^\star(x)\right)\right)=\frac{\sigma}{2}\Delta\rho_t^\star(x), \tag*{(47)}
∂tΛt(x)+σ2∥∇Λt(x)∥2+σ2ΔΛt(x)+⟨Px⊥(bt[ρt⋆](x)),∇Λt(x)⟩=−qt[ρt⋆](x),(48)\partial_t\Lambda_t(x)+\frac{\sigma}{2}\lVert\nabla\Lambda_t(x)\rVert^2+\frac{\sigma}{2}\Delta\Lambda_t(x)+\left\langle P_x^\perp\left(b_t[\rho_t^\star](x)\right),\nabla\Lambda_t(x)\right\rangle=-q_t[\rho_t^\star](x), \tag*{(48)}
ρ0⋆(x)=ρinitial(x),ρT⋆(x)=ρfinal(x),(49)\rho_0^\star(x)=\rho_{\mathrm{initial}}(x),\qquad\rho_T^\star(x)=\rho_{\mathrm{final}}(x), \tag*{(49)}

where qt[ρt⋆]q_t[\rho_t^\star] is as in (S24).

The forward-backward dynamics

Next, we introduce a change of variable

Λt(x)=log⁡φt(x),(50)\Lambda_t(x)=\log\varphi_t(x), \tag*{(50)}

where φt\varphi_t is a positive function for all t∈[0,T]t\in[0,T]. This transformation is known as the Cole–Hopf ([18, 33, 55]) or Fleming logarithmic transformation ([26]). By (S27), Eq. (S26a) can be written as

ut⋆(x)=σ∇log⁡φt(x),u_t^\star(x)=\sigma\nabla\log\varphi_t(x),

recovering (14).

By (S27), (S26c), and the identity

∥∇Λt(x)∥g2+ΔΛt(x)=Δφt(x)φt(x),\lVert\nabla\Lambda_t(x)\rVert_g^2+\Delta\Lambda_t(x)=\frac{\Delta\varphi_t(x)}{\varphi_t(x)},

we can obtain the dynamics of φt\varphi_t as in (16).

Introducing a second nonnegative function φ^t\widehat{\varphi}_t through the factorization

ρt⋆(x)=φt(x)φ^t(x),\rho_t^\star(x)=\varphi_t(x)\widehat{\varphi}_t(x),

as in (15), we deduce that φ^t\widehat{\varphi}_t satisfies (17). Lastly, by (15), we can obtain (18) and (19).

Combining the preceding optimality conditions and the defined transformations yields the Schrödinger system stated in the theorem.

Additional S1\mathrm{S}^{1} Experiment

We report an additional mean-field token-steering experiment over S1\mathrm{S}^{1} that supplements our results in § 4.1. Here, we focus on comparing the uncontrolled versus optimally controlled evolution of the token distribution in the mean-field (i.e., number of tokens N→∞N \to\infty) limit.

Inspired by the experiment reported in Bruno et al. [8], we set ρinitial\rho_{\mathrm{initial}} to be uniform on S1\mathrm{S}^{1} slightly perturbed by white noise. It is known that for this ρinitial\rho_{\mathrm{initial}}, the uncontrolled mean-field dynamics for certain choice of parameters gives rise to a 3 mode meta-stable clustering. To investigate the possibility of countering this trend via control, we set ρfinal\rho_{\mathrm{final}} as an equal-weight mixture of two von Mises-Fisher densities on S1\mathrm{S}^{1}, given by

ρfinal∝∑i=12wieκT⟨μi,x⟩,\rho_{\mathrm{final}} \propto\sum_{i=1}^{2} w_i e^{\kappa_T \langle\mu_i,x\rangle},

with w1=w2=0.5w_1=w_2=0.5, κT=25\kappa_T=25, μi=(cos⁡θi,sin⁡θi)T\mu_i=(\cos\theta_i,\sin\theta_i)^{\mathsf{T}} for i∈{1,2}i\in\{1,2\}, θ1:=1.6072\theta_1:=1.6072 rad, and θ2:=θ1+π\theta_2:=\theta_1+\pi. In Figure S1, this ρfinal\rho_{\mathrm{final}} is shown as “target”. We use the parameters: σ=0.2\sigma=0.2, T=1T=1, β=5\beta=5, Qt=Kt≡I2Q_t=K_t\equiv I_2 (here d=2d=2), and randomly generated

Mean-field Token Steering: evolution of uncontrolled versus optimally controlled token distribution at $t=0.00$, $t=0.33$, $t=0.67$, and $t=1.00$; legend: Uncontrolled, Controlled $\rho_t^\star$, Target

Figure S1. Evolution of uncontrolled versus optimally controlled token distribution for the S1\mathrm{S}^{1} experiment in Supplementary Section B.

Vt≡[0.03050.11230.11710.0885]∀t∈[0,T].V_t \equiv\begin{bmatrix} 0.0305 & 0.1123 \\ 0.1171 & 0.0885 \end{bmatrix} \quad\forall t\in[0,T].

We follow the space-time discretization as in Bruno et al. [8], and in Figure S1, compare the uncontrolled (i.e., with prior mean-field token dynamics) versus controlled (i.e., with corrected mean-field token dynamics) evolution of the token densities over t∈[0,1]t\in[0,1]. The controlled evolution is computed using Algorithm 1 proposed here with the same algorithm parameters as in § 4.1. Figure S1 shows that the optimal control accomplishes the uniform to target bimodal token steering, overcoming the natural tendency of forming 3 modes over the same horizon.

References

  1. [1]Abella, Á. R., Silvestre, J. P., and Tabuada, P. (2025). Consensus is all you get: The role of attention in transformers. In Forty-second International Conference on Machine Learning.
  2. [2]Adila, D., Cooper, J., Yun, A., Trost, A., and Sala, F. (2026). Weight updates as activation shifts: A principled framework for steering. In Zhang, T., Dudik, M., Jaggi, M., Agarwal, A., Li, S., Schuurmans, D., Zhu, J., Berkenkamp, F., Dong, H., and Bietti, A., editors, Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research, pages 565–590. PMLR.arxiv.org/abs/2603.00425
  3. [3]Agazzi, A., Bruno, G., García, E. M., Saviōzzi, S., and Romito, M. (2026). Stochastic scaling limits and synchronization by noise in deep transformer models. arXiv preprint arXiv:2604.26898.arxiv.org/abs/2604.26898
  4. [4]Albergo, M., Boffi, N. M., and Vanden-Eijnden, E. (2025). Stochastic interpolants: A unifying frame- work for flows and diffusions. Journal of Machine Learning Research, 26(209):1–80.
  5. [5]Backhoff, J., Conforti, G., Gentil, I., and Léonard, C. (2020). The mean field Schrödinger problem: ergodic behavior, entropy estimates and functional inequalities. Probability Theory and Related Fields, 178(1):475–530.
  6. [6]Bahdanau, D., Cho, K., and Bengio, Y. (2014). Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473.arxiv.org/abs/1409.0473
  7. [7]Bolley, F., Cañizo, J. A., and Carrillo, J. A. (2011). Stochastic mean-field limit: Non-Lipschitz forces and swarming. Mathematical Models and Methods in Applied Sciences, 21(11):2179–2210.arxiv.org/abs/1009.5166
  8. [8]Bruno, G., Pasqualotto, F., and Agazzi, A. (2025). Emergence of meta-stable clustering in mean-field transformer models. In The Thirteenth International Conference on Learning Representations.arxiv.org/abs/2410.23228
  9. [9]Bruno, G., Pasqualotto, F., and Agazzi, A. (2026). A multiscale analysis of mean-field transformers in the moderate interaction regime. Advances in Neural Information Processing Systems, 38:133305–133341.arxiv.org/abs/2509.25040
  10. [10]Burger, M., Kabri, S., Korolev, K., Roith, T., and Weigand, L. (2025). Analysis of mean-field models arising from self-attention dynamics in transformer architectures with layer normalization. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 383(2298):20240333.arxiv.org/abs/2501.03096
  11. [11]Bushell, P. J. (1973). Hilbert’s metric and positive contraction mappings in a Banach space. Archive for Rational Mechanics and Analysis, 52(4):330–338.DOI
  12. [12]Caluya, K. F. and Halder, A. (2021). Wasserstein proximal algorithms for the Schrödinger bridge problem: Density control with nonlinear drift. IEEE Transactions on Automatic Control, 67(3):1163–1178.arxiv.org/abs/1912.01244
  13. [13]Chaintron, L.-P. and Diez, A. (2022). Propagation of chaos: A review of models, methods and applications. II. applications. Kinetic and Related Models, 15(6):1017–1173.
  14. [14]Chen, R. T. Q., Rubanova, Y., Bettencourt, J., and Duvenaud, D. K. (2018). Neural ordinary differential equations. In Advances in Neural Information Processing Systems, volume 31.arxiv.org/abs/1806.07366
  15. [15]Chen, Y., Georgiou, T. T., and Pavon, M. (2021). Stochastic control laisons: Richard Sinkhorn meets Gaspard Monge on a Schrödinger bridge. Siam Review, 63(2):249–313.DOI
  16. [16]Chetrite, R., Muratore-Ginanneschi, P., and Schwieger, K. (2021). E. Schrödinger’s 1931 paper “On the Reversal of the Laws of Nature” [“Über die Umkehrung der Naturgesetze”, Sitzungsberichte der preussischen Akademie der Wissenschaften, physikalisch-mathematische Klasse, 8 N9 144–153]. The European Physical Journal H, 46:28.
  17. [17]Chizat, L. and Bach, F. (2018). On the global convergence of gradient descent for over-parameterized models using optimal transport. Advances in neural information processing systems, 31.arxiv.org/abs/1805.09545
  18. [18]Cole, J. D. (1951). On a quasi-linear parabolic equation occurring in aerodynamics. Quarterly of Applied Mathematics, 9(3):225–236.DOI
  19. [20]De Bortoli, V., Thornton, J., Heng, J., and Doucet, A. (2021). Diffusion Schrödinger bridge with applications to score-based generative modeling. Advances in neural information processing systems, 34:17695–17709.
  20. [21]Dong, Y., Cordonnier, J.-B., and Loukas, A. (2021). Attention is not all you need: Pure attention loses rank doubly exponentially with depth. In International conference on machine learning, pages 2793–2803. PMLR.arxiv.org/abs/2103.03404
  21. [22]Dutta, S., Gautam, T., Chakrabarti, S., and Chakraborty, T. (2021). Redesigning the transformer architecture with insights from multi-particle dynamical systems. Advances in Neural Information Processing Systems, 34:5531–5544.arxiv.org/abs/2109.15142
  22. [23]Eldesoukey, A., Chen, Y., and Halder, A. (2026a). A generalized Sinkhorn algorithm for mean-field Schrödinger bridge. IEEE Control Systems Letters.
  23. [25]Fedorov, L., Sander, M. E., Elie, R., Marion, P., and Lauriere, M. (2026). Clustering in deep stochastic transformers. In Forty-third International Conference on Machine Learning.arxiv.org/abs/2601.21942
  24. [26]Fleming, W. H. (2005). Logarithmic transformations and stochastic control. In Advances in Filtering and Optimal Stochastic Control, pages 131–141. Springer.
  25. [27]Georgiou, T. T. and Pavon, M. (2015). Positive contraction mappings for classical and quantum Schrödinger systems. Journal of Mathematical Physics, 56,3(3).
  26. [29]Geshkovski, B., Letrouit, C., Polyanskiy, Y., and Rigollet, P. (2023). The emergence of clusters in self-attention dynamics. Advances in Neural Information Processing Systems, 36:57026–57037.DOI
  27. [30]Geshkovski, B., Letrouit, C., Polyanskiy, Y., and Rigollet, P. (2025). A mathematical perspective on transformers. Bulletin of the American Mathematical Society, 62(3):427–479.arxiv.org/abs/2312.10794
  28. [32]Hairer, E., Lubich, C., and Wanner, G. (2006). Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations, volume 31 of Springer Series in Computational Mathematics. Springer, Berlin, Heidelberg, 2nd edition.
  29. [33]Hopf, E. (1950). The partial differential equation $u_t + u u_x = \mu u_{xx}$. Communications on Pure and Applied Mathematics, 3(3):201–230.
  30. [34]Imaizumi, M., Koyama, M., Isobe, N., and Hayashi, K. (2026). Anti mode-collapse in mean-field transformer via auxiliary variables. arXiv preprint arXiv:2605.30229.arxiv.org/abs/2605.30229
  31. [35]Isobe, N., Inoue, D., and Imaizumi, M. (2026). Training-induced escape from token clustering in a mean-field formulation of transformers. arXiv preprint arXiv:2605.07772.arxiv.org/abs/2605.07772
  32. [36]Jain, N., Chiang, P.-y., Wen, Y., Kirchenbauer, J., Chu, H.-M., Somepalli, G., Bartoldson, B., Kailkhura, B., Schwarzschild, A., Saha, A., Goldblum, M., Geiping, J., and Goldstein, T. (2024). Neftune: Noisy embeddings improve instruction finetuning. In Kim, B., Yue, Y., Chaudhuri, S., Fragkiadaki, K., Khan, M., and Sun, Y., editors, International Conference on Learning Representations, volume 2024, pages 17566–17591.arxiv.org/abs/2310.05914
  33. [37]Kan, K., Li, X., Zhang, B., Sahai, T., Osher, S., and Katsoulakis, M. (2026). Optimal control for transformer architectures: Enhancing generalization, robustness and efficiency. Advances in Neural Information Processing Systems, 38:648183–64228.arxiv.org/abs/2505.13499
  34. [38]Lee, B. W., Padhi, I., Natesan Ramamurthy, K., Miehling, E., Dognin, P., Nagireddy, M., and Dhurandhar, A. (2025). Programming refusal with conditional activation steering. In Yue, Y., Garg, A., Peng, N., Sha, F., and Yu, R., editors, International Conference on Learning Representations, volume 2025, pages 90960–90985.arxiv.org/abs/2409.05907
  35. [39]Lee, J. M. (2012). Introduction to Smooth Manifolds, volume 218 of Graduate Texts in Mathematics. Springer New York, 2 edition.
  36. [40]Lee, J. M. (2018). Introduction to Riemannian Manifolds, volume 176 of Graduate Texts in Mathematics. Springer International Publishing. Cham, Switzerland, 2nd edition.DOI
  37. [41]Léonard, C. (2014). A survey of the schrödinger problem and some of its connections with optimal transport. Discrete and Continuous Dynamical Systems, 34(4):1533–1574.DOI
  38. [44]Luong, M.-T., Pham, H., and Manning, C. D. (2015). Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 conference on empirical methods in natural language processing, pages 1412–1421.arxiv.org/abs/1508.04025
  39. [45]Markdahl, J., Thunberg, J., and Gonçalves, J. (2017). Almost global consensus on the n-sphere. IEEE Transactions on Automatic Control, 63(6):1664–1675.arxiv.org/abs/1609.04885
  40. [46]McKean Jr, H. P. (1966). A class of Markov processes associated with nonlinear parabolic equations. Proceedings of the National Academy of Sciences, 56(6):1907–1911.pubmed.ncbi.nlm.nih.gov/16591437
  41. [47]Mei, S., Montanari, A., and Nguyen, P.-M. (2018). A mean field view of the landscape of two-layer neural networks. Proceedings of the National Academy of Sciences, 115(33):E7665–E7671.DOI
  42. [48]Pascucci, A., Rondelli, A., and Veretennikov, A. Y. (2026). Existence and uniqueness results for strongly degenerate McKean–Vlasov equations with rough coefficients. Stochastic Processes and their Applications, 199:104978.arxiv.org/abs/2409.14451
  43. [49]Rigollet, P. (2026). The Mean-Field Dynamics of Transformers, pages 389–404.
  44. [50]Sander, M. E., Ablin, P., Blondel, M., and Peyré, G. (2022). Sinkformers: Transformers with doubly stochastic attention. In Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151 of Proceedings of Machine Learning Research, pages 3515–3530. PMLR.arxiv.org/abs/2110.11773
  45. [51]Shalova, A. and Schlichting, A. (2026). Solutions of stationary Mckean–Vlasov equation on a high-dimensional sphere and other Riemannian manifolds. Advances in Nonlinear Analysis, 15(1):20250141.arxiv.org/abs/2412.14813
  46. [52]Shi, Y., De Bortoli, V., Campbell, A., and Doucet, A. (2023). Diffusion Schrödinger bridge matching. Advances in neural information processing systems, 36:62183–62223.arxiv.org/abs/2303.16852
  47. [53]Skifstad, J., Yang, X. A., and Chou, G. (2026). Local linearity of LLMs enables activation steering via model-based linear optimal control. In Zhang, T., Dudik, M., Jaggi, M., Agarwal, A., Li, S., Schuurmans, D., Zhu, J., Berkenkamp, F., Dong, H., and Bietti, A., editors, Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research, pages 113885–113919. PMLR.arxiv.org/abs/2604.19018
  48. [54]Sznitman, A.-S. (2006). Topics in propagation of chaos. In Ecole d’été de probabilités de Saint-Flour XIX—1989, pages 165–251. Springer.
  49. [55]Teter, A. and Halder, A. (2025). On the Hopf–Cole transform for control-affine Schrödinger bridges. arXiv preprint arXiv:2503.17640.
  50. [56]Tzen, B. and Raginsky, M. (2019). Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit. arXiv preprint arXiv:1905.09883.arxiv.org/abs/1905.09883
  51. [57]Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems, volume 30.arxiv.org/abs/1706.03762
  52. [58]Zhai, S., Likhomanenko, T., Littwin, E., Busbridge, D., Ramapuram, J., Zhang, Y., Gu, J., and Susskind, J. M. (2023). Stabilizing transformer training by preventing attention entropy collapse. In International conference on machine learning, pages 40770–40803. PMLR.arxiv.org/abs/2303.06296
  53. [59]Zhang, C., Jingpu, C., Xu, Y., and Li, Q. (2024). Parameter-efficient fine-tuning with controls. In Forty-first International Conference on Machine Learning.
  54. [60]Zhang, Z., Wang, Z., Sun, Y., Li, T., and Zhou, P. (2026). Modeling cell dynamics and interactions with unbalanced mean field Schrödinger bridge. Advances in Neural Information Processing Systems, 38:139518–139558.arxiv.org/abs/2505.11197

Paper details

vlnc:W_hbbyxqe6
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

generative AI

View statement
Looking for related papers…
Contents