Fast Gauss-Newton for Multiclass Cross-Entropy

Mikalai Korbit, Mario ZanonNeurIPS 2026

TL;DR

Second-order optimization promises smarter training steps by looking at the curvature of the loss landscape, but for multiclass classification, computing that curvature gets painfully slow as the number of classes grows. Fast Gauss-Newton (FGN) solves this by cleanly splitting the curvature matrix in two: keeping a lightweight "true-class vs. the rest" signal and dropping the noisy infighting among wrong classes. The result is an optimizer that preserves exact losses and gradients, matches full Gauss-Newton accuracy, and runs significantly faster.

What Problem Does This Paper Address?

First-order optimizers like SGD and Adam only look at the local slope (gradient) to decide how to update weights. Second-order methods also look at curvature—how fast that slope is changing—to take much more informed steps. Because exact Hessians (second-derivative matrices) are too massive and unruly for neural networks, researchers rely on the Generalized Gauss-Newton (GGN) matrix, a well-behaved, positive semidefinite approximation of curvature.

Here is the catch: in multiclass classification with $C$ classes, the softmax function entangles every class prediction with every other class prediction. Even if you use clever "matrix-free" tricks to avoid building the massive parameter matrix in memory, computing curvature-vector products still scales with $C$. When you have hundreds or thousands of classes (think fine-grained classification or vocabulary tokens), propagating curvature across every single logit becomes a severe computational bottleneck.

Methods

Instead of trying to compress or factorize the full $C$-dimensional curvature matrix after the fact, the authors rewrite the problem before taking second derivatives.

First, they use a classic identity: multiclass cross-entropy can be written exactly as a scalar function (softplus) of a single "true-vs-rest" margin per example—specifically, the log-sum-exp aggregate of all competing wrong-class logits minus the true-class logit. This changes neither the loss nor the gradient.

However, applying the Gauss-Newton approximation to this scalar margin instead of the full $C$-logit vector changes the curvature. The authors prove an exact mathematical decomposition of the standard multiclass GGN matrix:

$$\text{Full GGN} = \text{Kept True-vs-Rest Term (FGN)} + \text{Dropped Competitor Covariance}$$

The softmax covariance splits cleanly into a rank-one true-vs-rest outer product (kept by FGN) and a covariance block strictly among the wrong classes (dropped).

By keeping only the first term, each training example contributes just a rank-one curvature term rather than a $C \times C$ coupled block. For a mini-batch of size $b$, the authors show that finding the damped parameter update reduces to solving a tiny, symmetric $b \times b$ linear system ("row-space"). They solve this matrix-free using Conjugate Gradient (CG), requiring just one forward-mode (JVP) and one reverse-mode (VJP) autodiff pass through the scalar margin per CG step.

Datasets

No new benchmarks are introduced. The authors evaluate FGN across three settings:

  • Synthetic Gaussian features: 2048-dimensional features with class counts scaling from $C = 2$ up to $4096$ to benchmark raw update speed and verify theoretical properties.
  • Cars196: A fine-grained 196-class image dataset, optimizing a linear classification head on frozen, ImageNet-pretrained ResNet-50 features (where full GGN equals the exact Hessian).
  • CIFAR-100: Standard 100-class image classification, training a ResNet-20 nonlinearly end-to-end.

Key Insights and Ideas

  • Exact loss, approximate curvature: Unlike sampled-softmax or binary-reduction tricks, FGN never touches the forward loss or first-order gradient. Every competing class still contributes smoothly to the update direction via a probability-weighted mean; FGN only drops how the wrong classes covary with one another.
  • Exactness when one rival dominates: For binary classification ($C=2$), FGN is 100% exact. For $C > 2$, the approximation error depends on competitor dispersion—not total class count. If a dog breed classifier is torn between a Husky and a Malamute (one dominant rival to the true class) while ignoring 194 other breeds, the dropped covariance practically vanishes.
  • Damping masks the gap: Second-order methods add a damping term ($\lambda I$) to prevent wild steps in flat directions. The authors show that damping naturally suppresses the influence of the dropped competitor covariance, keeping FGN steps closely aligned with full GGN steps even when wrong-class probabilities are spread thin.

Key Results

  • Scaling with classes: On synthetic heads at $C = 4096$, FGN achieves a 2.85$\times$ speedup per step over a full matrix-free GGN baseline (SGN).
  • Frozen-feature head (Cars196): FGN reaches 44.43% test accuracy compared to 44.33% for SGN and 42.28% for Adam, hitting the 44% accuracy mark noticeably faster (3.45s vs. 4.44s for SGN)—remarkably, even though the dropped covariance accounts for ~41% of the curvature trace by the end of training.
  • End-to-end ResNet-20 (CIFAR-100): Under the same 5-iteration CG budget, FGN achieves 67.05% test accuracy vs. 66.78% for SGN while running 1.25$\times$ faster (76.15 ms vs. 95.50 ms per step). Standard SGD with momentum remains faster overall and slightly more accurate here (68.23% with standard tuning).

Limitations and Future Work

  • Regime-dependent tightness: When the model is confused across many competing classes simultaneously, the dropped covariance term grows larger, making FGN a looser under-approximation of the full GGN.
  • Forward pass still scales with $C$: Because FGN computes exact probabilities and gradients, evaluating all $C$ logits in the forward pass remains class-dependent—only the inner linear solver becomes independent of $C$.
  • Theory-practice gap: The formal convergence proofs assume independent mini-batches for gradients and curvature with fixed damping, whereas the practical algorithm reuses the same mini-batch.
  • Future directions: Extending the true-vs-rest curvature model by adding cheap, low-rank approximations to recapture the most important directions of the dropped competitor covariance.

Summary updated

BibTeX
@inproceedings{korbit2026fast,
  author = {Mikalai Korbit and Mario Zanon},
  title = {{Fast Gauss-Newton for Multiclass Cross-Entropy}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=KiUlDWxNTi},
}
Figure