Almost Surely Stable Deep Dynamics

Nathan P. Lawrence, Philip D. Loewen, Michael G. Forbes, Johan U. Backström, R. Bhushan Gopaluni

Deep Neural Networks (DNNs) are world-class function approximators, making them ideal for modeling complex, non-linear physical dynamics. However, they are fundamentally "black boxes." In safety-critical applications like robotics, aerospace, or chemical processing, engineers need a guarantee that the model won't diverge into unstable states.

Traditional "white-box" models derived from first principles are easy to analyze for stability but often lack the flexibility to capture complex real-world behavior. Conversely, standard DNNs can capture this behavior but offer no stability guarantees. The NeurIPS 2020 paper, "Almost Surely Stable Deep Dynamics," bridges this gap. It presents a framework for training deep neural networks to model physical systems while mathematically guaranteeing they remain stable, even when dealing with noisy, discrete-time stochastic data.

Bounding the Black Box with Lyapunov Theory

The core idea of the paper is to leverage Lyapunov Stability Theory. A Lyapunov function, $V(x)$, acts as a scalar "energy" function that must decrease over time as a system moves toward equilibrium. If such a function exists and consistently decreases, the system is mathematically proven to be stable.

Instead of trying to verify if a trained model is stable after the fact, the authors propose constraining the model during training so it can only learn stable dynamics. They simultaneously train a neural network to model the system and a corresponding Lyapunov function to enforce stability.

To bake this into a DNN, the authors propose two primary projection methods:

  1. Convex Lyapunov Functions: If the learned Lyapunov function is convex, the authors derive a closed-form scaling factor. If the model's predicted next state violates the stability criterion, it is mathematically "scaled back" along a vector until it satisfies the Lyapunov decrease.
  2. Implicit Output Layer (General/Non-convex): For more complex, non-convex Lyapunov functions, a closed-form solution isn't possible. Instead, the authors treat the stability constraint as an implicit layer. They utilize a 1D root-finding algorithm (a hybrid of Newton’s method and bisection) during the forward pass to find the exact scaling factor, $\gamma^*$, needed to maintain stability.
Comparison of stability enforcement using Convex and General Lyapunov functions.

Handling Stochasticity

Real-world systems are rarely deterministic; they are noisy. To handle this, the authors extend their method using Mixture Density Networks (MDNs). A major insight of the paper is that in stochastic systems, you do not need to stabilize every possible random outcome. Instead, you only need to stabilize the conditional mean of the dynamics and ensure the variance vanishes as the system reaches equilibrium. By applying their Lyapunov constraints to the mean dynamics of the MDN, they prove the entire stochastic system achieves "2nd mean stability."

Experimental Validation

The authors evaluated their methods on challenging dynamical systems designed to test the limits of stability modeling, including linear stochastic systems and non-linear systems with non-convex stability regions.

Trajectory predictions for deterministic and noisy data using the implicit method.

Key results from these experiments include:

  • Accuracy in Complex Regions: The implicit method significantly outperformed the convex-only approach when the underlying physics had non-convex stability regions, demonstrating much higher trajectory accuracy and flexibility.
  • Long-term Reliability: In stochastic simulations, standard unconstrained MDNs eventually drifted or became unstable over long time horizons. In contrast, the "Stable MDN" remained anchored to the equilibrium, perfectly matching the true system's asymptotic behavior.
  • Training Efficiency: Despite the added computational complexity of the root-finding implicit layer, the models remained highly trainable using standard backpropagation and automatic differentiation tools.

Limitations and Future Directions

While the proposed framework is a significant step forward for safe machine learning, it has limitations. The examples provided in the paper are relatively low-dimensional (e.g., 2D states). While the underlying theory scales, the computational cost of the implicit root-finding layer in very high-dimensional state spaces remains an open question.

Furthermore, the paper focuses strictly on modeling a system's natural dynamics. A natural and exciting next step is extending this framework to Control, where the network must learn an active policy to force an otherwise unstable system into stability. Finally, the method still requires some domain expertise to define the general structure of the Lyapunov function (such as ensuring it is positive-definite), meaning it is not yet a purely "plug-and-play" solution.

Ultimately, Almost Surely Stable Deep Dynamics proves that we do not have to choose between the expressive power of deep learning and the rigorous safety guarantees of classical control theory—with the right architecture, we can have both.

Summary updated

BibTeX
@inproceedings{lawrence2020almost,
  author = {Nathan P. Lawrence and Philip D. Loewen and Michael G. Forbes and Johan U. Backström and R. Bhushan Gopaluni},
  title = {{Almost Surely Stable Deep Dynamics}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=7Cey6c2cCX},
}
Figure