Learning mechanical systems from real-world data using discrete forced Lagrangian dynamics

Martine Dyring Hansen, Elena Celledoni, Benjamin K Tapley · Submission to NeurIPS 2025 · Rejected

TL;DR

The Discrete Forced Lagrangian Neural Network (DFLNN) learns the equations of motion for dissipative mechanical systems directly from sequential position measurements without needing velocity or momentum data. By discretizing the continuous Lagrange–d'Alembert principle, DFLNN naturally preserves symplectic structure in unforced regimes, stably handles real-world tracking and image data, and cleanly decouples conservative dynamics from external dissipation.

What Problem Does This Paper Address?

Physics-informed architectures like Hamiltonian and Lagrangian Neural Networks (HNNs and LNNs) embed conservation laws into deep learning models, enabling exceptional sample efficiency and long-term rollout stability. However, they share a critical practical vulnerability: they require access to instantaneous velocity or momentum.

In real-world settings—such as computer vision (video frames) or motion capture—sensors record only coordinates or pixels. Differentiating noisy position sequences via finite differences to estimate velocities introduces severe truncation error and noise amplification. Furthermore, classical HNNs/LNNs assume strictly conservative (energy-preserving) dynamics, failing to capture ubiquitous non-conservative effects like friction, damping, or active control forces.

Methods

Instead of differentiating continuous Euler–Lagrange equations with estimated velocities, the authors leverage discrete mechanics and variational integrators:

  • Discrete Lagrange–d'Alembert (dLDA) Principle: The continuous variational principle is discretized over time steps $h$ using a midpoint rule. The resulting discrete forced Euler–Lagrange equations act on local position triplets $(q_{n-1}, q_n, q_{n+1})$.
  • Decomposed Architecture:
  • The Lagrangian $L_\theta$ is parameterized as a neural network (often structured in mechanical form $T - U$ with a positive-definite mass matrix via Cholesky decomposition).
  • External/dissipative forces $F_\theta$ are learned as an independent network (e.g., a general MLP with dropout regularization, or a Rayleigh dissipation function $-K_\theta(q)\dot{q}$).
  • Hessian Regularization ($\mathcal{L}_{\text{reg}}$): To prevent trivial solutions (such as learning a constant Lagrangian where derivatives vanish), a log-barrier penalty ensures that the Hessian matrix $S = \partial^2 L / \partial \dot{q}^2$ remains regular and invertible.
  • Latent Dynamics via Autoencoders: For high-dimensional data (e.g., pixel images or multi-joint skeletons), convolutional or dense autoencoders embed positions into a low-dimensional latent space $z \in \mathbb{R}^l$, where the dLDA loss is enforced end-to-end alongside the reconstruction loss.
  • Prediction Workflow: At test time, given two initial positions $\{q_0, q_1\}$, forward simulation is performed step-by-step by solving the discrete root-finding problem $E_d(q_{n-1}, q_n, \hat{q}_{n+1}) = 0$ for $\hat{q}_{n+1}$.

Datasets

The authors evaluate DFLNN against Neural ODEs and Generalized Lagrangian Neural Networks (GLNN) across four setups:

  1. Damped Double Pendulum: Synthetic angular trajectories with injected Gaussian noise ($\sigma^2 = 10^{-2}h$).
  2. Dissipative Charged Particle in a Magnetic Field: Synthetic 3D Cartesian coordinates with velocity-dependent generalized potentials.
  3. Pixel Damped Pendulum: Grayscale visual frames ($50 \times 30$) rendered using Gymnasium's Pendulum-v1 with added damping, mapped into a 1D latent space.
  4. CMU Motion Capture (Real-World): Real 3D skeletal data of a human swinging from a bar (Subject 43, trials 2 and 3; 10 linked joints mapped to a 6D latent space).

Key Insights and Ideas

  • Bypassing Numerical Differentiation: Operating directly on discrete action sums rather than differential equations eliminates finite-difference approximations of velocity from the training pipeline.
  • True Disentanglement of Dissipation: Because conservative and dissipative dynamics are modeled modularly ($L_\theta$ and $F_\theta$), one can turn off $F_\theta$ at test time to simulate the ideal, unforced counterpart. DFLNN accurately extrapolates to the conservative regime despite only seeing damped data.
  • Symplectic Structure Retention: In the limit where non-conservative forces vanish, the midpoint dLDA formulation naturally collapses into a variational integrator, guaranteeing near-conservation of energy and symplectic structure over long rollouts.

Key Results

At evaluation step $k = 35$, DFLNN dramatically outperformed baselines on long rollouts and non-conservative tasks:

  • Task 1 (Double Pendulum): DFLNN achieved an extrapolation error of $0.051 \pm 0.022$, matching Neural ODE ($0.050 \pm 0.034$) while GLNN degraded ($0.42 \pm 0.19$). In conservative extrapolation, DFLNN maintained bounded orbits while baselines diverged.
  • Task 2 (Charged Particle): DFLNN reached an error of $0.0072 \pm 0.0029$, beating Neural ODE ($0.041 \pm 0.015$) and GLNN ($4.0 \cdot 10^7$).
  • Task 3 (Pixel Pendulum): Evaluated with a Harris corner/Dice coefficient metric on edge maps, DFLNN achieved $0.0030 \pm 0.0019$ compared to $\approx 0.022$ for both baselines.
  • Task 4 (Human MoCap): DFLNN yielded an error of $11.75 \pm 10.89$, while Neural ODE exploded ($2.4 \cdot 10^7$) and GLNN produced NaN. Beyond the 60-frame training window, DFLNN rollouts remained physically stable.

Limitations and Future Work

  • Implicit Root Solving at Inference: Because discrete Euler–Lagrange equations are implicit, stepping forward requires numerical root-finding (e.g., Newton's method) at every step, which is computationally heavier than explicit ODE integrators.
  • Local Segment Independence: The standard training objective only scores local triplets $(q_{n-1}, q_n, q_{n+1})$, ignoring longer-range temporal dependencies during gradient updates.
  • Structural Priors: While the model accommodates generic MLPs, peak stability still benefits from architectural assumptions (such as mechanical-form kinetic energy or Rayleigh dissipation).

Summary updated

BibTeX
@misc{hansen2025learning,
  author = {Martine Dyring Hansen and Elena Celledoni and Benjamin K Tapley},
  title = {{Learning mechanical systems from real-world data using discrete forced Lagrangian dynamics}},
  year = {2025},
  eprint = {2505.20370},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.20370},
}
Figure