Course Correcting Koopman Representations

Mahan Fathi, Clement Gehring, Jonathan Pilault, David Kanaa, Pierre-Luc Bacon, Ross Goroshin

Introduction

Modeling nonlinear dynamical systems (NLDS)—such as chaotic weather patterns, swinging pendulums, or walking robots—is a notoriously difficult challenge. Koopman Theory offers an elegant mathematical workaround: by finding the right "measurement functions" (features), complex nonlinear transitions can be represented as simple linear transitions in a high-dimensional latent space. Linear systems are highly desirable because they are easy to solve, parallelize, and control using established tools like Linear Quadratic Regulators (LQR).

However, translating this theory into practice using deep learning (specifically, autoencoders) introduces a critical flaw. When linear dynamics are unrolled over long horizons in the latent space, they suffer from "drift," slowly losing their connection to the true physical state. The authors identify two specific mathematical failures causing this drift:

  1. Trajectory Crossing: In the latent space, two different paths might map to the exact same point in the original state space. This violates the fundamental rule of dynamical systems that a future state should be uniquely determined by its current state.
  2. Switching Dynamics: Purely linear systems struggle to represent environments that "switch" behaviors between different fixed points, such as a ball rolling between two distinct valleys.

The Solution: Periodic Reencoding

To combat latent drift, the authors introduce Periodic Reencoding, a simple yet powerful inference-time "course correction" mechanism for Deep Koopman Autoencoders.

The standard architecture consists of an encoder ($\phi$), a decoder ($\psi$), and a linear transition matrix ($K$). Normally, dynamics are unrolled purely in the latent space ($z_{t+1} = Kz_t$). With Periodic Reencoding, the latent state is periodically "reset." Every $k$ steps, the system performs two actions:

  1. Decode the current latent state back to the original state space: $\hat{x} = \psi(\hat{z})$.
  2. Re-encode that state back into the latent space: $z_{new} = \phi(\hat{x})$.

Because the neural encoder and decoder are not perfect inverses, this small jump acts as a course correction. It prevents the latent dynamics from wandering into regions of the feature space that the decoder no longer understands. Additionally, the authors incorporate a continuous-time parameterization using the bilinear (Tustin) method, which allows the model to handle controlled systems more effectively.

Key Insights

The success of Periodic Reencoding highlights a fundamental "Injective Gap" in Koopman autoencoders. Because the latent space is typically much larger than the state space, the decoder is not injective—multiple latent points can map to a single real-world state. Periodic reencoding forces the latent trajectory to stay on the specific "manifold" that the decoder accurately recognizes.

Instead of forcing a perfectly global linear representation, this method treats the linear model as a locally accurate approximation that gets regularly refreshed. Interestingly, the authors found that a Koopman model with a linear decoder often outperformed models with nonlinear decoders for long-range prediction, provided reencoding was used. Furthermore, this correction mechanism provides enough stability that researchers do not necessarily need to artificially constrain the eigenvalues of the $K$ matrix, a common trick in prior work.

Experiments and Results

The researchers validated their approach across two distinct categories of benchmarks:

  • Classic Nonlinear Systems: Low-dimensional but mathematically challenging ODEs, including the Parabolic Attractor, Duffing Oscillator (which features switching dynamics), Lotka-Volterra, Pendulum, and the chaotic Lorenz System.
  • D4RL Robotics Benchmarks: High-dimensional, complex environments involving collisions and control inputs (Hopper-v2, HalfCheetah-v2, and Walker2d-v2).

The results demonstrate massive error reductions. On the Duffing Oscillator, Periodic Reencoding reduced the Mean Squared Error (MSE) over 1,000 steps from 20.54 (without reencoding) to just 1.06. In the D4RL robotics tasks, the Koopman Autoencoder with Periodic Reencoding consistently outperformed standard Multi-Layer Perceptron (MLP) baselines. For example, on the "Hopper-medium" task, the model achieved an MSE of 0.008 compared to the MLP's 0.533.

The models also exhibited remarkable long-horizon stability, accurately predicting states up to 300 steps ahead despite only being trained on 100-step sequences. Furthermore, the model successfully acted as a semi-open-loop controller, planning 100 steps of actions into the future without feedback to achieve significant rewards in robotics environments.

Limitations and Future Directions

While highly effective, Periodic Reencoding does introduce a computational cost. Passing data back through the decoder and encoder is more expensive than a simple matrix multiplication. However, because this correction only happens periodically (e.g., every 20 steps), the authors argue the overhead is entirely manageable.

The authors also experimented with structured matrices (like diagonal or skew-symmetric matrices) to improve stability natively, but found they lacked the expressivity needed for complex tasks. Moving forward, establishing formal theoretical bounds for the optimal reencoding frequency ($k$) across different classes of systems remains an open question. Finally, the authors suggest that this stable "look-ahead" capability is ripe for integration into Model Predictive Control (MPC) or value function bootstrapping in Reinforcement Learning.

Summary updated

BibTeX
@inproceedings{fathi2024course,
  author = {Mahan Fathi and Clement Gehring and Jonathan Pilault and David Kanaa and Pierre-Luc Bacon and Ross Goroshin},
  title = {{Course Correcting Koopman Representations}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=A18gWgc5mi},
}
Figure