betaFeedback

WorksMathematics

Two Adjoint Perspectives on Fokker-Planck Optimization: A Microscopic-Macroscopic Correspondence

Abstract

The Fokker-Planck equation admits both a macroscopic Eulerian description through probability densities and a microscopic Lagrangian description through stochastic trajectories. Consequently, optimization problems constrained by the Fokker-Planck equation can be formulated from either perspective. Surprisingly, the corresponding adjoint equations appear to be fundamentally different: the macroscopic adjoint is governed by the backward Kolmogorov equation, whereas the microscopic adjoint evolves pathwise along stochastic trajectories. In this note, we reconcile these two formulations by establishing their correspondence in the continuum setting. We further show that, although their discrete gradients no longer coincide after discretization, both provide consistent numerical approximations of the continuum gradient. Explicit convergence rates are established for both discretization strategies.

Introduction

The Fokker–Planck equation is one of the most fundamental evolution equations describing the transport of probability distributions under drift and diffusion. Its adjoint equation plays a central role in inverse problems, stochastic optimal control, mean-field games, and PDE-constrained optimization. For the PDE-constrained optimization problem

min⁡aJ(ρT),\min_{a} \mathcal{J}(\rho_T),

with ρ\rho satisfying the prototype equation

∂tρt+∇⋅(a(x)ρt)=Δρt,(1)\partial_t \rho_t + \nabla\cdot(a(x)\rho_t) = \Delta\rho_t, \tag*{(1)}

on x∈Rdx \in\mathbb{R}^d, t∈(0,T]t \in(0,T], the associated adjoint is the backward Kolmogorov equation

∂tμt+a(x)⋅∇μt+Δμt=0,with μT=δJδρT,(2)\partial_t \mu_t + a(x) \cdot\nabla\mu_t + \Delta\mu_t = 0, \qquad\text{with } \mu_T = \frac{\delta\mathcal{J}}{\delta\rho_T}, \tag*{(2)}

and the gradient with respect to the control variable is assembled through the forward and adjoint variables as

G[a](x)=δJδa(x)=∫0Tρ(t,x)∇μ(t,x) dt.(3)\mathcal{G}[a](x) = \frac{\delta\mathcal{J}}{\delta a}(x) = \int_0^T \rho(t,x)\nabla\mu(t,x)\,\mathrm{d}t. \tag*{(3)}

This gradient term is then deployed in an optimization iteration. The main object examined in this paper is this gradient term at any fixed aa, and throughout the paper, we drop aa dependence. When no ambiguity arises, we use shorthand notation ρt\rho_t and μt\mu_t to denote ρ(t,⋅)\rho(t,\cdot) and μ(t,⋅)\mu(t,\cdot).

To numerically compute this gradient, one needs to examine the effects of discretization. We focus on particle-type discretization of the forward equation in sense of Monte Carlo approximation, and study how they affect the computation of (3).

More specifically, we adopt the Lagrangian formulation and simulate the Fokker–Planck equation’s solution by particles/samples that evolve forward in time according to a stochastic differential equation (SDE),

ρt≈ρtN=1N∑i=1NδXi,t,dXi,t=a(Xi,t) dt+2 dWi,t.(4)\rho_t \approx\rho_t^N = \frac{1}{N}\sum_{i=1}^{N}\delta_{X_{i,t}}, \qquad dX_{i,t} = a(X_{i,t})\,\mathrm{d}t + \sqrt{2}\,\mathrm{d}W_{i,t}. \tag*{(4)}

The empirical measure ρtN\rho_t^N converges to the solution of (1), both in the weak and the Wasserstein sense. If one differentiates the particle formulation (4) directly, a straightforward sensitivity analysis shows that the corresponding particle adjoint satisfies the pathwise ordinary differential equation (ODE)

dYi,t=−∇a(Xi,t)TYi,t dt,withYi,T=∇δJδρT(ρTN)(Xi,T).(5)dY_{i,t} = -\nabla a(X_{i,t})^{\mathsf{T}}Y_{i,t}\,\mathrm{d}t,\qquad\text{with}\quad Y_{i,T} = \nabla\frac{\delta\mathcal{J}}{\delta\rho_T}(\rho_T^N)(X_{i,T}). \tag*{(5)}

Surprisingly, this microscopic adjoint bears little resemblance to the backward Kolmogorov equation (2). While (2) is a deterministic backward parabolic PDE, (5) is a pathwise ODE evolving along stochastic trajectories. At first sight, it is not even clear why the two formulations should be connected to the same gradient.

This mismatch is reminiscent of the classical distinction between optimize-then-discretize (OTD) and discretize-then-optimize (DTO). The particle representation can be considered a discretization and the adjoint (5) arises from differentiating these discretized dynamics, whereas the Kolmogorov adjoint (2) is obtained by first deriving the optimality system at the continuum level, before discretization. The two procedures do not commute, leading to two distinct numerical representations of the continuum gradient (3).

This is the central question of the paper:

How can the microscopic and macroscopic adjoint formulations be reconciled?

The goal of this note is to clarify this apparent discrepancy. We show that the two formulations represent two complementary differentiation paradigms for the same optimization problem: an Eulerian (PDE-based) perspective and a Lagrangian (particle-based) perspective.

We first remain at the continuum level and introduce the stochastic representation of the Fokker–Planck equation. Instead of viewing the state variable solely as a probability density, we represent it by the stochastic process

dXt=a(Xt) dt+2 dWt,Law⁡(Xt)=ρt.(6)dX_t = a(X_t)\,\mathrm{d}t + \sqrt{2}\,\mathrm{d}W_t,\qquad\operatorname{Law}(X_t) = \rho_t. \tag*{(6)}

Associated with each sample path is the pathwise adjoint variable

dYt=−∇a(Xt)TYt dt,withYT=∇δJδρT(ρT)(XT).(7)dY_t = -\nabla a(X_t)^{\mathsf{T}}Y_t\,\mathrm{d}t,\qquad\text{with}\quad Y_T = \nabla\frac{\delta\mathcal{J}}{\delta\rho_T}(\rho_T)(X_T). \tag*{(7)}

where ∇a(x)∈Rd×d\nabla a(x) \in\mathbb{R}^{d\times d} denotes the Jacobian matrix of a:Rd→Rda : \mathbb{R}^d \to\mathbb{R}^d.

The main results of this paper are threefold.

  • Continuum correspondence. We first show that the continuum gradient admits two equivalent representations,

G(x)=∫0T∇μt(x)ρt(x) dt⏟Eulerian=E[∫0TYtδXt dt⏟Lagrangian].G(x) = \underbrace{\int_0^T \nabla\mu_t(x)\rho_t(x)\,\mathrm{d}t}_{\mathrm{Eulerian}} = \mathbb{E}\left[\underbrace{\int_0^T Y_t\delta_{X_t}\,\mathrm{d}t}_{\mathrm{Lagrangian}}\right].

The key connection between the two formulations is the conditional expectation identity

E(Yt∣Xt=x)=∇μ(t,x),ρt-a.e.(8)\mathbb{E}(Y_t \mid X_t = x) = \nabla\mu(t,x),\qquad\rho_t\text{-a.e.} \tag*{(8)}

which explains why both adjoint formulations produce the same first-order variation. This correspondence is established in Section 2.

  • Eulerian discretization. Discretizing the macroscopic formulation yields the numerical gradient

GNE(x)=∫0TρN(t,x)∇μN(t,x) dt,\mathcal{G}^{\mathrm{E}}_{N}(x)=\int_{0}^{T}\rho^{N}(t,x)\nabla\mu^{N}(t,x)\,\mathrm{d}t,

where ρN\rho^{N} is a numerical approximation of ρ\rho, and μN\mu^{N} solves the adjoint equation (2) with terminal condition determined by ρN(T)\rho^{N}(T). Under suitable assumptions we prove that for a suitable distance function dist⁡(⋅,⋅)\operatorname{dist}(\cdot,\cdot), one has

dist⁡(GNE,G)=O(W1(ρN,ρ)).\operatorname{dist}(\mathcal{G}^{\mathrm{E}}_{N},\mathcal{G})=\mathcal{O}\left(W_{1}(\rho^{N},\rho)\right).

When ρN\rho^{N} is generated by the particle approximation (4), this further gives the Monte Carlo sampling rate from [16]

α(N):={N−1/2,d=1,N−1/2log⁡(1+N),d=2,N−1/d,d>2,(9)\alpha(N):= \begin{cases} N^{-1/2}, & d=1,\\ N^{-1/2}\log(1+N), & d=2,\\ N^{-1/d}, & d>2, \end{cases} \tag*{(9)}

and thus

dist⁡(GNE,G)=O(α(N)).\operatorname{dist}(\mathcal{G}^{\mathrm{E}}_{N},\mathcal{G})=\mathcal{O}(\alpha(N)).

We present the precise topology and assumptions in Section 3.

  • Lagrangian discretization. Alternatively, one may discretize the stochastic representation directly by replacing the expectation in the Lagrangian formulation with finitely many sample paths (4)-(5). This leads to an intuitive approximation:

GNL=1N∑i=1N∫0TYi,t δXi,t dt.\mathcal{G}^{\mathrm{L}}_{N}=\frac{1}{N}\sum_{i=1}^{N}\int_{0}^{T}Y_{i,t}\,\delta_{X_{i,t}}\,\mathrm{d}t.

We will establish

dist⁡(GNL,G)=O(α(N)).\operatorname{dist}(\mathcal{G}^{\mathrm{L}}_{N},\mathcal{G})=\mathcal{O}(\alpha(N)).

with the precise notion of convergence presented in Section 4.

It is worth emphasizing that the two numerical approximations are fundamentally different objects. The Eulerian approximation GNE\mathcal{G}^{\mathrm{E}}_{N} is obtained by solving a discretized adjoint PDE and therefore remains a Eulerian quantity throughout. In contrast, the Lagrangian approximation GNL\mathcal{G}^{\mathrm{L}}_{N} is defined directly on stochastic trajectories and never invokes the adjoint PDE. Consequently, the continuum identity (10) no longer survives discretization. Indeed, the naive discrete counterpart is false:

\nabla\mu^{N}(t,x)\ne\frac{1}{N}\sum_{i=1}^{N}Y_{i,t}\,\middle|\,X_{i,t}=x\quad\rho_{t}\text{-a.s.}

The OTD and DTO procedures therefore produce genuinely different finite-dimensional adjoints, even though both converge to the same continuum gradient.

In the subsequent sections, we discuss continuum correspondence, followed by the Eulerian and Lagrangian discretizations. Some a-priori estimates are repeatedly used throughout the error analysis, and we summarize them in Appendix Section A.

Relation to existing work. The Fokker–Planck equation is one of the most fundamental PDE models and has been widely studied. The gradient (3) of an observable J(ρT)\mathcal{J}(\rho_{T}) appears in a variety of contexts. It’s Eulerian form (3) appeared early in statistical mechanics, where the celebrated fluctuation-dissipation theorem relates the linear response of an equilibrium system to a small perturbation to temporal correlation functions of the unperturbed system [22, 1, 33], with applications, e.g., in parameter inference in molecular dynamics [15], climate response [25, 17] and active matter [7]. Related optimization formulations are also widely used, especially in the context of optimal control of probability laws, where backward Kolmogorov or Pontryagin-type adjoint are prominent concepts [2, 34, 6]. For deterministic continuity equations, equivalence among Lagrangian, Eulerian, and Kantorovich formulations, as well as their particle-to-continuum convergence, have also been established [9]. Our focus is different: rather than comparing optimal controls, we compare two numerical representations of the reduced gradient at a fixed control.

From the viewpoint of stochastic processes, several distinct objects are commonly referred to as adjoints. Classical stochastic-flow and semigroup-sensitivity formulas represent derivatives of backward Kolmogorov solutions in terms of the Jacobian of the stochastic flow [23, 14]. Numerically, the Feynman–Kac formula has been deployed [37] as the pathwise representation of backward Kolmogorov. In stochastic optimal control, the adapted adjoint is instead described by a backward stochastic differential equation, whose martingale term enforces adaptedness [32]. By contrast, reverse-mode or pathwise differentiation of a realized SDE trajectory produces a random backward ODE such as Equation (7) below, computed with the Brownian path held fixed [27, 20, 24]. Because its terminal value contains future information, this pathwise adjoint is generally not adapted. Its conditional projection onto the present state is the Markovian adjoint, which is precisely the mechanism expressed by (10) in Section 2.

This conditional-projection viewpoint has recently appeared in the literature on adjoint matching for stochastic optimal control. Domingo-Enrich et al. introduced a backward “lean adjoint” ODE along simulated trajectories and incorporated it into a regression-based stochastic-control method [12]. Domingo-Enrich and Han subsequently related this pathwise ODE to the adapted adjoint BSDE arising from the stochastic maximum principle and established equality after conditioning on the current state [13]. In the additive-noise, terminal-cost setting considered here, their lean adjoint specializes to (7), and the corresponding conditional relation specializes to (10). The emphasis of the present work is instead on identifying the PDE gradient with an adjoint-weighted measure and on comparing the two finite-particle approximations resulting from the Eulerian and Lagrangian constructions.

At the numerical level, the issue is closely connected to the classical optimize–then–discretize (OTD) versus discretize–then–optimize distinction (DTO). For Monte Carlo PDE solvers, the numerical state and adjoint may both be empirical measures, so a formal product of independently sampled forward and adjoint approximations is not defined. In radiative-transfer and kinetic settings, this obstruction has motivated both DTO particle adjoints and correlated OTD estimators that reuse the forward samples and interpret the adjoint as a test function [26, 8, 11]. One practical DTO strategy is to record the random number generator state [29]. Related work on SDE-constrained calibration likewise contrasts law-level Fokker–Planck formulations with direct trajectory-wise Monte Carlo differentiation [4]. The present analysis isolates this distinction for a diffusion process and quantifies how the two finite-dimensional adjoints, although different for fixed NN, approximate the same continuum gradient.

Continuum Correspondence

Before introducing any numerical discretization, we first compare the Eulerian and Lagrangian formulations at the continuum level. The Eulerian description is expressed in terms of the forward Fokker–Planck equation and its backward Kolmogorov adjoint, whereas the Lagrangian description follows the underlying stochastic trajectories together with their pathwise adjoints. The main result of this section shows that these two apparently different constructions yield the same continuum gradient. In particular, we establish the conditional-expectation identity that connects the pathwise adjoint to the spatial gradient of the Kolmogorov adjoint and thereby reconciles the two formulations.

Since the well-posedness of the forward and adjoint problems already requires certain regularity, we summarize our assumptions on aa, ρ0\rho_0 and J\mathcal{J}. More details are in Sections A.1 and A.2.

Assumption 1. We impose the following regularity assumptions on the velocity field aa, the initial data ρ0\rho_0 and the objective function J\mathcal{J}: Let θ∈(0,1)\theta\in(0,1) be a Hölder exponent such that

(A1)a∈Cb1,θ(Rd;Rd), and\text{(A1)}\quad a \in C_b^{1,\theta}(\mathbb{R}^d;\mathbb{R}^d),\text{ and}
(A2)ρ0∈Pq(Rd) is a probability measure over Rd with finite q-th moment, for q=2 when d>2 and q>2 otherwise.\text{(A2)}\quad\rho_0 \in\mathcal{P}_q(\mathbb{R}^d)\text{ is a probability measure over }\mathbb{R}^d\text{ with finite }q\text{-th moment, for }q=2\text{ when }d>2\text{ and }q>2\text{ otherwise.}
(A3E)There exists a polynomial p>0 such that the first variation δJδρ and its derivatives are polynomially bounded and Lipschitz, in the sense that there exists a constant CJ such\text{(A3}^{\mathcal{E}}\text{)}\quad\text{There exists a polynomial }p>0\text{ such that the first variation }\frac{\delta\mathcal{J}}{\delta\rho}\text{ and its derivatives are polynomially bounded and Lipschitz, in the sense that there exists a constant }C_{\mathcal{J}}\text{ such}

that for all measures ν,ν′∈Pq(Rd)\nu,\nu' \in\mathcal{P}_q(\mathbb{R}^d)

δJδρ∣ν∈Cp2,θand∥δJδρ∣ν−δJδρ∣ν′∥Cp2,θ≤CJW1(ν,ν′).\left.\frac{\delta J}{\delta\rho}\right|_{\nu} \in C_{\mathbf{p}}^{2,\theta} \quad\text{and}\quad \left\|\left.\frac{\delta J}{\delta\rho}\right|_{\nu}-\left.\frac{\delta J}{\delta\rho}\right|_{\nu'}\right\|_{C_{\mathbf{p}}^{2,\theta}} \leq C_J W_1(\nu,\nu').

References

  1. [1]G. S. Agarwal. Fluctuation-dissipation theorems for systems in non-thermal equilibrium and applications. Zeitschrift für Physik A Hadrons and nuclei, 252(1):25–38, 1972.DOI
  2. [2]M. Annunziato and A. Borzì. A Fokker–Planck control framework for stochastic systems. EMS Surveys in Mathematical Sciences, 5(1–2):65–98, 2018.DOI
  3. [3]J. T. Barron. A general and adaptive robust loss function. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4326–4334. IEEE, 2019.arxiv.org/abs/1701.03077
  4. [4]J. Bartsch, R. Denk, and S. Volkwein. Adjoint-based calibration of nonlinear stochastic differential equations. Applied Mathematics & Optimization, 90:50, 2024. Article 50.DOI
  5. [5]V. I. Bogachev, N. V. Krylov, M. Röckner, and S. V. Shaposhnikov. Fokker–Planck–Kolmogorov Equations, volume 207. American Mathematical Society, 2022.
  6. [6]T. Breitenbach and A. Borzì. The Pontryagin maximum principle for solving Fokker–Planck optimal control problems. Computational Optimization and Applications, 76(2):499–533, 2020.DOI
  7. [7]E. W. Burkholder and J. F. Brady. Fluctuation-dissipation in active matter. The Journal of chemical physics, 150(18), 2019.DOI
  8. [8]R. Caflisch and Y. Yang. Adjoint monte carlo method. In J. A. Carrillo and E. Tadmor, editors, Active Particles, Volume 4: Theory, Models, Applications, Modeling and Simulation in Science, Engineering and Technology, pages 461–505. Springer Nature Switzerland, Cham, 2024.arxiv.org/abs/2401.08361
  9. [9]G. Cavagnari, S. Lisini, C. Orrieri, and G. Savaré. Lagrangian, eulerian and Kantorovich formulations of multi-agent optimal control problems: Equivalence and Γ-convergence. Journal of Differential Equations, 322:268–364, 2022.
  10. [10]P. Charbonnier, L. Blanc-Féraud, G. Aubert, and M. Barlaud. Deterministic edge-preserving regularization in computed imaging. IEEE Transactions on image processing, 6(2):298–311, 1997.pubmed.ncbi.nlm.nih.gov/18282924
  11. [11]P. Chen, Q. Li, L. Wang, and Y. Yang. Inference of interacting kernel in the mean-field regime, 2026.arxiv.org/abs/2603.14211
  12. [12]C. Domingo-Enrich, M. Drozdzal, B. Karrer, and R. T. Q. Chen. Adjoint matching: Fine-tuning flow and diffusion generative models with memoryless stochastic optimal control. In The Thirteenth International Conference on Learning Representations, 2025.arxiv.org/abs/2409.08861
  13. [13]C. Domingo-Enrich and J. Han. Adjoint matching through the lens of the stochastic maximum principle in optimal control, 2026.arxiv.org/abs/2604.08580
  14. [14]K. D. Elworthy and X.-M. Li. Formulae for the derivatives of heat semigroups. Journal of Functional Analysis, 125(1):252–286, 1994.DOI
  15. [15]L. Ercole, A. Marcolongo, and S. Baroni. Accurate thermal conductivities from optimally short molecular dynamics simulations. Scientific reports, 7(1):15835, 2017.DOI
  16. [16]N. Fournier and A. Guillin. On the rate of convergence in wasserstein distance of the empirical measure. Probability theory and related fields, 162(3):707–738, 2015.arxiv.org/abs/1312.2128
  17. [17]L. T. Giorgini, F. Falasca, and A. N. Souza. Predicting forced responses of probability distributions via the fluctuation-dissipation theorem and generative modeling. Proceedings of the National Academy of Sciences, 122(41):e2509578122, 2025.
  18. [18]I. Karatzas and S. E. Shreve. Methods of mathematical finance, volume 39. Springer, 1998.
  19. [19]J. Kawakami and S. Hashimoto. Approximate gibbs sampler for bayesian huberized lasso. Journal of Statistical Computation and Simulation, 93(1):128–162, 2023.arxiv.org/abs/2204.00237
  20. [20]P. Kidger, J. Foster, X. Li, and T. Lyons. Efficient and accurate gradients for neural SDEs. In Advances in Neural Information Processing Systems, volume 34, pages 18747–18761. Curran Associates, Inc., 2021.arxiv.org/abs/2105.13493
  21. [21]P. E. Kloeden and E. Platen. Stochastic differential equations. In Numerical solution of stochastic differential equations, pages 103–160. Springer Berlin Heidelberg Berlin, Heidelberg, 1992.
  22. [22]R. Kubo. Statistical-mechanical theory of irreversible processes. I. general theory and simple applications to magnetic and conduction problems. Journal of the physical society of Japan, 12(6):570–586, 1957.
  23. [23]H. Kunita. Stochastic Flows and Stochastic Differential Equations, volume 24 of Cambridge Studies in Advanced Mathematics. Cambridge University Press, Cambridge, 1990.
  24. [24]R. Leburu, L. Nurbekyan, and L. Ruthoro. Differentiating through stochastic differential equations: A primer, 2026.
  25. [25]C. E. Leith. Climate response and fluctuation dissipation. Journal of the Atmospheric Sciences, 32(10):2022–2026, 1975.doi.org/10.1175/1520-0469(1975)032<2022:crafd>2.0.co;2
  26. [26]Q. Li, L. Wang, and Y. Yang. Monte carlo gradient in optimization constrained by radiative transport equation. SIAM Journal on Numerical Analysis, 61(6):2744–2774, 2023.
  27. [27]X. Li, T.-K. L. Wong, R. T. Q. Chen, and D. Duvenaud. Scalable gradients for stochastic differential equations. In Proceedings of the Twenty-Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 3870–3882. PMLR, 2020.arxiv.org/abs/2001.01328
  28. [28]L. Lorenzi. Optimal schauder estimates for parabolic problems with data measurable with respect to time. SIAM Journal on Mathematical Analysis, 32(3):588–615, 2000.
  29. [29]E. Lovbak, F. Blondeel, A. Lee, L. Vanroye, A. Van Barel, and G. Samaey. Reversible random number generation for adjoint monte carlo simulation of the heat equation. In Monte Carlo and Quasi-Monte Carlo Methods, pages 451–468. Springer International Publishing, 2024.
  30. [30]B. Oksendal. Stochastic differential equations: an introduction with applications. Springer Science & Business Media, 2013.
  31. [31]O. A. Oleinik. On the mathematical theory of boundary layer for an unsteady flow of incompressible fluid. Journal of Applied Mathematics and Mechanics, 30(5):951–974, 1966.
  32. [32]É. Pardoux and S. Peng. Adapted solution of a backward stochastic differential equation. Systems & Control Letters, 14(1):55–61, 1990.
  33. [33]J. Prost, J.-F. Joanny, and J. M. Parrondo. Generalized fluctuation-dissipation theorem for steady-state systems. Physical review letters, 103(9):090601, 2009.
  34. [34]S. Roy, M. Annunziato, A. Borzi, and C. Klingenberg. A fokker–planck approach to control collective motion. Computational Optimization and Applications, 69(2):423–459, 2018.
  35. [35]Y. Song and P. Dhariwal. Improved techniques for training consistency models. In International Conference on Learning Representations, volume 2024, pages 15078–15097, 2024.arxiv.org/abs/2310.14189
  36. [36]D. W. Stroock and S. S. Varadhan. Multidimensional diffusion processes. Springer, 2007.
  37. [37]M. Yang, G. Zhang, D. del Castillo-Negrete, and M. Stoyanov. A feynman-kac based numerical method for the exit time probability of a class of transport problems. Journal of Computational Physics, 444:110564, 2021.

Paper details

vlnc:W_5pjqnakw
Version
v1 · latest
Published
Added
License
CC BY-SA 4.0
Usage

views · 0

downloads · 0

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

  • Mathematics

Not recorded for this paper

View statement
Looking for related papers…
Contents