Matrix-Free Natural Gradient via Stochastic Truncated Metrics

Ke SunNeurIPS 2026

TL;DR

Second-order optimization promises to navigate the bumpy loss landscapes of deep learning far better than standard gradient descent, except its core ingredient—a massive curvature matrix—is completely impossible to build or invert at modern scales. This paper introduces the Stochastic Truncated Metric (STM), an architecture-agnostic optimizer that replaces that gigantic matrix with a rolling buffer of just $K$ parameter-sized "probe" vectors. By inverting this tiny subspace exactly at every step, STM brings true natural gradient geometry to modern neural networks in linear time and memory—no layer-by-layer structural hacks required.

What Problem Does This Paper Address?

Standard optimizers like SGD and Adam step downhill in parameter space, blind to how much a tiny tweak in weights actually alters the network's output distribution. Natural Gradient Descent (NGD) fixes this by measuring distance using the Fisher Information Matrix (FIM)—a local map of the probability manifold's curvature.

There’s just one catch: for a network with $d$ parameters, the FIM is a $d \times d$ matrix. When $d$ is in the millions or billions, $O(d^2)$ storage and $O(d^3)$ inversion time are non-starters. Existing workarounds like K-FAC or Shampoo chop the matrix into layer-wise blocks or Kronecker factors. While effective, these impose rigid, architecture-dependent assumptions on the network's geometry (for instance, struggling with or skipping certain Transformer layers) and still carry heavy computational overhead. Can we get an unbiased, faithful natural gradient without explicit matrices or architectural assumptions?

Methods

STM strips NGD down to a strict matrix-free budget using three clever mechanisms:

  1. Unbiased Hutchinson Probes: Instead of building the batch FIM, STM runs one extra backward pass per step using random $\pm 1$ (Rademacher) noise injected at the output probabilities. This produces a single parameter-shaped vector $g_t$ whose outer product $g_t g_t^\top$ is a mathematically unbiased rank-1 estimate of the batch FIM.
  2. Truncated Moving Average: STM accumulates these noisy rank-1 snapshots over time via an exponential moving average (decay $\beta$), anchored by a constant damping floor ($\gamma I$). Crucially, it truncates history, storing only the past $K$ probes (e.g., $K = 20$) in a ring buffer.
  3. Exact Woodbury Inversion: Because the metric is just an identity matrix plus $K$ rank-1 updates, STM doesn't need iterative solvers. Using the classic Woodbury matrix identity, it inverts the metric algebraically and exactly by solving a tiny $K \times K$ Cholesky system maintained incrementally.
Table 1: Optimizer-update complexity comparison for total parameter count d and buffer size K (excluding forward/backward passes; Shampoo, SOAP, and K-FAC assume squared layers with factor decompositions at every step).

For a small fixed $K$, parameter updates take $O(Kd)$ time and auxiliary memory—linear in model size $d$.

Datasets

The author evaluates STM on two standard benchmarks (no new datasets are introduced):

  • CIFAR-10 image classification trained with a small ResNet ($d \approx 272\text{k}$ parameters).
  • Character-level Shakespeare language modeling trained with nanoGPT ($d \approx 10.7\text{M}$ parameters).

Key Insights and Ideas

  • The "Stochastic Spotlight" Effect: STM acts as a hybrid optimizer. The $K$ stored probes illuminate a $K$-dimensional subspace with true second-order Fisher preconditioning, while the remaining $d - K$ orthogonal directions stay "in the dark" and fall back to standard Euclidean gradient descent scaled by $1/\gamma$. Thus, $\gamma$ isn't just numerical damping—it directly sets the learning rate for unprobed directions.
  • Temporal Variance Reduction: Natural gradient usually demands huge batch sizes to tame curvature noise. STM trades spatial averaging (giant batches) for temporal averaging, blending curvature across $K$ small-batch steps.
  • Geometric Error Decay: You might worry that throwing away history past $K$ steps ruins the metric. The author proves that the error from truncating the infinite moving average decays geometrically ($\propto \beta^K$), meaning a modest buffer like $K = 20$ captures the lion's share of the historical signal.
  • Zero Extra Distributed Overhead: In multi-GPU setups, workers only need to sync the standard gradient and the single probe vector $g_t$—an $O(d)$ communication cost identical to SGD, unlike K-FAC which must sync layer-wise matrix factors.

Key Results

STM ($K=20$) was benchmarked against SGD, AdamW, and K-FAC across three random seeds on a single NVIDIA L4 GPU:

Figure 1: Training and validation curves on CIFAR-10 with a small ResNet (left) and character-level Shakespeare with nanoGPT (right). The final training runs use three new seeds for 100 and 200 epochs, respectively. Validation accuracy lines and shaded bands show the mean and sample standard deviation. Dotted curves show mean training loss. The gray band marks the CIFAR-10 20-epoch HPO promotion boundary for reference. STM uses fixed memory K = 20. For nanoGPT, K-FAC is configured to skip wte, wpe, attn, and lm_head.
  • CIFAR-10 / ResNet: STM achieves 88.70% test accuracy—within 0.26 percentage points of K-FAC (88.96%), though slightly behind SGD (89.83%) and AdamW (90.07%). Notably, STM runs ~3x faster than K-FAC (9.80s vs. 29.39s per epoch), despite refreshing its inverse every step while K-FAC updates every 10 steps.
  • Shakespeare / nanoGPT: STM reaches 49.71% test accuracy, beating SGD (49.16%) and landing within 0.61 points of K-FAC (50.32%), while matching K-FAC's per-epoch speed (~23.4s vs. 23.0s)—even though K-FAC had to be configured to skip embedding, attention, and head layers, whereas STM preconditioned the entire network seamlessly.
Table 2: Test accuracy, training time, and peak GPU memory. Accuracy is measured at each reloaded validation-best checkpoint and reported as mean ± sample standard deviation. Time is the mean per training epoch including data loading. Memory is the mean peak allocated GPU memory across three seeds, where each seed’s peak is the maximum over training epochs. Sample standard deviations are below 0.01 MiB except Shakespeare K-FAC (0.40 MiB).

Limitations and Future Work

  • Memory Bottleneck at LLM Scale: While $O(Kd)$ is linear in $d$, storing $K = 20$ full-precision copies of a 70-billion-parameter model is still prohibitively expensive (as seen on nanoGPT, where STM used 3865 MiB of VRAM vs. K-FAC's 3226 MiB).
  • Blind Directions: When critical curvature lies outside the tiny $K$-dimensional probe span, performance degrades to basic gradient descent. Furthermore, STM trailed AdamW in raw test accuracy on both tasks.
  • Future Directions: To scale to LLM pre-training and fine-tuning, the author suggests compressing the probe buffer to BF16, or combining the Woodbury setup with sharded, Kronecker, or random-sketched buffers. Extending the theoretical concentration bounds from fixed trajectories to full, non-convex training dynamics also remains an open problem.

Summary updated

Abstract

Natural gradient descent has been a theoretical pillar of second-order optimization for neural networks. Existing implementations either rely on structural approximations of the metric or incur substantial computational and memory overhead. Direct application of the natural gradient remains difficult at deep-network scale. We build an optimizer based on an unbiased stochastic estimator of the Fisher information matrix. It employs a truncated exponential moving average metric with damping, which we call the Stochastic Truncated Metric (STM), and is otherwise closely aligned with Amari's original natural gradient. This gives a parameter update with $O(Kd)$ time and memory per step for fixed small $K$, and is matrix-free in the sense that no dense $d\times d$ or layer-wise metric matrix is constructed or inverted. It is applicable across network architectures without layer-wise assumptions. We bound the error induced by the finite-memory truncation. On two benchmarks, STM achieves mean test accuracy within 0.7 percentage points of K-FAC, with comparable or lower per-epoch training cost.
BibTeX
@inproceedings{sun2026matrix,
  author = {Ke Sun},
  title = {{Matrix-Free Natural Gradient via Stochastic Truncated Metrics}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=R6odsq6K6r},
}
Figure