Bayesian Neural Ordinary Differential Equations

Raj Dandekar, Vaibhav Dixit, Mohamed Tarek, Aslan Garcia-Valadez, Christopher RackauckasarXiv 2020

TL;DR

This paper introduces Bayesian Neural Ordinary Differential Equations (BN-ODEs) to quantify uncertainty in learned physical models. By integrating Bayesian inference methods (NUTS, SGHMC, SGLD) with Neural ODEs, they achieve competitive accuracy on MNIST and demonstrate robust uncertainty quantification for dynamical systems, including recovering missing model terms.

What Problem Does This Paper Address?

Traditional Neural Ordinary Differential Equations (Neural ODEs) offer a powerful way to learn differential equations governing physical systems directly from data, bypassing the need to explicitly define the ODEs. However, a critical limitation of standard Neural ODEs is their inability to quantify uncertainty in their learned parameters. This means we don't know how confident the model is in its predictions, which is crucial for scientific applications where understanding uncertainty is paramount. This paper addresses this gap by exploring how to integrate Bayesian learning frameworks with Neural ODEs to provide robust uncertainty quantification for the model's weights.

Methods

The core contribution is the development and evaluation of Bayesian Neural ODEs. The authors explore three primary Bayesian inference methods:

  • No-U-Turn Sampler (NUTS): An extension of Hamiltonian Monte Carlo (HMC) that automatically adapts its sampling parameters, making it efficient for high-dimensional problems.
  • Stochastic Gradient Hamiltonian Monte Carlo (SGHMC): Combines HMC's exploration capabilities with stochastic gradient methods for computational efficiency, injecting friction into the momentum updates.
  • Stochastic Gradient Langevin Descent (SGLD): An adaptation of stochastic gradient descent that allows sampling from the posterior distribution by adding Gaussian noise at each iteration.

They also explore:

  • Variational Inference (VI): An optimization-based approach to approximate posteriors, which is generally faster than MCMC.
  • Normalizing Flows: Used to enhance the expressiveness of VI posteriors, allowing for more complex distributions.
  • Universal Differential Equations (UDEs): A framework that combines Neural Networks with differential equations to recover missing terms in dynamical systems. They specifically use a Preconditioned SGLD (PSGLD) variant for this.

The implementation leverages the Julia programming language and its differentiable programming ecosystem, including the Turing probabilistic programming language.

Datasets

The paper evaluates their BN-ODE framework on:

  • Classical physical systems: Specifically, a "Spiral ODE" and the "Lotka-Volterra ODE" model.
  • Standard machine learning datasets: The MNIST dataset for image classification.
  • Simulated data for PDEs: Burgers' equation, Korteweg-De Vries (KdV) equation, Fisher-KPP equation, and a SEIR epidemiological model.

Key Insights and Ideas

  • Bridging the Gap: The paper successfully demonstrates that Bayesian inference can be integrated with Neural ODEs to provide meaningful uncertainty quantification, a significant step beyond standard black-box models.
  • SGLD's Advantage: SGLD generally shows better prediction accuracy and less bias compared to NUTS, particularly in non-convex likelihood landscapes. This is attributed to its use of stochastic gradients, which helps it explore and stay within regions of higher probability mass.
  • Neural ODEs for Model Discovery: The UDE framework, powered by Bayesian inference (PSGLD), proves effective in recovering missing terms in dynamical systems, offering a powerful tool for scientific discovery where model structure is not fully known.
  • MNIST Performance: Integrating Neural ODEs with SGHMC achieves competitive accuracy on MNIST, while crucially providing uncertainty estimates, a feature lacking in many state-of-the-art classifiers.
  • Variational Inference Potential: While plain VI showed poor forecasting, combining it with normalizing flows shows marginal improvement, suggesting that more expressive posterior families are key for effective VI in this context.

Key Results

  • MNIST Accuracy: Achieved a test ensemble accuracy of 98.5% (abstract) and 99.22% (page 7) on the MNIST dataset, competitive with state-of-the-art methods, while providing uncertainty estimates.
  • Physical Systems: BN-ODEs with NUTS, SGHMC, and SGLD demonstrated consistent prediction and forecasting for the Spiral ODE and Lotka-Volterra ODE, matching ground truth data.
  • Model Recovery: For predator-prey and epidemiological models, the Bayesian UDE approach successfully recovered missing terms with high accuracy and identified dominant terms using sparsity-inducing methods. For example, in the Lotka-Volterra case, the recovered term was 0.964*u1*u2, very close to the true u1*u2.
  • PDEs: BN-UDEs showed good agreement with true data for Burgers' and KdV equations, providing estimates of error in mean posterior predictions.

Limitations and Future Work

  • Computational Cost: Bayesian learning for Neural ODEs is noted as computationally expensive, especially for large datasets.
  • Algorithm Comparison: While differences between NUTS and SGLD are observed, a deeper understanding of why they differ and how they compare to other algorithms is still needed.
  • Variational Inference: Further research is required to address open questions regarding the suitability and effectiveness of VI with Neural ODEs, particularly in improving forecasting performance.
  • Future Directions: The authors suggest exploring Bayesian Neural SDEs and their applicability to physical systems and large-scale machine learning. They also aim to further identify the relationship between model uncertainties and probabilistic automated discovery.
  • Code Availability: The code for SGHMC, Bayesian Neural UDE, and Variational Inference Neural ODE objects is publicly available.

Summary updated

BibTeX
@misc{dandekar2020bayesian,
  author = {Raj Dandekar and Vaibhav Dixit and Mohamed Tarek and Aslan Garcia-Valadez and Christopher Rackauckas},
  title = {{Bayesian Neural Ordinary Differential Equations}},
  year = {2020},
  eprint = {2012.07244},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2012.07244},
}
Figure