Manuscript Offprint
arXiv:2608.14373Boosting Data Augmentation with Stochastic Weight Averaging
Abstract
The symmetries of a learning task have become an important factor in designing modern deep learning solutions. Data augmentation is a straightforward and effective way of incorporating symmetries into a generic neural network. Recent results show that infinitely large deep ensembles show perfect symmetry when trained on augmented data. However, since training ensembles requires repeating the training process many times, this method is costly. In this work, we study stochastic weight averaging (SWA) applied to classification as an alternative ensembling technique that does not require repeated training runs. We analyze SWA by approximating the stochastic training trajectory at the end of training with an Ornstein–Uhlenbeck process. We show that in the infinite-width limit, SWA on augmented data provides an equivariance boost that goes beyond what could be expected from the performance increase due to SWA alone. We verify our results with extensive numerical experiments on numerous models spanning image and graph classification with both discrete and continuous symmetries.
1 Introduction
Many machine-learning tasks, ranging from protein folding [1] to medical image processing [2] feature symmetries that constrain the learning problem and, if taken into account, can be used to improve the performance of the trained models. In deep learning more specifically, there are two major approaches for incorporating symmetries into the learning algorithm.
Firstly, the symmetry can be realized as a constraint on the neural network architecture. In particular, the layers of the network can be chosen such that they are equivariant functions with respect to the symmetry of the task at hand [3, 4]. This approach requires specialized architectures (discussed in a large body of literature) but realizes the symmetry exactly and improves sample efficiency during training.
Secondly, the neural network can be trained on transformed versions of the original training data, a method known as data augmentation. Since this technique does not constrain the network architecture, it can be applied to any highly optimized off-the-shelf architecture as long as the symmetry transformation can be implemented. It is therefore straightforward and flexible. However, it does not lead to an exactly equivariant model, but rather one that is approximately equivariant (or equivariant in distribution).
Theoretical studies of equivariant neural networks are plentiful due to deep connections between equivariant layers and representation theory. In particular, practically relevant special cases such as the symmetry
Equal Contribution
Department of Mathematical Sciences, Chalmers University of Technology and the University of Gothenburg, SE-412 96 Gothenburg, Sweden.
Emails: longde@chalmers.se, gerken@chalmers.se
Department of Mathematics and Mathematical Statistics, Umeå University, Linnéus väg 49, 901 87 Umeå, Sweden. Email: axel.flinth@umu.se groups of permutations, of rotations or of roto-translations have been studied extensively in the literature, for various different model architectures.
In contrast, most studies of data augmentation are purely empirical, see e.g. [5]. This is because data augmentation modifies the training procedure and therefore one inevitably needs to study the complicated, non-linear training dynamics of neural networks. Despite this obstacle, recent advances in this area show that in expectation over the initialization distribution, neural networks are exactly equivariant when they are trained on augmented data [6, 7]. Approximately, this can be realized by training a deep ensemble.
However, ensemble training is notoriously computationally intensive, since the training needs to be repeated for each ensemble member. For this reason, and motivated by the recent results mentioned above, we study the effects of data augmentation on stochastic weight averaging (SWA). Instead of an ensemble over independent training trajectories, SWA takes an ensemble mean over several models from the same training trajectory [8], thereby reducing the training cost to that of a single model.
Intuitively, the training trajectory of SGD is dominated by noise from batch selection when it is close to a minimum of the loss. Therefore, SWA can be expected to have a similar effect to averaging over random initializations. In this work, we investigate whether this intuition holds up. In particular, we approximate the stochastic training trajectory at the end of training with an Ornstein–Uhlenbeck process and use the ratio of the expected losses with and without SWA to quantify the performance boost due to SWA.
A central obstacle to the theoretical analysis of SWA in this setting is the non-independence resulting from the samples being taken from a single training trajectory. To overcome this problem, we assume a well-trained network and express the performance boost in terms of the trace of the Hessian of the network. In this setting, we then consider the expected equivariance boost which focuses on the non-equivariant contributions to the loss. In the infinite-width limit, we compute a bound on this expected equivariance boost using the theory of neural tangent kernels (NTKs). Our calculations show that combining data augmentation with SWA leads to an equivariance boost which goes beyond the mere performance increase expected from ordinary SWA.
We validate our theoretical analysis with extensive numerical experiments. In particular, we explicitly verify that the bound predicted by our theory holds and has the right dependence on group size and averaging time on a synthetic problem over which we have full control. We furthermore demonstrate the claimed improvement on computer vision and graph classification tasks, as well as both discrete and continuous symmetry groups, for numerous different model classes.
Our main contributions are as follows:
• We formalize SWA at the end of training with an Ornstein–Uhlenbeck process and analyse the equivariance properties of the resulting model in the case of augmented training data. To quantify the performance boost due to SWA, we introduce the loss ratio R in (20). Similarly, to quantify the equivariance boost due to SWA, we define the loss ratio in (36). We overcome the central obstacle of dependent ensemble members from one trajectory by assuming a well-trained network and expressing R and in terms of the trace of the Hessian of the network, see (61) and (62).
• We then take the infinite-width limit and leverage the theory of NTKs to derive a bound on (Theorem 4.12) which shows that SWA with data augmentation leads to a non-trivial improvement in equivariance for a wide range of models. In the process, we derive novel results about the NTK limit for equivariant models.
• We validate our theoretical results numerically by considering a synthetic learning task. We verify for this task that our bound still holds for a finitely-sized network and has the predicted dependence on the group size and averaging time (Section 5.1). We furthermore test the equivariance gain from SWA in more realistic settings (Section 5.2). In particular, we demonstrate the predicted improvement on five vision datasets with seven different models (MLPs, CNNs, vision and graph transformers) for discrete rotations. We also show that the same effect can be observed for a molecular graph classification task invariant with respect to 3D rotations.
From this parameter restriction arises the structural question: is layerwise equivariance the only way to realize equivariance? Bökman et al. [16] first tackled this question in theory, arguing that this is not the general scenario despite the existence of supporting examples; they nevertheless conjectured that it holds empirically for trained CNNs. Shahverdi et al. [17], under a stronger condition of identifiability, showed rigorously that end-to-end equivariance always implies the existence of a parameter choice realizing the same function with layerwise equivariance. This thread of works is the premise on which we treat the equivariant subspace E as well-defined, and study the training dynamics restricted to it.
Layerwise realizability does not make the architectural route costless in practice, since it requires committing to a specific group at design time, implementing specialized layers for it, and training within a restricted parameter space. As an alternative, data augmentation offers a route to equivariance that leaves the parameter space unconstrained, at the cost that the resulting network is only approximately equivariant. Whether this matters is contested. Gerken et al. [5] find that for invariant classification tasks for spherical images, sufficiently augmented models with large scale match equivariant architectures. Similarly, [18] reports that dropping the rotational inductive bias simplifies model scaling considerably. Brehmer et al. [19], in contrast, argues equivariant models outperform augmented ones at every compute budget tested. Augmentation thus appears as a viable substitute for architectural equivariance in some scenarios, including the classification tasks with finite groups considered in our work. Chen et al. [20] give a theoretical framework for this alternative, modelling data augmentation as an averaging operation over group orbits that renders the data distribution approximately invariant, which is exactly the setting of our work.
Ensembles and checkpoint averaging. To achieve exact equivariance from data augmentation, ensembling has emerged as a provable mechanism [6, 7]. The result of Nordenfors et al. [7], that an infinite ensemble of networks trained with fully augmented data is equivariant in expectation, appears in our more general framework as a special case. This connection to ensembling motivates a closer look at the broader literature on combining multiple models.
Ensembles of independently trained networks are a classical and extensively studied technique for improving generalization, and we refer to Ganaie et al. [21] for a general review. Among the broad spectrum of methods, ensembling with multiple sequentially trained models has emerged as an efficient strategy. Huang et al. [22] and Chen et al. [23] constructed ensembles by averaging the outputs of models saved at different points during a single training round. Both works are based on the hypothesis that the training trajectory explores different local minima, and averaging over them reduces overfitting. Garipov et al. [24], on the other hand, explored the loss landscape further and discovered that local minima are con-nected by simple low-loss curves, challenging the isolated minima view. Inspired by this insight of mode connectivity, they traverse nearby low-loss regions to collect a diverse set of ensemble members.
A common issue among these methods is that they still require storing and evaluating multiple models at inference time, limiting their practicality. Weight averaging avoids this cost entirely by collapsing the ensemble into a single set of weights before inference, and is exactly the backbone of the mechanism we study in our work.
Weight averaging. Averaging the iterates of a stochastic optimization algorithm has classical roots in Polyak–Ruppert averaging [25]. The most common form in deep learning is the exponential moving average (EMA) [26], a related but distinct technique that stochastic weight averaging (SWA) [8] is often contrasted against. The two differ in their averaging scheme, which leads to different accounts of their effect on the loss landscape: by averaging iterates sampled uniformly rather than with exponential decay, SWA is argued to land in the interior of a wide, flat optimum, which is connected to better generalization. Several works adopt this wide-minima point of view. Xie et al. [27] ground this flat-minima intuition by modeling SGD as a diffusion process whose stationary distribution concentrates exponentially more on flat minima; Damian et al. [28] similarly show that SGD with label noise biases toward flatter minimizers by analyzing how the noise affects local quadratic structure of the loss.
This flat-minima account is not, however, unchallenged. Guo et al. [29] revisit SWA empirically and find its benefit highly dependent on how well the underlying SGD trajectory has converged before averaging, arguing the operation contributes primarily through variance reduction rather than flat-minima discovery. This coincides with Mandt et al. [30], who model SGD as a continuous-time SDE and show that near a well-fitted minimum, its stationary distribution is governed by a quadratic approximation of the loss with covariance set by the Hessian, which is the same picture we adopt. Unlike Mandt et al. [30], however, who treat this as a general posterior characterization of SGD, we consider the setting where the dynamics decompose into equivariant and non-equivariant components, studying the impact of SWA on each in turn.
The quadratic, Hessian-governed picture is itself an active subject of empirical analysis. Meterez et al. [31] stress-test it at LLM pretraining scale and find it remains predictive over a non-trivial fraction of training, while Ben Arous et al. [32] show that in high-dimensional classification tasks the SGD trajectory aligns with a low-dimensional outlier eigenspace of the Hessian, layer by layer. We likewise focus on classification tasks and study the spectrum of the Hessian, but apply the theory of the neural tangent kernel to derive a quantitative analysis.
Neural tangent kernel. The NTK [33] characterizes the training dynamics of sufficiently wide neural networks as kernel gradient descent under a fixed, architecture-determined kernel, and is based on the network’s correspondence to a Gaussian process at initialization known as the neural network Gaussian process (NNGP) [34]. Subsequent work has used the spectrum of the NTK to characterize structure in the Hessian and gradients of trained networks. Jacot et al. [35] show that the NTK itself governs the asymptotic spectrum of the Hessian throughout training. Basri et al. [36] use the NTK’s spectral decomposition to characterize which frequencies a network learns fastest, extending the classical frequency-bias result to non-uniformly sampled data. Seleznova et al. [37] build an OOD detector for classification models, based on the discovery of a related alignment phenomenon: the NTK’s approximate block-diagonal structure across classes.
Closest to our setting in equivariant tasks, Misof et al. [38] compute the NTK of equivariant architectures whose intermediate representations are regular representations of a finite group. Our derivation in Section 4.5.2 generalizes this to arbitrary intermediate representations and irrep decompositions, and we use the resulting equivariant NTK to bound the trace of the equivariant Hessian relative to the full Hessian H, which leads to our main theorem.
3 Problem Setting
In this section, we will set the notation and formalize stochastic weight averaging (SWA).
Dataset and Data Augmentation. For a generic training task, we denote the true dataset as a joint distribution over , from which the training samples are drawn. Here, and are the input and output spaces. We assume the distribution to be supported on a compact set . Furthermore, we assume a pair of group representations of a group on the input and output spaces, respectively,
In this context, we consider data augmentation of the training data as a condition on the distribution. Specifically, an augmented dataset corresponds to a distribution that is invariant under the group action, namely the joint random variable is identically distributed with . This also means . For simplicity, we denote with .
Network. As the neural network we train, we consider a multilayer perceptron (MLP) with parameters and nonlinearities . In terms of the preactivations , the network function is given by
where and . In particular, we have and . We denote the space of parameters of this network by
To accommodate practical and modern architectures of interest, such as convolutional networks (CNN), transformers, and residual structures, we follow a standard parameter-space restriction and further restrict the admissible parameters to an affine subspace . At layer , we will denote space of admissible parameters by .
We call an equivariant network, if for a.e. we have
Loss function. The loss function is defined over . We assume it is non-negative, twice differentiable, locally Lipschitz and attains zero if and only if . We further assume that it is group invariant,
Consequently, if the network itself is equivariant, then is invariant,
The cumulative loss, , is defined as the expectation of with respect to the data distribution,
Group action on the parameter space. For a network with a feed forward structure, one natural way to achieve equivariance is through layerwise equivariance. Therefore, we define a series of representations
on the intermediate spaces . We assume all representations, including the one on the input and the output space, are unitary with respect to the canonical tensor basis.
The group then naturally acts on the parameter space as
We require the non-linearities to be equivariant with respect to the corresponding intermediate representations ,
Note that it is equivalent that a set of parameters is equivariant w.r.t. these representations,
and that it is invariant under the associated representation (denote as ),
The parameters satisfying (11) form a linear subspace in . We assume the space of admissible parameters is invariant under the group action , and the space of admissible equivariant parameters is non-empty. By picking , we can associate with .
Assuming (8) and (9), the group action on the data is equivalent to an action on the parameter space,
This coincides with the definition of , since if , the equation above turns into
which is just the usual definition of equivariance. Consequently, for the loss we have
Remark 3.1. All practically used equivariant neural networks are constructed out of equivariant layers, i.e. in our language. However in general, that a network is equivariant does not imply that . As shown in Shahverdi et al. [17], if the parameters are identifiable (intuitively, this means that the map is injective up to symmetries), there is an equivalence between equivariant layers and equivariant functions.
We assume the group to be finite. We will furthermore assume that the representation is unitary with respect to the Euclidean inner product. Then, we can consider the orthogonal complement of . Furthermore, the orthogonal projection of a vector to is given by [39, Prop. 2.8]
Learning Algorithm. We train the network with respect to the loss function with stochastic gradient descent (SGD). With learning rate and batch size B, the training step could be formulated as
(16) where are independent random variables identically distributed with . The sample gradient has mean and covariance
Stochastic weight averaging. The stochasticity of batch sampling provides an opportunity for the training process to explore wide basins in the loss landscape, but it also results in noise that prevents the trajectory from reaching the optimal solution. Stochastic weight averaging can be viewed as an estimator to approximate this solution, by taking the mean of the previous weights
Performance boost. To quantify the performance boost from stochastic weight averaging, we compare the expected loss before and after averaging. For a given starting iterate of the averaging window, define
where the expectation is over the batch sampling (equivalently, over the SGD trajectory). In particular, indicates that averaging improves the loss, with larger values indicating a greater boost.
4 Theoretical Results
As we outlined above, we will analyse stochastic gradient descent (16). For simplicity, we will ignore effects due to finite step size and instead consider the stochastic differential equation
where is Brownian motion with covariance , and . For small values of , (21) is a good approximation of the SGD dynamics. A heuristic argument for this is as follows: The sample gradient has mean and covariance . By the central limit theorem, approximates a Gaussian distribution with mean and covariance . Adding such increments to the variable (as we do in SGD) hence corresponds essentially to an Euler-Maruyama scheme to solve (21). The limit can also be justified more rigorously – see [40, Corollary 10]. This motivates exclusively analyzing (21) in the following.
Remark 4.1. To simplify the notation, we will normalize from here on.
4.1 Equivariance properties of the stochastic gradients
When training on augmented data, the Hessian and covariance matrix satisfy the following equivariance relations. They will be crucial to our entire analysis.
Lemma 4.2. For any , the following transformation rules hold,
Proof. Applying the chain rule to (14) implies , or equivalently
Applying the chain rule one more time yields
Because the data is augmented, , and hence, using (23) and (24), we obtain
Consider the flow associated to (21), that maps the initial probability measure of to the measure at time , i.e. . A first consequence of Lemma 4.2 is the following equivariance of ,
Here, denotes the pushforward operation of a map . The discrete version of this equivariance guarantee was in [7] shown to imply a weak equivariance guarantee for an ensemble of neural networks trained with SGD. Concretely, if we initialize an ensemble using an invariant distribution, the same will be true for all times , which in turn will imply that the ensemble mean will be equivariant at all times.
Proposition 4.3. Let be an invariant parameter distribution: for all . Let be the distribution obtained by independently training an ensemble of networks using (21) for a time . Then, the ensemble-averaged network
is G-equivariant for every t > 0.
Proof. See Appendix A.
Note that this result is not very informative for a single model – its initial distribution is a Dirac delta, and hence only invariant if it is concentrated in a point (applying the theorem in this context in fact recovers the results from [13] about single networks). Still, it is interesting that (28) persists in our stochastic setting, and we therefore provide a proof – based on analysing the Fokker–Planck equation – in Appendix A.
4.2 Dynamics close to equivariant minima and the Ornstein-Uhlenbeck process
We will now move on to study SWA (19) more specifically. Since stochastic averages are taken along single training runs, we need to analyse the solution paths of (21). We will assume that solutions converge towards equivariant minima since they are trained on augmented data. Put differently, we will study the dynamics of (21) near a local minimum of the cumulative loss , which we furthermore assume is equivariant in the strict sense (cf. Remark 3.1). To simplify the notation, we will shift the coordinates, so that .
Near , we can approximate with the quadratic function , with . We can furthermore make the approximation . The dynamics (21) then become
This is the well-known Ornstein–Uhlenbeck process. Its solution has a closed form: If the process is initialized at , we have
Since we are studying the dynamics at an equivariant point , and decompose into block matrices with respect to the decomposition , as specified by the following
Lemma 4.4. The matrices H and P commute with . Consequently, they have a block diagonal structure: They map to and to .
Proof. Since , we have . Together with Lemma 4.2, this shows that , , which is the first claim.
Let and . To prove the second claim, we note that by definition of , we have . Furthermore, the projection (15) yields
We therefore obtain
The argument for proceeds in the same manner. Since and are orthogonal complements, we may choose orthonormal bases for and for , so that forms an orthonormal basis for the ambient space. In this basis, takes the block-diagonal form , where and denote the restrictions of to and , respectively. We choose to be block-diagonal in the same basis, , with and . Then , and for any , , we have .
The previous lemma, and basic properties of the matrix exponential, immediately show that the solution (31) also decomposes: We get that , with
(34)
for independent Brownian motions on and , respectively.
With the block structure of the Hessian, we introduce a quantity to measure the equivariance of the network. Remember that is equivariant if . Hence, a reasonable measure of the “non-equivariance” of a parameter is the norm of the projection of onto . By Lemma 4.4 (and the fact that at the strict local minimum ), this is proportional to the quantity
Here, we measure the norm of the non-equivariant component of in the metric defined by which captures the length scale of the curvature of the loss landscape. I.e. if is small, then the non-equivariant component of the parameters is small in comparison to the length scale of the loss and the network is close to equivariance.
Analogous to (20), we introduce a quantity to measure the gain in equivariance from performing SWA. Concretely, we define it as the ratio of evaluated on averaged weights and on unaveraged weights at the end of training,
We will in the following argue that will be large (corresponding to a large gain in equivariance) in two settings: First, we will look at the case of weights sampled far apart from each other in time. Next, we will consider a more realistic scenario of dense samples, in a specialized setting of invariant classification problems. In the latter case, we will give detailed analysis of the behaviour of in the NTK limit.
4.3 Well-separated samples
Since we are at a strict local minimum, the operators and are positive definite. Therefore, and will for large values of be vanishingly small. This together with the decomposition (34) shows that and will be approximately independent of each other, and, more importantly, approximately independent of the initialization. Hence, if the sampling times in (19) are well separated in time ( sufficiently large), the sequence of samples will be approximately i.i.d. samples of the limit distribution
which is a Gaussian with mean zero and covariance matrix
The same argument applies to . As an i.i.d. mean of Gaussians, the stochastic weight average also becomes Gaussian distributed for large , with covariance . Since the covariance of does not scale with , we therefore conclude
Note that this result, while it conveys the main intuition behind why SWA improves equivariance, is not readily applicable to practical training runs. For one, it is hard to estimate a priori for how long we need to wait between taking samples in order for our approximations above to be valid. Longer wait times would furthermore increase training time. In the next section, we will therefore give a more detailed analysis that does not rely on the assumption of well-separated samples.
4.4 Dense samples in a classification setting
Let us now consider the complete opposite limit of taking samples well separated in time: taking them infinitesimally often. That is, make the approximation
Using standard results of stochastic calculus, one sees that also here becomes Gaussian distributed, with mean zero, but with a more complicated expression for the covariance:
To give a direct comparison between and is therefore harder than in the last section. It will depend highly on the interplay of the eigendecompositions of and , and we will therefore not do it in full generality. We instead again specialize, this time to group-invariant classification problems. That is, the group acts invariantly on the class label . As usual in such a setting, we use our network outputs to define a posterior probability distribution
over the label space . This distribution could be interpreted as a vector in the Euclidean space . We train the network using a cross-entropy loss:
We further restrict the analysis to the loss landscape near a well-fitted minimum. We claim that in this regime, the matrix is approximately equal to the Hessian . By well-fitted, we mean that the residual error between the predicted distribution and the data distribution is small. Here, is the unit vector with components , and is the true label class for the sample .
To formalize this approximation, let be the Jacobian of the network. Using the chain rule, the gradient of the loss is
Consequently, the Hessian takes the form
where we defined . Note that the residual term is linear in the small error . Now consider the covariance matrix . Applying (18) and the chain rule, we obtain
By expanding the bracket , we see that it equals , where . Combining (45) and (46), the difference between the two matrices is
Since both terms on the right-hand side are linear in , we have when . Furthermore, this structure allows us to formalize the relation between and .
Another direct outcome is that the two have a common eigenbasis, in which the dynamics decompose further into one-dimensional solutions
Here, we use the notation for the tensor , and denote by the contraction with over the -dimensional space.
Here, are independent, one-dimensional Brownian motions and are the eigenvalues of (the eigenvalues of are then ). This gives the following simplified form of the averaged process (40):
We will now use (48) and (50) to derive an expression for from (36). Using the Itô isometry, we obtain
The behavior of the above expressions for large depends on whether is large or small. For , we can approximate , so that we get
For , we instead have , so that
Summing the above expressions over all dimensions recovers the expected losses and . For large , we obtain
where denotes the number of large eigenvalues with and , . Hence, for large ,
Analogously, defining as the count of large eigenvalues in , we have

Figure 1: Definition of the NTK limit we consider here. On the left is the 'base architecture', on the right is the extended architecture by a factor N.
These results already show that, even with dense samples, both and converge to infinity as . Hence, stochastic weight averaging encourages equivariance and boosts performance at the same time.
This begs the question: How much of the equivariance gain from stochastic weight averaging simply comes from a generic improvement in overall performance? To measure this, we should study the ratio between and , i.e.
Asymptotically for , and will count all dimensions in and , respectively, and the -terms converge to zero. Consequently,
In the next section, we will derive a bound on this ratio in the NTK-, or infinitely wide, limit [33].
4.5 A refined analysis in the NTK limit
We begin by specifying the theoretical setting. We consider a base architecture as above, i.e. with input space X, intermediate spaces and output space Y on which representations , and act. We increase the network’s width by a factor N by taking N direct sums of the intermediate spaces, i.e. . The group then acts by the direct sum representation on the enlarged spaces, . We will consider the limit .
As finite-dimensional representations of a finite group, the actions on the base intermediate spaces decompose into direct sums of irreducible representations (irreps) as [39]
where denotes the multiplicity of the irrep and the sum runs over all irreps of . In particular, . The extended representations decompose in the same way, the only thing that changes are the multiplicities: .
Now, the base equivariant parameters satisfy . That is, they belong to the space . By (the real version of) Schur's lemma, that space is
where is the space of equivariant endomorphisms on . By a well-known theorem of Frobenius, has real dimension 1, 2 or 4, depending on whether the irrep is of real, complex or quaternionic type.
[39]. To keep the exposition readable, we will in the following concentrate on the case of all being real, so that . We will comment on the minor adjustment needed in the general case at the very end.
In the case of , the dimension of the space of equivariant parameters at layer l is
The dimension of the space of all parameters at base layer l is on the other hand given by
Since is a finite group, (see e.g. [39]) and we obtain the following bound by using Cauchy–Schwarz:
We now assume that the intermediate spaces all scale with the same rate in so that the ratios of their widths stay fixed. Formally, for all and for some . This gives
Since for , and similarly for , this inequality remains valid as we take the limit. However, it does not apply to the first and last layers whose parameters involve the fixed input and output representations. We circumvent this issue by a simple argument,
and similarly
We conclude that
for large N. Therefore,
for large N. Note that r is a constant that depends on the network structure but does not scale with N.
4.5.1 Ratio of the traces in the infinite-width limit
From here we consider the network training in the infinite-width limit. Namely, denoting the network width scaling as , the learning rate is , while the weights are initialized as . Under this condition and mild assumptions on the nonlinearity, the pre-activations converge to Gaussian processes with covariance kernel
Furthermore, the neural tangent kernel (NTK), defined as
converges in operator norm to for some symmetric positive semidefinite kernel with [33].
The limiting kernel can be obtained recursively layer-by-layer. For an MLP with nonlinearities , the recursion relations are given by
where, by we denote the expectation value with respect to
Remark 4.5. To simplify the notation, we will normalize from here on.
We introduce the label-smoothed cross entropy loss, introduced by Szegedy et al. [41], to avoid the degenerate Hessian of the one-hot cross-entropy (the derivatives from the non ground-truth classes are 0 in this case). The dependency on the smoothing parameter will drop out at the end of our calculation.
Lemma 4.6. Consider the label-smoothed cross entropy loss
with smoothing parameter . Define
where 1 is the vector with all components one. Assume that the smoothed labels approximate the data well, i.e. and so for all , thus by Eq. (45). Then:
Proof. By assumption,
(87)
(88)
Therefore
And
We would now like to apply NTK theory to also estimate in the limit. To this end, we consider the equivariant subnetwork of the full network
Where represents the orthogonal projection from onto with respect to the standard inner product on the parameter coordinates. It takes a simple calculation to argue that at points , is the Hessian of the network . In order to repeat the above calculation for , we hence need to study the NTK function of the network , which is the focus of the next section.
4.5.2 NTK for an equivariant subnetwork
We begin with a detailed discussion on the irrep decomposition introduced in (66).
Standard basis. We work in the setting discussed above: Intermediate pre-activations and post-activations live in , carrying a representation of . The network’s actual coordinates — the ones in which the nonlinearity is applied component-wise, and in which the weight matrices have i.i.d. Gaussian entries before any equivariance constraint — are the standard basis coordinates, which we write . This standard basis is generally not adapted to .
Change of basis. Fix an orthogonal matrix that block-diagonalizes into its irrep decomposition:
so that in the basis produced by . We call this the irrep-adapted basis, and define the irrep coordinates of an arbitrary vector by
where indexes the irreps, indexes the multiplicities of each irrep , and , , indexes the basis inside the irrep itself. Every quantity subscripted below lives in this irrep-adapted basis. Since is orthogonal, this change of basis preserves inner products and hence the (isotropic) Gaussian law of the unconstrained weights.
After enlarging by N times, we acquire a new index j, referring to the N copies of the base space . Note that after enlarging by N times, is applied channel-wise, i.e. we have
The nonlinearity on the full space. The activation function is applied entrywise only in the standard basis: means for each standard coordinate . Passing to irrep coordinates via , we define
(96) i.e. is conjugated by the change of basis. Because mixes standard coordinates across different , is in general not a component-wise map on . However, by the block structure of across channels, is still defined channel-by-channel on each copy of the base space , even after we extend it by times: acting on the full layer decomposes as independent copies of the same base map, so the post-activations depend only on channel 's own pre-activation and never on any other channel . This allows us to treat the channels as conditionally i.i.d. throughout.
With this notation in place, the non-equivariant network’s irrep coordinates across consecutive layers are related through
where are with a change of basis, hence are still standard Gaussian matrices (entries i.i.d. ).
Equivariant weights. For the equivariant subnetwork, the weights are further restricted to intertwiners . Since the equivariant weights are obtained by orthogonally projecting the isotropically Gaussian weights of the non-equivariant network onto the intertwiner subspace, they are themselves isotropic Gaussians on the equivariant subspace: Within each irrep , Schur's lemma forces the weight to be shared across the copies indexed by , so the projection reduces to a single scalar per , i.i.d. across all indices and layers. The overall prefactor is not constrained by Schur's lemma, but instead determined by the norm-preserving orthogonal projection. With this, relation (98) becomes, for the equivariant network,
In particular, conditioned on the previous layer, the are identically distributed for same , and but different ; and are independent for different , , and , since they are built from disjoint sets of weights.
Analogous to the standard MLP case, as , the pre-activations in irrep-adapted bases converge to Gaussian processes with kernels
and the NTK of the equivariant subnetwork converges to a deterministic limit,
It is worth clarifying that are the matrix-valued equivariant NNGP kernel and NTK. Their ambient dimension grows with , so a priori “convergence as ” is not meaningful, since the kernels for different live in different spaces. Lemma 4.7 resolves this. It shows that and are, for every , entirely determined by a fixed collection of blocks , which are independent of and .
Lemma 4.7. The kernels and admit the following block structure,
where each and are -dimensional matrices. Moreover, they have the following recursive formulas,
where denotes .
Proof. For : by (101) and independence of from ,
using . For the induction step, condition on layer ; by (101),
after using . Since the pairs , , are i.i.d. copies of with ; the average over converges almost surely to by the law of large numbers as , and the sum over collapses into counts of the single expectation, since the -summands are identically distributed.
For the NTK, at layer 0, so the block structure is automatically satisfied. For the induction step, split the tangent vector into the last-layer and earlier-layer parts,
The first term is computed exactly as for above and converges to . For the second, the chain rule applied to (101) gives
so that the second term, analogous to the NNGP kernel, converges a.s. by the induction hypothesis as to
Furthermore, since is fixed, it could be extracted from the expectation, giving (109).
Remark 4.8. In particular, the NNGP and NTK kernels we calculate here can be interpreted as the NTK for a layerwise equivariant architecture. Such a kernel has previously only been calculated in the case when all intermediate representations are regular representations of a finite group [38]. We extend these results to a much more general setting.
Note that there is an extra term for the recursive formula. These terms accumulate through layers and result in a bound of trace against the traces of the ambient kernels and .
Lemma 4.9. Assume is the elementwise ReLU. Define
Then for all ,
Proof. GP kernel. By Lemma 4.7, summing the trace of over the copies of each irrep, we have,
The second to last equality is because the change of basis preserves the norm, and the last equality is because is a dimensional matrix.
For the induction step, homogeneity of (ReLU) gives
For notational convenience, we denote as , so that
By induction, we have
NTK. For ReLU, is the indicator of , so for , , independent of the variance of . A calculation analogous to the GP bound gives the desired bound for NTK.
Since acts trivially on the output layer, there, , and only occurs in (109). Hence is a scalar function, and the matrix-valued collapses to times the identity , and the bound applies directly to the scalar kernel.
Corollary 4.10. and
Note that for the output layer, , hence does not contribute to the coefficient.
Combining Lemma 4.9 with the identity relating tr to used in the proof of Lemma 4.6 then gives, exactly as before,
Lemma 4.11. Under the assumptions above, for the cross-entropy loss and near an equivariant minimizer, the spectral proportion of relative to is at most , with .
4.6 Main theoretical result
Plugging the results of Lemma 4.11 and (76) into (64) leads to our main theorem. For convenience we list here the assumptions we made during its derivation:
• We average over long times, i.e. T large.
• The neural networks are wide, i.e. N large.
• The group G is finite, and all intermediate spaces decompose into irreps of real type.
• The model is well trained, i.e. the error is small.
• The non-linearity is the ReLU function.
Under these conditions, we have
Theorem 4.12. The asymptotic relative ratio of improvement for the equivariance of the solution satisfies the bound
In particular, the asymptotic relative ratio is bigger than one if
As an important special case, consider rectangular networks, i.e. (consequently, ) and for all and . In this case, Theorem 4.12 simplifies to
Corollary 4.13. For rectangular networks, the asymptotic relative ratio of improvement for the equivariance of the solution satisfies the bound
which is larger than one if
Remark 4.14. The bound in Theorem 4.12 explicitly depends on the representation on via the multiplicities . This may seem unintuitive since there is considerable freedom in the choice of the . However, the bounded improvement ratio also depends on via the equivariant minimum around which the loss is expanded. Hence, the equivariant minimum to which the network converged at the end of training selects the in (129).
Note the significance of the asymptotic ratio being greater than one – in this case in the limit of and hence the expected equivariance improvement due to SWA (as measured by ) outpaces the expected equivariance improvement due to SWA (as measured by ), under data augmentation. Some remarks are in order. First, note that for a given architecture, the condition (130) is harder to satisfy if the group is larger. This aligns with the intuition that tasks with larger symmetries are harder to learn, see for instance the discussion in [42]. Secondly, for any intermediate representation, we have
Hence, as long as sufficiently many intermediate representations are either mixtures of irreps or irreps of non-trivial dimension, the condition (130) will be satisfied. This aligns with the observation that in a manifestly symmetric network, using equivariant features up until the final layer is beneficial even if the task considered is invariant. Finally, we note that in many cases, is significantly smaller than 1. For example, if an intermediate representation is regular (as in a group-CNN [9]), we have for all [39, Cor. 2.18], so that for that .
Remark 4.15. The results and conclusions above hold also in the case of irreps of non-real type, with an adjusted definition of :
where . In particular, for regular representations, since , we still have . The proof requires only minor adjustments, which add little to the understanding while considerably complicating the argument; we therefore refrain from presenting them.
4.7 A proxy for the orthogonal loss
Before moving on to the experiments, we give an auxiliary result that justifies the equivariance metric we use in practice.
Recall that we restrict the scope to group invariant classification tasks. To achieve exact equivariance, a direct method is to take the group average of an output,
Note that is different from , where the average is taken in the parameter space instead of the output space. Under this setting, a natural metric for the equivariance of the network is the Kullback-Leibler divergence between the logits given by the raw output and its group-averaged version :
We now show that it is an accurate proxy for the orthogonal loss under our assumptions.
Proposition 4.16. Under the assumption that is small, for in a neighbourhood of the equivariant minimizer ,
In particular, the equivariant component does not contribute at this order.
Proof. Let be the Jacobian at the minimizer. Linearizing the network output gives . Since the minimizer is equivariant, its Jacobian satisfies , which gives
Taking the difference, we obtain
Next, analogous to Eq. (45), we expand the Kullback–Leibler divergence to second order,
(140)
Taking the expectation over yields .
Where is the Gauss-Newton matrix in (45). Since the full Hessian is with the residual being linear in , we can replace with at the cost of an error. We conclude that
Corollary 4.17. The ratio of equivariance losses evaluated on unaveraged and averaged weights satisfies
in the regime in which Proposition 4.16 applies.
Remark 4.18. From a practical standpoint, the orthogonal loss is a theoretical construct: computing it explicitly requires knowledge of the Hessian and the orthogonal projection in the parameter space, which is typically intractable for deep networks. In contrast, is an easily computable, well-motivated metric that directly measures the equivariance of the network's predictions. Proposition 4.16 essentially bridges this gap, establishing as a proxy for near a well-fitted minimum. Consequently, any theoretical predictions or dynamics derived for , in particular, the ratio , can directly transit to . This justifies the use of in our experiments to evaluate the learned equivariance of the network, with the confidence that this empirical metric follows the theoretical behavior of .
5 Experiments
In this section, we present both synthetic and practical experiments to validate our theoretical results. In Section 5.1, we conduct synthetic experiments to verify the theoretical predictions of Theorem 4.12. In Section 5.2, we evaluate the performance of SWA on a range of image and graph classification tasks, chosen to cover diverse data modalities and architectural families with a chosen augmentation group.
5.1 Synthetic experiments
We conduct synthetic experiments to validate our theoretical settings, and verify our theoretical results. Throughout the section, we work with multi-layer perceptrons (MLPs) since they have completely unrestricted parameter space, and our theory applies without modification.
5.1.1 Empirical validation of the quadratic approximation
Before applying our theoretical framework to weight averaging, we first conduct an experiment to validate the quadratic approximation of the loss landscape near a well-fitted minimum. We employ a teacher-student setup where both models are MLPs with identical architectures, and the input data is sampled from a standard Gaussian distribution. In this controlled setting, the global minimum is explicitly known, allowing us to compute the exact empirical Hessian at the minimizer.
To simulate the dynamics of late-stage training, we perturb the parameters away from the minimum with stochastic gradient ascent, which explicitly pushes the parameters along the noise distribution of SGD. We then perform standard stochastic gradient descent from these perturbed points, tracking both the true loss and its theoretically estimated quadratic approximation.
We first analyze the spectral properties of the Hessian. As illustrated in Figure 2a, the effective rank of the Hessian monotonically increases with the number of data samples used for its computation, eventually plateauing at a sample size of 45. Furthermore, the resulting matrix is nearly full rank; the difference is primarily due to the positive homogeneity of the ReLU activation functions, which causes scale invariances in the parameter space.
Despite this slight rank deficiency, the quadratic approximation remains accurate under the training dynamics. Figure 2b compares the true loss against the quadratic estimation for the optimization trajectory originating from the gradient ascent perturbations. The approximation aligns closely with the full loss, and the approximation error strictly decreases and stabilizes as the parameters converge back toward the minimizer. Crucially, this high accuracy holds because the parameter trajectory is not exploring the landscape arbitrarily. As is shown with the calculation, the covariance matrix of the SGD noise is asymptotically the Hessian, causing the optimization path to be heavily biased toward the top eigenspaces where the Hessian dominates the local geometry. By naturally avoiding flat or highly non-linear directions, the SGD trajectory remains confined to a region where the loss is strictly dominated by the quadratic term, rendering our approximation highly accurate.
5.1.2 Verification of the theorem
With the quadratic approximation for the loss function justified, we now extend the teacher-student setup of Section 5.1.1, and verify our main theorem (Theorem 4.12).
Setup. In this experiment, the teacher and student share the same expressivity in terms of equivariant functions, but they are no longer identical: the teacher is a multilayer perceptron whose hidden layers carry the regular representation of , so that the network is exactly G-equivariant by construction. On the other hand, the student is an ordinary MLP of matching width and depth, with no constraint tying its weights together. Working with MLPs rather than convolutional architectures is deliberate: the student's parameter space is then the full space with no affine restriction , which is exactly the setting in which Theorem 4.12 was derived and the theorem applies without modification.
The teacher’s weights are embedded into the student’s parameter space. Therefore, the minimizer is accessible to the student without relying on the convergence of SGD to recover it. Because the layerwise

(a)

(b)
Figure 2: Empirical validation of the quadratic approximation in a teacher-student MLP setting. (a) Effective rank of the empirical Hessian evaluated at the global minimum, plotted against the number of data samples used. (b) Evaluation of the quadratic approximation along an optimization trajectory (sampled via gradient ascent). Left: The true loss strictly follows the quadratic estimation. Right: The approximation error between full- and quadratic loss stabilizes and strictly decreases as the parameter distance to the minimizer diminishes.
representations are explicit, the group action on the parameter space is a permutation of coordinates, the decomposition is explicit, and the structural factors and are directly accessible. As a result, the trace ratio and the asymptotic ratios are evaluated exactly.
Starting from , we perturb the student away from by entrywise independent Gaussian diffusion added directly to the weights, with the standard deviation proportional to that of each weight. From each sampled parameter, we train the network with SGD, evaluating , , and along the trajectory, from which we obtain empirical estimates of , and their ratio.
Dependence on the averaging time. For a fixed cyclic group acting on the input, we track as a function of the number of SWA epochs ; the result is shown in Figure 3 (left). The ratio increases monotonically from values below the asymptotic bound early in averaging, before gradually decreasing and plateauing above the theoretical bound for large .
Dependence on the group size. We repeat the same procedure for teachers equivariant under cyclic groups of increasing order, holding the student architecture and training budget fixed, and record the plateaued value of for each ; see Figure 3 (right). The resulting values decrease with , in qualitative agreement with the trend implied by Theorem 4.12 and the discussion following it: larger symmetry groups lead to lower dimension ratio, since as grows, so the guaranteed excess of over shrinks correspondingly. Within the range of group sizes tested, the empirical ratio nonetheless remains bounded above 1 throughout, indicating that the equivariance-specific benefit of SWA persists even as it weakens for larger groups.
Taken together, these two experiments substantiate both qualitative predictions of Theorem 4.12: convergence of toward its asymptotic value as the averaging window grows, and a decreasing dependence of that asymptotic value on the size of the augmentation group.
5.2 Practical tasks
We evaluate the performance of SWA on a range of image and graph classification tasks, chosen to cover diverse input modalities and architectural families while keeping the augmentation group fixed across each experimental block.

(a)

(b)
Figure 3: Synthetic verification of Theorem 4.12 in the teacher-student setting. (a) The empirical ratio for as a function of the SWA averaging time . The curve gradually rises above the asymptotic bound (dashed line) and plateaus after mild decrease. (b) Plateaued value of against the group order for cyclic groups .
5.2.1 Datasets and architectures
Image classification. We use [MNIST, Fashion-MNIST, CIFAR-10, CIFAR-100, and ImageNet-100], augmented under the action of discrete cyclic subgroups of . For the primary experiments, we use the group of 90-degree rotations . This range spans low-resolution grayscale images, medium-resolution natural images with varying class counts (CIFAR-10/100), and higher-resolution natural images (ImageNet-100).
To explore the generality across architectures of the equivariance gain from SWA, we evaluate four families on this image-classification task:
• Multilayer perceptrons (MLPs). These serve as a baseline and provide the closest match to the theoretical setting of Section 4, where the parameter space is unrestricted, and Theorem 4.12 applies without modification.
• Convolutional networks (CNNs): VGG-16, PreResNet-164, and WideResNet-28×10. CNNs are the standard architecture for image classification and admit a natural lift to their group-equivariant counterparts (G-CNNs), which are exactly G-equivariant by construction. Comparing standard CNNs trained with G-augmentation against this architectural baseline isolates the contribution of SWA-induced statistical equivariance from architecturally-enforced equivariance.
• Vision transformers: ViT-S. ViTs process inputs as patch sequences, so any equivariance present is learned from data rather than architecturally imposed. This makes ViTs a test of whether SWA improves equivariance as a generic sampling mechanism, rather than a consequence of the architectural inductive biases of CNNs.
• Graph neural networks on superpixels: ViG-Ti applied to superpixel graphs extracted from the image inputs. This architecture lies between CNNs and pure GNNs. The input geometry is derived from the image, but the computation over graphs ignores the pixel grid information. It tests whether the SWA equivariance gain persists when the data geometry is diluted into node and edge features from exact pixel values.
Graph classification. To verify that the framework extends beyond image data, we additionally evaluate on three graph classification benchmarks: [DHFR, BZR, COX2], using graph isomorphism networks. Here the relevant symmetry is 3D rotation, and we augment with discrete subgroups of . We use the GIN introduced by [43]; it takes in positional features of the atoms and is therefore not manifestly equivariant. The graph classification experiments serve as a confirmation of consistency of the SWA effect ( ).
5.2.2 Training and evaluation
For training, we use cross entropy loss and the stochastic gradient descent (SGD) optimizer, along with canonical choices of hyperparameters for each architecture. For each model, we train for a number of epochs until convergence, and then train for an additional number of epochs while taking the average of the weights at the end of each epoch. We evaluate the models before and after applying SWA, and the gain from applying SWA.
Besides the cross entropy loss and accuracy on the test set, we use the following metrics for evaluation of equivariance:
• Orbit Same Prediction (OSP): the average proportion of the prediction within the same orbit that matches the mode prediction of the orbit. This metric is a direct measure of the equivariance of the model, as it quantifies how consistent the predictions are within the same orbit. Mathematically, the OSP can be defined as:
where N is the number of test samples, and denotes the prediction of sample x. Note that the OSP is lower bounded by the accuracy, and for a perfectly equivariant model, the OSP would be 100%.
• Equivariance Loss: the KL-divergence between the prediction of a sample and the average prediction of its orbit, as defined in Eq. (136). This serves as a continuous measure that captures how much the predictions deviate from being equivariant.
5.2.3 Results
We begin with image classification results, reporting the absolute gains in accuracy and equivariance from SWA, and show that the relative improvement ratio is consistently larger than 1. That is, SWA improves equivariance more than it improves general performance.
Boost of accuracy and equivariance. Table 1 summarizes the empirical impact of SWA on test accuracy and OSP across various datasets and architectures. A primary observation is the positive correlation between the gains in standard generalization ( Acc) and the improvements in equivariance ( OSP). Across different models, particularly on more complex tasks such as CIFAR-10 and CIFAR-100, boosts in test accuracy are consistently accompanied by proportionally large increases in OSP. For instance, the models that benefit the most in accuracy (e.g., PreResNet and WideResNet on CIFAR-100) concurrently achieve the highest absolute gains in OSP (up to 8.14%). This strong correlation suggests that a significant portion of SWA's performance benefit stems directly from the network acquiring better transformation invariance.
Furthermore, the improvement in equivariance via SWA appears as a robust and universal phenomenon. The improvement in OSP is strictly positive across all tested configurations, even in regimes where standard accuracy gains are negative (the ViG-Tiny setting on ImageNet-100). This persistent enhancement in equivariance, irrespective of the fluctuations in overall task accuracy, agrees with our theoretical framework.
| Dataset | Model | Accuracy (%) | OSP (%) | ||||
|---|---|---|---|---|---|---|---|
| Before | After | Before | After | ||||
| MNIST | MLP | 94.55 ±0.20 | 94.68 ±0.15 | 0.13 ±0.11 | 97.73 ±0.12 | 97.93 ±0.09 | 0.20 ±0.07 |
| CNN | 74.23 ±6.59 | 71.74 ±3.91 | -2.49 ±6.70 | 94.56 ±0.57 | 96.85 ±0.24 | 2.30 ±0.56 | |
| FashionMNIST | MLP | 85.28 ±0.09 | 85.98 ±0.07 | 0.71 ±0.11 | 95.62 ±0.21 | 96.71 ±0.16 | 1.09 ±0.15 |
| CNN | 75.43 ±2.79 | 85.21 ±0.08 | 9.77 ±2.74 | 96.08 ±0.33 | 98.45 ±0.06 | 2.37 ±0.30 | |
| CIFAR-10 | VGG-16 | 87.83 ±0.16 | 89.83 ±0.09 | 2.00 ±0.20 | 92.97 ±0.15 | 95.62 ±0.06 | 2.65 ±0.13 |
| PRN | 87.24 ±0.44 | 92.14 ±0.23 | 4.89 ±0.29 | 94.70 ±0.20 | 98.07 ±0.09 | 3.37 ±0.15 | |
| WRN | 90.09 ±0.41 | 94.72 ±0.20 | 4.63 ±0.27 | 95.40 ±0.13 | 98.90 ±0.07 | 3.50 ±0.17 | |
| CIFAR-100 | VGG-16 | 54.76 ±0.66 | 60.17 ±0.63 | 5.41 ±0.33 | 81.43 ±0.53 | 87.53 ±0.26 | 6.10 ±0.37 |
| PRN | 58.51 ±0.46 | 67.38 ±0.79 | 8.87 ±0.38 | 86.87 ±0.10 | 93.63 ±0.08 | 6.76 ±0.15 | |
| WRN | 65.89 ±0.39 | 74.93 ±0.20 | 9.04 ±0.46 | 87.91 ±0.24 | 96.05 ±0.10 | 8.14 ±0.18 | |
| ImageNet-100 | ViG-Ti | 72.36 ±0.54 | 72.19 ±0.97 | -0.17 ±0.46 | 91.10 ±0.14 | 93.00 ±0.29 | 1.90 ±0.24 |
| ViT-S | 61.59 ±1.04 | 76.27 ±0.08 | 14.68 ±1.04 | 88.71 ±0.32 | 95.95 ±0.22 | 7.25 ±0.45 | |
Table 1: Accuracy and OSP results under rotation augmentation, showcasing the impact of stochastic weight averaging (SWA). Positive values indicate an improvement after applying SWA. Model abbreviations: PRN (PreResNet-164), WRN (WideResNet-28×10).
| Dataset | Model | Loss (L) | Equivariance Loss () | Ratio | ||
|---|---|---|---|---|---|---|
| Before | After | Before | After | |||
| MNIST | MLP | 0.187 | 0.183 ±0.003 | 0.021 | 0.018 ±0.001 | 1.14 |
| CNN | 0.791 | 0.795 ±0.099 | 0.019 | 0.005 ±0.000 | 3.93 | |
| FashionMNIST | MLP | 0.422 | 0.406 ±0.002 | 0.021 | 0.014 ±0.001 | 1.44 |
| CNN | 0.720 | 0.455 ±0.002 | 0.011 | 0.003 ±0.000 | 2.52 | |
| CIFAR-10 | VGG-16 | 0.430 | 0.311 ±0.004 | 0.125 | 0.041 ±0.001 | 2.21 |
| PRN | 0.499 | 0.300 ±0.009 | 0.079 | 0.017 ±0.001 | 2.79 | |
| WRN×10 | 0.407 | 0.220 ±0.009 | 0.083 | 0.009 ±0.001 | 4.98 | |
| CIFAR-100 | VGG-16 | 2.627 | 1.495 ±0.032 | 0.327 | 0.056 ±0.005 | 3.32 |
| PRN | 2.050 | 1.608 ±0.042 | 0.155 | 0.045 ±0.001 | 2.70 | |
| WRN | 1.652 | 1.359 ±0.010 | 0.161 | 0.026 ±0.001 | 5.09 | |
| ImageNet-100 | ViG-T | 1.178 | 1.352 ±0.058 | 0.088 | 0.066 ±0.004 | 1.53 |
| ViT-S | 1.907 | 1.154 ±0.011 | 0.118 | 0.027 ±0.001 | 2.60 | |
Table 2: Loss and Equivariance loss () results under rotation augmentation. measures how much more efficiently SWA minimizes the equivariance loss compared to the overall cross-entropy loss. Model abbreviations: PRN (PreResNet-164), WRN (WideResNet-28×10).
Relative improvement ratio. In Section 5.1.2, we empirically verified our main theorem (Theorem 4.12) on synthetic tasks tailored to our theoretical setting. On practical datasets, however, several assumptions underlying the theorem no longer hold (e.g., the unrestricted parameter space), and the architectures involve structural information — such as the exact layerwise irrep decomposition — that is intractable to compute. We therefore restrict ourselves to demonstrating the qualitative claim that SWA improves equivariance more than it improves predictive performance. We revisit the image classification tasks and compare the gains in loss and in equivariance loss, listed in Table 2.
Across all architectures and datasets we observe , i.e. SWA reduces the equivariance loss strictly more efficiently than it reduces the overall loss . The magnitudes admit a more quantitative reading. For the augmentation group used throughout Table 2, the right-hand side of (129) is at most , attained at and in the limit of vanishing multiplicity factor ; larger or larger multiplicities only decrease it.
The MLPs, which are the architectures closest to the setting of Theorem 4.12 in that the parameter space
| Dataset | Group | Accuracy (%) | OSP (%) | ||||
|---|---|---|---|---|---|---|---|
| Before | After | Δ | Before | After | Δ | ||
| DHFR | Tetra | 79.90 ±2.07 | 81.45 ±1.57 | 1.55 ±1.82 | 96.36 ±0.18 | 98.13 ±1.15 | 1.77 ±1.13 |
| Octa | 82.28 ±2.44 | 79.47 ±2.15 | -2.81 ±3.58 | 97.11 ±0.27 | 97.79 ±0.76 | 0.68 ±0.61 | |
| Icosa | 80.23 ±2.44 | 78.42 ±4.09 | -1.81 ±2.23 | 96.96 ±0.40 | 99.42 ±0.51 | 2.46 ±0.47 | |
| BZR | Tetra | 85.83 ±3.15 | 84.15 ±3.34 | -1.68 ±2.99 | 98.22 ±0.67 | 98.98 ±1.22 | 0.76 ±1.14 |
| Octa | 83.13 ±2.51 | 85.61 ±3.04 | 2.48 ±1.07 | 97.68 ±0.57 | 99.29 ±0.71 | 1.61 ±0.49 | |
| Icosa | 86.46 ±2.47 | 83.66 ±2.38 | -2.80 ±2.01 | 98.82 ±0.40 | 99.76 ±0.22 | 0.94 ±0.29 | |
| COX2 | Tetra | 78.54 ±2.05 | 77.87 ±0.89 | -0.67 ±1.27 | 96.75 ±0.45 | 98.62 ±0.95 | 1.87 ±0.98 |
| Octa | 78.91 ±1.88 | 80.64 ±1.17 | 1.73 ±2.43 | 97.30 ±0.36 | 99.96 ±0.10 | 2.66 ±0.40 | |
| Icosa | 78.68 ±3.13 | 80.00 ±1.17 | 1.32 ±3.99 | 97.66 ±0.18 | 99.65 ±0.45 | 2.00 ±0.52 | |
Table 3: Accuracy and OSP on the graph classification benchmarks under augmentation by discrete rotation subgroups of (tetrahedral, octahedral and icosahedral), before and after stochastic weight averaging. Positive values indicate improvement.
is unrestricted , give ratios of 1.14 (MNIST) and 1.44 (FashionMNIST), i.e. they lie closely to the theoretical value 4/3. In particular, the MNIST value falling slightly below 4/3 is not a contradiction, since we disregard the structural facts that lead to actual values for the factors and . In summary, this reads as evidence that the bound is close to tight in the regime where its assumptions hold.
The deep convolutional models behave differently, reaching ratios between 2.21 and 5.09, with bound 4/3 being merely conservative for these settings. Specifically, the ratio shows a correlation with task complexity and model capacity. The deviation from perfect prediction is potentially the root cause of the looseness of the bound. Furthermore, the dimension count (76) assumes an unrestricted parameter space, whereas for residual networks, their admissible parameters form a proper affine subspace whose equivariant part is a smaller fraction of than the count suggests. Both effects push the true ratio upwards relative to the bound, and the trend in Table 2 broadly increases with model depth within each dataset, from VGG-16 to WideResNet-28×10.
Generalization to graph classification tasks. The results above establish that SWA robustly improves equivariance on image classification tasks, occasionally independently of whether accuracy improves at all. However, it is natural to ask whether this pattern is specific to convolutional architectures and image data, or reflects a more general property of SWA. To test this, we repeat the same analysis on graph classification tasks, where both the underlying group action and the network architecture differ substantially from the image setting.
Table 3 reports accuracy and OSP for the three benchmarks under augmentation by the tetrahedral, octahedral and icosahedral rotation groups. The pattern differs from the image experiments. The effect of weight averaging on the test accuracy is essentially random: five of the nine configurations show a negative Acc, the magnitudes range from to , and in every setting the error bar over seeds is comparable to or larger than the mean. Equivariance, in contrast, improves in all nine configurations, with OSP between and and a clearly resolved effect in the majority of them.
6 Conclusion
We analyzed stochastic weight averaging (SWA) applied to networks trained on augmented data, framing the problem in terms of an Ornstein–Uhlenbeck approximation of the SGD trajectory near an equivariant minimizer. Decomposing the parameter space into equivariant and orthogonal subspaces , we showed that the loss ratios and both diverge with the averaging time , and that their relative rate is governed by the trace ratio at the minimizer. Associating the ratio with the neural tangent kernel in the infinite-width limit, we derived a bound (Theorem 4.12) showing that this relative ratio exceeds one under mild conditions on the group and the minimizer, establishing that SWA yields an equivariance boost more prominent than its performance boost. We verified this prediction on a synthetic teacher-student task where all structural constants are accessible exactly; we demonstrated the qualitative effect of SWA increasing equivariance across image and graph classification benchmarks spanning a variety of model families.
Several future directions remain open. First, our analysis is confined to the lazy NTK regime. Extending it to feature learning, where the kernel evolves during training would bring the analysis closer to practical training dynamics. Second, our analysis is local to a single equivariant minimizer. On the other hand, real SGD trajectories may transition between basins during training. Understanding how competition or transitions between minima interact with the equivariance boost is left to future work. Furthermore, we treat the covariance matrix as constant at the minimizer, whereas in practice it varies along the trajectory. Injecting this complexity into the approximation would enrich the framework and refine the theoretical predictions. A complete empirical analysis of when SWA increases equivariance and when it does not remains an open problem. This involves factors including different tasks, architectures, and hyperparameters, therefore requiring more extensive studies that go beyond what was done in this work.
Acknowledgements
This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation. The computations were enabled by resources provided by the National Academic Infrastructure for Supercomputing in Sweden (NAISS), partially funded by the Swedish Research Council through grant agreement no. 2025/22-1341. We thank Jakob Galley for interesting discussions.
References
[1] Josh Abramson et al. “Accurate Structure Prediction of Biomolecular Interactions with AlphaFold 3”. In: Nature 630.8016 (2024), pp. 493–500. DOI: 10.1038/s41586-024-07487-w.
[2] Erik J. Bekkers et al. “Roto-Translation Covariant Convolutional Networks for Medical Image Analysis”. In: Medical Image Computing and Computer Assisted Intervention – MICCAI 2018. Lecture Notes in Computer Science. Cham: Springer International Publishing, 2018, pp. 440–448. DOI: 10.1007/978-3-030-00928-1_50. arXiv: 1804.03393. URL: https://arxiv.org/abs/1804.03393.
[3] Michael M. Bronstein et al. Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and Gauges. 2021. arXiv:2104.13478. URL: https://arxiv.org/abs/2104.13478.
[4] Jan E. Gerken et al. “Geometric Deep Learning and Equivariant Neural Networks”. In: Artificial Intelligence Review 56.12 (2023), pp. 14605–14662. DOI: 10.1007/s10462-023-10502-7. arXiv: 2105.13926. URL: https://arxiv.org/abs/2105.13926.
[5] Jan E. Gerken et al. “Equivariance versus Augmentation for Spherical Images”. In: Proceedings of the 39th International Conference on Machine Learning. Vol. 162. Proceedings of Machine Learning Research. PMLR, 2022, pp. 7404–7421. arXiv: 2202.03990. URL: https://arxiv.org/abs/2202.03990.
[6] Jan E. Gerken and Pan Kessel. “Emergent Equivariance in Deep Ensembles”. In: Proceedings of the 41st International Conference on Machine Learning. Vol. 235. Proceedings of Machine Learning Research. PMLR, 2024, pp. 15438–15465. arXiv: 2403.03103. URL: https://arxiv.org/abs/2403.03103.
[7] Oskar Nordenfors and Axel Flinth. Ensembles provably learn equivariance through data augmentation. 2024. arXiv:2410.01452. URL: https://arxiv.org/abs/2410.01452.
[8] Pavel Izmailov et al. “Averaging Weights Leads to Wider Optima and Better Generalization”. In: Proceedings of the Thirty-Fourth Conference on Uncertainty in Artificial Intelligence. Monterey, California, USA: AUAI Press, 2018, pp. 876–885. arXiv: 1803.05407. URL: https://arxiv.org/abs/1803.05407.
[9] Taco Cohen and Max Welling. “Group equivariant convolutional networks”. In: Proceedings of the 33rd International Conference on Machine Learning. Vol. 48. Proceedings of Machine Learning Research. PMLR, 2016, pp. 2990–2999. arXiv: 1602.07576. URL: https://arxiv.org/abs/1602.07576.
[10] Maurice Weiler, Fred A. Hamprecht, and Martin Storath. “Learning Steerable Filters for Rotation Equivariant CNNs”. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 2018, pp. 849–858. arXiv: 1711.07289. URL: https://arxiv.org/abs/1711.07289.
[11] Taco S. Cohen et al. “Spherical CNNs”. In: International Conference on Learning Representations. 2018. arXiv:1801.10130. URL: https://arxiv.org/abs/1801.10130.
[12] Risi Kondor and Shubhendu Trivedi. “On the Generalization of Equivariance and Convolution in Neural Networks to the Action of Compact Groups”. In: Proceedings of the 35th International Conference on Machine Learning. Vol. 80. Proceedings of Machine Learning Research. PMLR, 2018, pp. 2747–2755. arXiv: 1802.03690. URL: https://arxiv.org/abs/1802.03690.
[13] Oskar Nordenfors, Fredrik Ohlsson, and Axel Flinth. “Optimization dynamics of equivariant and augmented neural networks”. In: Transactions on Machine Learning Research (2025). arXiv: 2303.13458. URL: https://arxiv.org/abs/2303.13458.
[14] Bryn Elesey and Sheheryar Zaidi. “Provably Strict Generalisation Benefit for Equivariant Models”. In: Proceedings of the 38th International Conference on Machine Learning. Vol. 139. Proceedings of Machine Learning Research. PMLR, 2021, pp. 2959–2969. arXiv: 2102.10333. URL: https://arxiv.org/abs/2102.10333.
[15] Akiyoshi Sannai, Masaaki Imaizumi, and Makoto Kawano. “Improved generalization bounds of group invariant / equivariant deep networks via quotient feature spaces”. In: Proceedings of the Thirty-Seventh Conference on Uncertainty in Artificial Intelligence. Vol. 161. Proceedings of Machine Learning Research. PMLR, 2021, pp. 771–780. arXiv:1910.06552. URL: https://arxiv.org/abs/1910.06552.
[16] Georg Bökman and Fredrik Kahl. “Investigating How ReLU-networks Encode Symmetries”. In: Advances in Neural Information Processing Systems. Vol. 36. Curran Associates, Inc., 2023, pp. 13720–13744. arXiv: 2305.17017. URL: https://arxiv.org/abs/2305.17017.
[17] Vahid Shahverdi et al. “Identifiable Equivariant Networks are Layerwise Equivariant”. In: Proceedings of the 43rd International Conference on Machine Learning. PMLR, 2026. arXiv: 2601.21645. URL: https://arxiv.org/abs/2601.21645.
[18] Yuyang Wang et al. “Swallowing the Bitter Pill: Simplified Scalable Conformer Generation”. In: Proceedings of the 41st International Conference on Machine Learning. Vol. 235. Proceedings of Machine Learning Research. PMLR, 2024, pp. 50400–50418. arXiv: 2311.17932. URL: https://arxiv.org/abs/2311.17932.
[19] Johann Brehmer et al. “Does Equivariance Matter at Scale?” In: Transactions on Machine Learning Research (2025). ISSN: 2835-8856. arXiv: 2410.23179. URL: https://arxiv.org/abs/2410.23179.
[20] Shuxiao Chen, Edgar Dobriban, and Jane H. Lee. “A Group-Theoretic Framework for Data Augmentation”. In: Journal of Machine Learning Research 21.245 (2020), pp. 1–71. arXiv: 1907.10905. URL: https://arxiv.org/abs/1907.10905.
[21] M.A. Ganaie et al. “Ensemble Deep Learning: A Review”. In: Engineering Applications of Artificial Intelligence 115 (2022), p. 105151. DOI: 10.1016/j.engappai.2022.105151. arXiv: 2104.02395. URL: https://arxiv.org/abs/2104.02395.
[22] Gao Huang et al. “Snapshot Ensembles: Train 1, Get M for Free”. In: International Conference on Learning Representations. 2017. arXiv: 1704.00109. URL: https://arxiv.org/abs/1704.00109.
[23] Hugh Chen, Scott Lundberg, and Su-In Lee. Checkpoint Ensembles: Ensemble Methods from a Single Training Process. 2017. arXiv: 1710.03282. URL: https://arxiv.org/abs/1710.03282.
[24] Timur Garipov et al. “Loss Surfaces, Mode Connectivity, and Fast Ensembling of DNNs”. In: Advances in Neural Information Processing Systems. Vol. 31. Curran Associates, Inc., 2018, pp. 8803–8812. arXiv: 1802.10026. URL: https://arxiv.org/abs/1802.10026.
[25] Boris Polyak and Anatoli Juditsky. “Acceleration of Stochastic Approximation by Averaging”. In: SIAM Journal on Control and Optimization 30 (1992), pp. 838–855. DOI: 10.1137/0330046.
[26] Antti Tarvainen and Harri Valpola. “Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results”. In: Advances in Neural Information Processing Systems. Vol. 30. Curran Associates, Inc., 2017, pp. 1195–1204. arXiv: 1703.01780. URL: https://arxiv.org/abs/1703.01780.
[27] Zeke Xie, Issei Sato, and Masashi Sugiyama. “A Diffusion Theory For Deep Learning Dynamics: Stochastic Gradient Descent Exponentially Favors Flat Minima”. In: International Conference on Learning Representations. 2021. arXiv:2002.03495. URL: https://arxiv.org/abs/2002.03495.
[28] Alex Damian, Tengyu Ma, and Jason D. Lee. “Label Noise SGD Provably Prefers Flat Global Minimizers”. In: Advances in Neural Information Processing Systems. Vol. 34. Curran Associates, Inc., 2021, pp. 27449–27461. arXiv:2106.06530. URL: https://arxiv.org/abs/2106.06530.
[29] Hao Guo, Jiyong Jin, and Bin Liu. "Stochastic Weight Averaging Revisited". In: Applied Sciences 13.5 (2023), p. 2935. DOI: 10.3390/app13052935. arXiv: 2201.00519. URL: https://arxiv.org/abs/2201.00519.
[30] Stephan Mandt, Matthew D. Hoffman, and David M. Blei. "Stochastic Gradient Descent as Approximate Bayesian Inference". In: Journal of Machine Learning Research 18.134 (2017), pp. 1–35. arXiv: 1704.04289. URL: https://arxiv.org/abs/1704.04289.
[31] Alexandru Meterez et al. A Defense of the Quadratic Model. 2026. arXiv: 2607.21716. URL: https://arxiv.org/abs/2607.21716.
[32] Gerard Ben Arous et al. “Spectral Alignment of Stochastic Gradient Descent for High-Dimensional Classification Tasks”. In: The Annals of Applied Probability 35.4 (2025), pp. 2767–2822. DOI: 10.1214/25-AAP2187. arXiv:2310.03010. URL: https://arxiv.org/abs/2310.03010.
[33] Arthur Jacot, Franck Gabriel, and Clement Hongler. “Neural Tangent Kernel: Convergence and Generalization in Neural Networks”. In: Advances in Neural Information Processing Systems. Vol. 31. Curran Associates, Inc., 2018, pp. 8571–8580. arXiv: 1806.07572. URL: https://arxiv.org/abs/1806.07572.
[34] Jaehoon Lee et al. “Deep Neural Networks as Gaussian Processes”. In: International Conference on Learning Representations. 2018. arXiv: 1711.00165. URL: https://arxiv.org/abs/1711.00165.
[35] Arthur Jacot, Franck Gabriel, and Clément Hongler. “The Asymptotic Spectrum of the Hessian of DNN throughout Training”. In: International Conference on Learning Representations. 2020. arXiv: 1910.02875. URL: https://arxiv.org/abs/1910.02875.
[36] Ronen Basri et al. “Frequency Bias in Neural Networks for Input of Non-Uniform Density”. In: Proceedings of the 37th International Conference on Machine Learning. Vol. 119. Proceedings of Machine Learning Research. PMLR, 2020, pp. 685–694. arXiv: 2003.04560. URL: https://arxiv.org/abs/2003.04560.
[37] Mariia Seleznova et al. “GradPCA: Leveraging NTK Alignment for Reliable Out-of-Distribution Detection”. In: The Fourteenth International Conference on Learning Representations. 2026. arXiv: 2505.16017. URL: https://arxiv.org/abs/2505.16017.
[38] Philipp Misof, Pan Kessel, and Jan E Gerken. “Equivariant Neural Tangent Kernels”. In: Proceedings of the 42nd International Conference on Machine Learning. Vol. 267. Proceedings of Machine Learning Research. PMLR, 2025, pp. 44470–44503. arXiv: 2406.06504. URL: https://arxiv.org/abs/2406.06504.
[39] William Fulton and Joe Harris. Representation Theory: A First Course. Springer Science & Business Media, 1991. ISBN: 978-0-387-97495-8.
[40] Qianxiao Li, Cheng Tai, and Weinan E. “Stochastic modified equations and dynamics of stochastic gradient algorithms i: Mathematical foundations”. In: Journal of Machine Learning Research 20.40 (2019), pp. 1–47. arXiv: 1811.01558. URL: https://arxiv.org/abs/1811.01558.
[41] Christian Szegedy et al. “Rethinking the Inception Architecture for Computer Vision”. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 2016, pp. 2818–2826. DOI: 10.1109/CVPR.2016.308. arXiv: 1512.00567. URL: https://arxiv.org/abs/1512.00567.
[42] Longde Huang et al. “Learning Chern Numbers of Multiband Topological Insulators with Gauge Equivariant Neural Networks”. In: Advances in Neural Information Processing Systems. Vol. 38. Curran Associates, Inc., 2025, pp. 164259–164288. DOI: 10.52202/085713-4948. arXiv: 2502.15376. URL: https://arxiv.org/abs/2502.15376.
[43] Keyulu Xu et al. “How Powerful are Graph Neural Networks?” In: International Conference on Learning Representations. 2019. arXiv: 1810.00826. URL: https://arxiv.org/abs/1810.00826.
A Proof of Proposition 4.3
It is well known that the evolution of (21) is described by the Fokker-Planck equation: If is the density of the distribution at time t, we have
Here, D is the diffusion tensor:
We can express (144) in operator form , with
It will be convenient to introduce also the push-forward operation as an operator:
This for instance makes the difference between , which is , and , which is .
The time-derivative trivially commutes with . Its commutation relations with the divergence and Laplace operators are as follows.
Lemma A.1. For all ,
Proof. Using Einstein summation, the chain rule gives, for any vector field h,
where denote the entries of the matrix corresponding to the action . Since , we get
Now, since is orthogonal, we have , so
which is the first claim. Similarly, the chain rule implies for every tensor field E
Since , we get
where we again applied .
Using the above formulas, it is now not hard to prove that commutes with .
Lemma A.2. We have for all .
Proof. Lemma A.1 implies
Now, we note that the chain rule and the invariance of the cumulative loss, and Lemma 4.2 implies that
so that
(156)
With the commutation , it is not hard to prove Proposition 4.3.
Proof of Proposition 4.3. Since both and commute with , so does the flow – if solves the equation initialized at , will do it for the one initialized at . In particular, if we initialize at an invariant distribution, , we remain invariant, , due to the existence and uniqueness of the solution. Consequently, , therefore
i.e., is equivariant.