FAM: Relative Flatness Aware Minimization

Linara Adilova, Amr Abourayya, Jianning Li, Amin Dada, Henning Petzka +3 more
7/5/2023
cs.LG

Official code: kampmichael/RelativeFlatnessAndGeneralization (8 stars, Apache-2.0, last commit 2024-05-14).

Abstract

Flatness of the loss curve around a model at hand has been shown to empirically correlate with its generalization ability. Optimizing for flatness has been proposed as early as 1994 by Hochreiter and Schmidthuber, and was followed by more recent successful sharpness-aware optimization techniques. Their widespread adoption in practice, though, is dubious because of the lack of theoretically grounded connection between flatness and generalization, in particular in light of the reparameterization curse - certain reparameterizations of a neural network change most flatness measures but do not change generalization. Recent theoretical work suggests that a particular relative flatness measure can be connected to generalization and solves the reparameterization curse. In this paper, we derive a regularizer based on this relative flatness that is easy to compute, fast, efficient, and works with arbitrary loss functions. It requires computing the Hessian only of a single layer of the network, which makes it applicable to large neural networks, and with it avoids an expensive mapping of the loss surface in the vicinity of the model. In an extensive empirical evaluation we show that this relative flatness aware minimization (FAM) improves generalization in a multitude of applications and models, both in finetuning and standard training. We make the code available at github.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Experiments and implementations of the methods described in the paper "Relative Flatness and Generalization".

81Shell, PythonMay 27, 20212 years agoApache-2.0

Similar Papers

Cite this paper

@article{adilova2023fam,
  title  = {FAM: Relative Flatness Aware Minimization},
  author = {Linara Adilova and Amr Abourayya and Jianning Li and Amin Dada and Henning Petzka and Jan Egger and Jens Kleesiek and Michael Kamp},
  year   = {2023},
  eprint = {2307.02337},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.02337v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2307.02337.svg)](https://codeofpaper.com/paper/2307.02337)

Discussion