Model-based Reinforcement Learning with a Hamiltonian Canonical ODE Network

Yao Feng, Yuhong Jiang, Hang Su, Dong Yan, Jun Zhu · DOI

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in complex domains like strategic games and simulated control. However, its practical application in real-world robotics is often hindered by extreme sample complexity. Traditional model-free methods require millions of interactions, which is often unfeasible for physical hardware. Model-based Reinforcement Learning (MBRL) addresses this by learning a "world model"—a predictive simulator—allowing the agent to plan and practice in an "imaginary" environment.

Despite its promise, learning an accurate world model from scratch remains a significant challenge. Standard neural networks, acting as black boxes, often fail to respect fundamental physical principles like energy conservation or continuous-time dynamics. Researchers from Tsinghua University address this by introducing NODA (Neural Ordinary Differential Auto-encoder), a framework that embeds Hamiltonian mechanics directly into the network architecture to improve sample efficiency and predictive stability.

The NODA Framework

The core innovation of NODA is the integration of Hamiltonian canonical equations into a Neural Ordinary Differential Equation (Neural ODE) framework. This approach moves away from traditional second-order differential equations, which are often numerically unstable, and instead utilizes a system of first-order ODEs.

The NODA architecture integrates an auto-encoder with a Hamiltonian-based ODE network to model physical dynamics in a latent space.

As illustrated in the architecture diagram, NODA consists of two primary modules:

  1. The Auto-encoder: This component maps high-dimensional observations $s$ (such as raw sensor data or pixels) into a latent space defined by canonical variables: generalized coordinates $q$ and momentum $p$.
  2. The ODE Network: Instead of a discrete-time transition function, NODA employs a Neural ODE to model the continuous evolution of $(q, p)$. The dynamics are governed by Hamiltonian equations, where the change in state is derived from the partial derivatives of a learned Hamiltonian function $\mathcal{H}$.

By forcing the latent space to follow these physical laws, the model gains a powerful inductive bias. This structure allows for stable long-term predictions and the ability to handle varying time steps naturally.

Experimental Evaluation

The authors evaluated NODA across a diverse set of benchmarks, ranging from simple physical systems to complex multi-joint robotic simulations:

  • Pendulum Tasks: "Pixel Pendulum" and "Real Pendulum" were used to test the model's ability to learn dynamics from both image-based and state-based inputs.
  • MuJoCo Benchmarks: Standard continuous control environments including InvertedPendulum-v2, HalfCheetah-v3, Hopper-v3, and Ant-v3.
  • DeepMind Control Suite (DMC): Visual-based control tasks such as Walker-Run and Finger-Spin.

Key Insights and Results

A critical finding of the study is the importance of the latent dimension. In tasks like Ant-v3, the authors observed that aligning the latent dimension with the system's actual degrees of freedom (e.g., 40 for the Ant) led to optimal performance. This suggests that providing even minimal structural information about the physical system can significantly simplify the learning landscape.

The integration of NODA into existing RL algorithms yielded substantial performance gains. When paired with the Soft Actor-Critic (SAC) algorithm, the resulting NODA-SAC agent demonstrated superior sample efficiency and higher asymptotic returns compared to vanilla SAC or TD3.

NODA-SAC (red) demonstrates faster convergence and higher episode returns across various MuJoCo environments compared to standard RL baselines.

As shown in the performance plots, NODA-SAC consistently reaches peak performance faster than its counterparts. In the HalfCheetah-v3 environment, NODA-SAC achieved a return of approximately 9241, outperforming standard SAC while maintaining higher stability throughout training. Furthermore, in visual tasks using the Dreamer framework, NODA-Dreamer surpassed state-of-the-art baselines like BIRD, particularly in the early stages of training where data is most scarce.

Conclusion

NODA represents a significant step toward physics-informed reinforcement learning. By baking Hamiltonian mechanics into the world model, the researchers have created a framework that is not only more sample-efficient but also more numerically stable and theoretically grounded. While the current model assumes deterministic environments, future work exploring Stochastic Differential Equations (SDEs) could extend these benefits to noisy, real-world settings. The success of NODA underscores the value of leveraging classical physical principles to guide the development of modern machine learning architectures.

Summary updated

BibTeX
@misc{feng2022model,
  author = {Yao Feng and Yuhong Jiang and Hang Su and Dong Yan and Jun Zhu},
  title = {{Model-based Reinforcement Learning with a Hamiltonian Canonical ODE Network}},
  year = {2022},
  eprint = {2211.00942},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.00942},
}
Figure