History-informed Lagrangian Neural Networks

arXiv:2608.13215 · cs.LG · Submitted 2026-08-13 · Read on arXiv

Tianshuo Zhang, Xianglei Xing, Wenzhe Zhai, Jia Gao, He Cao

Harbin Engineering University

cs.LG

Submitted: 2026-08-13

Updated: 2026-08-14

Comments: 15 pages, 5 figures. Accepted to the 9th Chinese Conference on Pattern Recognition and Computer Vision (PRCV 2026) as an oral paper

Code: https://github.com/yingtian22/History-informed-LNN

License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/

Importance score: 96/100

The gist: History-informed Lagrangian Neural Networks (HiLNN) is introduced to address the challenge of long-horizon forecasting of mechanical systems from position-only observations.

Terminology

Summary

History-informed Lagrangian Neural Networks (HiLNN) is introduced to address the challenge of long-horizon forecasting of mechanical systems from position-only observations. The paper states: "Forecasting the long-horizon evolution of mechanical systems from position-only observations is a pivotal yet difficult task, as hidden velocities and trajectory-specific physical properties must be inferred simultaneously. While physics-guided neural networks like Lagrangian Neural Networks (LNNs) guarantee physical plausibility, they generally require complete state inputs and lack adaptability to changing system parameters."

The proposed method is grounded in the insight that temporal position sequences implicitly encode underlying dynamics. HiLNN "employs a recurrent encoder to extract a latent context from history. This context not only reconstructs the unobserved initial velocity but also adaptively modulates the mass matrix, potential energy, and damping coefficients of a structured Lagrangian system. The framework uses a differentiable RK4 rollout scheme and is optimized end-to-end under multi-step trajectory supervision and energy-consistency regularization."

The problem is formally defined as predicting future state trajectories X̂ t+1:t+H = (q̂ t+1, q̇̂ t+1),, (q̂ t+H, q̇̂ t+H) from a position history H t q = q t-L+1, q t-L+2,, q t. The method encodes the history with a GRU to produce a latent context z t = Enc theta(H t q), which is used by a velocity head to infer the missing initial velocity q̇̂ t, forming the initial state x̂ t = (q t, q̇̂ t). The context also conditions the Lagrangian module through context-dependent mass, potential, and optional damping terms. The dynamics are derived from a context-conditioned Lagrangian L theta(q, q̇, z t) = T theta(q, q̇, z t) - V phi(q, z t), with kinetic energy T theta(q, q̇, z t) = 1 over 2 q̇ T M theta(q, z t) q̇ and potential energy V phi(q, z t) = MLP V([q, z t]). For dissipative systems, a generalized non-conservative force Q = -D psi(q, z t) q̇ is used, where D psi is non-negative.

The training objective combines a multi-step rollout loss L roll = 1 over H sum k=1 H (lambda q q̂ t+k - q t+k 2 squared + lambda q̇ q̇̂ t+k - q̇ t+k 2 2), an initial velocity supervision loss L v0 = q̇̂ t - q̇ t 2 squared, and an energy regularization loss L E = 1 over H sum k=1 H E(q̂ t+k, q̇̂ t+k) - E(q t+k, q̇ t+k) 2 squared. The final objective is L = L roll + lambda v0 L v0 + lambda E L E.

Experiments are conducted on three pendulum-based systems: a fixed conservative pendulum, a fixed damped pendulum, and a variable-parameter pendulum with trajectory-dependent dynamics. The models observe only a position history of length L = 8 and predict H = 32 future steps with t = 0.05. Baselines include LNN, HNN, Neural ODE, MLP-based predictors, and an LNN-multistep variant.

The main quantitative results show that HiLNN achieves the best performance across conservative, dissipative, and variable-parameter settings. On the standard pendulum, it reduces the average MSE from 0.279 of LNN to 0.103, while also obtaining the lowest Final MSE@32 and Energy MSE. For the damped pendulum, HiLNN achieves an average MSE of 4.28×10-3 and reduces Energy MSE from 0.987 to 0.107 compared with LNN. For the variable-parameter pendulum, HiLNN reduces MSE from 0.894 of LNN-multistep to 0.061 and Final MSE@32 from 2.295 to 0.193.

Long-horizon rollout analysis shows that HiLNN consistently achieves lower errors on all three systems, especially at medium and long horizons. On the conservative pendulum, HiLNN achieves lower errors from Step 8 onward and reduces the final-step error from 0.483 to 0.271. On the damped pendulum, HiLNN achieves the lowest errors at Steps 8, 16, and 32, reducing the final-step error from 0.149 to 0.018. On the variable-parameter pendulum, HiLNN achieves the best performance at all selected steps and reduces the Step-32 error from 2.483/2.295 to 0.193 compared with LNN/LNN-multistep.

For physical consistency, HiLNN obtains the lowest energy errors at Steps 16 and 32 on the damped pendulum, reducing Test Energy MSE from 0.987 to 0.107 and mean absolute energy error from 0.686 to 0.167. On the variable-parameter setting, HiLNN reduces Test Energy MSE to 1.759 and Step-32 energy error from 26.111 to 3.646 compared with LNN.

Ablation studies cover energy regularization, rollout training, initial velocity supervision, and history length. For energy regularization, removing λE weakens physical consistency, yielding an MSE of 0.118 and an Energy MSE of 3.147, while a small weight improves the accuracy–energy trade-off. The default lambda E = 0.01 gives the best overall MSE and Energy MSE. For rollout design, the Euler variant with detached states, HiLNN v1a, performs poorly, with an MSE of 0.449 and Final MSE@32 of 1.025. Using RK4 with full backpropagation through time reduces them to 0.118 and 0.261. For initial velocity supervision, removing the auxiliary initial velocity loss keeps rollout MSE similar but increases the initial velocity error from 0.115 to 0.245.

The paper concludes that HiLNN preserves mechanical structure while improving long-horizon stability and achieves more accurate and physically consistent predictions than representative black-box and physics-guided baselines. The source code is publicly available at https://github.com/yingtian22/History-informed-LNN.

Improvements for AI systems

Improvements to AI Systems:

  1. Physics-constrained sequence-to-sequence forecasting with latent state inference:
  • The AI system can now perform long-horizon predictions of mechanical systems using only position observations, without requiring velocity or parameter measurements.

  • It infers hidden initial velocities and trajectory-specific physical properties (mass, potential, damping) from a short history window via a recurrent encoder, enabling accurate multi-step rollout (e.g., 32 steps) with stable energy behavior.

  1. Adaptive physics-guided modeling for varying system parameters:
  • The system can generalize to systems whose physical parameters change across trajectories (e.g., variable pendulum length or damping) by conditioning the Lagrangian (mass matrix, potential energy, damping) on a latent context extracted from history.

  • This removes the need for manual re-identification or retraining when system dynamics shift, making it suitable for online adaptation in robotics or control.

  1. Energy-consistent long-horizon prediction:
  • By incorporating an energy-consistency regularization term, the AI system maintains physical plausibility (e.g., bounded energy error) even for dissipative systems, reducing drift in medium- and long-term forecasts.

  • It achieves lower energy MSE (e.g., from 0.987 to 0.107 on damped pendulum) compared to standard LNNs, making it reliable for energy-critical applications like power systems or mechanical wear prediction.

  1. Improved training stability via differentiable RK4 rollout and multi-step supervision:
  • The system uses a differentiable RK4 integrator with full backpropagation through time, which outperforms simpler Euler or detached-state variants, reducing final-step MSE by over 70% (e.g., from 1.025 to 0.261).

  • Multi-step rollout loss (not just one-step) ensures the model optimizes for cumulative error, leading to better long-horizon accuracy than single-step or black-box baselines.

  1. Robustness to missing velocity data and noisy initial conditions:
  • The auxiliary initial velocity supervision loss improves velocity estimation accuracy (error reduced from 0.245 to 0.115), which is critical for downstream tasks like control or state estimation.

  • The system can operate with short history lengths (L=8) and still achieve high accuracy, reducing data requirements and enabling faster real-time inference.

  1. Hybrid interpretability and performance:
  • Unlike pure black-box models (MLP, Neural ODE), the system retains an interpretable Lagrangian structure (kinetic/potential energy, damping), allowing engineers to inspect learned physical parameters or energy flows.

  • It outperforms both black-box and physics-guided baselines in all tested settings (conservative, damped, variable-parameter), achieving up to 10x lower MSE in variable-parameter scenarios.

What the improved AI system can do:

  • Predict future positions and velocities of mechanical systems (e.g., pendulums, robotic arms, vehicles) from raw position time series alone, with high accuracy and physical consistency over long horizons.

  • Automatically adapt to changing system dynamics (e.g., payload changes, friction variations) without retraining, by inferring context from recent observations.

  • Provide energy-stable forecasts suitable for model-based control, anomaly detection, or digital twin simulations, even when only partial sensor data (positions) is available.

  • Serve as a drop-in replacement for LNNs or Neural ODEs in applications requiring both data efficiency and physical guarantees, such as predictive maintenance, simulation of mechanical systems, or real-time trajectory planning.

Sources

Related papers