NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Kalman Filter for Online Classification of Non-Stationary Data

Michalis Titsias, Alexandre Galashov, Amal Rannen-Triki, Razvan Pascanu, Yee Whye Teh, Jorg Bornschein

Introduction

In the real world, data is rarely static. Whether a model is predicting weather patterns or identifying trending topics on social media, the underlying rules change over time—a phenomenon known as non-stationarity. In Online Continual Learning (OCL), a model processes a continuous stream of data and must learn on the fly. Standard deep learning models struggle in this setting: if they learn too quickly, they suffer from catastrophic forgetting; if they learn too slowly, they lose the plasticity needed to adapt to new trends.

Most existing solutions rely on memory-intensive "replay buffers" that store old examples to re-show the model later. Researchers from Google DeepMind have proposed a fundamental alternative: adapting the classic Kalman Filter to treat the weights of a neural network's final layer as a dynamic state that "drifts" over time. This allows the model to automatically learn when to hold onto old knowledge and when to pivot to new patterns.

Methodology

The authors propose a probabilistic Bayesian approach that replaces the standard final linear layer of a neural network with a Kalman Filter (KF).

  1. The State Space Model: The weights ($w$) of the final layer are treated as a hidden state that evolves according to a "parameter drift" equation: $w_n = \gamma_n w_{n-1} + \text{noise}$.
  2. The Forgetting Coefficient ($\gamma_n$): This coefficient dictates memory retention. If $\gamma_n = 1$, the model remembers perfectly; if $\gamma_n = 0$, it completely resets. Instead of using a fixed value, the system uses Online SGD to learn $\gamma_n$ directly from the data. When predictions become inaccurate due to a distribution shift, the system automatically lowers $\gamma_n$ to "forget" outdated weights and adapt.
  3. Fast Recursions: Bayesian methods are notoriously slow, but the authors utilize efficient Kalman recursions. By sharing the covariance matrix across all classes, they reduce the computational cost to $O(m^2)$ (where $m$ is the feature size), significantly outperforming alternative Bayesian methods that scale at $O(m^3)$.
  4. Classification Trick: Because Kalman Filters are natively designed for continuous regression tasks, the authors employ a Gaussian approximation of the softmax likelihood. This maintains the mathematical elegance of the KF while enabling it to handle discrete classification labels.

Key Insights

A major insight from this work is that complex Bayesian logic does not need to be applied to the entire deep network. Applying it solely to the final "readout" layer—while fine-tuning the feature extractor backbone with standard SGD—provides a powerful balance of stability and flexibility.

Furthermore, the learned forgetting coefficient $\gamma_n$ acts as an automatic, "soft" change-point detector.

Automatic change detection in a toy time series

As observed in experiments with synthetic time series data, $\gamma_n$ visibly drops exactly when the data distribution shifts abruptly, allowing the model to shed stale knowledge before recovering as the new distribution stabilizes.

Experimental Results

The model was evaluated on several benchmarks, including a Toy Time Series, CIFAR-100 (in a class-incremental, non-stationary setup), and CLOC (a massive real-world dataset of 39 million images spanning 9 years of shifting geolocations).

Average online accuracy across task boundaries
  • Superior Accuracy: On the non-stationary CIFAR-100 benchmark, the Kalman Filter with a learned $\gamma$ achieved 33.3% accuracy in a purely linear setting, compared to just 13.7% for a stationary version.
  • Replay-Free Efficiency: The Kalman Filter approach, without any stored memory (replay), can match or exceed standard models that rely on replay buffers. Tracking the uncertainty of weights proves to be a highly sample-efficient alternative to hoarding old data.
  • Scaling to Large Data: On the massive CLOC dataset, the KF approach significantly outperformed strong baselines like Experience Replay (ER) and ACE. When initialized from a pre-trained model, the KF adapted much faster and reached higher peak performance than Online SGD.

Limitations and Future Work

While highly effective, the approach has a few limitations. The authors note that approximating the softmax likelihood with a Gaussian is a relatively crude simplification; more sophisticated approximations could yield better performance. Additionally, when training a network from scratch, the noisy features from early layers can sometimes interfere with the Kalman Filter's updates. Finally, the current model assumes a simple first-order Markov process. Future iterations could explore higher-order dynamics to capture more complex temporal patterns in the data stream.

Summary updated

BibTeX
@inproceedings{titsias2024kalman,
  author = {Michalis Titsias and Alexandre Galashov and Amal Rannen-Triki and Razvan Pascanu and Yee Whye Teh and Jorg Bornschein},
  title = {{Kalman Filter for Online Classification of Non-Stationary Data}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=ZzmKEpze8e},
}
Figure