arXiv:2610.11206cs.LGOct 2026

Manuscript Offprint

arXiv:2610.11206

Do Flatter Minima Drive Better Generalization? An Algorithmic Separation in Grokking

Mohnish Harwani

Abstract

Flat loss landscapes have long been linked to better generalization in neural networks. However, its role as a causal mechanism for generalization is less established. Grokking provides an unique testbed to understand this distinction: models are prone to fit observed data using non-generalizing structure and remain in that regime for prolonged periods, transitioning to generalization only under particular training conditions. In this work, we study whether flat loss landscapes can act as a driving mechanism in this transition. While recent work has argued for flatness as a necessary geometric condition for this transition, we find that biasing training toward flatter solutions using sharpness-aware minimization (SAM) is insufficient to reliably induce this transition, despite producing flatter solutions. However, when SAM is paired with mechanisms that drive generalization such as weight decay, an interesting property emerges: SAM can accelerate the transition to generalizing solutions by up to 4x at the epoch-level. We theoretically untangle this relationship between SAM and weight decay using a minimal interpolating two-layer ReLU model with both memorizing and generalizing solutions. We show that even in this simple setup, flatness alone cannot distinguish a memorizing solution from a generalizing one, while weight decay favors generalizing solutions. However, under a local stability analysis, there exists a window where a memorizing interpolant is locally stable under gradient descent but unstable under SAM in the low-norm regime, which can explain SAM's ability to accelerate this transition. Overall, our results provide a more interpretable account of the role of flatness in driving generalization, especially in settings where models are vulnerable to minimizing loss through learning non-generalizing structure.

1 Introduction

Distinguishing properties that correlate with generalization from those that causally drive it is especially important when learning from noisy, real-world data. In these settings, models can exploit sample-specific features and noise to achieve high performance on their training data, while failing to generalize on unseen data. An attractive mechanism for inducing generalization is biasing training towards flatter loss landscapes which have long been associated with generalization in artificial neural networks. Models that converge to flatter minima often exhibit better performance on unseen data [Hochreiter & Schmidhuber, 1997, Keskar et al., 2017], motivating optimization methods such as sharpness-aware minimization (SAM) [Foret et al., 2021] that explicitly bias training toward locally flat solutions at an additional computational cost [Andriushchenko & Flammarion, 2022, Compagnoni et al., 2023, Wen et al., 2023].

To understand whether flatness drives generalization in settings where memorizing solutions are particularly attractive, we study grokking, a unique phenomenon where models first reach near-zero training loss while remaining near chance on held-out data, and only after prolonged optimization abruptly transition to high test accuracy [Power et al., 2021]. Unlike conventional training, where

Preprint.

memorization and generalization often develop simultaneously, grokking exposes a temporally separated transition from a memorizing solution to a generalizing one. This makes it possible to algorithmically separate and track differing characteristics between memorizing and generalizing interpolants. Prior work has uncovered two leading mechanisms that can induce this transition from memorization to generalization. Mechanistic studies of modular arithmetic have established a decrease in parameter norm as central in inducing this transition from memorization to generalization, arguing that generalizing circuits become favorable once they are cheaper than memorizing alternatives [Varma et al., 2023]. More recently, flatness has been proposed as a necessary geometric condition to induce this transition, [Han et al., 2025] which stands as an alternative explanation.

Our observations reconcile these two threads of prior research on mechanisms that induce generalization in grokking. We use SAM to directly test whether biasing optimization toward flatter solutions is sufficient to trigger the memorization-to-generalization transition. Across several architectures on modular arithmetic tasks, we find that it is not: SAM alone consistently produces substantially flatter solutions while models remain memorizing. These experiments provide direct counterexamples to the hypothesis that flatness alone selects generalizing solutions, challenging existing work. [Han et al., 2025] However, when pairing SAM with weight decay, we observe that the system reaches generalizing regimes substantially earlier at an epoch level: up to 4x faster than weight decay alone. This acceleration increases with the strength of SAM's flatness regularization, until SAM can no longer meaningfully enforce flatness due to inaccuracy of the first-order Taylor estimate that it relies upon. Figure 1 summarizes this contrast. We explain these phenomena through an algorithmic separation: while SAM fails to distinguish memorizing and generalizing interpolants (whereas parameter norm does), SAM changes the local stability of memorizing solutions once weight decay has moved the system into the appropriate low-norm regime.

To develop a theoretical understanding of this algorithmic separation, we construct a minimal two-layer interpolating network that isolates the sufficient structural conditions under which this separation emerges. We explicitly construct two classes of local optima—memorizing and generalizing interpolants—which, by design, have identical trace flatness; thus flatness does not distinguish between them. At the same scale, however, generalizing interpolants use shared features rather than sample-specific neurons, and (for sufficiently large training set size) the norm of the generalizing solutions is strictly smaller than that of the memorizing solutions. Thus, incorporating

Figure

Figure 1: Flatness regularization accelerates generalization in grokking where grokking already occurs. It does not, however, trigger generalization alone. Lighter colors correspond to stronger regularization. Stronger regularization is linked with faster generalization.

ing weight-decay into optimization can trigger grokking as it leads to eventual decrease in the norm of the parameters. We then analyze local stability under gradient descent (GD) and SAM. Under the quadratic SAM approximation, SAM changes the ‘effective’ local curvature, producing a regime in which a memorizing interpolant is stable under GD but unstable under SAM. This shows that SAM is not the selector of generalization: selection is driven by norm and weight decay [Loshchilov & Hutter, 2019, D’Angelo et al., 2024]. SAM instead conditionally accelerates escape from memorizing solutions faster than GD once the trajectory has entered low-norm regimes where memorizing solutions become fragile.

We make three key contributions in this work. First, we provide empirical counterexamples to flatness-as-selector explanations of grokking on interpretable, modular arithmetic tasks: SAM-only produces very flat models that remain memorizing, while WD and SAM+WD grok. Second, we prove an algorithmic separation between flatness, norm, and local stability in an interpolating ReLU model. Third, we extend our findings beyond modular arithmetic to show strikingly similar acceleration-flatness relationships in image classification and natural language processing tasks across several architectures, demonstrating the broader applicability of our work beyond interpretable settings. Together, these results highlight the interplay between loss landscape geometry (via flatness), model capacity (via norm), and generalization.