Projected Neural Differential Equations for Learning Constrained Dynamics

Alistair White, Anna Büttner, Maximilian Gelbrecht, Valentin Duruisseaux, Niki Kilbertus, Frank Hellmann, Niklas Boers · DOI

Neural Differential Equations (NDEs) have emerged as a powerful tool for modeling complex dynamical systems by integrating neural networks into the framework of ordinary differential equations. Despite their flexibility, standard NDEs often struggle to respect fundamental physical laws, such as energy conservation or geometric constraints. This "drifting" problem leads to unrealistic long-term predictions where the model violates the very physics it aims to represent.

In the paper "Projected Neural Differential Equations for Learning Constrained Dynamics," the authors introduce PNDEs, a method that mathematically enforces hard physical constraints by projecting the learned dynamics onto the manifold of valid states.

The PNDE Framework: Enforcing Hard Constraints

The core innovation of PNDEs lies in differential geometry. Rather than treating physical laws as soft penalties in a loss function—which are difficult to tune and often fail to eliminate drift—PNDEs ensure that the system's "velocity" is always consistent with its constraints.

Conceptual diagram of PNDE projecting a learned vector field onto the tangent space of a constraint manifold.

As illustrated in the figure above, for a system with state $u$ constrained to a manifold $\mathcal{M}$ defined by $g(u) = 0$, the PNDE takes the raw neural network prediction $f_\theta(u)$ and projects it onto the tangent space $T_u\mathcal{M}$. Using the Jacobian of the constraint function and the Moore-Penrose pseudoinverse, the projection operator $P(u)$ ensures that the resulting vector field $P(u)f_\theta(u)$ keeps the trajectory strictly on the manifold. This approach prevents errors from accumulating, maintaining constraint satisfaction near machine precision.

Experimental Evaluation

The authors evaluated PNDEs across three distinct domains:

  1. FPUT Lattice: Testing energy conservation in vibrating systems.
  2. Damped N-Pendulum: Modeling chaotic multi-link systems in Cartesian coordinates, where constraints are explicit but complex.
  3. Power Grid Models: Benchmarking on IEEE 14-Bus and RTS-96 systems to ensure power balance constraints are met.

A significant advantage of PNDEs is the ability to work in Cartesian coordinates (e.g., X, Y, Z positions) rather than complex generalized coordinates (e.g., angles). While Cartesian systems have more constraints, the PNDE handles them automatically, allowing the neural network to learn simpler underlying dynamics.

Results: Precision and Stability

PNDEs demonstrate superior performance compared to unconstrained NDEs and Stabilized NDEs (SNDEs). While SNDEs attempt to "nudge" the system back toward the manifold, they require careful tuning of stabilization parameters and can introduce numerical stiffness.

Performance comparison of NDE, SNDE, and PNDE. (a) Trajectory tracking, (b) Relative state error, and (c) Constraint error over time.

As shown in the results above, PNDEs achieve constraint errors several orders of magnitude lower than competing methods. In power grid simulations, PNDEs reached a constraint error of $3.5 \times 10^{-11}$, significantly outperforming the best-tuned SNDE ($0.5 \times 10^{-7}$). Furthermore, PNDEs maintain stability over long-term rollouts where unconstrained models typically diverge into physically impossible states.

Conclusion

Projected Neural Differential Equations provide a robust, parameter-free solution for learning constrained dynamics. By embedding geometric constraints directly into the architecture, PNDEs offer high precision, improved numerical stability, and simplified coordinate systems for complex physical modeling. Future work may explore integrating PNDEs with Graph Neural Networks to handle dynamic topologies in infrastructure networks like power grids.

Summary updated

BibTeX
@inproceedings{white2024projected,
  author = {Alistair White and Anna Büttner and Maximilian Gelbrecht and Valentin Duruisseaux and Niki Kilbertus and Frank Hellmann and Niklas Boers},
  title = {{Projected Neural Differential Equations for Learning Constrained Dynamics}},
  booktitle = {D3S3 @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=oN7kUxq4cX},
}
Figure