Lagrangian Neural Networks

Miles Cranmer, Sam Greydanus, Stephan Hoyer, Peter Battaglia, David Spergel +1 more
3/10/2020
cs.LGmath.DSphysics.comp-ph

Official code: MilesCranmer/lagrangian_nns (575 stars, Python, Apache-2.0, last commit 2025-09-24).

Abstract

Accurate models of the world are built upon notions of its underlying symmetries. In physics, these symmetries correspond to conservation laws, such as for energy and momentum.

Show full abstract

Yet even though neural network models see increasing use in the physical sciences, they struggle to learn these symmetries. In this paper, we propose Lagrangian Neural Networks (LNNs), which can parameterize arbitrary Lagrangians using neural networks. In contrast to models that learn Hamiltonians, LNNs do not require canonical coordinates, and thus perform well in situations where canonical momenta are unknown or difficult to compute. Unlike previous approaches, our method does not restrict the functional form of learned energies and will produce energy-conserving models for a variety of tasks. We test our approach on a double pendulum and a relativistic particle, demonstrating energy conservation where a baseline approach incurs dissipation and modeling relativity without canonical coordinates where a Hamiltonian approach fails. Finally, we show how this model can be applied to graphs and continuous systems using a Lagrangian Graph Network, and demonstrate it on the 1D wave equation.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Lagrangian Neural Networks

575111PythonJan 5, 20201 years agoApache-2.0

Similar Papers

Cite this paper

@article{cranmer2020lagrangian,
  title  = {Lagrangian Neural Networks},
  author = {Miles Cranmer and Sam Greydanus and Stephan Hoyer and Peter Battaglia and David Spergel and Shirley Ho},
  year   = {2020},
  eprint = {2003.04630},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2003.04630}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2003.04630.svg)](https://codeofpaper.com/paper/2003.04630)

Discussion