Action Learning for Scientific Simulations

1Kempner Institute 2Harvard University 3Microsoft Research New England

TLDR: We introduce action learning, which treats the stochastic action of a system as the learning target and recovers it from trajectory samples as a differentiable path space objective, reusable for inference, steering and sampling without retraining.

Observed paths come from the true dynamics of a toy landscape, and the last step uses the action LEAP learned from them.

Abstract

Understanding and controlling how systems evolve is central to science and engineering, where many problems require reasoning about complete trajectories. Existing approaches typically learn local dynamics or generate trajectories, but objectives constructed from individual transitions can miss dependencies across time, while generative models do not necessarily provide a tractable objective for evaluating and optimizing arbitrary paths. We study action learning, the problem of recovering a stochastic action from trajectory observations, yielding a common objective for reasoning about dynamical systems. We introduce LEAP (Learned Energy on Action Paths), which anchors the unknown action to a tractable reference process and learns the remaining correction by comparing observed trajectories with reference trajectories. This construction yields a differentiable objective on path space that can capture both local dynamical structure and nonadditive dependencies across time. Once learned, the same action can be flexibly reused for path ranking and inference, mechanism steering, constrained optimization and sampling. Across stochastic physical systems, many-body orbital dynamics and molecular simulations, LEAP recovers underlying dynamics, captures dependencies across time and enables transfer across inference objectives and physical conditions. We show that action learning is a promising framework for turning trajectory observations into reusable objectives for scientific inference and control.

From Trajectory Samples to Path Inference

Many scientific questions concern whole trajectories, such as which route a molecule takes between two conformations, which intermediates a transition passes through or which paths stay likely once we add a constraint, and answering them requires a way to evaluate and optimize complete paths. When the dynamics are known, the Onsager–Machlup action provides exactly this, assigning every complete trajectory a cost whose minimizers are the most probable paths and whose main term, for a diffusion, accumulates how far the velocity departs from the drift.

In most applications the dynamics are unknown, and what we have are trajectories from simulation or experiment. Learned models typically fit a one step predictor or a trajectory generator to such data, which produce new paths and leave the cost of any given path implicit. We call the task of recovering such an evaluable action from trajectory samples action learning. Its premise is that the action is the natural object to learn from trajectory data, since once it is learned, every question about paths becomes a problem on one fixed objective.

Local dynamics learning, with paths assembled from local transitions between basins A and B.

(a) Local dynamics learning from transition laws

Action learning, with complete paths from A to B compared as wholes.

(b) Action learning from complete paths

Learning Action Functionals from Trajectory Samples

Main Idea

LEAP learns the action from trajectory samples and a reference process alone, with no access to the drift, the potential or the simulator likelihood. Our approach rests on three observations about a discretized trajectory \(\Phi = (x_0, x_1, \dots, x_N)\) at times \(t_k = k\Delta t\), observed under a context \(c\) such as endpoints, a terminal region or a horizon.

  1. Following Onsager–Machlup and Freidlin–Wentzell theory, we take the action of a trajectory to be its negative log path density, so lower action means higher probability,
    \[ S^*(\Phi;c) \;=\; -\log p_{\mathrm{data}}(\Phi \mid c) \;+\; \alpha(c), \]
    where \(\alpha(c)\) is constant across paths with the same context.
  2. A reference process such as Brownian motion has a path density we can evaluate and sample, so with \(S_{\mathrm{ref}} = -\log p_{\mathrm{ref}}\) the unknown action splits into a reference action we can compute and a path log ratio we must learn,
    \[ S^*(\Phi;c) \;=\; \underbrace{S_{\mathrm{ref}}(\Phi;c)}_{\text{reference action}} \;-\; \underbrace{G^*(\Phi;c)}_{\log p_{\mathrm{data}}/p_{\mathrm{ref}}} \;+\; \alpha(c). \]
  3. A path log ratio can be learned by comparison, since up to a constant per context it is what the optimal classifier computes when it picks out the observed trajectory from reference trajectories of the same context.

Then, at a high level, LEAP draws one observed trajectory \(\Phi^+ \sim p_{\mathrm{data}}(\cdot \mid c)\) and \(K\) reference trajectories \(\Phi^-_k \sim p_{\mathrm{ref}}(\cdot \mid c)\) from the same context and trains \(G_\theta\) to pick out the observed one by minimizing the comparison objective

\[ \mathcal{L}_K(\theta) \;=\; -\,\mathbb{E}\left[\log \frac{e^{G_\theta(\Phi^+;c)}}{e^{G_\theta(\Phi^+;c)} + \sum_{k=1}^{K} e^{G_\theta(\Phi^-_k;c)}}\right]. \]

Two properties of trajectory data shape how we choose the reference and parameterize \(G_\theta\), and the first two experiments below test each of them.

Learning on Paths

To see why comparison recovers the action, consider what the optimal classifier computes. When the observed trajectory sits at a uniformly random index \(I\) among the \(K+1\) candidates, Bayes' rule gives a softmax over the true path log ratios,

\[ P(I = i \mid \Phi_{0:K}, c) \;=\; \frac{p_{\mathrm{data}}(\Phi_i \mid c)/p_{\mathrm{ref}}(\Phi_i \mid c)}{\sum_{\ell=0}^{K} p_{\mathrm{data}}(\Phi_\ell \mid c)/p_{\mathrm{ref}}(\Phi_\ell \mid c)} \;=\; \frac{e^{G^*(\Phi_i;c)}}{\sum_{\ell=0}^{K} e^{G^*(\Phi_\ell;c)}}. \]
\[ \begin{aligned} P(I = i \mid \Phi_{0:K}, c) &= \frac{p_{\mathrm{data}}(\Phi_i \mid c)/p_{\mathrm{ref}}(\Phi_i \mid c)}{\sum_{\ell=0}^{K} p_{\mathrm{data}}(\Phi_\ell \mid c)/p_{\mathrm{ref}}(\Phi_\ell \mid c)} \\ &= \frac{e^{G^*(\Phi_i;c)}}{\sum_{\ell=0}^{K} e^{G^*(\Phi_\ell;c)}}. \end{aligned} \]

When the candidates are drawn independently, the data and reference densities share their support and the model class contains \(G^*\), the objective is minimized exactly when the model's softmax matches this posterior, at \(G_\theta = G^* + a(c)\) for every \(K \ge 1\). Centering under the reference fixes the free constant, and the learned action

\[ S_\theta(\Phi;c) \;=\; -\log p_{\mathrm{ref}}(\Phi \mid c) \;-\; \tilde G_\theta(\Phi;c), \qquad \tilde G_\theta(\Phi;c) \;=\; G_\theta(\Phi;c) - \mathbb{E}_{\Phi' \sim p_{\mathrm{ref}}(\cdot \mid c)}\big[G_\theta(\Phi';c)\big], \]
\[ \begin{aligned} S_\theta(\Phi;c) &= -\log p_{\mathrm{ref}}(\Phi \mid c) - \tilde G_\theta(\Phi;c), \\ \tilde G_\theta(\Phi;c) &= G_\theta(\Phi;c) - \mathbb{E}_{\Phi' \sim p_{\mathrm{ref}}(\cdot \mid c)}\big[G_\theta(\Phi';c)\big], \end{aligned} \]

equals \(S^*\) up to a constant per context, which leaves path rankings, optimization solutions and Metropolis–Hastings ratios unchanged.

The Girsanov Form

The objective leaves the form of \(G_\theta\) open, and for Markov dynamics the reference suggests a form whose learned part is a drift correction. We use a Gaussian Markov reference, \(x_{k+1} = x_k + b_{\mathrm{ref}}(x_k,t_k;c)\,\Delta t + \sqrt{2D\Delta t}\,\xi_k\) with \(\xi_k \sim \mathcal{N}(0, I)\), whose transition law is analytic. When the data also follow Euler–Maruyama dynamics with the same diffusion \(D\), initial law and time grid, differing only in drift, \(b_{\mathrm{data}} = b_{\mathrm{ref}} + u^*\), LEAP parameterizes the path log ratio in its Girsanov form, with \(v_k = (x_{k+1} - x_k)/\Delta t\) and \(u_\theta\) parameterizing the drift difference,

\[ G_\theta(\Phi;c) \;=\; \sum_{k=0}^{N-1} \Big[\underbrace{\tfrac{1}{2D}\,u_\theta(x_k,t_k;c)^{\top}\big(v_k - b_{\mathrm{ref}}(x_k,t_k;c)\big)}_{\text{velocity alignment}} \;-\; \underbrace{\tfrac{1}{4D}\,\|u_\theta(x_k,t_k;c)\|^2}_{\text{normalization cost}}\Big]\,\Delta t. \]
\[ \begin{aligned} G_\theta(\Phi;c) = \sum_{k=0}^{N-1} \Big[ &\tfrac{1}{2D}\,u_\theta(x_k,t_k;c)^{\top}\big(v_k - b_{\mathrm{ref}}(x_k,t_k;c)\big) \\ &- \tfrac{1}{4D}\,\|u_\theta(x_k,t_k;c)\|^2 \Big]\,\Delta t. \end{aligned} \]

Each term involves one transition, while \(u_\theta\) is fit by comparing complete paths, which is what lets LEAP handle selected trajectories in the first experiment below. At \(u_\theta = u^*\) this is the exact path log likelihood ratio, and for a fixed initial state the data action is, up to a constant \(C_{\mathrm{EM}}(c)\), the Euler–Maruyama action of the data drift,

\[ S_{\mathrm{ref}}(\Phi;c) - G^*(\Phi;c) \;=\; C_{\mathrm{EM}}(c) \;+\; \sum_{k=0}^{N-1} \frac{\Delta t}{4D}\,\big\|v_k - b_{\mathrm{data}}(x_k,t_k;c)\big\|^2. \]
\[ \begin{aligned} S_{\mathrm{ref}}(\Phi;c) - G^*(\Phi;c) &= C_{\mathrm{EM}}(c) \\ &\quad + \sum_{k=0}^{N-1} \frac{\Delta t}{4D}\,\big\|v_k - b_{\mathrm{data}}(x_k,t_k;c)\big\|^2. \end{aligned} \]

Because the path KL divergence between two such processes is a sum of expected squared drift differences along the path, matching the unselected trajectory distribution identifies the drift at every visited state and time. For conservative systems we parameterize the total drift as \(-\nabla U_\theta\), so LEAP also returns a learned potential.

Local and Global Path Functionals

The Girsanov form adds one term per transition, and LEAP-Local more generally learns a scalar term for each transition,

\[ G^{\mathrm{local}}_\theta(\Phi;c) \;=\; \sum_{k=0}^{N-1} g_\theta(x_k, x_{k+1}, t_k; c). \]

When information persists along the whole path, this factorization can fail, so LEAP-Global learns the path log ratio on the complete path, \(G^{\mathrm{global}}_\theta(\Phi;c) = r_\theta(\Phi;c)\).

Downstream Trajectory Inference

With the learned action in hand, each downstream question becomes a problem on path space. The same \(S_\theta\) ranks candidate paths, infers representative trajectories, incorporates mechanism preferences, imposes soft constraints and defines trajectory distributions, and preferences \(M_j\) and penalties \(C_\ell\) simply add to it,

\[ \pi(\Phi \mid c) \;\propto\; \exp\Big(-S_\theta(\Phi;c) + \sum_j \gamma_j M_j(\Phi) - \sum_\ell \lambda_\ell C_\ell(\Phi)\Big), \]

so each new request changes the inference problem without retraining the model. Errors in the learned action also stay controlled, since an action within \(\varepsilon\) of the true one up to a constant keeps its minimizers within \(2\varepsilon\) of optimal under the true action.

All four panels use one learned action. Dashed paths omit the added term, and the red disc can be dragged.

Recovering Dynamics under Terminal Selection

We first study whether LEAP can recover underlying dynamics from trajectories selected according to their final states. When observed and reference trajectories are conditioned on the same event \(E\), their path log density ratio differs from the original ratio only by a constant,

\[ \log \frac{p_{\mathrm{data}}(\Phi \mid E, c)}{p_{\mathrm{ref}}(\Phi \mid E, c)} \;=\; \log \frac{p_{\mathrm{data}}(\Phi \mid c)}{p_{\mathrm{ref}}(\Phi \mid c)} \;+\; \log \frac{P_{\mathrm{ref}}(E \mid c)}{P_{\mathrm{data}}(E \mid c)}, \]
\[ \begin{aligned} \log \frac{p_{\mathrm{data}}(\Phi \mid E, c)}{p_{\mathrm{ref}}(\Phi \mid E, c)} &= \log \frac{p_{\mathrm{data}}(\Phi \mid c)}{p_{\mathrm{ref}}(\Phi \mid c)} \\ &\quad + \log \frac{P_{\mathrm{ref}}(E \mid c)}{P_{\mathrm{data}}(E \mid c)}, \end{aligned} \]

although conditioning changes the local transition distributions. We demonstrate this in a double well system with drift \(b(x) = x - x^3\), using trajectories that start in the left well and end near the right well. Cubic regression learns the modified local dynamics despite containing the true drift in its function class, resulting in drift MSE 0.7752. In contrast, LEAP uses a Brownian reference conditioned on the same final region and recovers the original drift with MSE \(3.3 \times 10^{-4}\). The learned action also supports path inference under new endpoints and horizons without retraining.

We simulate paths live from the SDE and show the LEAP and cubic regression drifts over three seeds.

Recovering a Nonadditive Trajectory Action

Next, we test whether LEAP can capture dependencies that extend across multiple transitions. In a 31 body orbital system, an unobserved variable \(z \in \{-1, +1\}\) is sampled once per trajectory and determines the solar mass \(m_\odot(1 + z\eta)\). Marginalizing this variable produces an exact path correction,

\[ G^*(\Phi;c) \;=\; \sum_k m_k \;+\; \log\cosh A, \qquad A = \sum_k d_k, \]

that contains a nonlinear interaction between transitions and cannot be represented as a sum of individual transition terms. LEAP-Local therefore misses the exact correction, while LEAP-Global uses information from the entire trajectory and recovers the mass perturbation as \(1.02 \times 10^{-4}\), compared with the true value \(1.04 \times 10^{-4}\). The advantage of the global model persists for larger systems with up to 42 bodies and 256 transitions.

Path colors mark the hidden \(z\), which LEAP never sees, and LEAP-Global follows the exact \(\log\cosh A\).

Reusing Learned Actions across Conditions and Objectives

Finally, we test whether one learned action can be reused across physical conditions and inference objectives. We learn this action for alanine dipeptide in its backbone angles \((\phi, \psi)\) from reactive C7eq → C7ax trajectories simulated at 600 K, a reduced description whose effective dynamics are not available in closed form. Keeping this action fixed, we complete paths from a few observed states and add basin preferences and angular constraints. With a reference fit to 500 K trajectories, the log ratio learned at 600 K also separates 500 K paths from that reference at least as well as a model trained at 500 K.

LEAP paths from the paper on the 600 K free energy, with the molecule drawn at the angles of the preference and bound paths.

Conclusion

Treating the stochastic action as a reusable learning target lets LEAP recover the dynamics behind selected trajectories, capture dependencies that span the whole trajectory and serve many inference problems with one learned action. This only requires trajectory samples and a reference that can be sampled, has an evaluable path density and covers the data, so beyond the physical and molecular systems tested here it can extend to robot trajectories and logged agent rollouts, where a learned action can help analyze and steer behavior. Looking forward, we hope action learning encourages a broader view of trajectory modeling that shifts the focus to learning reusable objectives over complete paths.

Limitations

BibTeX

@misc{liaw2026actionlearningscientificsimulations,
      title={Action Learning for Scientific Simulations},
      author={Sarah Liaw and Yuanqi Du and Yilun Du},
      year={2026},
      eprint={2610.31585},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2610.31585},
}