Flatness-Aware Stochastic Gradient Langevin Dynamics
Abstract
Lay Summary
Training a neural network is like searching a vast landscape for a low point, but not all low points are equally useful. Some solutions sit in narrow valleys, where a small change can make the model worse, while others sit in wide, flatter valleys that often lead to better performance on new data. Existing methods can encourage models to find these flatter solutions, but they often require extra computations, extra memory, or only look in a small neighborhood of the current model. We introduce Flatness-Aware Stochastic Gradient Langevin Dynamics, a training method that uses carefully calibrated random noise to help the model explore the landscape and favor flatter, more stable solutions. The key idea is simple: instead of measuring flatness directly, which is expensive, we add small random perturbations during training so that the algorithm can sense whether a solution remains good nearby. Our theory shows how to choose the amount of noise so that this effect reliably targets flat solutions. In experiments on image classification, uncertainty estimation, and detecting unfamiliar data, our method performs competitively or better than strong baselines while using about the same memory and computation as standard training methods. This makes flatness-aware training more practical for building neural networks that generalize well and provide more reliable uncertainty estimates.