NeurIPS 2026 · Spotlight

Learned Lagrangian Models of PDEs via Euler–Lagrange Residual Minimization

Lyra Zhornyak1, Eric Forgoston2, M. Ani Hsieh1

1University of Pennsylvania  ·  2Montclair State University

A learned density simulates a 2D wave for 1,000 s. Existing methods break down within a tenth of that time.

The first variational integrator approach for learning and simulating PDEs with continuous Lagrangians, producing stable, long-horizon predictions from small neural models of physics primitives.

Forecasting needs stable iteration

Modern learned models capture the underlying physics with increasing accuracy. Yet most of the focus has been on producing better next-frame predictions, with strikingly little attention paid to how these models are used for tasks where forward integration plays a central role, e.g., forward simulation, prediction and forecasting, estimation and filtering.

This oversight matters because forecasting a system's behavior places different demands on the learned model than finding a solution does. While these two uses are closely related — knowing how to produce a good local solution does help forecasting — their objectives are distinct: solving demands local accuracy and sensitivity to the equations, while forecasting demands stability and bounded long-term error. For systems that conserve energy (waves, vibrations, orbits, etc.), this distinction is particularly important as even small per-step errors compound over long simulations, eventually producing solutions that violate conservation laws and become physically meaningless.

u(t) neural network u(t + Δt) + ε ε is unconstrained and re-enters the next step
The usual pipeline treats dynamics as regression: predict the next state, feed it back in, repeat.

Existing work has predominantly focused on producing better and better models of the dynamics, implicitly assuming that forecasting errors can be overcome by either more training or specialized architectures. This assumption fails most severely for chaotic systems and systems defined by partial differential equations (PDEs). Accumulated errors can violate the structure of the system, pushing a trajectory outside of the stable, learned regime, thereby causing a catastrophic failure in the prediction. Classical numerical analysis has long known that preserving structure can matter as much as per-step accuracy. For Hamiltonian and Lagrangian systems, symplectic integrators trade local fidelity for energy conservation and long-term stability. Despite this, most learned-physics methods treat the integrator as an implementation detail.

The Technical Details

Conceptually, Euler–Lagrange Minimization (ELM) separates what a system's physics are (the Lagrangian density) from how to simulate them (the variational integrator). Given a learned Lagrangian density \(\mathcal{L}\), we want to find the path \(q\) such that the action

\[ S[q] = \int_X \mathcal{L}\big(q, q_t, q_x\big)\,\mathrm{d}X \]

is stationary. As an example, for the 1D wave equation, \(\mathcal{L}(q, q_t, q_x) = \tfrac{1}{2}\mu\, q_t^2 - \tfrac{1}{2}c^2 q_x^2\). ELM is a minimization-based integrator designed for learned models, constructed at three scales. A local, pointwise residual measuring the deviation from the learned dynamics defines the error induced by a path approximated from a finite set of nodes. Starting from an initial guess, a damped Newton solve swept via Jacobi iteration across overlapping patches advances the global state without a coupled solve.

A small neural network: three inputs, two hidden layers, one output
\((q, q_t, q_x) \to\) network \(\to \mathcal{L}\)

LocalEuler–Lagrange residual

\[ R[q \mid (t,x)] \equiv \frac{\partial\mathcal{L}}{\partial q} - \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial\mathcal{L}}{\partial q_t} - \frac{\mathrm{d}}{\mathrm{d}x} \frac{\partial\mathcal{L}}{\partial q_x} \]

\(R=0\) is the Euler–Lagrange equation. Given an approximate path \(\hat{q}\), the squared Euler–Lagrange residual \(R^2[\hat{q} \mid (t,x)]\) is a measure of the deviation from the dynamics represented by \(\mathcal{L}\).

One patch: three known nodes at the current time, three unknown nodes at the next time, four sample points inside the shaded cell, faded neighbouring nodes on either side
● known · ○ unknown · × sample points

PatchHermite interpolation and patch error

\[ J(\mathcal{Q}, \mathcal{X}) \equiv \iint_{\mathrm{Conv}(\mathcal{X})} R^2[\hat{q} \mid (t,x)]\,\mathrm{d}t\,\mathrm{d}x \approx \sum_{i=1}^{n_\omega} \omega_i R^2\big[\hat{q} \mid (\tilde t_i, \tilde x_i)\big] \]

For a set of \(4m\) functions \(\mathcal{F}\), we construct a Hermite interpolation \(\hat{q}\) by fitting \(\mathcal{F}\) to this patch. We define the residual accumulated by this interpolation as the patch error, where \(\mathrm{Conv}(\mathcal{X})\) is the convex hull of \(\mathcal{X}\), from which we select \(n_\omega\) points \((\tilde t, \tilde x)\) and associated weights \(\omega\).

A row of seven nodes advanced one time step together, covered by overlapping shaded patches; an arrow points forward in time
Overlapping patches; arrow is one time step

GlobalDamped Newton sweeps

\[ \gamma^{(k+1)} = \gamma^{(k)} - \lambda \big(\nabla^2_\gamma J(\gamma^{(k)})\big)^{-1} \nabla_\gamma J(\gamma^{(k)}) \]

To advance the solution by one time step, we seek the node \(\gamma\) at a new coordinate \(\eta\) that minimizes the patch error given the known states. By minimizing the residual locally on overlapping patches, we bypass the global implicit solve inherent to fixed discretizations. Our method scales linearly with domain size via Jacobi iteration.

Structure and symplecticity

Unlike classical discrete methods that advance \(q \in Q\), ELM advances a state \((q, q_t)\) on the tangent bundle \(TQ\). From this state, the momentum is given by \(p = \partial\mathcal{L}/\partial q_t\) and the differential of the discrete action can be expressed as

\[ \mathrm{d}S_d = p(t_1)\,\mathrm{d}q(t_1) - p(t_0)\,\mathrm{d}q(t_0) + \sum_{i=1}^{n_\omega} \omega_i\, R[\hat{q} \mid \tilde t_i]\,\mathrm{d}\hat{q}(\tilde t_i) + \mathcal{O}(\Delta t^{2n_\omega + 1}). \]

When the Newton iteration converges such that \(J = 0\), \(R = 0\) at each Gauss–Legendre quadrature point and the update can be represented by a type-1 generating function to within quadrature error. For Lagrangians with a constant mass matrix, \(\mathcal{L} = \tfrac12 q_t^\top M q_t - V(q)\), the quadrature error vanishes exactly to result in a symplectic method. For PDE systems in this work, we oversample the quadrature, trading exact symplecticity for the stability of the patch solver.

We learn models that remain stable and conservative

Since every well-conditioned learned Lagrangian is a valid Lagrangian and represents some dynamics, the error in the learned model can only contribute to phase error while all energy drift is attributable to the integrator.

Chaotic double pendulum, 100,000 s

We compare ELM against four standard integrators with the same underlying learned model of the system. The non-symplectic methods (the classical Runge–Kutta (RK4) and Dormand–Prince) result in continual and steady energy accumulation. In contrast, symplectic methods conserve a discrete Hamiltonian, so while they do oscillate, they remain bounded over long time-scales. ELM matches the fourth-order Gauss–Legendre Runge–Kutta method (GLRK) since ELM is also a fourth-order method.

Relative energy error over 100,000 s on log-log axes: RK4 and Dormand–Prince grow steadily to 77% and 17%; implicit midpoint reaches a few percent; GLRK-4 and ELM stay bounded below 0.1%.

1D wave equation, 10,000 s

We compare the LNN wave model against ELM on a 1D wave equation, both using learned Lagrangians with equivalent architectures. LNN learns on a fixed discretization while ELM learns the continuous Lagrangian density. Even at the coarsest settings, ELM maintains discernible and symmetric wavefronts.

ELM shows several orders of magnitude improvement in energy conservation, improving with smaller step size, while LNN sees diminishing returns.

Relative energy error over 224 periods: both LNN step sizes grow past 100%; ELM at n = 21, 31 and 51 stays below 22%, 5% and 2%.

2D wave equation, 1,000 s

Relative energy error over 1000 s: FNO leaves the plot within about 11 s and diverges at 22 s, PDE-Refiner saturates near 300%, ELM stays between about 1% and 20%.

ELM tracks the ground truth with only minor phase drift and energy loss, while both FNO and PDE-Refiner drift within the first 20 s. While PDE-Refiner fails more gracefully than FNO, it still falls into a non-physical global oscillation. ELM achieves better overall accuracy and energy conservation with 78,000 times fewer model parameters than PDE-Refiner.

To the best of our knowledge, this is the first work to simulate a PDE with two spatial dimensions using a learned Lagrangian density over long time-horizons. The rollout is shown in the video at the top of the page.

19%ELM energy error at 1,000 s
271%PDE-Refiner energy error at 1,000 s
78,000×fewer parameters than PDE-Refiner

One trained model transfers to new domains

Since learned continuous Lagrangians are pointwise, models compose and transfer to new domains without retraining.

Impedance interface (1D)

Suppose we have two learned Lagrangians independently trained on separate homogeneous media with different wave speeds and we want to explore what happens when they are joined. Here, we represent the transition as a sharp sigmoid blend between the two Lagrangians at \(x = 1\). The wave partially reflects and partially transmits at the interface, exactly as waves behave when they hit an impedance barrier.

\[ \mathcal{L}(x) = \big(1 - \sigma(x)\big)\,\mathcal{L}_1 + \sigma(x)\,\mathcal{L}_2 \]

Double slit (2D)

The same flexibility extends to 2D. A driven wave hits a barrier with two slits, producing interference fringes. This uses the identical model from the 2D wave; barriers, slits, and driven boundaries are enforced purely through constraints on the degrees of freedom.

The operator baselines have no comparable method for transferring to this domain.

Ongoing work: a faster symplectic step

With a small modification to the method, we can formally prove symplecticity for the class of PDEs we examine. Using the same frozen models on the same hardware, the modified step runs faster per step, and the 2D energy error stays flat instead of growing. More details will be available in upcoming work.

20.6×faster per step on the 2D wave (968 → 47 ms)
5.5–6.4×faster per step on the 1D wave
0.058%max 2D energy error over 1,000 s
2D wave relative energy error over 1000 s: published ELM rises to about 20%, modified ELM stays flat near 0.03%; PDE-Refiner saturates near 300% and FNO diverges.

The Takeaway

A learned continuous Lagrangian with local minimization can compose and transfer across domains without retraining, acting as a physics primitive. Operator-based methods, which fuse dynamics with discretization, cannot transfer this way.

We argue that the integrator deserves the same care as the model to achieve flexible physics-learning systems. ELM offers a starting point for learned models that can be deployed, constrained, and combined at inference time rather than retrained per scenario.

BibTeX

@inproceedings{zhornyak2026elm,
  title     = {Learned Lagrangian Models of {PDEs} via
               {Euler--Lagrange} Residual Minimization},
  author    = {Zhornyak, Lyra and Forgoston, Eric and Hsieh, M. Ani},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2026}
}