HyperDynamics: Meta-Learning Object and Agent Dynamics with Hypernetworks

Zhou Xian, Shamit Lal, Hsiao-Yu Tung, Emmanouil Antonios Platanios, Katerina Fragkiadaki

Introduction

HyperDynamics is a meta-learning framework that leverages hypernetworks to generate custom, "expert" dynamics models on the fly. By conditioning on an agent's visual observations and recent interaction history, the system dynamically reconfigures its own neural weights to adapt to varying physical properties—such as mass, friction, or terrain steepness. This approach significantly outperforms traditional gradient-based meta-learning and fixed global models, offering a robust solution for environments with non-stationary dynamics.

The Challenge of Non-Stationary Environments

In model-based reinforcement learning, an agent relies on a "dynamics model" to predict how the environment will change in response to its actions. However, the real world is inherently non-stationary. An object might be heavier than it appears, or a surface might be unexpectedly slippery.

Standard approaches to this problem usually fall into two categories, both with notable drawbacks:

  1. Fixed Global Models: These attempt to learn a single "catch-all" model that takes environment properties (like mass) as input features. They often fail to generalize to novel objects because they struggle to capture the complex, multiplicative ways physical properties interact with state transitions.
  2. Gradient-Based Meta-Learning (e.g., MAML): These models adapt by performing gradient descent at test time. While flexible, this process is often sample-inefficient and slow, requiring multiple interactions before the model successfully adapts to the new dynamics.

HyperDynamics proposes a middle ground: a system that "reads" the environment and immediately generates a specialized neural network tailored to the current situation, without the need for test-time gradient steps.

Methods: The HyperDynamics Architecture

The HyperDynamics architecture consists of three primary components that work together to achieve functional adaptation:

HyperDynamics Architecture
  1. Encoding Module: This module creates a latent representation of the environmental "context." It utilizes a Visual Encoder ($E_{vis}$)—based on Geometry-Aware Recurrent Networks to handle 3D shapes and occlusions—and an Interaction Encoder ($E_{int}$) that processes a short history of recent state-action pairs (e.g., the last 5-16 steps).
  2. Hypernetwork ($H$): Instead of outputting a state prediction directly, this core network takes the latent context code and outputs the weights for a separate "target" dynamics model.
  3. Target Dynamics Model ($F$): Also referred to as the "expert," this is a smaller Multi-Layer Perceptron (MLP) constructed using the weights generated by $H$. It takes the current low-dimensional state and action as input to predict the next state.

By generating the weights of $F$, the hypernetwork enables multiplicative interactions. The inferred physical properties fundamentally alter the logic of the dynamics model, rather than merely being appended as extra input data.

Experimental Datasets

The researchers evaluated HyperDynamics on two distinct types of tasks:

  • Object Pushing: Using the PyBullet simulator, a Kuka robot arm interacts with 31 different object meshes. These include 11 basic geometries from the MIT Push dataset and 20 realistic objects (like mugs and bowls) from ShapeNet, all with randomized mass and friction coefficients.
  • Locomotion: Using MuJoCo, "Half-Cheetah" and "Ant" robots were tested on challenging terrains, including a "Slope" (upward inclines with varying steepness) and a "Pier" (blocks floating on water with varying damping and friction).

Key Insights

  • Weights as Features: The central insight of HyperDynamics is that system properties shouldn't just be inputs to a network; they should define the network's behavior. Changing the weights allows the model to fundamentally alter its "physics engine" for every new object or terrain.
  • Orientation as Context: In the pushing task, including an object's orientation in the state led to overfitting. Instead, encoding the oriented shape into the hypernetwork treated the same object at different angles as different instances. This effectively augmented the training data and helped the hypernetwork learn a smoother distribution of dynamics.
  • Single-Shot Adaptation: Unlike MAML, which requires "inner-loop" gradient steps to adapt, HyperDynamics is "feed-forward." Once the encoders process a few frames of interaction, the hypernetwork instantly produces the correct expert model.

Key Results

HyperDynamics consistently outperformed baselines across both prediction accuracy and downstream control tasks.

Performance Results
  • Pushing Accuracy: On novel (unseen) objects, HyperDynamics achieved a prediction error of 0.93 cm, compared to 1.24 cm for a standard global model ("Direct") and 1.76 cm for MB-MAML.
  • Control Success: In downstream tasks using Model Predictive Control (MPC), HyperDynamics achieved a 92% success rate on novel objects without obstacles, matching the performance of an "Expert-Ens" (an ensemble of models specifically trained on each object).
  • Locomotion: In the "Cheetah-Slope" task on novel terrains, HyperDynamics achieved an average return of 124.5, vastly outperforming Recurrent models (76.6) and MB-MAML (62.7).

Limitations and Future Work

While highly effective, the approach has limitations. Generating weights for massive architectures (like large Transformers) using a hypernetwork remains a significant computational challenge due to the dimensionality of the output layer. Additionally, while the visual encoder uses 3D-aware representations to bridge the sim-to-real gap, the experiments were conducted entirely in simulation; real-world sensor noise and complex lighting remain hurdles. Future work may involve the hypernetwork predicting not just the weights, but the architecture of the target dynamics model itself to better suit specific tasks.

Summary updated

BibTeX
@inproceedings{xian2021hyperdynamics,
  author = {Zhou Xian and Shamit Lal and Hsiao-Yu Tung and Emmanouil Antonios Platanios and Katerina Fragkiadaki},
  title = {{HyperDynamics: Meta-Learning Object and Agent Dynamics with Hypernetworks}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=pHXfe1cOmA},
}
Figure