arXiv:2609.05808physics.opticsSep 2026

Manuscript Offprint

arXiv:2609.05808

Physical policy gradient theorem for in situ stochastic-adjoint training

William Tuxbury, Zin Lin

William Tuxbury* and Zin Lin

Bradley Department of Electrical and Computer Engineering, Virginia Tech, Blacksburg, Virginia 24061, USA

In situ adjoint training extracts parameter gradients directly from measurement, but has so far been limited to reciprocal or restricted systems. Here, we introduce the physical counterpart of the policy gradient theorem: a stochastic-adjoint gradient estimator that lifts these constraints by trading reciprocity for nondegenerate diffusion. As validation, we train a nonlinear resonator network, whose own dynamics supply the policy, against antagonistic temporal modulations with gradients from measured stochastic trajectories alone, without finite differences or a separate adjoint experiment.

Physical neural networks propagate and process information according to the physics of their substrate. Complexity from multi-path interference, nonlinearity, and parametric encoding has been harnessed to train physical systems that classify data and realize target functionalities [1–11]. Conventionally, these devices are simulated and optimized in silico prior to deployment. This paradigm, however, introduces a mismatch between model and device, which grows more severe as the substrate incorporates the very complexity that enhances its expressivity: features such as nonlinearity, time modulation, and stochasticity.

A parallel lineage executes gradient-based training in situ on reconfigurable physical platforms, reducing reliance on a complete digital model and thereby minimizing the sim-to-real gap. The operative principle of this approach is reciprocity: excitation and observation sites may be interchanged without altering the system's intrinsic dynamics, enabling the same hardware to emulate the adjoint of its own equations of motion [11–14]. Adjoint methods are especially efficient because they recover the full gradient with respect to P\mathcal{P} parameters using only one forward and one adjoint measurement, rather than the P+1\mathcal{P} + 1 measurements required by forward finite differences. Although in situ adjoint protocols have been demonstrated across a broad class of reciprocal media [11, 14–16] and extended to specific nonlinear defects and symmetries [6, 17–19], they remain inapplicable to unrestricted dynamics, such as arbitrary nonlinear, time-modulated, and stochastic systems.

To overcome these limitations, we approach in situ adjoint training with a complementary formulation. Our approach is inspired by reinforcement learning in uncertain environments, wherein an agent interacting with the environment learns a policy that maximizes the average accumulated reward, or total expected return. Prevailing methods parameterize the policy and optimize those parameters using policy gradient methods. The

workhorse behind breakthrough developments in reinforcement learning, from the foundational REINFORCE algorithm [20] to modern methods including trust region policy optimization (TRPO) [21] and proximal policy optimization (PPO) [22], is the policy gradient theorem (PGT) [23]. In the PGT, the gradient of the expected return is expressed as the expectation value of the return-to-go weighted by the score of the policy. Crucially for our purposes, the PGT differentiates only the policy with respect to parameters along sampled trajectories. By contrast, deterministic backpropagation would require emulating the transpose Jacobian of the state dynamics, which cannot, in general, be implemented through the same forward physical processes [17, 18].

This perspective raises three questions: can the intrinsic dynamics of an arbitrary nonlinear stochastic substrate embody a policy? Does an analog of the PGT exist for such a physically embodied policy? And importantly, can its gradient be evaluated in situ? In this Letter, we answer these questions by introducing a score-based policy gradient theorem for continuous-time stochastic physical dynamics in direct analogy with PGT, enabling in situ adjoint training of physically embodied policies. Our formulation rests on three ingredients: the Fokker–Planck equation [24], the Feynman–Kac theorem [25], and Itô's lemma [26]. Although individual trajectories of a stochastic process are random, their distribution evolves deterministically according to the Fokker–Planck equation. Specifying a performance objective as an expected return generates a corresponding adjoint equation whose solution determines the parameter gradient. Here, the Feynman–Kac theorem identifies the adjoint solution with the expected return-to-go, an average over sampled paths of the physical dynamics, which can be estimated from the forward trajectories without additional adjoint experiments. Lastly, Itô's lemma connects the generator of the Itô process with the expected rate of change of an observable. When this observable is chosen as the adjoint field (return-to-go), parameter sensitivity is recast via the score function associated with the transition kernel, which itself is the physically embodied policy.

Unlike previous in situ adjoint protocols [6, 11, 14, 17, 19], which require reciprocity or admit only restricted classes of nonlinearities, our formulation applies to arbitrary Itô processes by trading reciprocity for nondegenerate diffusion, naturally present in any physical device. As a validation, we simulate the training of a physically embodied policy in a driven, fully nonlinear, time-modulated resonator network, modeled by stochastic temporal coupled mode theory (TCMT) [27, 28]. More broadly, our framework recasts a physical system's intrinsic dynamics as a trainable policy, opening a route toward online reinforcement learning in matter.

Framework.—Consider the generic Itô process,

dXt=μ(Xt,t)dt+σ(Xt,t)dWt,(1)d X_{t}=\mu\left(X_{t},t\right)d t+\sigma\left(X_{t},t\right)d W_{t}, \tag{1}

with Xt∈X⊆RMX_t \in \mathcal{X} \subseteq \mathbb{R}^{\mathcal{M}}, μ(x,t):X×[0,T]→RM\mu(x,t): \mathcal{X} \times [0,T] \to \mathbb{R}^{\mathcal{M}}, σ(x,t):X×[0,T]→RM×W\sigma(x,t): \mathcal{X} \times [0,T] \to \mathbb{R}^{\mathcal{M} \times \mathcal{W}}, and WtW_t a standard W\mathcal{W}-dimensional Wiener process. The drift μ(Xt,t;θ)=μ(Xt,t)\mu(X_t,t;\theta) = \mu(X_t,t), and diffusion Q(Xt,t;θ)=σ(Xt,t)σ⊤(Xt,t)/2Q(X_t,t;\theta) = \sigma(X_t,t)\sigma^\top(X_t,t)/2 also depend on the parameter vector θ∈RP\theta \in \mathbb{R}^P. We define an objective function as an expectation value involving both terminal gT(XT)g_T(X_T) and continuing g(Xt,t)g(X_t,t) rewards,

J(θ)=E[gT(XT)+∫0Tdtg(Xt,t)]=⟨gT,p(⋅,T)⟩+∫0Tdt⟨g,p⟩,\begin{align*}J\left(\theta\right)&=\mathbb{E}\left[g_{T}\left(X_{T}\right)+\int_{0}^{T}dt g\left(X_{t},t\right)\right]\\&=\left\langle g_{T},p(\cdot,T)\right\rangle+\int_{0}^{T}dt\left\langle g,p\right\rangle,\end{align*}

(2)

where in the second equality we have introduced the inner-product notation, ⟨u,v⟩≡∫Xdx uv\langle u, v \rangle \equiv \int_{\mathcal{X}} dx \, uv.

The goal is to efficiently compute the gradient ∇θJ\nabla_{\theta}J by sampling the original SDE over E\mathcal{E} trajectories. The distribution of the process solves the corresponding Fokker–Planck equation, which we write in its generator form, ∂tp=Lt†p\partial_{t}p = \mathcal{L}_{t}^{\dagger}p with p(x,0)=p0(x;θ)p(x,0) = p_{0}(x;\theta). A standard adjoint-method result expresses the gradient,

∇θJ=⟨∂gT∂θ,p(⋅,T)⟩+⟨λ(⋅,0),s(⋅,0)⟩+∫0Tdt⟨∂g∂θ+∂Lt∂θλ,p⟩,\begin{align*}\nabla_{\theta}J=\left\langle\frac{\partial g_{T}}{\partial\theta},p(\cdot,T)\right\rangle+\langle\lambda(\cdot,0),s(\cdot,0)\rangle\\+\int_{0}^{T}dt\left\langle\frac{\partial g}{\partial\theta}+\frac{\partial\mathcal{L}_{t}}{\partial\theta}\lambda,p\right\rangle,\end{align*}

(3)

where the adjoint variable λ(x,t)\lambda(x,t) solves the adjoint PDE, ∂tλ+Ltλ+g=0\partial_t\lambda+\mathcal{L}_t\lambda+g=0 with terminal condition λ(T)=gT\lambda(T)=g_T [29]. For simplicity, neglect the terms involving the initial sensitivity, s(x,0)≡∂θp0(x;θ)s(x,0)\equiv\partial_{\theta}p_0(x;\theta), and reward functions, which usually vanish or can be calculated analytically. So, Eq. (3) reduces to, in expectation-value form,

∇θJ=E[∫0Tdt(∂Lt∂θλ)(Xt,t)].(4)\nabla_{\theta}J=\mathbb{E}\left[\int_{0}^{T}d t\left(\frac{\partial\mathcal{L}_{t}}{\partial\theta}\lambda\right)(X_{t},t)\right]. \tag{4}

A simplified form of the well-known Feynman–Kac theorem [25] allows the adjoint variable to be sampled from

the same Itô process as that under stochastic optimization,

λ(x,t)=E[gT(XT)+∫tTdτg(Xτ,τ)∣Xt=x].(5)\lambda(x,t)=\mathbb{E}\left[g_{T}\left(X_{T}\right)+\int_{t}^{T}d\tau g(X_{\tau},\tau)\bigg|X_{t}=x\right]. \tag{5}

Since λ\lambda is the conditional expected return-to-go, it can be evaluated at T+1\mathcal{T}+1 discrete time steps tn≡nΔtt_n \equiv n\Delta t (n=0,…,Tn=0,\ldots,\mathcal{T}) via the forward trajectories as the return-to-go,

λ^n≡gT(Xtτ)+∑k=nT−1g(Xtk,tk)Δt.(6)\hat{\lambda}_{n}\equiv g_{T}\left(X_{t_{\tau}}\right)+\sum_{k=n}^{\mathcal{T}-1}g(X_{t_{k}},t_{k})\Delta t. \tag{6}

However, Lt\mathcal{L}_{t} is a differential operator requiring state-space derivatives of the adjoint field, which pointwise estimates do not supply. Therefore, we aim to rewrite Eq. (4) in a form amenable to sampling λ^n\hat{\lambda}_{n} from the forward trajectories alone.

For a Markov process, state transitions over a step Δt\Delta t are set by the kernel pθΔt(x′∣x)p_{\theta}^{\Delta t}(x'|x). Taking expectations of Itô's lemma applied to an arbitrary time-dependent function φ(x,t)\varphi(x,t) (Dynkin's formula [30]), the instantaneous rate of change of its conditional expectation along the process is

(∂φ∂t+Ltφ)(x,t)=lim⁡Δt→01Δt[∫dx′φ(x′,t+Δt)pθΔt(x′∣x)−φ(x,t)].\begin{align*}\left(\frac{\partial\varphi}{\partial t}+\mathcal{L}_{t}\varphi\right)(x,t)=&\\\lim_{\Delta t\to0}\frac{1}{\Delta t}\left[\int dx^{\prime}\varphi\left(x^{\prime},t+\Delta t\right)p_{\theta}^{\Delta t}\left(x^{\prime}|x\right)-\varphi(x,t)\right].\end{align*}

(7)

Differentiating in θ\theta, using the log-trick, and taking φ=λ\varphi = \lambda, we have

(∂Lt∂θλ)(x,t)=lim⁡Δt→01ΔtE[λ(Xt+Δt,t+Δt)U(x,Xt+Δt;θ)∣Xt=x],\begin{align*}\left(\frac{\partial\mathcal{L}_{t}}{\partial\theta}\lambda\right)(x,t)=&\\\lim_{\Delta t\to0}\frac{1}{\Delta t}\mathbb{E}\left[\lambda\left(X_{t+\Delta t},t+\Delta t\right)U(x,X_{t+\Delta t};\theta)\mid X_{t}=x\right],\end{align*}

(8)

where we have introduced the score function, U(x,x′;θ)≡∂θln⁡pθΔt(x′∣x)U(x, x'; \theta) \equiv \partial_{\theta} \ln p_{\theta}^{\Delta t}(x'|x), hereafter suppressing its θ\theta argument along sampled trajectories. Finally, from Eqs. (4) and (8), we obtain the physical policy gradient theorem (PPGT),

∇θJ=lim⁡Δt→01Δt∫0TdtE[λ(Xt+Δt,t+Δt)U(Xt,Xt+Δt)].(9)\nabla_{\theta}J=\operatorname*{l i m}_{\Delta t\to0}\frac{1}{\Delta t}\int_{0}^{T}d t\mathbb{E}[\lambda\left(X_{t+\Delta t},t+\Delta t\right)U(X_{t},X_{t+\Delta t})]. \tag{9}

Equation (9) is the continuous-time, physically embodied counterpart of the policy gradient theorem [23],

∇θJ=E[∑kGk∂∂θln⁡πθ(Ak∣Sk)].(10)\nabla_{\theta}J=\mathbb{E}\Big[\sum_{k}G_{k}\frac{\partial}{\partial\theta}\ln\pi_{\theta}(A_{k}|S_{k})\Big]. \tag{10}

The transition kernel pθΔt(x′∣x)p_{\theta}^{\Delta t}(x'|x) plays the role of the policy πθ\pi_{\theta}, its score U is ∂θln⁡πθ\partial_{\theta}\ln\pi_{\theta}, the sampled Feynman–Kac adjoint λ^\hat{\lambda} is the return-to-go GkG_{k}, and XtX_{t} is the continuous-time analog of SkS_{k}. The physical policy is no longer an

Figure

FIG. 1. Physical Policy Training (a) Expected return and (b) trajectories per iteration versus training iteration for antagonistic modulation amplitudes σκ\sigma_{\kappa} indicated by the common legend in (a). Inset: continuations of the σκ=0\sigma_{\kappa}=0 optimization from a common breakpoint (vertical dashed line) at escalated, constant, and de-escalated trajectory budgets, overlaid with 25-iteration rolling averages. The green ( E=25,000\mathcal{E}=25,000) and black ( E=20,000\mathcal{E}=20,000) curves share a similar rate of progress, while the red ( E=1,000\mathcal{E}=1,000) curve drifts off the gradient flow. Hence, the trajectory budget was over-provisioned, but without escalation the achievable optimum is limited by the fixed noise floor of the gradient estimate (see End Matter). (c) Resonator frequency, (d) internal coupling, and (e) Kerr coefficient parameters versus training iteration for σκ=0.2\sigma_{\kappa}=0.2. Curve opacities are set by the time-integrated field exposure of the respective elements, and since high-exposure sites are near χn=0\chi_{n}=0, nonlinearity is largely decorative in the optimization; find opacity mapping details in the text. (f) Network diagram of the trained optimum for σκ=0.2\sigma_{\kappa}=0.2 forming an effective waveguide (green bonds) with detuned flanks. The input (output) port is indicated with a green triangle (blue star), resonator frequencies are represented by their disk radii, coupling magnitude by bond thickness and color, and Kerr coefficient by disk color (color bars are beneath the diagram with parameter mapping details in the text).

abstracted rule set, but is instead baked into the dynamics themselves. The substrate's own stochastic evolution supplies the action distribution, and the transition it makes, Xt→Xt+ΔtX_{t} \to X_{t+\Delta t}, is the action, AkA_{k}.

When θ\theta only enters the drift μ\mu (and not the diffusion QQ; see End Matter), the Itô process following Euler-Maruyama updates (discretized form of Eq. (1); dt→Δtdt \to \Delta t) has the score function

U(x,x′;θ)=12r(x,x′)⊤Q−1∂μ(x,t)∂θ,(11)U(x,x^{\prime};\theta)=\frac{1}{2}r\left(x,x^{\prime}\right)^{\top}Q^{-1}\frac{\partial\mu(x,t)}{\partial\theta}, \tag{11}

where r(x,x′)≡x′−x−μ(x,t)Δtr(x,x') \equiv x' - x - \mu(x,t)\Delta t.

Restoring the neglected gradient terms of Eq. (3), assuming a closed form of the initial sensitivity (see End Matter), the full form of the PPGT is

∇θJ=E[G({Xtn}n=0T)],(12)\nabla_{\theta}J=\mathbb{E}\left[\mathcal{G}\left(\left\{X_{t_{n}}\right\}_{n=0}^{\mathcal{T}}\right)\right], \tag{12}

where from Eqs. (3) and (9), the experimentally measur-

able stochastic-adjoint gradient estimator is

G({Xtn}n=0T)=(λ^0−λˉs)∂∂θln⁡p0(X0)+∂gT∂θ(Xtτ)+Δt∑n=0T−1∂g∂θ(Xtn,tn)+∑n=0T−1(λ^n+1−λˉn)U(Xtn,Xtn+1),(13)\begin{aligned}\mathcal{G}\big(\{X_{t_{n}}\}_{n=0}^{\mathcal{T}}\big)=&\left(\hat{\lambda}_{0}-\bar{\lambda}_{s}\right)\frac{\partial}{\partial\theta}\ln p_{0}(X_{0})\\ +&\frac{\partial g_{T}}{\partial\theta}(X_{t_{\tau}})+\Delta t\sum_{n=0}^{\mathcal{T}-1}\frac{\partial g}{\partial\theta}(X_{t_{n}},t_{n})\\ &+\sum_{n=0}^{\mathcal{T}-1}\left(\hat{\lambda}_{n+1}-\bar{\lambda}_{n}\right)U(X_{t_{n}},X_{t_{n+1}}),\end{aligned} \tag{13}

which is consistent in the limit Δt→0\Delta t \to 0 and where we replaced the adjoint variable with its forward-sampled estimate from Eq. (6). The first term is the initial sensitivity and λˉ\bar{\lambda} are baselines for variance reduction with suppressed “leave-one-out” trajectory-index notation for simplicity (see Eqs. (17) and (20) in End Matter).

Results.—As validation, we deploy PPGT in an 11×1311 \times 13 rectangular coupled-resonator lattice, modeled using TCMT, with nearest-neighbor internal coupling and two leads attached at opposite corners (with orthonormal channel basis elements denoted ∣e1⟩|e_1\rangle and ∣e2⟩|e_2\rangle). The ef fective Hamiltonian includes Kerr nonlinearity and modulated internal coupling,

Heff(θ,t)=∑n[(ωn(θ)+χn(θ)∣ψn∣2)∣n⟩⟨n∣]+∑m≠n(κnm(θ)+δκnm(t))∣n⟩⟨m∣−iΓ,(14)\begin{aligned}H_{\mathrm{eff}}(\theta,t)&=\sum_{n}\left[(\omega_{n}(\theta)+\chi_{n}(\theta)|\psi_{n}|^{2})\left|n\right\rangle\langle n|\right]\\&+\sum_{m\neq n}(\kappa_{nm}(\theta)+\delta\kappa_{nm}(t))\left|n\right\rangle\langle m|-i\Gamma,\end{aligned} \tag{14}

where ∣n⟩|n\rangle denotes the local orthonormal basis element associated with the nthn^{\text{th}} resonator mode with amplitude ψn=⟨n∣ψ⟩\psi_n = \langle n|\psi\rangle; Γ\Gamma is the total decay-rate matrix due to external coupling and radiative loss channels (see End Matter for additional modeling details), from which additive Wiener processes are emitted. The external coupling rates are symmetric and normalized, γe=1\gamma_e = 1, while radiative decay rates are assumed uniform, γ=0.02\gamma = 0.02. All coupling strengths are taken real and symmetric, so Heff(θ,t)=Heff⊤(θ,t)H_{\text{eff}}(\theta, t) = H_{\text{eff}}^\top(\theta, t), while nonlinearity and modulation break reciprocity. The 143 resonator frequencies ωn(θ)\omega_n(\theta), 262 static internal coupling strengths κnm(θ)\kappa_{nm}(\theta), and 143 Kerr coefficients χn(θ)\chi_n(\theta) are all trainable and real for a total of P=548\mathcal{P} = 548 trainable parameters.

The NN complex-variable TCMT equations (Eq. (22) in the End Matter) can be transformed to a 2N2N real-variable representation equivalent to Eq. (1), where HeffH_{\mathrm{eff}}, ∣ψ⟩|\psi\rangle, DD, and ∣s+⟩|s^{+}\rangle enter through the drift, while DD and D(r)D^{(r)} enter through the noise coefficients. Here, the trainable parameters enter only through the drift, so the score function, Eq. (11), is obtained from ∂θHeff\partial_{\theta}H_{\mathrm{eff}}, which follows directly from Eq. (14) (see End Matter).

The system is driven by a harmonic source at the first lead, ∣s+⟩=s1+e−iωt∣e1⟩|s^+\rangle = s_1^+ e^{-i\omega t} |e_1\rangle for t≥0t \geq 0 with s1+=10s_1^+ = 10, from zeroed initial condition p0(x)=δ2N(x)p_0(x) = \delta^{2N}(x). The return is taken as the transmitted power to the second lead over 0≤t≤T0 \leq t \leq T, with ω=10\omega = 10 and T=20T = 20,

J=E[∫0Tdt∣⟨e2∣s−(t)⟩⟨e1∣s+(t)⟩∣2].(15)J=\mathbb{E}\left[\int_{0}^{T}d t\left|\frac{\langle e_{2}|s^{-}(t)\rangle}{\langle e_{1}|s^{+}(t)\rangle}\right|^{2}\right]. \tag{15}

During training, additive Wiener processes were incorporated into all open channels with identical amplitude σW=0.5\sigma_{W}=0.5. In addition to the Wiener processes, without which the diffusion is singular and the score diverges (see Eq. (11)), we also consider a class of antagonistic, temporally-correlated, internal coupling modulations δκnm(t)\delta\kappa_{nm}(t) that are drawn independently per bond and trajectory (see Eq. (23) in End Matter).

Several lattices were trained at various σκ\sigma_{\kappa} ranging from 0 to 0.2. The improvement in expected returns and the corresponding ensemble sizes are plotted in Figs. 1(a) and (b), respectively (see End Matter for optimization details). The inset of Fig. 1(b) shows the role of ensemble size escalation: some escalation is required to sustain progress at early iterations, though later escalations were over-provisioned. While gradual progress persisted for

tens of thousands of iterations, most improvement happened early and relatively cheaply. For instance, in the σκ=0\sigma_{\kappa}=0 optimization 40% of the eventual gain in expected return was achieved within the first 15 iterations and an additional 20% within the next 60 before any escalation from E=1,000\mathcal{E}=1,000.

Parameter trajectories for σκ=0.2\sigma_{\kappa} = 0.2 are shown in (c-e), where curve opacity logarithmically encodes, within each family, the time-integrated field exposure of each parameter in the optimized configuration at zero Wiener noise, ∫dt⟨f(Xt)⟩E\int dt \langle f(X_t) \rangle_{\mathcal{E}}, with f(Xt)=∣ψn∣2f(X_t) = |\psi_n|^2 for ωn\omega_n, f(Xt)=∣ψnψm∣f(X_t) = |\psi_n \psi_m| for κnm\kappa_{nm}, and f(Xt)=∣ψn∣4f(X_t) = |\psi_n|^4 for χn\chi_n, where ⟨⋅⟩E\langle \cdot \rangle_{\mathcal{E}} denotes a sample average over E\mathcal{E} trajectories. The optimal trained parameters are graphically visualized in Fig. 1(f), where the green triangle and blue star respectively mark the input and output ports of the network. Disk radii increase with resonator frequency detuning; segment width and color both encode the internal coupling magnitude, compressed on asymmetric square-root scales about their initial value κnm=1\kappa_{nm} = 1; disk color represents the Kerr coefficient. The optimized lattice shows a band of enhanced coupling along the diagonal, with detuned frequencies on the flanks forming an effective waveguide.

The convergence and variance scaling of the PPGT estimator are analyzed in Fig. 2(a-c). In Figs. 2(a,b), estimates of ∂ωnJ\partial_{\omega_n}J for one representative nn (see figure caption) are plotted against the number of trajectories E\mathcal{E}, taken at mid-training iterations of the σκ=0\sigma_{\kappa} = 0 and 0.2 optimizations, respectively: the solid blue line is a moving average of the running estimate, shown unsmoothed and faded underneath. The estimates converge to the finite-difference values (black dashed line). The light-blue shaded band is the standard error of the estimate. Notably, over P=548\mathcal{P} = 548 dimensions a noisy update is still informative enough for progress; per-component accuracy is not required. Moreover, noisy gradients are often advantageous in stochastic optimization [31].

In Fig. 2(c), the estimator variance averaged over all resonator frequencies, denoted ⟨⋅⟩{ωn}\langle \cdot \rangle_{\{\omega_n\}}, is sampled using E=1,000\mathcal{E} = 1,000 and plotted versus Wiener noise amplitude, σW\sigma_W, at a representative mid-training iteration for σκ∈{0,0.05,0.2}\sigma_\kappa \in \{0, 0.05, 0.2\}, with (solid curves) and without (dashed curves) a baseline. The vertical grey dashed line marks the operating point the networks were trained at and the black dotted line indicates the predicted variance scaling ∼σW−2\sim \sigma_W^{-2}. From Eq. (1), Q−1∼σW−2Q^{-1} \sim \sigma_W^{-2} and r∼σWr \sim \sigma_W, so in Eq. (11) U∼σW−1U \sim \sigma_W^{-1}, then assuming λ\lambda scales constant with σW\sigma_W, from Eq. (9) we predict the observed scaling, Var(G)∼(∫dtλU)2∼σW−2\text{Var}(\mathcal{G}) \sim (\int dt \lambda U)^2 \sim \sigma_W^{-2}. Presence of the baseline reduces estimator variance by several orders, to the extent that in the best case of σκ=0\sigma_\kappa = 0 it is suppressed to a constant over several orders of σW\sigma_W. In all scenarios, lim⁡σW→0Var(G)→∞\lim_{\sigma_W \to 0} \text{Var}(\mathcal{G}) \to \infty as QQ becomes numerically singular and the score diverges.

Figure

FIG. 2. Estimator Properties Convergence of single components of the gradient estimate associated with resonator frequency for (a) σκ=0\sigma_{\kappa} = 0 and (b) σκ=0.2\sigma_{\kappa} = 0.2 versus the number of trajectories accumulated in the ensemble average. Respective iteration and site index were selected to favor the resolvability of systematic bias, avoiding pathologies (e.g., lead-coupled sites or detuned flanks). The horizontal dashed lines indicate the finite-difference values (using E=1,000\mathcal{E} = 1,000 with common noise realizations across the differenced legs) and the vertical dashed lines indicate the maximum trajectory budget in optimization (see Fig. 1). (c) Gradient estimate variance versus instrumental noise amplitude with (solid) and without (dashed) baselines computed at a representative mid-training iteration (800) using E=1,000\mathcal{E} = 1,000, shown for σκ=0,0.05\sigma_{\kappa} = 0, 0.05, and 0.2. Apart from the baselined σκ=0\sigma_{\kappa} = 0 case, whose variance is independent of small σW\sigma_{W} before the score goes numerically singular, all follow the ∼σW−2\sim \sigma_{W}^{-2} dotted trend line. (d) Bias in the expected return due to σW≠0\sigma_{W} \neq 0 using E=10,000\mathcal{E} = 10,000, taken as a paired difference against σW=0\sigma_{W} = 0 under common noise realizations, for each σκ\sigma_{\kappa} in the legend. The ∼σW2\sim \sigma_{W}^{2} dotted trend line shows that excessive instrumental noise biases the measured return (see End Matter). Inset: Standard deviation of the return with dotted trend line ∼σW\sim \sigma_{W}. The visible crossovers are controlled by whether σW\sigma_{W} or σκ\sigma_{\kappa} dominate return variance. The vertical dashed lines in (c) and (d) indicate the σW\sigma_{W} value used in optimization (see Fig. 1), so a contribution ΔJ≈0.01\Delta J \approx 0.01 to the expected return is attributable to the instrumental noise.

Nondegenerate diffusion is not only a requirement of PPGT, but in fact amplified instrumental noise can suppress estimator variance. However, the same noise has the opposite effect on the measured return, which is quantified by the instrumental bias ΔJ(σW)≡∣J(σW)−J(0)∣\Delta J(\sigma_W) \equiv |J(\sigma_W) - J(0)| and plotted in Fig. 2(d). The bias follows the ∼σW2\sim \sigma_W^2 dotted trend line, and at excessive values the measured return is dominated by noise. The inset shows a crossover in the corresponding standard deviation in the return, following the ∼σW\sim \sigma_W dotted trend line, as instrumental noise overtakes antagonistic noise as the dominant

source of return variance. The instrumental noise amplitude used in the optimizations is marked by the vertical dashed line and corresponds to ΔJ≈0.01\Delta J \approx 0.01, small against J≈0.65J \approx 0.65.

Discussion.—Until now, in situ adjoint training has been confined to special classes of systems. By trading these restrictions for diffusion, PPGT can be deployed in situ for training arbitrary nonreciprocal physical substrates described by general (fully nonlinear, time-dependent) Itô processes. In contrast to prior methods, training via PPGT does not require separate adjoint experiments per iteration. Instead, many forward experiments are run subject to intrinsic or instrumented diffusion. The gradient of every parameter is then read off from these forward trajectories alone, requiring neither adjoint excitation nor prepared states. The substrate need only run, fluctuate, and be judiciously observed over the support of the score, according to Eq. (12).

Beyond the standard in situ adjoint calibrations, e.g., calibration of ∂θμ\partial_{\theta}\mu [11], PPGT additionally requires calibrating the summary statistics Q, which characterize the covariance of the noise processes, not their individual realizations. The gradient estimate is then resolved from averages over the measured fields according to Eqs. (6), (12), and (13). Experimental feasibility of the approach, which relies on many trajectories per iteration, depends on both a measurement rate sufficient to record the time-domain field response and an adequate repetition rate of trajectories. The trajectory burden can be mitigated by using a baseline or, since the estimator variance scales as σW−2\sigma_{W}^{-2} (Fig. 2(c)), instrumenting noise to the level the substrate and return bias tolerate (Fig. 2(d)). In particular, RF and microwave implementations ( ∼\sim100 kHz–10 GHz range) offer arguably the best timescale tradeoff: infrared or optical settings ( ∼\sim100 MHz–100 THz) strain time-domain measurement rates, while mechanical or acoustic devices ( ∼\sim1 Hz–10 kHz) may be limited by repetition rate.

As validation, we implemented the method by optimizing the transmission through a rectangular resonator network against antagonistic modulations in the internal coupling strengths. The optimizer made little use of the available Kerr coefficients, which reflects the choice of performance objective. Transmission alone does not require nonlinearity, unlike a fundamentally nonreciprocal task such as isolation. The validation nonetheless ran in a setting strictly inaccessible to reciprocity-based methods.

Conclusion.—Noise inherent to physical processes, intrinsic or instrumented, is the resource that renders the gradient resolvable through measurement in PPGT. As the continuous-time physical analog of PGT, it is primed to inherit the established concepts of reinforcement learning, such as partial observability [32], continual learn-ing [33], and off-policy reuse with trust-region methods (e.g., TRPO, PPO) [21, 22, 34]. Since PPGT is formulated at the generator level, it is applicable to general Markov processes (e.g., jump-diffusions), with only the score function changing form. Even non-Markovian extensions, such as colored noise or spectrally filtered rewards, can be incorporated through state augmentation. On the practical side, the many trajectories required by PPGT in situ can potentially be amortized for continuing, rather than episodic, tasks [35] (e.g., steady-state operation under continuous drive) by partitioning a single time-series measurement into multiple weakly correlated sub-trajectories. A proof-of-principle experimental demonstration in RF circuitry [11, 16, 17] is currently underway. Eventually, this in situ design approach could be implemented via parallel device arrays, thereby naturally accounting for mesoscopic fluctuations and fabrication errors among ensemble members. We view PPGT as an early step toward physical, rather than digital, intelligence, in which body and brain merge into a shared substrate—opening a path toward adaptive, self-optimizing, and ultimately, agentic metamaterials that autonomously execute multistep tasks [36].

Acknowledgements.—W.T. and Z.L. are supported by the U.S. Army Research Office (award numbers W911NF2410390 and W911NF2510113).

[1] D. Psaltis, D. Brady, X.-G. Gu, and S. Lin, Holography in artificial neural networks, Nature 343, 325 (1990).

[2] Y. Shen, N. C. Harris, S. Skirlo, et al., Deep learning with coherent nanophotonic circuits, Nature Photonics 11, 441 (2017).

[3] X. Lin, Y. Rivenson, N. T. Yardimci, M. Veli, Y. Luo, M. Jarrahi, and A. Ozcan, All-optical machine learning using diffractive deep neural networks, Science 361, 1004 (2018).

[4] G. Wetzstein, A. Ozcan, S. Gigan, S. Fan, D. Englund, M. Soljačić, C. Denz, D. A. B. Miller, and D. Psaltis, Inference in artificial intelligence with deep optics and photonics, Nature 588, 39 (2020).

[5] B. J. Shastri, A. N. Tait, T. Ferreira de Lima, W. H. P. Pernice, H. Bhaskaran, C. D. Wright, and P. R. Prucnal, Photonics for artificial intelligence and neuromorphic computing, Nature Photonics 15, 102 (2021).

[6] N. D. Cin, F. Marquardt, and C. C. Wanjura, Training nonlinear optical neural networks with scattering back-propagation (2025), arXiv:2508.11750 [physics.optics].

[7] L. G. Wright, T. Onodera, M. M. Stein, et al., Deep physical neural networks trained with backpropagation, Nature 601, 549 (2022).

[8] Z. Xue, T. Zhou, Z. Xu, S. Yu, Q. Dai, and L. Fang, Fully forward mode training for optical neural networks, Nature 632, 280 (2024).

[9] F. Xia, K. Kim, Y. Eliezer, S. Han, L. Shaughnessy, S. Gigan, and H. Cao, Nonlinear optical encoding enabled by recurrent linear scattering, Nature Photonics 18, 1067

(2024).

[10] A. Momeni, B. Rahmani, B. Scellier, L. G. Wright, P. L. McMahon, C. C. Wanjura, Y. Li, A. Skalli, N. G. Berloff, T. Onodera, I. Oguz, F. Morichetti, P. del Hougne, M. Le Gallo, A. Sebastian, A. Mirhoseini, C. Zhang, D. Marković, D. Brunner, C. Moser, S. Gigan, F. Marquardt, A. Ozcan, J. Grollier, A. J. Liu, D. Psaltis, A. Alù, and R. Fleury, Training of physical neural networks, Nature 645, 53 (2025).

[11] J. Guillamon, C.-Z. Wang, Z. Lin, and T. Kottos, In-situ physical adjoint computing in multiple-scattering electromagnetic environments for wave control, Nature Communications 16, 11466 (2025).

[12] M. P. Bendsoe, O. Sigmund, et al., Topology optimization: theory, methods, and applications, Vol. 2 (Springer Berlin, 2004).

[13] S. Molesky, Z. Lin, A. Y. Piggott, W. Jin, J. Vucković, and A. W. Rodriguez, Inverse design in nanophotonics, Nature Photonics 12, 659 (2018).

[14] S. Pai, Z. Sun, T. W. Hughes, T. Park, B. Bartlett, I. A. D. Williamson, M. Minkov, M. Milanizadeh, N. Abebe, F. Morichetti, A. Melloni, S. Fan, O. Solgaard, and D. A. B. Miller, Experimentally realized in situ backpropagation for deep learning in photonic neural networks, Science 380, 398 (2023).

[15] T. W. Hughes, M. Minkov, Y. Shi, and S. Fan, Training of photonic neural networks through in situ backpropagation and gradient measurement, Optica 5, 864 (2018).

[16] H. Kwon, A. Suntharalingam, L. Bulus-Rossini, and T. Kottos, In-situ time-domain physical adjoint optimization of complex wave dynamics (2026), arXiv:2608.19456 [physics.optics].

[17] J. Guillamon, W. Tuxbury, C.-Z. Wang, O. Miller, Z. Lin, and T. Kottos, In-situ adjoint wave control in reconfigurable non-Hermitian nonlinear systems (2026), arXiv:2608.13503 [physics.optics].

[18] C. Bösch, Y. Gediz, and H. Türeci, Unifying physical backpropagation (2026), arXiv:2608.11585 [cond-mat.dis-nn].

[19] Z. Li, L. J. Fernández-Alcázar, Z. Lin, and T. Kottos, In-situ adjoint protocols for nonlinear pt-symmetric self-optimizing machines (2026), arXiv:2608.16056 [physics.optics].

[20] R. J. Williams, Simple statistical gradient-following algorithms for connectionist reinforcement learning, Machine learning 8, 229 (1992).

[21] J. Schulman, S. Levine, P. Moritz, M. I. Jordan, and P. Abbeel, Trust region policy optimization, in Proceedings of the 32nd International Conference on Machine Learning (ICML) (2015) pp. 1889–1897.

[22] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, Proximal policy optimization algorithms (2017), arXiv:1707.06347 [cs.LG].

[23] R. S. Sutton, D. McAllester, S. Singh, and Y. Mansour, Policy gradient methods for reinforcement learning with function approximation, in Advances in Neural Information Processing Systems, Vol. 12, edited by S. Solla, T. Leen, and K. Müller (MIT Press, 1999).

[24] H. Risken, Fokker-planck equation, in The Fokker-Planck equation: methods of solution and applications (Springer, 1989) pp. 63–95.

[25] I. Karatzas and S. E. Shreve, Brownian Motion and Stochastic Calculus, 2nd ed., Graduate Texts in Mathematics, Vol. 113 (Springer, New York, 1991).

[26] K. Itô, On stochastic differential equations, Memoirs of the American Mathematical Society 4, 1 (1951).

[27] J. D. Joannopoulos, S. G. Johnson, J. N. Winn, and R. D. Meade, Photonic Crystals: Molding the Flow of Light, 2nd ed. (Princeton University Press, Princeton, NJ, 2008).

[28] L. Zhu, S. Sandhu, C. Otey, S. Fan, M. B. Sinclair, and J. A. Tsai, Temporal coupled mode theory for thermal emission from a single emitter, Applied Physics Letters 102, 103104 (2013).

[29] S. Li and L. Petzold, Adjoint sensitivity analysis for time-dependent partial differential equations with adaptive mesh refinement, Journal of Computational Physics 198, 310 (2004).

[30] E. B. Dynkin, Theory of Markov processes (Courier Corporation, 2012).

[31] L. Bottou, Large-scale machine learning with stochastic gradient descent, in Proceedings of COMPSTAT'2010 (Physica-Verlag HD, Heidelberg, 2010) pp. 177–186.

[32] L. P. Kaelbling, M. L. Littman, and A. R. Cassandra, Planning and acting in partially observable stochastic domains, Artificial intelligence 101, 99 (1998).

[33] L. Wang, X. Zhang, H. Su, and J. Zhu, A comprehensive survey of continual learning: Theory, method and application (2024), arXiv:2302.00487 [cs.LG].

[34] L.-J. Lin, Self-improving reactive agents based on reinforcement learning, planning and teaching, Machine Learning 8, 293 (1992).

[35] J. Baxter and P. L. Bartlett, Infinite-horizon policy-gradient estimation, Journal of Artificial Intelligence Research 15, 319 (2001).

[36] A. Keshvari, W. Tuxbury, and Z. Lin, Adaptive sensing beyond non-adaptive information limits: End-to-end co-design of geometry, policy, and inference (2026), arXiv:2604.25193 [physics.optics].

[37] S. Mohamed, M. Rosca, M. Figurnov, and A. Mnih, Monte carlo gradient estimation in machine learning, Journal of Machine Learning Research 21, 1 (2020).

[38] J. L. Nazareth, Conjugate gradient method, WIREs Computational Statistics 1, 348 (2009).

END MATTER