Distributional Gradient Matching for Learning Uncertain Neural Dynamics Models

Lenart Treven, Philippe Wenk, Florian Dörfler, Andreas Krause

Introduction

In fields like robotics and biology, continuous-time systems are often modeled using Ordinary Differential Equations (ODEs). Neural ODEs have emerged as a powerful tool to learn these dynamics from data. However, standard Neural ODEs are deterministic, providing a single "best guess" trajectory. For safety-critical applications such as robust control or exploration in reinforcement learning, estimating predictive uncertainty (epistemic uncertainty) is crucial.

Traditionally, Bayesian inference is used to capture this uncertainty. Unfortunately, this introduces a massive computational bottleneck: evaluating model fit requires numerically integrating the ODE thousands of times, which is slow, computationally expensive, and often numerically unstable.

To address this, researchers have introduced Distributional Gradient Matching (DGM), a novel framework for learning uncertain neural dynamics without the need for costly numerical integration. By jointly training a Gaussian Process smoother and a neural dynamics model to match their gradient distributions, DGM achieves prediction speeds 1–2 orders of magnitude faster than traditional MCMC-based methods while maintaining superior accuracy.

Methodology: Distributional Gradient Matching

Instead of integrating dynamics to match state observations, DGM matches the gradients (derivatives) of the system. The framework consists of three main components:

  1. The Smoother (S): A Gaussian Process (GP) acts as a smoother over the observed data. Because GPs are differentiable, the distribution of the gradients at any point in time can be determined analytically.
  2. The Dynamics Model (D): A neural network represents the vector field. To capture uncertainty, DGM uses a reparameterization trick that models uncertainty directly in the state space, rather than over the high-dimensional weights of the network. This avoids the difficulties of modeling uncertainty in the parameter space of large neural networks.
  3. The Loss Function: DGM minimizes a multi-objective loss that balances data fit (ensuring the smoother accurately reflects observed data) and distributional matching. It uses the Wasserstein distance to ensure the gradients predicted by the dynamics model match those produced by the smoother. The authors found Wasserstein outperformed Kullback-Leibler (KL) divergence, as it provides more meaningful gradients for optimization even when initial distributions have little overlap.

Key Insight: The Importance of Joint Training

A critical finding of the paper is that training the smoother and the dynamics model jointly is vastly superior to a two-step process. The dynamics model acts as a "physics-informed" regularizer, helping the smoother make sense of sparse or noisy data.

Comparison of independent and joint smoothers

As illustrated above, a joint smoother combined with dynamics significantly reduces uncertainty and improves trajectory predictions compared to independent training, especially in regions with sparse observations or complex dynamics.

Experiments and Results

The authors evaluated DGM on four challenging dynamical systems: Lotka-Volterra (2D predator-prey), the Lorenz System (3D chaotic), Double Pendulum (4D non-linear mechanics), and a Quadrocopter (12D drone flight). They tested both single-trajectory (dense data) and multi-trajectory (generalization to unseen initial conditions) settings.

  • Accuracy: DGM consistently achieved higher log-likelihoods than state-of-the-art baselines like Stochastic Gradient Langevin Dynamics (SGLD) and SGHMC. Notably, on the high-dimensional 12D Quadrocopter task, DGM succeeded where SGLD failed to converge entirely.
  • Speed: Because DGM uses the smoother for prediction instead of an ODE solver, it is 10x to 100x faster at inference time than sampling-based Bayesian methods.
  • Robustness: DGM proved highly resilient to overparameterization. While MCMC methods often degrade when the neural network becomes too large, DGM’s performance remained stable.

Limitations and Future Directions

While DGM offers significant advantages, it has a few limitations. The use of Gaussian Processes introduces a cubic scaling cost ($O(N^3)$) relative to the number of observations, which can be a hurdle for extremely large datasets (though sparse GP approximations could mitigate this). Additionally, the current implementation uses independent GPs for each state dimension, potentially missing complex inter-variable correlations.

Looking forward, DGM presents a promising foundation for active learning. Because it provides robust uncertainty estimates, the model could be used to identify exactly which new data points would most effectively reduce uncertainty about the system's underlying dynamics.

Summary updated

BibTeX
@inproceedings{treven2021distributional,
  author = {Lenart Treven and Philippe Wenk and Florian Dörfler and Andreas Krause},
  title = {{Distributional Gradient Matching for Learning Uncertain Neural Dynamics Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=uh60RfoOfSj},
}
Figure