Skip to main content
QUICK REVIEW

[Paper Review] Sharpness-Aware Training for Free

Jiawei Du, Daquan Zhou|arXiv (Cornell University)|May 27, 2022
Advanced Neural Network ApplicationsComputer Science15 citations
TL;DR

This paper proposes Sharpness-Aware Training for Free (SAF), a novel method that achieves sharpness-aware training with near-zero computational overhead by minimizing a trajectory loss based on KL-divergence between model outputs at current and past weights. SAF matches SAM's generalization performance on ImageNet while training at nearly the same speed as standard SGD, making it highly efficient for large-scale models.

ABSTRACT

Modern deep neural networks (DNNs) have achieved state-of-the-art performances but are typically over-parameterized. The over-parameterization may result in undesirably large generalization error in the absence of other customized training strategies. Recently, a line of research under the name of Sharpness-Aware Minimization (SAM) has shown that minimizing a sharpness measure, which reflects the geometry of the loss landscape, can significantly reduce the generalization error. However, SAM-like methods incur a two-fold computational overhead of the given base optimizer (e.g. SGD) for approximating the sharpness measure. In this paper, we propose Sharpness-Aware Training for Free, or SAF, which mitigates the sharp landscape at almost zero additional computational cost over the base optimizer. Intuitively, SAF achieves this by avoiding sudden drops in the loss in the sharp local minima throughout the trajectory of the updates of the weights. Specifically, we suggest a novel trajectory loss, based on the KL-divergence between the outputs of DNNs with the current weights and past weights, as a replacement of the SAM's sharpness measure. This loss captures the rate of change of the training loss along the model's update trajectory. By minimizing it, SAF ensures the convergence to a flat minimum with improved generalization capabilities. Extensive empirical results show that SAF minimizes the sharpness in the same way that SAM does, yielding better results on the ImageNet dataset with essentially the same computational cost as the base optimizer.

Motivation & Objective

  • To address the high computational cost of Sharpness-Aware Minimization (SAM), which doubles training time due to two backward passes per step.
  • To develop a sharpness-aware training method that incurs almost no additional computation beyond standard optimization.
  • To maintain or improve generalization performance comparable to SAM while operating at the same speed as SGD.
  • To enable efficient sharpness-aware training on large-scale datasets like ImageNet-1k and beyond, where memory and compute are critical.
  • To introduce a memory-efficient variant, MESA, for deployment on extremely large-scale datasets such as ImageNet-21K or JFT-300M.

Proposed method

  • Proposes a novel trajectory loss based on the KL-divergence between the output distributions of a neural network using current weights and past weights.
  • Uses this trajectory loss as a surrogate for SAM's sharpness measure, capturing the rate of change in the loss along the training trajectory.
  • Integrates the trajectory loss into standard optimization by minimizing it alongside the main training loss, effectively penalizing sharp and sudden drops in the loss.
  • Memorizes the model outputs from previous steps to compute the trajectory loss without additional forward passes during training.
  • Introduces MESA, a memory-efficient variant that uses an exponential moving average (EMA) of the model weights to generate the past model outputs.
  • Employs a two-stage training process: first, the model is trained with standard SGD; second, the trajectory loss is minimized using stored outputs from earlier steps.

Experimental results

Research questions

  • RQ1Can sharpness-aware training be achieved with near-zero additional computational cost compared to standard SGD?
  • RQ2Does a trajectory-based loss based on output distribution shifts effectively approximate the sharpness measure used in SAM?
  • RQ3Can the proposed method SAF match or exceed SAM’s generalization performance while maintaining training speed?
  • RQ4How does the method scale to large-scale datasets like ImageNet-1k and ImageNet-21k in terms of both accuracy and memory efficiency?
  • RQ5Can a memory-efficient variant like MESA be designed to extend the applicability of SAF to extremely large-scale learning tasks?

Key findings

  • SAF achieves 96.37% top-1 accuracy on ImageNet-1k with ResNet-50, comparable to SAM’s 96.50%, but with 97.6% of the training speed of standard SGD.
  • On ResNet-101, SAF attains 96.93% top-1 accuracy, matching SAM’s performance while training at 99.2% of the speed of SGD.
  • On Wide-ResNet-28-10, SAF achieves 97.08% top-1 accuracy, slightly outperforming SAM (97.07%) with nearly identical training speed.
  • MESA achieves 97.46% top-1 accuracy on PyramidNet-110, outperforming both SAM and SAF while using only 84.3% of the training speed of SGD.
  • SAF incurs only 0.7% additional computational cost compared to SAM’s 100%, demonstrating near-zero overhead in practice.
  • The trajectory loss based on KL-divergence effectively captures sharpness dynamics and enables convergence to flatter minima without additional backward passes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.