arXiv:2610.01633cs.LGOct 2026

Manuscript Offprint

arXiv:2610.01633

Generalization in Neural Networks Through the Lens of Magnitude Potential

Sahel Torkamani, Henry Gouk, Rik Sarkar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Explaining generalization and training dynamics in neural networks remains a challenge, and various approaches have been developed to study different aspects of these phenomena. In this paper, we introduce the idea of magnitude potential – a quantity based on the theory of metric magnitude – that reflects how well an arbitrary point is represented by a given set. We find that this basic quantity can be applied to examine various features in neural generalization. The ratio between the magnitude potential with respect to a class and with respect to the entire data, computed at the logit layer, is informative of the representation of the point. In experiments, these ratios for individual training points are found to be correlated with the Feldman memorization scores. Magnitude potential ratios aggregated across points detect structural changes in the decision boundaries and provide a geometric indicator of grokking in modular arithmetic. Although the magnitude potential ratio and neural collapse are both closely associated with intra-class and inter-class geometric structure, the magnitude potential ratio remains informative even when neural collapse is explicitly suppressed.

1 Introduction

Neural networks have become popular due to their excellent generalization ability, but the mechanisms behind this generalization remain a major area of study. The behavior of overparameterized neural networks is difficult to analyze using traditional statistical learning theory [5]. These networks regularly memorize certain volumes of data, and indeed, memorization has been argued to be an essential component for generalization in these networks [8]. With continued training, large neural networks are capable of memorizing entire training datasets [32, 6, 10].

More recently, it has been found that in domains where generalization to test datasets is difficult, prolonged training past memorization can cause the sudden emergence of generalization. This phenomenon, called grokking, was first shown for algorithmically generated modular arithmetic datasets [29] and then observed in more general data [21, 13]. Various approaches based on network weight decay [21], the geometry of loss landscapes [11], statistical physics [34], and other approaches have been used to develop our understanding of neural network training behavior.

Meanwhile, metric magnitude [16] has been shown to provide insights in closely related work attempting to understand different aspects of network training. Examples include generalization [1, 2], diversity of latent representations [19], and quantifying distances between datasets [30]. In this paper, we show that an extension of the metric magnitude called Magnitude Potential can be used to study and predict a range of phenomena in training dynamics. For a given dataset X and a test data point z, the magnitude potential, ρt(z,X)\rho^{t}(z, X), can be seen as the degree to which z is represented within X at scale t. It is a continuous Lipschitz function applicable to both training and unseen points. The ratio of the potential at z relative to points in its own class, to its potential relative to the entire dataset,

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Figure

(a) KDE within-class

(b) MP (t=1.0)(t = 1.0)

(c) MP ratio (t=1.0)(t = 1.0)

(d) Logit (Pre-softmax)

Figure 1: Comparison of KDE and MP. Each class has a cluster and a few sparse points at the boundary. (a): KDE is computed for each class, which fails to capture the sparse boundary points as it is dominated by the dense cluster. (b): MP is computed for each class and the largest value shown, which has a higher score at the outlier points points, and shows a decision boundary similar to neural network in (d). (c): MP ratio, which inherits this sensitivity and bends around the sparse boundary samples. (d): the pre-softmax logit of a high-accuracy model, showing similar decision boundaries.

provides a per-sample geometric signal that is closely related to memorization, and captures training phase transitions when aggregated across the dataset.

Our contributions. Metric Magnitude [15] is a measure of the size or effective number of points in a metric space. For an embedded finite point set X∈RDX \in \mathbb{R}^D such as often used in machine learning, it assigns a weight w(x)\mathbf{w}(x) to every vertex x∈Xx \in X, roughly representing the distinctness of xx within XX, and Mag(X)\text{Mag}(X) is the sum of these weights. The weights are computed based on a similarity measure ζ(xi,xj)=exp⁡(−d(xi,xj))\zeta(x_i, x_j) = \exp(-d(x_i, x_j)), and satisfy that at any xix_i, the sum ∑xjζ(xi,xj)w(xj)=1\sum_{x_j} \zeta(x_i, x_j) \mathbf{w}(x_j) = 1.

Magnitude potential is an extension of this idea to all points z∈RDz \in \mathbb{R}^D, so that the potential at zz is ρ(z,X)=∑xjζ(z,xj)w(xj)\rho(z, X) = \sum_{x_j} \zeta(z, x_j) \mathbf{w}(x_j). It can be seen as the influence of all points of XX that is felt at zz. The following intuition for this potential is given by Meckes [23]. Suppose we have a type of “electric charge” such that a unit charge at xx creates a potential of ζ(z,x)\zeta(z, x) at zz. The points XX are connected to a ground from which charge can flow; they each have a charge of wx\mathbf{w}_x such that the potential at xx is exactly 1. Then the potential at any z∈RDz \in \mathbb{R}^D is given by ρ(z,X)\rho(z, X).

We observe that in the machine learning context, this function can be used as a degree of coverage or representation of z by X. Unlike simple coverage with unit balls, we prove in Section 3 that the magnitude potential describes a soft coverage score that decays gracefully with distance from X. At the same time, compared to kernel density estimation, the magnitude potential is less sensitive to high-density clusters and can incorporate low-density groups and isolated points in a meaningful way to compute representation. This idea is shown in Figure 1. The kernel density of a large cluster can overwhelm a sparser cluster. But magnitude potential allocates larger class scores to sparser clusters and even isolated points. This behavior is similar to outputs of neural networks that can fit to outliers and isolated points. We prove that the magnitude potential is Lipschitz continuous and theoretically well-behaved in limiting regimes: its variance vanishes under within-class variance collapse, and it recovers nearest-neighbor structure when data points scatter.

Next, we describe the Magnitude Potential Ratio as a ratio between the magnitude potential of z with respect to its own class, and the magnitude potential of z with respect to the entire dataset. Section 3 shows that points that are heavily memorized tend to be ones with a low magnitude potential ratio. The memorization of points is computed via the memorization score defined in [9].

In our analysis of training dynamics, the magnitude potential ratio is computed on the space of logit values of training and validation data points (Figure 2). In Section 5, the magnitude potential ratio is shown to undergo changes in sync with training dynamics. In a simple 2D dataset, the standard deviation of the magnitude potential is seen to first drop at points where the decision boundaries transition from linear separators to class-cluster specific boundaries and then rise again when the model starts to overfit (Section 5.1).

In grokking on modular arithmetic data, the increase in the mean of the training MP ratio indicates a geometric signal consistent with the other leading indicators of model generalization, preceding the validation accuracy transition. At close to 100% validation accuracy, the standard deviation of MP ratio for both training and validation sets decreases, and the mean value stabilizes (Section 5.2). These

Figure

Figure 2: magnitude potential ratio in training dynamics. (a) MP ratio is computed in the logit-layer output space. (b) MP ratio correlates (negatively) with memorization score: lower MP ratio suggests memorization. (c) Training MP ratio mean indicates grokking prior to generalization being achieved. (d) The validation MP ratio mean and standard deviation track decision boundary changes as the model fits.

results are seen to hold independent of neural collapse (Section 6). Our code is publicly available at https://github.com/saheltorkamani/Magnitude_Potential.

References (27)