Abstract
Standard neural networks often struggle to model physical systems accurately over long periods because they do not inherently respect conservation laws. While Hamiltonian Neural Networks (HNNs) were designed to address this, they are limited by the requirement for "canonical coordinates," which are often unknown in real-world observations. Lagrangian Neural Networks (LNNs) provide a more flexible alternative by learning the system's Lagrangian directly from generalized coordinates. By leveraging automatic differentiation to solve the Euler-Lagrange equations, LNNs can model a wide variety of systems—including double pendulums and relativistic particles—while maintaining strict energy conservation.
Introduction: The "Physics-Blind" AI Problem
Standard neural networks are powerful pattern recognizers but often lack an understanding of the underlying physical laws governing a system. When trained to predict the motion of a pendulum, a vanilla network might produce visually plausible results in the short term, but it inevitably accumulates errors that lead to energy gain or loss, causing the simulation to drift into non-physical states.
Previous attempts to solve this, such as Hamiltonian Neural Networks (HNNs), require inputs to be in canonical coordinates (position $q$ and conjugate momentum $p$). However, in many practical scenarios, we only have access to raw observations like angles and velocities. If the coordinates are not perfectly canonical, HNNs fail to generalize. Lagrangian Neural Networks (LNNs) aim to provide the benefits of physics-informed learning without these restrictive coordinate requirements.
Methodology: The Lagrangian Framework
The core innovation of LNNs is the use of the Lagrangian formalism, where a system's state is described by a single scalar function: the Lagrangian ($L = T - V$, the difference between kinetic and potential energy).
- Network Architecture: Instead of directly predicting the next state, the neural network is trained to represent the scalar Lagrangian function $L(q, \dot{q})$.
- The Euler-Lagrange Equation: The actual motion of the system is derived by applying the Euler-Lagrange equation to the learned Lagrangian.
- The Hessian Trick: Since the network is a black box, the authors use automatic differentiation to compute the Hessian of the Lagrangian with respect to velocity. By inverting this Hessian, they can numerically solve for the system's acceleration ($\ddot{q}$).
- Implementation: To ensure stable derivatives, the researchers replaced standard ReLU activations with
softplusand developed a custom weight initialization scheme suited for the non-linear landscape of Lagrangian optimization.
Experimental Evaluation
The authors evaluated LNNs against standard baselines and HNNs across several physical simulations:
- Double Pendulum: In this chaotic system, LNNs significantly outperformed baseline models. The LNN reduced energy drift to just 0.4% of the maximum potential energy, whereas the baseline drifted by 8%.
- Relativistic Particles: LNNs successfully learned the non-Newtonian dynamics of special relativity. While HNNs failed when given non-canonical coordinates, LNNs matched the performance of an HNN that was "cheating" with perfect coordinate information.
- Wave Equations: By treating a grid of points as a graph, a "Lagrangian Graph Network" (LGN) successfully modeled wave propagation, demonstrating the framework's scalability to multi-body systems.
Discussion and Future Directions
LNNs offer a significant advantage through coordinate agnosticism. Because the Lagrangian framework is naturally independent of the specific coordinate system used, LNNs can learn from any generalized coordinates. Furthermore, energy conservation is not explicitly programmed but emerges as a mathematical necessity of the framework.
Despite these strengths, the approach has limitations. Solving for acceleration requires inverting a Hessian matrix, which can be computationally expensive for high-dimensional systems. Additionally, the current framework assumes conservative systems; extending LNNs to handle non-conservative forces like friction or external driving forces remains an area for future research.
Summary updated