Modular Neural Ordinary Differential Equations

Max Zhu, Pietro Lió, Jacob MossarXiv 2021

Abstract

Modular Neural Ordinary Differential Equations (Modular NODEs) address the "black-box" nature of standard neural ODEs by decomposing complex dynamical systems into interpretable, physics-informed modules. By incorporating physical priors such as Maxwell’s equations and spatial periodicity directly into the architecture, these models achieve superior accuracy and energy conservation while enabling modular flexibility across different physical domains.

Introduction

In the quest to teach machines the laws of physics, researchers often utilize Neural Ordinary Differential Equations (NODEs). While powerful, standard NODEs are typically "black boxes": they predict state changes without explicitly modeling the underlying forces, such as gravity, magnetism, or friction. Existing structured alternatives like Hamiltonian (HNNs) or Lagrangian Neural Networks (LNNs) struggle with dissipative forces like friction and often require non-intuitive coordinate systems. This paper introduces Modular NODEs, a framework designed to be both interpretable and flexible enough to handle the multi-force reality of classical dynamics.

Methodology

The core innovation of the Modular NODE is the decomposition of the force equation into separable components based on Newton's Second Law:

$$\frac{d^2\mathbf{x}}{dt^2} = -\nabla V(\mathbf{x}) + \mathbf{B}(\mathbf{x}) \times \mathbf{v} - f(\mathbf{v})\mathbf{v}$$

Separable Modules and Physical Priors

Instead of a single monolithic network, individual neural networks are assigned to learn specific physical properties: $V(\mathbf{x})$ for potential energy, $\mathbf{B}(\mathbf{x})$ for magnetic fields, and $D(\mathbf{v})$ for drag. To ensure physical consistency, the authors incorporate specific priors:

  • Divergence-Free Fields: To respect Maxwell’s equations ($\nabla \cdot \mathbf{B} = 0$), the model can be forced to learn a "vector potential" $\mathbf{A}$ where $\mathbf{B} = \nabla \times \mathbf{A}$.
  • Periodicity: For lattice-like systems, a mod operator is applied to input coordinates before they reach the potential module.
  • Second-Order Structure: The framework utilizes Second Order NODEs (SONODEs) to learn acceleration directly, aligning with Newtonian physics.
The architecture of a Modular NODE, showing separate modules for potential, magnetic, and drag forces.

Experimental Evaluation

The models were evaluated using synthetic datasets of a charged particle moving through 3D force fields, including complex potentials, space-dependent magnetic fields, and non-isotropic drag.

Key Results

  • Accuracy: In experiments involving drag, the Divergence Magnetic NN achieved a Mean Squared Error (MSE) of 0.50, significantly outperforming a basic black-box NN (MSE 41.4) and a standard SONODE (MSE 178).
  • Symmetry and Priors: For periodic potentials, the Periodic NN (MSE 1.00) vastly outperformed the standard Magnetic NN (MSE 142), demonstrating that architectural constraints are vital for capturing specific symmetries.
  • Energy Conservation: While standard SONODEs exhibit significant "drift" over time, Modular NODEs (with drag disabled) naturally conserve energy, matching the performance of more rigid LNN models.
Energy conservation over time for various models. Modular NODEs maintain energy stability compared to the drifting SONODE.

Discussion and Insights

Modular NODEs offer a "Lego-like" flexibility. In a standout experiment, a magnetic module learned from one system and a potential module from another were combined to successfully predict the behavior of a new system without additional training. This modularity also enhances interpretability, as each learned field can be visualized and verified against ground truth independently.

Limitations and Future Work

The current approach requires prior knowledge of the form of the forces involved (e.g., knowing a magnetic field exists to include its module). Future research aims to automate structure discovery—allowing the model to identify necessary modules from raw data—and to incorporate complex coordinate transforms to handle mathematical singularities.

Summary updated

BibTeX
@misc{zhu2021modular,
  author = {Max Zhu and Pietro Lió and Jacob Moss},
  title = {{Modular Neural Ordinary Differential Equations}},
  year = {2021},
  eprint = {2109.07359},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.07359},
}
Figure