Skip to main content
QUICK REVIEW

[Paper Review] When Do Flat Minima Optimizers Work?

Jean Kaddour, Linqing Liu|arXiv (Cornell University)|Feb 1, 2022
Advanced Neural Network ApplicationsComputer Science7 citations
TL;DR

This paper provides a comprehensive empirical comparison of Stochastic Weight Averaging (SWA) and Sharpness-Aware Minimization (SAM), two prominent flat-minima optimizers, across 42 tasks in computer vision, NLP, and graph representation learning. Despite SAM finding flatter minima via Hessian analysis, SWA often generalizes better, especially in graph learning; averaging SAM iterates yields the flattest solutions, and performance differences are highly dependent on architecture and dataset.

ABSTRACT

Recently, flat-minima optimizers, which seek to find parameters in low-loss neighborhoods, have been shown to improve a neural network's generalization performance over stochastic and adaptive gradient-based optimizers. Two methods have received significant attention due to their scalability: 1. Stochastic Weight Averaging (SWA), and 2. Sharpness-Aware Minimization (SAM). However, there has been limited investigation into their properties and no systematic benchmarking of them across different domains. We fill this gap here by comparing the loss surfaces of the models trained with each method and through broad benchmarking across computer vision, natural language processing, and graph representation learning tasks. We discover several surprising findings from these results, which we hope will help researchers further improve deep learning optimizers, and practitioners identify the right optimizer for their problem.

Motivation & Objective

  • To systematically compare SWA and SAM across diverse deep learning domains, including computer vision, NLP, and graph representation learning.
  • To investigate how model architecture and dataset characteristics influence the effectiveness of flat-minima optimizers.
  • To analyze the geometry of loss surfaces and flatness of minima found by SWA and SAM using Hessian eigenvalues and linear interpolations.
  • To identify conditions under which flat-minima optimizers improve generalization, and when they fail.
  • To provide a reproducible benchmark with open-sourced code and hyper-parameters for future research and practitioner use.

Proposed method

  • Trained models using SWA and SAM across 42 diverse tasks spanning image classification, NLP, and graph learning with standardized training protocols.
  • Employed linear interpolation between model weights to visualize loss surface geometry and quantify flatness.
  • Computed Hessian eigenvalues to quantitatively compare the flatness of minima found by SWA and SAM.
  • Used a rigorous model selection procedure with hyper-parameter tuning per task and model architecture.
  • Applied WASAM (Weight-Averaged SAM) to explore hybrid optimization strategies combining SWA and SAM.
  • Reported results on standard benchmarks (e.g., GLUE for NLP, OGB for GRL) using standard evaluation metrics.

Experimental results

Research questions

  • RQ1How do SWA and SAM compare in terms of generalization performance across diverse deep learning tasks?
  • RQ2Does SAM consistently find flatter minima than SWA, and does this translate to better generalization?
  • RQ3How do model architecture and dataset type affect the relative performance of SWA and SAM?
  • RQ4What is the relationship between loss surface flatness (measured via Hessian) and actual test accuracy?
  • RQ5Can averaging iterates from SAM further improve flatness and generalization beyond standard SAM?

Key findings

  • Despite SAM finding flatter minima than SWA based on Hessian eigenvalue analysis, SWA often generalizes better, especially in graph representation learning (GRL) tasks.
  • For NLP tasks, SAM outperforms SWA in most cases, indicating that flatness is more beneficial in this domain.
  • In GRL tasks, SWA consistently outperforms SAM, suggesting that flatness alone is insufficient for improved generalization.
  • Averaging iterates from SAM (via WASAM) yields the flattest minima among all methods, indicating that ensemble averaging enhances flatness.
  • When flat-minima optimizers fail to improve performance, clear discrepancies are observed in the shapes of loss and accuracy curves during training.
  • The effectiveness of SWA and SAM is highly dependent on both the model architecture and the dataset, with no single optimizer universally superior.

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.