Large-Scale Distributed Second-Order Optimization Using Kronecker-Factored Approximate Curvature for Deep Convolutional Neural Networks.

Kazuki Osawa, Yohei Tsuji, Yuichiro Ueno, Akira Naruse, Rio Yokota, Satoshi Matsuoka · DOI

TL;DR

This paper tackles the "generalization gap" that arises when training deep neural networks with very large mini-batches, a common practice in large-scale distributed settings. The authors propose a novel distributed implementation of a second-order optimization method, Kronecker-Factored Approximate Curvature (K-FAC), which achieves comparable generalization to first-order methods like SGD but converges significantly faster, even with massive mini-batches.

What Problem Does This Paper Address?

Training deep neural networks (DNNs) on massive datasets often involves distributing the workload across many GPUs. A common strategy is data parallelism, where the dataset is split, and each GPU processes a subset with a replica of the model. As the number of GPUs increases, the effective mini-batch size (total samples processed per gradient update) grows proportionally. However, research has shown that excessively large mini-batches can lead to a "generalization gap," meaning the model performs worse on unseen data despite achieving high training accuracy. Existing solutions often involve complex, ad-hoc adjustments to learning rates and batch normalization. This paper aims to provide a more principled and efficient solution by leveraging second-order optimization.

Methods

The core of the paper is the adaptation and distributed implementation of the Kronecker-Factored Approximate Curvature (K-FAC) method. K-FAC is a second-order optimization technique that uses an approximation of the Fisher Information Matrix (FIM) to guide the optimization process. The key innovations presented are:

  • Distributed K-FAC: A hybrid data-parallel and model-parallel scheme is designed to efficiently compute and distribute K-FAC's approximations of the FIM (Kronecker factors). This design aims to reduce the overhead typically associated with second-order methods.
  • Mixed-Precision Computation: Leveraging NVIDIA's Tensor Cores to accelerate the computation of Kronecker factors, which are a bottleneck in the data-parallel stage.
  • Symmetry-Aware Communication: Exploiting the symmetric nature of Kronecker factors to reduce the volume of data communicated between processes.
  • Training Schemes: Several techniques are introduced to further improve K-FAC's performance and stability, including:
  • Mixup: An extension of the mixup regularization technique.
  • Warmup Damping: A method to stabilize training by gradually reducing a damping factor applied to the FIM, especially crucial in early training stages when the FIM is unstable.
  • Learning Rate and Momentum Scheduling: Polynomial decay for learning rate and a momentum rate adjusted to maintain a fixed ratio with the learning rate.
  • Weights Rescaling: A technique to prevent weights from becoming too large.
  • Stale Fisher Information: Investigating the impact of updating the FIM less frequently, which can significantly reduce computational overhead.
  • Diagonal Fisher Information Matrix for BN Layers: Approximating the FIM for Batch Normalization layers as diagonal to reduce memory consumption.

Datasets

  • ImageNet: Used for training and evaluating the ResNet-50 model. The paper focuses on large-scale training scenarios, utilizing the full ImageNet dataset.

Key Insights and Ideas

  • Second-order methods can generalize as well as first-order methods: Contrary to some prior beliefs, this work demonstrates that K-FAC, a second-order method, can achieve comparable generalization performance to highly optimized first-order methods (SGD) even with extremely large mini-batches.
  • K-FAC's inherent advantage with large mini-batches: The statistical stability of gradients in large mini-batches makes them more amenable to second-order approximations, potentially unlocking K-FAC's full potential in these scenarios.
  • Systematic improvements over ad-hoc techniques: The paper frames its training schemes not as arbitrary fixes but as systematic design decisions informed by the mathematical properties of the FIM, suggesting a more principled path to optimizer development.
  • Staleness of FIM is tolerable: The FIM doesn't need to be updated at every iteration, especially for larger mini-batches, offering a significant avenue for computational savings.
  • BN layer FIM can be simplified: Approximating the FIM for Batch Normalization layers as diagonal drastically reduces memory overhead without sacrificing accuracy.

Key Results

  • Competitive Accuracy with Large Mini-batches: Achieved 75% Top-1 validation accuracy on ImageNet with ResNet-50 using mini-batch sizes up to 131,072.
  • Faster Convergence: For mini-batch sizes under 16,384, convergence to 75% accuracy was achieved in 35 epochs. Even with a mini-batch size of 131,072, convergence took only 978 iterations.
  • High-Performance Distributed Training: Trained ResNet-50 on ImageNet in 10 minutes to achieve 74.9% top-1 accuracy using 1,024 Tesla V100 GPUs, demonstrating the effectiveness of their distributed K-FAC design.
  • Scalability: Observed superlinear scaling up to 64 GPUs, with performance degradation starting around 256 GPUs due to communication overhead.

Limitations and Future Work

  • Communication Bottleneck: While significantly improved, communication overhead for distributing Kronecker factors remains a hotspot, especially at very large scales.
  • Further Approximation of Kronecker Factors: The authors suggest that there is still room for more aggressive approximation of Kronecker factors without loss of accuracy, which could further accelerate training.
  • Understanding the Role of Ad-hoc Techniques: The observation that successful SGD improvements align with FIM properties suggests a deeper theoretical connection to be explored. Future work could involve further analysis of FIM eigenvalues and their impact on preconditioning to better understand the advantages of second-order methods.

Summary updated

BibTeX
@inproceedings{osawa2019large,
  author = {Kazuki Osawa and Yohei Tsuji and Yuichiro Ueno and Akira Naruse and Rio Yokota and Satoshi Matsuoka},
  title = {{Large-Scale Distributed Second-Order Optimization Using Kronecker-Factored Approximate Curvature for Deep Convolutional Neural Networks.}},
  booktitle = {CVPR},
  year = {2019},
  doi = {10.1109/cvpr.2019.01264},
}
Figure