Interactive Differentiable Simulation

Eric Heiden, David Millard, Hejia Zhang, Gaurav S. SukhatmearXiv 2019

Abstract

Researchers from the University of Southern California have introduced Interactive Differentiable Simulation (IDS), a physics engine designed to function as a differentiable layer within deep learning architectures. By treating simulation as a transparent, gradient-aware process rather than a "black box," IDS enables agents to perform precise system identification from visual data and achieve significantly higher sample efficiency in control tasks compared to standard reinforcement learning methods.

Introduction

In the pursuit of "intuitive physics" for artificial intelligence, researchers typically choose between model-free Reinforcement Learning (RL) and learned dynamics models. Model-free RL agents learn through trial and error, which is notoriously sample-inefficient and often fails to generalize. Conversely, learned dynamics models, such as Graph Neural Networks, frequently produce physically impossible results—like pendulums that violate energy conservation—because they are not strictly bound by physical laws.

IDS addresses this gap by utilizing a simulator that "knows" the laws of physics but remains differentiable. This allows for gradient-based optimization of specific physical parameters (e.g., mass, friction, or link length) until the simulation aligns with observed reality.

Methodology

The core of the IDS engine is a rigid-body dynamics simulator implemented in C++ that prioritizes both physical accuracy and computational efficiency.

The IDS Computational Graph

IDS utilizes the Articulated Body Algorithm (ABA) to compute forward dynamics in $O(n)$ time, making it suitable for complex kinematic chains. Unlike traditional simulators like MuJoCo or Bullet, which are often non-differentiable, IDS is built using the Stan Math library. This architecture supports reverse-mode automatic differentiation, allowing the system to calculate the gradient of any output with respect to any input parameter.

The IDS computational graph showing the differentiable simulation loop over a horizon H.

In practice, IDS can be integrated as a "bottleneck layer" in an autoencoder. An encoder maps images to physical states (position and velocity), the IDS layer simulates future states, and a decoder translates these back into predicted visual frames.

Key Insights and Results

IDS provides a strong inductive bias by ensuring that the model cannot produce "illegal" motions. This constraint allows for accurate long-term predictions compared to pure neural network models, which tend to drift into unphysical states. Furthermore, the model learns interpretable physical constants rather than abstract latent variables.

Visual System Identification

The researchers evaluated IDS on several benchmarks, including a chaotic 3-link compound pendulum. The model successfully recovered true link lengths from arbitrary initial guesses using only grayscale images as input.

Visual system identification of a 3-link compound pendulum using IDS to estimate physical parameters from state data.

Performance and Efficiency

  • Sample Efficiency: In the Double Cartpole swing-up task, IDS-based Adaptive Model-Predictive Control (MPC) reached optimal performance in a fraction of the time required by state-of-the-art RL algorithms like Soft Actor-Critic (SAC) and DDPG.
  • Design Optimization: Using the L-BFGS optimizer with IDS gradients, the system automatically optimized robot arm geometry to follow specific trajectories in fewer than 10 iterations.

Limitations and Future Work

Currently, the primary limitation of IDS is the lack of a comprehensive contact model. While it excels at kinematic chains, it does not yet handle collisions or friction between separate objects in a fully differentiable manner. Future research will focus on implementing differentiable collision detection and exploring loss surfaces for redundant parameters to improve calibration in complex robotic motions.

Summary updated

Abstract

Intelligent agents need a physical understanding of the world to predict the impact of their actions in the future. While learning-based models of the environment dynamics have contributed to significant improvements in sample efficiency compared to model-free reinforcement learning algorithms, they typically fail to generalize to system states beyond the training data, while often grounding their predictions on non-interpretable latent variables. We introduce Interactive Differentiable Simulation (IDS), a differentiable physics engine, that allows for efficient, accurate inference of physical properties of rigid-body systems. Integrated into deep learning architectures, our model is able to accomplish system identification using visual input, leading to an interpretable model of the world whose parameters have physical meaning. We present experiments showing automatic task-based robot design and parameter estimation for nonlinear dynamical systems by automatically calculating gradients in IDS. When integrated into an adaptive model-predictive control algorithm, our approach exhibits orders of magnitude improvements in sample efficiency over model-free reinforcement learning algorithms on challenging nonlinear control domains.
BibTeX
@misc{heiden2019interactive,
  author = {Eric Heiden and David Millard and Hejia Zhang and Gaurav S. Sukhatme},
  title = {{Interactive Differentiable Simulation}},
  year = {2019},
  eprint = {1905.10706},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.10706},
}
Figure