THOR, Trace-based Hardware-driven Layer-Oriented Natural Gradient Descent Computation

Mengyun Chen, Kai-Xin Gao, Xiaolei Liu, Zidong Wang, Ningxi Ni, Qian Zhang, Lei Chen, Chao Ding, Zheng-Hai Huang, Min Wang, Shuangling Wang, Fan Yu, Xinyuan Zhao, Dachuan Xu

Abstract

Second-order optimization methods like Natural Gradient Descent (NGD) offer superior convergence rates compared to first-order methods but are often hindered by the massive computational overhead of calculating and inverting the Fisher Information Matrix (FIM). We present THOR (Trace-based Hardware-driven layer-ORiented Natural Gradient Descent), a novel optimizer designed to make second-order optimization practical for large-scale deep learning. THOR introduces trace-based adaptive updates to skip redundant computations and hardware-driven matrix splitting to maximize throughput. Our results demonstrate that THOR can train ResNet-50 on ImageNet to 75.9% accuracy in as little as 2.7 minutes, significantly outperforming standard first-order and second-order optimizers in wall-clock time.

Introduction

Deep learning training typically relies on first-order optimizers such as Stochastic Gradient Descent (SGD) or Adam. While computationally efficient, these methods only utilize gradient information, often struggling with the complex and unbalanced curvature of neural network loss landscapes. Second-order methods utilize the Fisher Information Matrix (FIM) to account for this curvature, requiring fewer iterations to converge. However, the $O(n^3)$ complexity of FIM inversion makes these methods prohibitively expensive for large models. THOR builds upon Kronecker-factored Approximate Curvature (KFAC) to eliminate this overhead through algorithmic and hardware-aware innovations.

Methodology

Trace-Based Adaptive Updates

THOR optimizes the frequency of FIM updates by monitoring the matrix trace. The authors hypothesize that the FIM eventually converges to a stationary distribution, meaning frequent updates become redundant as training progresses.

Stabilization of F-norm across different network layers during training.

By calculating a "relative change rate" of the trace, THOR adaptively skips expensive updates when the change is minimal. Unlike the Frobenius norm, which is computationally expensive to scale, the matrix trace provides a linear-time proxy for detecting FIM stability.

Relative change of matrix trace over training iterations for various layers (conv-1, conv-2, conv-3, and fc).

Hardware-Driven Matrix Splitting

To further reduce latency, THOR employs hardware-algorithm co-design. Recognizing that modern accelerators (e.g., Tesla V100, Ascend 910) have specific "sweet spots" for matrix dimensions, THOR splits large Kronecker factors into smaller block-diagonal matrices. This approximation allows the hardware to perform inversions significantly faster, reducing a typical 2-second KFAC inversion to just 200ms on a Tesla V100.

Layer-Oriented Computation

THOR treats each layer independently. This allows the optimizer to maintain high update frequencies for volatile layers while aggressively increasing the update intervals for stable layers, ensuring computational resources are allocated where they provide the most benefit to convergence.

Key Results

THOR demonstrates that second-order methods can surpass first-order methods in total wall-clock training time:

  • Large-Scale Performance: On ImageNet, THOR trained ResNet-50 to 75.9% accuracy in 66.7 minutes using 8 NPUs. Scaling to 256 NPUs reduced the training time to a remarkable 2.7 minutes.
  • Efficiency Gains: In CIFAR-10 benchmarks, THOR reached 93% accuracy 152 seconds faster than Momentum and nearly 4,000 seconds faster than standard KFAC implementations.
  • Computational Savings: The combination of adaptive updates and hardware-aware splitting drastically reduces the per-step overhead, making the theoretical advantages of NGD accessible in practice.

Conclusion and Future Work

THOR successfully bridges the gap between the theoretical efficiency of second-order optimization and the practical requirements of high-performance hardware. By prioritizing hardware throughput and utilizing cheap statistical proxies like the matrix trace, THOR achieves unprecedented training speeds for CNNs. Future work will focus on extending THOR to Transformer-based architectures like BERT and GPT-2, and automating the hardware-specific profiling required for optimal matrix splitting.

Summary updated

BibTeX
@inproceedings{chen2021thor,
  author = {Mengyun Chen and Kai-Xin Gao and Xiaolei Liu and Zidong Wang and Ningxi Ni and Qian Zhang and Lei Chen and Chao Ding and Zheng-Hai Huang and Min Wang and Shuangling Wang and Fan Yu and Xinyuan Zhao and Dachuan Xu},
  title = {{THOR, Trace-based Hardware-driven Layer-Oriented Natural Gradient Descent Computation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i8.16867},
}
Figure