Low-rank extended Kalman filtering for online learning of neural networks from streaming data

Peter G. Chang, Gerardo Duràn-Martín, Alexander Y. Shestopaloff, Matt Jones, Kevin Murphy · DOI

Introduction

Online learning presents a unique challenge for modern machine learning: models must update incrementally from a continuous stream of data, often processing one sample at a time. While Stochastic Gradient Descent (SGD) is the ubiquitous choice for training neural networks, it struggles in truly online settings. SGD is notoriously sample-inefficient, requires careful tuning of learning rates, and often fails to capture the uncertainty necessary for robust decision-making in non-stationary environments.

The "gold standard" for online Bayesian learning is the Extended Kalman Filter (EKF). By tracking the posterior distribution of model parameters, the EKF provides a principled way to update weights and quantify uncertainty. However, for a network with $P$ parameters, the EKF requires $O(P^2)$ space and $O(P^3)$ time to update its covariance matrix. For modern architectures with millions of parameters, this is computationally infeasible. Previous attempts to scale the EKF typically relied on "diagonal" approximations, which ignore correlations between parameters and sacrifice the very information that makes the Kalman filter effective.

The LO-FI Algorithm

This paper introduces LO-FI (Low-rank Extended Kalman Filter), a deterministic algorithm designed to provide the benefits of Bayesian filtering at a computational cost that scales linearly with the number of parameters.

Diagonal plus Low-Rank (DLR) Approximation

The core innovation of LO-FI is the approximation of the parameter precision matrix using a "diagonal plus low-rank" (DLR) structure: $$\Sigma^{-1}_t = \Upsilon_t + W_t W_t^T$$ Here, $\Upsilon_t$ is a diagonal matrix representing independent parameter uncertainty, and $W_t$ is a low-rank matrix ($P \times L$, where $L \ll P$) that captures the most significant correlations between parameters.

Recursive Updates and SVD

LO-FI operates through a sequence of efficient updates:

  1. Linearization: Similar to the standard EKF, the algorithm linearizes the neural network's output with respect to its parameters at each time step.
  2. Woodbury Identity: By applying the Matrix Inversion Lemma (Woodbury identity), LO-FI updates the posterior without ever explicitly constructing the full $P \times P$ covariance matrix.
  3. Rank Maintenance via SVD: To prevent the rank $L$ from growing with every new data point, the algorithm performs an efficient Singular Value Decomposition (SVD) at each step. It retains only the top $L$ directions of uncertainty—those that capture the most information—and folds the remaining variance back into the diagonal term $\Upsilon_t$.

This approach ensures that the computational complexity remains $O(P L^2)$, making it viable for large-scale neural networks.

Experimental Evaluation

The authors evaluated LO-FI across a variety of tasks, comparing it against SGD, diagonal EKF variants, and other Bayesian Neural Network (BNN) baselines.

Image Classification and Non-Stationarity

On the Fashion-MNIST dataset, LO-FI demonstrated superior sample efficiency, reaching lower error rates faster than SGD. The algorithm's strengths were particularly evident in non-stationary scenarios, such as gradually rotating images or piecewise stationary tasks (e.g., permuted labels). In these cases, LO-FI adapted to distribution shifts significantly faster than replay-based SGD, as its Bayesian framework allows it to "unlearn" outdated certainties more effectively.

UCI Regression Benchmarks

Testing on eight standard UCI regression datasets showed that LO-FI consistently outperformed or matched other BNN baselines. Notably, LO-FI is fully deterministic, avoiding the variance issues associated with stochastic variational inference methods.

Contextual Bandits

To test the quality of LO-FI's uncertainty estimates, the researchers applied it to an MNIST-based contextual bandit problem. Using Thompson Sampling, the LO-FI agent accumulated significantly higher rewards than an $\epsilon$-greedy SGD agent. This suggests that the low-rank approximation successfully captures the uncertainty required for effective exploration-exploitation tradeoffs.

Key Insights

  • The Power of Partial Correlations: A critical finding is that capturing only a small number of correlations (e.g., $L=10$ to $50$) provides a massive performance boost over purely diagonal methods. Even in high-dimensional parameter spaces, most of the "information" in the covariance matrix is concentrated in a few principal directions.
  • Eliminating the Learning Rate: As a proper Bayesian filter, LO-FI inherently calculates its own optimal "step size" based on current uncertainty. This removes the need for the tedious learning rate tuning required by SGD.
  • Efficiency: Compared to L-RVGA, a recent stochastic low-rank method, LO-FI was approximately 20 times faster while maintaining competitive accuracy.

Limitations and Future Work

While LO-FI achieves $O(P)$ scaling, the constant factor involves $O(L^2)$ operations. As the rank $L$ increases, the computational overhead grows. Additionally, while LO-FI eliminates the learning rate, it introduces other hyperparameters such as "system noise" ($q$) and "prior strength" ($\eta_0$).

Future research directions include automating the tuning of these remaining hyperparameters via online Variational Bayes and extending the LO-FI framework to larger architectures like Transformers. The authors also suggest exploring ensembles of LO-FI models to better capture functional uncertainty.

Conclusion

LO-FI represents a significant step forward for online learning. By combining the theoretical rigor of the Extended Kalman Filter with an efficient low-rank approximation, it offers a scalable, deterministic, and sample-efficient alternative to SGD for training neural networks on streaming data.

Summary updated

BibTeX
@inproceedings{chang2023low,
  author = {Peter G. Chang and Gerardo Duràn-Martín and Alexander Y. Shestopaloff and Matt Jones and Kevin Murphy},
  title = {{Low-rank extended Kalman filtering for online learning of neural networks from streaming data}},
  booktitle = {CoLLAs},
  year = {2023},
}
Figure