Eva: A General Vectorized Approximation Framework for Second-order Optimization

Lin Zhang, Shaohuai Shi, Bo LiarXiv 2023 · DOI

Introduction

Training deep neural networks (DNNs) typically relies on first-order optimizers like SGD or Adam. While computationally efficient per iteration, these methods often require thousands of steps to converge because they lack awareness of the loss landscape's "curvature." Second-order optimizers, such as K-FAC, utilize curvature information to take more informed steps, potentially halving the number of iterations required.

However, second-order methods face a significant "memory tax." Storing and inverting large curvature matrices is prohibitively expensive; for a ResNet-50 model, a full Hessian would require 650 Terabytes. Even efficient approximations like K-FAC remain roughly 3x slower per iteration than SGD and consume significantly more memory. Eva (General Vectorized Approximation) is a new framework designed to bridge this efficiency gap, offering second-order convergence speeds with a memory footprint nearly identical to SGD.

The Eva Framework: Vectorized Approximation

The core innovation of Eva lies in its shift from matrix-based to vector-based curvature approximation. Traditional methods like K-FAC approximate the Fisher Information Matrix using Kronecker products of two square matrices (Kronecker Factors). Eva replaces these with Kronecker Vectors (KVs)—the average activation and average gradient.

Comparison of (a) standard backpropagation, (b) matrix-based second-order methods like K-FAC, and (c) Eva's vectorized approach.

By using vectors, Eva reduces memory complexity from quadratic ($d^2$) to sublinear ($d$) relative to layer size. Furthermore, because Eva constructs the curvature matrix as a rank-one matrix plus a damping term, it can utilize the Sherman-Morrison formula for matrix inversion. This analytical approach transforms a cubic-time ($O(d^3)$) inversion into a linear-time ($O(d)$) vector operation, making the overhead per step almost negligible (1.14x vs SGD, compared to 3.47x for K-FAC).

Key Insights: Aggressive Trust Regions

A surprising finding is that a simple rank-one update captures enough curvature information to significantly outperform first-order methods. Theoretically, Eva can be viewed as an "aggressive" trust-region optimizer. While K-FAC is relatively conservative, Eva’s rank-one approximation allows for larger steps in specific directions.

Visualization of trust regions for different optimizers: (a) SGD, (b) Eva, (c) K-FAC, and (d) Shampoo. Eva's rank-one approximation creates a highly directed trust region.

The authors demonstrate that the largest eigenvalue/vector of the curvature matrix dominates the update, justifying this vectorized approach. Additionally, because Eva communicates vectors instead of matrices across GPUs via all-reduce, it is inherently more system-friendly for distributed training, avoiding the need for complex "stale" inverse strategies often required by K-FAC.

Performance and Results

Eva was evaluated across diverse benchmarks, from small-scale autoencoders to large-scale ImageNet training with ResNet-50 and Vision Transformers (ViT).

  • Speed: Eva achieves up to a 2.42x end-to-end speedup over Shampoo and 2.05x over SGD.
  • Efficiency: It uses 31% to 45% less memory than Shampoo and K-FAC, respectively. Its memory usage is almost indistinguishable from standard SGD.
  • Scalability: On ImageNet, Eva reached the MLPerf target accuracy (75.9%) significantly faster than all baseline optimizers.

Conclusion

Eva demonstrates that high-quality second-order optimization does not require massive memory overhead. By leveraging Kronecker Vectors and Sherman-Morrison inversion, Eva provides a practical path for scaling curvature-aware optimization to the largest deep learning models. Future work includes integrating Eva with model parallelism for LLMs and developing training recipes specifically tuned for second-order dynamics.

Summary updated

BibTeX
@misc{zhang2023eva,
  author = {Lin Zhang and Shaohuai Shi and Bo Li},
  title = {{Eva: A General Vectorized Approximation Framework for Second-order Optimization}},
  year = {2023},
  eprint = {2308.02123},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.02123},
}
Figure