LoKO: Low-Rank Kalman Optimizer for Online Fine-Tuning of Large Models

Hossein Abdi, Mingfei Sun, Andi Zhang, Samuel Kaski, Wei Pan · Submission to ICLR 2025 · Rejected

TL;DR

The Low-Rank Kalman Optimizer (LoKO) casts parameter-efficient fine-tuning (PEFT) as an online state-estimation problem, replacing standard gradient-based optimizers with the Extended Kalman Filter (EKF). By combining Low-Rank Adaptation (LoRA/DoRA) with a diagonal covariance approximation and an exponential moving average (EMA) noise estimator, LoKO scales Kalman optimization to large vision and language models (up to 355M parameters), achieving faster convergence and higher online accuracy than AdamW and AdaGrad.

What Problem Does This Paper Address?

In streaming and real-time deployment scenarios, models must adapt online to individual samples (batch size of 1) as data arrives. While Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA drastically reduce the number of trainable parameters, they typically rely on first-order gradient optimizers like AdamW or AdaGrad. These first-order methods are prone to sub-optimal convergence and require meticulous hyperparameter tuning (such as learning rate decay schedules).

Second-order methods—specifically the Extended Kalman Filter (EKF), which theoretically mirrors online natural gradient descent—offer rapid, robust updates. Historically, however, EKF has been computationally prohibitive for deep networks: its error covariance matrix scales quadratically ($\mathcal{O}(n^2)$) and requires costly matrix inversions, making it infeasible for modern architectures with millions of parameters.

Methods

LoKO resolves this scalability bottleneck through three key innovations:

  1. State-Space Formulation over LoRA Parameters: Trainable low-rank parameters $\tilde{\theta}_k \in \mathbb{R}^{\tilde{n}}$ (where $\tilde{n} \ll n$) are treated as the hidden state in a stationary process model ($\tilde{\theta}_k = \tilde{\theta}_{k-1}$ without process noise). The forward pass serves as the nonlinear measurement model.
  2. Diagonal Covariance Approximation: Instead of maintaining an $\tilde{n} \times \tilde{n}$ covariance matrix, LoKO retains only the diagonal entries $\hat{p}_k$, reducing memory and update complexity from quadratic to linear ($\mathcal{O}(\tilde{n})$). Crucially, the required matrix inversion is restricted to the output space $m \times m$ (where $m$ is the output dimension, e.g., the number of classes), keeping matrix inversion costs independent of model parameter count.
  3. EMA Observation Noise Covariance Estimation: The measurement noise covariance $R_k$ is dynamically tracked using an Exponential Moving Average (EMA) with a forgetting factor $\beta \in (0.9, 0.98)$. LoKO incorporates a first-order Taylor expansion term—$H_k(\hat{p}_{k|k-1} \bullet H_k^\top)$—into the noise residual without added overhead, significantly stabilizing training and widening the viable initialization window for the prior covariance $\hat{p}_0$.

Datasets

The authors evaluated LoKO on standard computer vision and natural language processing benchmarks:

  • Computer Vision: MNIST, CIFAR-10, CIFAR-100, and ImageNet100. Backbones included DenseNet-121 (7.5M), ResNet-18 (11M), ResNet-50 (24M), ViT-B16 (86M), and ViT-L16 (305M).
  • Natural Language Processing (GLUE): SST-2, CoLA, and MRPC using RoBERTa-base (125M) and RoBERTa-large (355M).

No new benchmarks were introduced.

Key Insights and Ideas

  • Natural Diagonalization: The authors observed empirically that as neural network training progresses, the parameter covariance matrix naturally converges toward a (block-)diagonal structure, providing theoretical and empirical justification for discarding off-diagonal terms.
  • Output-Bounded Inversion Cost: Because inversion occurs in the observation dimension $m$ rather than parameter dimension $\tilde{n}$, large vision transformers with hundreds of millions of parameters incur the exact same matrix inversion cost as a toy network on the same classification task.
  • Hyperparameter Robustness: Unlike gradient descent algorithms that diverge if the learning rate is slightly misconfigured, LoKO achieves near-optimal parameters across a wide initialization range for $\hat{p}_0$ (especially when drawn uniformly from $[0, \text{upper\_bound}]$).
  • Resilience to Distribution Shift: When evaluating out-of-distribution (OOD) data injected into the stream, LoKO adapted significantly faster to distribution shifts than AdamW.

Key Results

  • Superior Online Accuracy: In single-epoch streaming adaptation across vision tasks, LoKO consistently outperformed LoRA/AdamW and LoRA/AdaGrad:
  • ResNet-18 on CIFAR-10: 96.05% vs. 65.98% (AdamW) and 61.83% (AdaGrad).
  • ResNet-50 on CIFAR-100: 79.39% vs. 60.39% (AdamW) and 40.62% (AdaGrad).
  • ViT-L16 on ImageNet100: 97.71% vs. 95.13% (AdamW) and 93.91% (AdaGrad).
  • Faster Convergence: LoKO reached flat loss plateaus in far fewer observations (e.g., 5,000 steps vs. 12,000 for AdamW on ImageNet100/ViT-L16; 2,000 steps vs. 7,000 on CIFAR-100/ViT-B16).
  • DoRA Extension: Combining Kalman filtering with Weight-Decomposed LoRA (DoRA) matched or surpassed baseline optimizers (e.g., 97.96% on ImageNet100 with ViT-L16).

Limitations and Future Work

  • Higher Per-Step Wall-Clock Overhead: Computing output Jacobians means LoKO has a higher per-step wall-clock latency compared to AdamW (e.g., 1.4s vs. 0.03s per step on ViT-L16), though it compensates by requiring substantially fewer total steps to converge.
  • Language Task Gap from Weight Decay: AdamW slightly outperformed LoKO on specific text classification tasks (e.g., RoBERTa-large on MRPC reached 93.04% with AdamW vs. 88.70% with LoKO). The authors attribute this to AdamW's decoupled weight decay regularization, which LoKO currently lacks.
  • Scope: Evaluations were limited to online classification in CV and NLP. Extending LoKO to open-ended autoregressive generation and online reinforcement learning remains open for future research.

Summary updated

BibTeX
@misc{abdi2024loko,
  author = {Hossein Abdi and Mingfei Sun and Andi Zhang and Samuel Kaski and Wei Pan},
  title = {{LoKO: Low-Rank Kalman Optimizer for Online Fine-Tuning of Large Models}},
  year = {2024},
  eprint = {2410.11551},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.11551},
}
Figure