Skip to main content
Back

Aalto University Cuts Robot Training Data by 3x Using Physics-Baked AI

Researchers from Aalto and Helsinki replace black-box dynamics models in RL with physics-constrained Lagrangian networks, cutting the sample cost by 3x over model-free baselines.

Pro

Paper, Full Access
  • Researchers integrate Lagrangian Neural Networks (LNNs) into the Dyna MBRL framework, enforcing physical laws in the dynamics model.
  • LNN-based MBRL converges in ~28,500-30,000 timesteps vs. ~90,000 for model-free RL on an inverted pendulum task.
  • A second key innovation: LNN weights are trained using an Extended Kalman Filter (EKF) instead of Adam, acting as a second-order optimizer.
  • EKF-based training converges ~5-10% faster than Adam and is naturally uncertainty-aware and online-adaptive.
  • The method outperforms a constrained DNN physics-informed baseline (~36,500 timesteps) by ~20%.
  • Current limitations: tested only on single-DOF pendulum, no code released, EKF scales poorly to very large networks.

Training a robot to balance a pole or swing a pendulum upright sounds trivial, but the data cost is brutal. Standard model-free reinforcement learning (RL) agents learn purely through trial and error, and they can require tens of thousands of environment interactions before converging. A new paper from researchers at Aalto University and the University of Helsinki proposes a cleaner path: bake the laws of physics directly into the dynamics model, and let a Kalman filter handle the weight updates.

The sample efficiency problem in model-based RL

Model-based reinforcement learning (MBRL) already improves on model-free methods by learning a dynamics model of the environment and using it to generate synthetic training data, a strategy known as the Dyna framework. Dyna-style off-policy MBRL algorithms generate synthetic state transition data to enhance the sample efficiency of RL algorithms. But the quality of those synthetic rollouts is only as good as the dynamics model itself.

The performance of MBRL highly relies on the quality of the learned model, which is usually built in a black-box manner and may have poor predictive accuracy outside of the data distribution. When a standard deep neural network (DNN) is used as the dynamics model, it has no built-in understanding of physics. It will happily predict trajectories that violate conservation of energy or produce physically impossible accelerations the moment it encounters states outside its training distribution. For physical systems like robots and vehicles, this is a serious problem.

Physics as a structural prior

The core idea of this paper is to swap out the black-box DNN dynamics model for a Lagrangian Neural Network (LNN). An LNN is a neural network that does not directly predict the next state. Instead, it learns the system's Lagrangian, a scalar function equal to kinetic energy minus potential energy. The equations of motion are then derived analytically from that Lagrangian using the Euler-Lagrange equations, guaranteeing that the predicted dynamics are physically consistent by construction.

Lagrangian Neural Networks learn a Lagrangian directly and do not require canonical coordinates, making them suitable when momenta are difficult to observe. This is a key advantage over the related Hamiltonian Neural Network (HNN) approach, which requires working in canonical momentum coordinates that are often hard to measure directly from sensors.

Concretely, the LNN takes position q and velocity q_dot as inputs and outputs a scalar L. The acceleration q_ddot is then computed by differentiating through the network using the Euler-Lagrange operator. A second-order Runge-Kutta (RK-2) integrator then steps the state forward in time:

# Conceptual sketch of LNN-based state rollout
def lnn_step(q, q_dot, action, dt, lnn):
    # LNN outputs scalar Lagrangian L(q, q_dot)
    L = lnn(q, q_dot)
    # Euler-Lagrange gives acceleration (via autodiff)
    q_ddot = euler_lagrange(L, q, q_dot, action)
    # RK-2 integration to get next state
    k1 = (q_dot, q_ddot)
    k2 = euler_lagrange(L, q + 2/3*dt*k1[0], ...)
    q_next = q + dt * (0.25*k1[0] + 0.75*k2[0])
    q_dot_next = q_dot + dt * (0.25*k1[1] + 0.75*k2[1])
    return q_next, q_dot_next

Training the LNN with a Kalman filter instead of Adam

The second innovation is in how the LNN's weights are trained. Standard approaches use stochastic gradient descent (SGD) or Adam, which update weights by following the gradient of a loss function. The paper instead frames weight learning as a state estimation problem: the network weights are treated as hidden states of a dynamical system, and each new training observation is used to update a probability distribution over those weights via the Extended Kalman Filter (EKF).

The EKF is a classic algorithm for tracking the state of a nonlinear system under noisy observations. It maintains a mean estimate and a covariance matrix (capturing uncertainty) and updates both recursively as new data arrives. Applied to neural network weights, this is effectively a second-order optimization method: it uses curvature information encoded in the covariance matrix rather than just the gradient direction.

Compared to back-propagation, the EKF helps networks reach the training steady state much faster for non-stationary processes, and it can excel the back-propagation algorithm in training with limited data. This matters enormously in the Dyna setting, where the dynamics model must be updated online as new environment data trickles in.

How the full pipeline works

The complete system, which the authors call the LNN-based Dyna framework, alternates between three activities:

  1. Real interaction: The agent acts in the real environment, collecting state-action-reward tuples stored in a replay buffer D_env.
  2. Model learning: The LNN is trained on D_env using either Adam or EKF to predict accelerations, which are then integrated with RK-2 to predict next states.
  3. Synthetic rollouts: Once the model is accurate enough, it generates imaginary trajectories stored in D_mod. An actor-critic policy is then updated on the combined buffer D_env ∪ D_mod.

The physical structure of the LNN constrains the model to produce plausible rollouts even in regions of state space that have not been visited yet, which is exactly what makes it more data-efficient than a generic DNN.

Benchmark results on the inverted pendulum

The team evaluated their approach on the classic inverted pendulum task from OpenAI Gym, comparing four configurations:

MethodTimesteps to converge
Model-free RL (MFRL baseline)~90,000
Physics-informed MBRL with constrained DNN~36,500
LNN-based MBRL (Adam optimizer)~30,000
LNN-based MBRL (EKF optimizer)~28,500

The average return of PIMBRL with LNN using Adam reaches approximately -200 after about 30,000 timesteps, while PIMBRL with LNN using EKF achieves the same performance slightly earlier, at about 28,500 timesteps. The model-free baseline, by contrast, fluctuates around -750 for a prolonged period before finally converging near 90,000 timesteps. That is a roughly 3x reduction in sample cost just from switching to the LNN, and the EKF optimizer squeezes out another 5-10% on top of that.

What this is good for, and where it falls short

This approach is a strong fit for any physical control problem where the system obeys Lagrangian mechanics: robotic arms, pendulums, quadrotors, autonomous vehicles, and other rigid-body systems. In model-based RL, model accuracy mainly matters in environments that are sensitive to initial conditions, where numerical errors accumulate fast; in these environments, the physics-informed version achieves significantly better average-return and sample efficiency.

The limitations are real, though. The current paper only demonstrates results on a single-degree-of-freedom inverted pendulum. The EKF's covariance matrix scales quadratically with the number of network weights, making it computationally expensive for large networks. The method also assumes the system obeys Lagrangian mechanics without friction or contacts, which rules out a large class of real-world scenarios. No code repository was released alongside the paper.

The deeper shift

The real contribution here is not just better numbers on a pendulum benchmark. It is a demonstration that the optimizer used to train a physics-informed dynamics model is itself a meaningful design choice. The EKF optimizer leverages curvature information and adaptive scaling, leading to faster, more stable convergence than conventional first-order gradient-based optimizers. Treating neural network training as a Bayesian filtering problem opens the door to online, uncertainty-aware model updates, which is exactly the kind of adaptive behavior needed when deploying RL agents on real hardware where data is expensive and model drift is inevitable.

As the physics-informed Dyna literature matures and methods like this are validated on higher-dimensional systems, the gap between simulation-trained and hardware-deployable RL agents may start to close meaningfully.