Learned Lagrangian Models of PDEs via Euler–Lagrange Residual Minimization

Lyra Zhornyak, Eric Forgoston, M. Ani Hsieh

TL;DR

Machine learning models can learn the laws of physics from data, yet when asked to predict a system’s future over long timescales, they often violate energy conservation and blow up. This paper introduces Euler–Lagrange Minimization (ELM), a structure-preserving numerical integrator that pairs with learned continuous Lagrangians to simulate partial differential equations (PDEs) stably over thousands of steps. Because ELM decouples what the physics are from how we simulate them, a single model trained on simple data can generalize to new geometries, boundaries, and mixed materials—like a classic double-slit experiment—without any retraining.

What Problem Does This Paper Address?

Imagine trying to forecast the ripples on a pond or the swing of a pendulum. Finding a good local approximation of the governing equations is one thing; stepping that model forward thousands of times in a row is another. In conservative physical systems (waves, orbits, vibrations), tiny integration errors at each step compound over time. Standard neural operators (like FNO) implicitly fuse the system's dynamics with a fixed spatial grid and time-stepper. Over long rollouts, this causes energy to drift artificially, leading to physically meaningless explosions or decay.

Classical numerical analysis solved this decades ago using variational or symplectic integrators—time-steppers geometrically designed to keep energy bounded. However, building a classical variational integrator for PDEs requires symbolically manipulating equations, which you can't do when your physics model is a black-box neural network. Previous attempts to bridge this gap either worked only for simple ordinary differential equations (ODEs) or baked a fixed grid into the network, requiring massive, slow global calculations at every step.

Methods

Instead of discretizing the equations before learning, the authors learn a continuous, pointwise Lagrangian density (essentially kinetic minus potential energy at a point in space-time) using a standard neural network, and introduce ELM to step it forward. ELM operates across three scales:

Figure 1: The construction of ELM at three scales. Local: the squared Euler–Lagrange residual R2 is computed from the learned Lagrangian L and evaluated at nω quadrature points. Patch: Hermite interpolation fits a set of basis functions to known node states to form ˆq. The resulting residuals are summed to form the patch error J. Global: an initial estimate γ(0) is refined by damped Newton iteration using J; iterating nr times around the loop advances the solution by one time step.
  1. Local Scale: Nature follows the path of stationary action, mathematically expressed by the Euler–Lagrange equation equaling zero. ELM evaluates how badly a candidate path violates this law by computing the squared Euler–Lagrange residual ($R^2$) directly from the learned network via automatic differentiation.
  2. Patch Scale: Rather than solving the entire spatial grid at once, ELM breaks space-time into small, overlapping local patches. It fits smooth polynomial curves (Hermite interpolations) to known node states and sums $R^2$ at selected quadrature points to measure total "patch error."
  3. Global Scale: To advance one time step, ELM tweaks the future state estimates to drive the patch error to zero using damped Newton iterations swept across the patches via Jacobi iteration. Because patches are solved locally, computation scales linearly with domain size, and boundary conditions (walls, driven edges) become simple constraints on the optimized variables.

Datasets

Rather than relying on static external benchmarks, the authors train and evaluate on simulated physical trajectories across three conservative systems of increasing complexity (exact training generation parameters are deferred to the appendices, with code publicly released):

  • Chaotic Double Pendulum (ODE): A classic nonlinear, coupled benchmark evaluated over 100,000 seconds.
  • 1D Wave Equation (PDE): Simulated with Gaussian initial conditions and periodic boundaries over 10,000 seconds, plus a heterogeneous test abutting two media with different wave speeds.
  • 2D Wave Equation (PDE): Simulated on a 2D domain with Dirichlet boundaries over 1,000 seconds (~350 wave periods), alongside a novel zero-shot transfer setup featuring a driven wave hitting a double-slit barrier with absorbing boundaries.

Key Insights and Ideas

  • Decoupling Model Error from Integration Error: Every well-conditioned neural network outputting a scalar represents some valid Lagrangian. Therefore, imperfections in the learned network only cause the wave to move at a slightly wrong speed (phase error), while all energy drift comes strictly from the integrator. Fixing the integrator keeps simulations physically sane even with imperfect models.
  • Learned Models as Composable "Physics Primitives": Because the learned Lagrangian is purely pointwise and discretization-agnostic, you can change spatial resolution at test time, stitch two separately trained material models together to get realistic wave reflection/transmission, or drop walls into a 2D domain to get diffraction—all without retraining.
  • Trading Exact Symplecticity for PDE Stability: While ELM is provably symplectic for constant-mass ODEs when the residual hits zero, in 2D PDEs the authors intentionally oversample quadrature points. This trades away strict mathematical symplecticity in exchange for numerical stability during local patch solves, while still keeping energy remarkably bounded.

Key Results

  • Double Pendulum: Over a 100,000 s rollout, non-symplectic solvers (RK4, Dormand–Prince) steadily accumulate energy error, whereas ELM keeps relative energy error bounded around $10^{-5}$ to $10^{-4}$, matching the gold-standard 4th-order Gauss–Legendre Runge–Kutta symplectic integrator.
  • 1D Wave: Over 10,000 s, ELM lowers relative energy error by orders of magnitude compared to Lagrangian Neural Networks (LNNs) and improves spatial accuracy as grid resolution increases, whereas LNNs hit an error ceiling due to their fixed learned discretization.
1D wave equation comparisons showing ELM maintaining crisp wavefronts, orders-of-magnitude lower energy error, and cleaner spatial profiles than LNN over long horizons.
  • 2D Wave: In the first long-horizon 2D PDE simulation using a learned continuous Lagrangian, FNO diverges completely at $t \approx 22\text{ s}$ and PDE-Refiner devolves into non-physical global oscillations. ELM tracks the ground truth for the full 1,000 s—using 78,000$\times$ fewer parameters than PDE-Refiner.
  • Zero-Shot Boundary Generalization: Abutting two 1D wave models yields partial reflection/transmission with only ~1% energy drift over 20 s. Taking the homogeneous 2D wave model and constraining nodes to form a double-slit barrier produces textbook interference fringes within ~6% of theoretical Fraunhofer minima.

Limitations and Future Work

ELM is computationally heavier per time step than standard explicit integrators, especially for ODEs where classical symplectic methods already exist. Furthermore, the local Jacobi sweeps converge slowly when systems are strongly coupled or when patches heavily overlap in higher dimensions. Currently, the formulation only supports Lagrangians with first-order derivatives (ruling out fourth-order PDEs like Euler–Bernoulli beam mechanics), and its stability guarantees do not yet cover strong derivative nonlinearities. Future work aims to extend this local minimization framework to dissipative (energy-losing) systems, higher-order field theories, and adaptive mesh refinement.

Summary updated

Abstract

We present the first method to directly use a learned continuous Lagrangian to forecast the dynamics of systems governed by partial differential equations, exploiting the inherent conservative structure to achieve stable long-range predictions. We develop an integrator that minimizes the squared Euler–Lagrange residual via a discretization-agnostic, structure-preserving construction on local space-time patches. Different from integrators for analytical models, integrators for learned models should decouple model error (phase error) from integration error (conservation error). By minimizing the residual locally on overlapping patches, we bypass the global implicit solve inherent to fixed discretizations, which slows time- and space-stepping and complicates learning. Our method scales linearly with domain size via Jacobi iteration, and places no structural requirements on the learned network, allowing it to be coupled with existing physics-guided machine learning (ML) methods. We validate our approach on a learned representation of a double pendulum, a one-dimensional wave equation, and a two-dimensional wave equation. Our method achieves long-horizon predictions with error comparable to classical symplectic methods while generalizing to spatially varying dynamics and arbitrary boundary conditions without retraining.
BibTeX
@inproceedings{zhornyak2026learned,
  author = {Lyra Zhornyak and Eric Forgoston and M. Ani Hsieh},
  title = {{Learned Lagrangian Models of PDEs via Euler–Lagrange Residual Minimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=clkBSNjrrR},
}
Figure