betaFeedback

WorksComputer Science

Understanding the Importance of Massive Activations through Adversarial Robustness

Abstract

A common occurrence in Large Language Models (LLMs) is the emergence of so-called massive activations. This phenomenon is well known in the literature and has been connected to attention sinks, representational compression, as well as signal propagation. However, the reasons and consequences for their appearance are not yet well understood. In this paper, we explain the role of massive activations in deep learning by showing that they are connected to the region migration phenomenon in delayed robustness. Under the spline theoretic interpretation of deep networks, we show that massive activations push the representations away from the nonlinearity boundaries of the network, decreasing the complexity of its input-output map around data points. Furthermore, we uncover for the first time that this phenomenon is not unique to transformers and actually appears in a number of common architectures performing simple supervised learning tasks. We validate this connection through extensive experiments on a diverse set of architectures including residual MLP, ResNet18, Vision Transformers and GPT and datasets including MNIST, CIFAR10, Imagenette and Shakespeare Text. We consistently observe that massive activations and region migration co-occur with adversarial robustness. Furthermore, we illustrate that this connection holds in the large-scale pretraining of LLMs by showing that the rise of massive activations in LLMs closely tracks the adversarial accuracy of the model under perturbations of the token embeddings.

Introduction

Despite their remarkable success, the inner workings of neural networks remain poorly understood, giving rise to surprising phenomena that challenge our understanding of how they learn. One such phenomenon that recently gained traction in the context of LLMs is the so-called massive activations [45]. These are a few activations in the hidden representation of neural networks that grow multiple orders of magnitude larger than the others. These activations rise in early layers and persist through the network via the residual stream, until disappearing near the output. Recent work has linked massive activations to attention sinks and pre-norm architectures [46], traced their formation to interactions between normalization and feed-forward layers [44], and interpreted them as structural bias vectors [12]. Related work on activation outliers has also implicated normalization, signal propagation, and optimization in their emergence [23]. However, their broader functional role remains poorly understood.

This work is, to the best of our knowledge, the first to empirically and theoretically show the connection between massive activations, delayed robustness and adversarial grokking [27] (the emergence of adversarial robustness [20, 37] (Szegedy et al. 2014) long after generalization). Our central finding is that massive activations, emerging in the late phases of training, simplify the local input-output map of neural networks, inducing the phenomenon called region migration [27] in delayed robustness, which empirically coincides with increased adversarial robustness.

To study this connection in a principled manner, we view neural networks through the lens of Spline Theory of Deep Networks [3] (Balesterio et al. 2018). Under this interpretation, a neural network partitions its input space into convex polytopal regions and applies an affine mapping on each region. We show that massive activations displace the data points onto large linear regions and away from nonlinearity boundaries. This displacement of representations is the region migration phenomenon observed in delayed robustness [27].

We provide extensive experimental support for this connection, on a diverse mix of architectures, like MLPs [35] with residual connections, ResNet18 [24], Vision Transformers (ViTs) [19] and GPTs and datasets, like MNIST [35], CIFAR10 [33], Imagenette [25] and Shakespeare Text [30]. Across all the experiments we consistently observe that massive activations and region migration co-occur with adversarial robustness, providing strong empirical support for our proposed connection. Furthermore, we investigate this connection in LLMs and show that during pretraining the rise of massive activations closely tracks the onset of region migration and robustness to perturbations in the token embedding space.

We summarize our contributions as follows:

  • We show that massive activations are more widespread in deep learning than previously known (they do not appear only in transformers, as was originally found in Sun et al. [45]).

  • We provide extensive empirical evidence showing that massive activations cause region migration and co-occur with adversarial robustness, providing a new perspective on the role of massive activations and why they are useful in deep learning.

  • Under the spline theoretic view of deep networks, we theoretically show that massive activations displace the representations away from nonlinearity boundaries, simplifying the neural network input-output map.

  • We demonstrate that our finding is also relevant for LLMs, by showing that the massive activations emerging during pretraining induce region migration and closely follow the robustness to perturbations of the token embeddings.

Preliminaries and Related Work

Massive Activations

Massive activations are a surprising empirical phenomenon, observed in the hidden representations of large neural networks [45]. Sun et al. [45] conduct a systematic study of these activations and report that massive activations have two defining characteristics: first, there are very few of them, typically fewer than ten in the hidden representation; second, they are a few orders of magnitude larger than the other activations.

Sun et al. [45] observed that massive activations emerge as early as after the computation of the first layer in the network, remain roughly constant in value throughout most of the intermediate layers and diminish in the final few layers. Massive activations reside in a fixed location of the hidden representations, are typically input independent, and often occur in the beginning of a sequence, period or newline token, which do not have semantic meaning.

What are Massive Activations For?

Fixed Biases. Sun et al. [45] show that massive activations are not redundant and act as fixed but important biases in the network. Notably, when they are set to zero, the model performance degrades significantly; on the other hand, setting massive activations to their mean value computed across different samples, causes negligible performance change.

Attention Sinks. Sun et al. [45]; Queipo-de-Llano et al. [42]; Sun et al. [46] claimed that massive activations cause attention sinks (Xiao et al., 2024). The connection is due to the fact that massive activations appear in the attention key vectors of their associated tokens and the dot product between any query and these key vectors produces a large activation logit. As a result, the large activation logit dominates the softmax operation, since the softmax output must sum to one and nearly all the probability mass is allocated to the token with the massive activation.

Mitigating Over-mixing. Barbero et al. [9] show that attention sinks, which are a consequence of massive activations on the first token [45, 42], are useful in transformers, because they prevent over-mixing of the representations and enable faithful information propagation through the layers, providing an additional interpretation of their role and why they might be useful in deep learning.

Compression Valleys. Queipo-de-Llano et al. [42] showed that massive activations compress the hidden representations, which is captured by the low entropy of the hidden representations in the middle layers. Massive activations cause the representation norm of a single token to dominate the others, creating a dominant singular value in the hidden representation matrix. The dominant singular value suppresses the contributions of all the tokens, causing the matrix based entropy of the representation to drop.

Natural Robustness. The closest work in the literature to ours is Crabbé et al. [13], which identifies a connection between large activations and natural robustness (robustness to ImageNet [17] distribution shifts). While Crabbé et al. [13] shows that large activations are indicative of natural robustness, our work and contributions differ in the following important ways. Firstly, we consider adversarial robustness that measures robustness under carefully crafted input perturbations that aim to cause misclassification, which meaningfully differs from natural robustness. Additionally, we provide empirical and theoretical connections between massive activations and region migration [27], which is associated with emergent adversarial robustness. In contrast to Crabbé et al. [13] we validate this connection across a diverse mix of architecture and dataset choices.

Delayed Robustness and Region Migration

Humayun et al. [27] found a novel, previously unknown form of grokking [41, 36, 34], in which adversarial accuracy always exhibits a delayed transition, after the saturation of train and test accuracy, and termed this delayed robustness. Humayun et al. [27] showed that across a wide range of architectures and training settings, deep networks become adversarially robust long after generalization. This means that there is a third phase beyond memorization and generalization where the network reorganizes its parameters to become adversarially robust to input perturbations, which Humayun et al. [27] measures with Projected Gradient Descent (PGD) attack [37] with different radii ϵ\epsilon. This phenomenon has been established to be a general occurrence in deep learning and consistently observed in MLPs trained on MNIST [35], CNNs [35] and ResNets [24] trained on CIFAR10, CIFAR100 [33] and Imagenette [25] and GPT trained on Shakespeare Text [30].

Local Complexity. To track the emergence of delayed robustness, Humayun et al. [27] propose a local complexity (LC) progress measure [8, 39], which quantifies the density of the nonlinearity boundaries around data points, that serves as a measure of local expressivity. More concretely, LC is computed by first constructing a small cross-polytopal frame around an input point xx. Let {v1,…,vP}\{v_1, \ldots, v_P\} be PP orthonormal directions, r>0r > 0 be a neighborhood radius and Vx={x±rvp:p=1,…,P}\mathcal{V}_x = \{x \pm r v_p : p = 1, \ldots, P\} be the input cross-polytopal frame. The convex hull of this frame approximates a local neighborhood of the data point. The frame is constructed once in the input space and then propagated through the network layer by layer. At each layer, the metric asks how many neuron nonlinearity boundaries cut through the propagated neighborhood. Operationally, this is checked by evaluating each neuron’s preactivation on the vertices of the propagated frame. If different vertices fall on different sides of the same nonlinearity boundary, then the frame has crossed that boundary and the neuron contributes to the layer’s LC. The total LC is obtained by summing these boundary-crossing counts over all layers. Thus, LC should be understood geometrically as the number of nonlinear boundaries intersected by a small neighborhood of the data point as that neighborhood travels through the network. A large LC indicates that the neighborhood is cut by many activation boundaries and can move between many affine maps under small perturbations, while a small LC indicates that the propagated neighborhood lies inside larger affine regions.

Delayed Robustness. Humayun et al. [27] study the LC throughout the training of deep networks and find that it undergoes a double descent (first decreases, then increases and then decreases). Humayun et al. [27] shows that the network starts becoming robust against PGD perturbations during the second descent of LC, also called region migration, and this is when it reaches the delayed robustness state. We provide an illustration of delayed robustness for MLP with residual connections on MNIST dataset in Figure 1. Figure 1 (left) shows the train, test and adversarial accuracy on test set across steps along with the LC metric on train, test and random points. The adversarial accuracy increases with the decrease of the LC metric after generalization. Figure 1 (middle and right) shows SplineCam (Humayun et al., [26]) visualization of the input space partitioning of the network before region migration (middle), where the nonlinearity boundaries are dense around data points (marked with stars) and after region migration (right), where the nonlinearity boundaries migrated away from data points.

Figure 1. Residual MLP training on MNIST digit classification dataset. Left: train, test and adversarial accuracies along with the LC on train, test and random points. Middle and Right: SplineCam visualization of the input space partitioning of the residual MLP that passes through three data points. The black lines in the SplineCam plots represent the nonlinearity boundaries of the model, where on each induced cell or region the neural network is an affine map. Stars represent the data points, red line is the decision boundary and colors of the regions correspond to the norm of their affine mappings. We provide more detailed explanation about SplineCam visualization in A.4

Massive Activations Induce Region Migration

In this section, we claim that massive activations are the mechanistic cause for region migration in deep networks. The following sections detail this mechanistic connection along with extensive experimental support. Additionally, we show that this connection is not specific to any architecture or dataset and can be observed in residual MLP on MNIST, GPT on Shakespeare Text, and Pythia 160M on The Pile as depicted in Figure 2 and in ResNet18 on CIFAR10, ViT Tiny on CIFAR and ViT Small on ImageNet as illustrated in Figure 9. All the experimental details and computation of the metrics are provided in Appendix C.

Figure 2. Joint emergence of massive activations, region migration and adversarial robustness (evaluated with AutoAttack) in MLP on MNIST with ϵ=0.03\epsilon= 0.03 (left), GPT on Shakespeare Text with ϵ=0.01\epsilon= 0.01 (middle) Pythia 160M on The Pile with ϵ=0.001\epsilon= 0.001 (right). The top row shows the accuracy and adversarial accuracy on the test set along with the LC (on the mirrored axis) throughout the training. The bottom row shows the sum of the three largest activations in the representation across all the layers.

Figure 9. Emergence of the massive activations, region migration and adversarial robustness, in ResNet18 on CIFAR10 (left), ViT Tiny on CIFAR10 (middle) and ViT Small on Imagenette (right). Plots follow the same format as Figure 2. Adversarial radius of ϵ=0.0025\epsilon= 0.0025 is chosen in all evaluations.

Early Emergence and Persistence Through Residual Stream

Massive activations typically emerge in early layers of the network depending on the architecture. For instance in GPT (Figure 2, middle), Pythia 160M (Figure 2, right) and ViTs (Figure 9, middle and right) massive activations emerge in early layers. On the other hand, for ResNet18 (Figure 9, left), they do not have an exact emergence point, but gradually increase with each layer. Once they emerge, massive activations live in the representation from that point on and pass through the network via the residual stream. Figure 3, visualizes this mechanism via the hidden representations of residual MLP on MNIST (left), the CLS token representation of the ViT Small on Imagenette (middle) and the first token representation of GPT on Shakespeare text (right) across the network layers. In Appendix § 11.§ 4 we discuss the setting when residual connections are removed and show that massive activations emerge in early layers, however their propagation through the network largely disappears.

Visualization of massive activations in the hidden representations of residual MLP, ViT Small, and GPT

Figure 3. Visualization of massive activations in the hidden representations of residual MLP trained on MNIST (left), the CLS token representations of ViT Small trained on Imagenette (middle) and the first token representations of GPT trained on Shakespeare Text (right). Massive activations emerge as early as in the first layer and propagate through the network via the residual stream. In the case of ViT Small the massive activations amplify during the first few layers after the emergence.

Theoretical Characterization of Region Migration

This section develops a theoretical characterization of region migration through massive activations. We first consider region migration within a single hidden layer. Let W(ℓ)=[w1(ℓ),…,wD(ℓ)(ℓ)]W^{(\ell)} = [w_1^{(\ell)}, \ldots, w_{D^{(\ell)}}^{(\ell)}] and b(ℓ)=[b1(ℓ),…,bD(ℓ)(ℓ)]b^{(\ell)} = [b_1^{(\ell)}, \ldots, b_{D^{(\ell)}}^{(\ell)}] be the parameters of layer ℓ\ell and x(ℓ−1)x^{(\ell-1)} be its input representation, where D(ℓ)D^{(\ell)} is the output dimensionality of layer ℓ\ell. For clarity and ease of analysis we assume a ReLU activation function in the network. Given this setup, in the input space partition of layer ℓ\ell, the neuron ii induces the following hyperplane Hi(ℓ)={z:wi(ℓ)⊤z+bi(ℓ)=0}\mathcal{H}_i^{(\ell)} = \{z : {w_i^{(\ell)}}^\top z + b_i^{(\ell)} = 0\}. The LC of this layer is quantified by how many such hyperplanes lie close to the input representation x(ℓ−1)x^{(\ell-1)}. This dependence can be described through the distance from the representation to each neuron hyperplane given by

dist⁡(x(ℓ−1),Hi(ℓ))=∣wi(ℓ)⊤x(ℓ−1)+bi(ℓ)∣∥wi(ℓ)∥.(1)\operatorname{dist}(x^{(\ell-1)}, \mathcal{H}_i^{(\ell)}) = \frac{\left|{w_i^{(\ell)}}^\top x^{(\ell-1)} + b_i^{(\ell)}\right|}{\left\|w_i^{(\ell)}\right\|}. \tag*{(1)}

Therefore, LC and region migration in a single layer can be characterised as the growth of these distances. The increase of these distances, would mean that representations move away from non-linearity boundaries and reside inside large regions.

Now suppose that the input representation x(ℓ−1)x^{(\ell-1)} has large activations. These activations would increase the distance between the representation and the neuron hyperplanes, hence displacing them into large regions and decreasing LC. To formalize this mechanism, Proposition 3.1 derives the activation magnitude required to ensure any desired distance δ>0\delta> 0 from nonlinearity boundaries. Throughout the analysis, v−kv_{-k} denotes the vector obtained from vv by setting its kkth coordinate to zero.

Proposition 3.1. Let 0<η<10 < \eta< 1. Assume that the massive activation at kkth entry dominates the representation

∥x−k(ℓ−1)∥<η∣xk(ℓ−1)∣\lVert\mathbf{x}_{-k}^{(\ell-1)} \rVert< \eta|x_k^{(\ell-1)}|

and assume the neuron hyperplane parameters do not cancel out the dominance of the massive,

∣wi,k(ℓ)∣>η∥wi,−k(ℓ)∥,i=1,…,D(ℓ).|w_{i,k}^{(\ell)}| > \eta\lVert\mathbf{w}_{i,-k}^{(\ell)} \rVert,\quad i=1,\ldots,D^{(\ell)}.

Then x(ℓ−1)\mathbf{x}^{(\ell-1)} is more than δ>0\delta> 0 distance away from every hyperplane in the layer whenever

∣xk(ℓ−1)∣>max⁡i=1,…,D(ℓ)δ∥wi(ℓ)∥+∣bi(ℓ)∣∣wi,k(ℓ)∣−η∥wi,−k(ℓ)∥.(2)|x_k^{(\ell-1)}| > \max_{i=1,\ldots,D^{(\ell)}} \frac{\delta\lVert\mathbf{w}_i^{(\ell)} \rVert+ |b_i^{(\ell)}|}{|w_{i,k}^{(\ell)}|-\eta\lVert\mathbf{w}_{i,-k}^{(\ell)} \rVert}. \tag*{(2)}

Proof. Given in B.2.

As massive activations emerge early in the network and travel through the residual stream, which supplies it to the inputs of the subsequent layers, they push the data points away from neuron hyperplanes in each layer, resulting in decreased LC and region migration in all layers, and hence for the whole network.

Theorem 3.2. Let α=max⁡ℓ=1,…,L∥W(ℓ)∥\alpha= \max_{\ell=1,\ldots,L} \lVert W^{(\ell)} \rVert and 0<η<10 < \eta< 1. Assume that the massive activation at entry kk dominates the representation at every layer

∥x−k(ℓ−1)∥<η∣xk(ℓ−1)∣,ℓ=1,…,L\lVert\mathbf{x}_{-k}^{(\ell-1)} \rVert< \eta|x_k^{(\ell-1)}|,\quad\ell=1,\ldots,L

and every neuron hyperplane parameters do not cancel out the dominance of the massive,

∣wi,k(ℓ)∣>η∥wi,−k(ℓ)∥,ℓ=1,…,L,i=1,…,D(ℓ).|w_{i,k}^{(\ell)}| > \eta\lVert\mathbf{w}_{i,-k}^{(\ell)} \rVert,\quad\ell=1,\ldots,L,\quad i=1,\ldots,D^{(\ell)}.

Then the propagated ball of radius δ>0\delta> 0 centered at x(0)\mathbf{x}^{(0)} does not intersect any neuron hyperplane whenever

xk(0)>max⁡ℓ,i(1+α)(ℓ−1)δ∥wi(ℓ)∥+∣bi(ℓ)∣∣wi,k(ℓ)∣−η∥wi,−k(ℓ)∥.x_k^{(0)} > \max_{\ell,i} \frac{(1+\alpha)^{(\ell-1)}\delta\lVert\mathbf{w}_i^{(\ell)} \rVert+ |b_i^{(\ell)}|}{|w_{i,k}^{(\ell)}|-\eta\lVert\mathbf{w}_{i,-k}^{(\ell)} \rVert}.

Proof. Given in B.2.

Under the stated assumptions, Theorem 3.2 illustrates, that for a given distance δ>0\delta> 0 a large enough activation magnitude would ensure that nonlinearity boundaries in the input space are further than δ\delta from the input point. We claim that this is the mechanistic connection between massive activations and region migration. We provide additional discussion about the theoretical setup and the proofs in Appendix B.

Suppressing Massive Activations

To validate the causal link between massive activations and region migration, in this section we study the impact of suppressing massive activations on LC and prediction consistency. We found that removing some activations strongly hinders clean accuracy, making adversarial accuracy hard to interpret (since it measures the stability of correct predictions). Therefore in our suppression study we track adversarial consistency (which measures the fraction of predictions that remain unchanged under the adversarial attack) as our main metric along with accuracy and LC.

Table 1 shows the resulting metrics when we zero out the massive activations in ViT Tiny, GPT and Pythia 160M models vs randomly selected activations. We find that consistency drops when massive activations are removed from the model, and changes only slightly when the same number of random activations are removed. This trend is accompanied by the corresponding increase in LC across all the models. These results provide further evidence for the mechanistic role of massive activations in adversarial robustness.

ModelConditionAccuracy (%)Consistency (%)LC
ViT TinyNo suppression71.8839.8447.55
ViT TinyTop 4 zeroed59.3821.8861.97
ViT TinyRandom 4 zeroed71.7238.7547.20
GPTNo suppression63.4859.3811.65
GPTTop 4 zeroed25.981.9543.09
GPTRandom 4 zeroed63.6757.3011.62
Pythia 160MNo suppression41.216.642,483.28
Pythia 160MTop 6 zeroed21.090.983,255.83
Pythia 160MRandom 6 zeroed40.556.052,517.70

Table 1. Effect of zeroing dominant versus randomly selected activations on accuracy, adversarial consistency, and LC. Consistency is the percentage of predictions that remain unchanged under the attack, regardless of whether the clean prediction is correct.

Additionally, Figure 4 provides SplineCam visualization of a trained residual MLP’s last layer input space partitioning, as the dominant activations are suppressed in its input. Figure 4 shows that when the dominant activation is explicitly removed, region migration gets undone as depicted by the increased density of nonlinearity boundaries around data points and the number of regions in the partitioning. We provide additional examples of the input space partitioning in MLPs, when the dominant activation is decreased in Appendix D.3.

SplineCam visualizations of the last-layer input space partitioning with and without the dominant activation

Figure 4. Removing the dominant activation from the input representation of the last layer of a 4 depth and 200 width residual MLP on MNIST undoes region migration. Left: Without any changes, serving as a reference. Right: The dominant activation set to zero. This Figure follows the same format as Figure 1 (middle and right).

Which Tokens?

Figure 5 shows that in ViT Small and GPT the massive activation structure is fundamentally different. In ViT Small’s hidden representations they reside on the CLS token embedding, while in GPT they are present across all tokens in the hidden representation. We believe that this is not a structural coincidence, but a reflection of what region migration requires for different architectures. Recall that ViTs utilize the CLS token representation for classification, and since the MLPs (where the nonlinearities reside) in the transformer block are applied pointwise to the tokens, having the massive activation in the CLS token is sufficient for region migration. In contrast GPT would require them in all token representations because each token representation is used to make a prediction on the subsequent token.

Visualization of the massive activations in the residual streams of ResNet18, ViT Small and GPT

Figure 5. Visualization of the massive activations in the residual streams of ResNet18, ViT Small and GPT. Left: Activations of ResNet18 on CIFAR10, which contains the channels where the top 6 (by magnitude) massive activations reside. Middle: Activations of ViT Small on Imagenette of the CLS token, followed by the activations of the next 6 patch tokens. Right: Activations of GPT on Shakespeare Text for the first 6 tokens in the sequence.

Key Finding: We illustrate that under the spline theoretic interpretation of deep learning massive activations that emerge in residual MLP, ResNet18, ViT, GPT and Pythia 160M induce region migration and co-emerge with adversarial robustness.

Region Migration and Adversarial Robustness in LLMs

In Section 3 we established a connection between massive activations and adversarial robustness through region migration and provided extensive experimental evidence across diverse training settings. In this section we investigate if this connection holds in the context of LLMs, containing billions of parameters. Massive activations have initially been observed in LLMs [45] hence it is a natural question arising from our framework, whether or not the massive activations observed in LLMs are a sign of region migration and emergent robustness.

Pythia Suite

We study the Pythia suite of LLMs [10], a family of decoder only transformers pretrained on The Pile [10] dataset. We use the checkpoints available throughout pretraining to monitor the emergence of massive activations and their relation to LC and adversarial robustness in the same dataset.

Experiment Setup. Similar to the prior experimental setup the sum of the largest three activations in the hidden token representation is recorded and averaged across tokens and samples across all layers in the network. The adversarial perturbations are applied to token embeddings and adversarial accuracy is measured on the next-token prediction task, similar to the GPT on Shakespeare Text setting. The attack configuration is detailed in Appendix C.2.

Results. Figure 6 presents the results of this experiment on Pythia 1.4B and illustrates that the emergence of massive activations (left) closely tracks the descent of LC (right) and robustness to adversarial perturbation (middle). We observe the same trend across different model sizes in the Pythia suite. These results demonstrate that massive activations, originally observed in LLMs, are indeed connected to the emergence of adversarial robustness. In Figure 7, we provide the massive activations in the residual stream of the Pythia models across different scales. Notably, all token representations possess massive activations, which is consistent with the discussion for GPT on Shakespeare Text setting detailed in Section 3.4. Appendix § 11.§ 5 provides additional evidence for the emergence of per-token massive activations for Qwen 2.5 (Yang et al., 2024) and Gemma 3 [29] pretrained model families.

Evolution of top activations, adversarial accuracy and local complexity in Pythia 1.4B

Figure 6. Evolution of top activations, adversarial accuracy and LC in Pythia 1.4B. Massive activations (left) co-occur with region migration, manifested by the decreasing LC (right) and robustness to adversarial perturbations (middle). The perturbations are constructed with AutoAttack detailed in Appendix C.2.

Activation magnitudes in hidden representations across Pythia model sizes

Figure 7. The activation magnitudes in the hidden representations of the Pythia suite across different model sizes.

Why Is Delayed Robustness Less Evident in LLMs?

In Figure 6, we observe that region migration occurs relatively earlier during training, compared to the experiments in § 3, where adversarial accuracy starts increasing long after the train and test accuracies plateau. We hypothesise that this is due to the fact that the dataset size of the Pythia suite is significantly larger than in any of the training settings in § 3 and it has been observed in Humayun et al. [26] that this factor accelerates the occurrence of delayed robustness.

Key Finding: We find that massive activations in LLMs actually induce region migration and emerge alongside robustness to perturbations of the input sequence embeddings during pretraining.

Discussion and Future Work

In this work, we have uncovered a connection between massive activations and adversarial robustness in deep learning. We have shown that massive activations push the representations of the network away from the neuron hyperplanes, which define the input space partitioning boundaries, inducing region migration, which is connected to adversarial robustness. We demonstrated that this connection is not specific to any particular architecture or dataset configuration and can be observed in residual MLPs, ResNet18, ViTs, GPTs, and can even be extended to LLMs pretrained on diverse text data.

Are Massive Activations Useful? The existing literature offers no concrete explanations for the role of massive activations in deep learning and whether they are useful or undesirable. Sun et al. [45] showed that they act as fixed biases in the model and their removal results in significant performance degradation. Massive activations also induce attention sinks (Xiao et al., 2024), which have been argued to prevent over-mixing in the attention operation [9]. On the other hand, Xiao et al. (2023); Dettmers et al. [18] show that large magnitude activations make quantising neural networks more challenging. Our work adds a new perspective to this discussion, suggesting that massive activations act as a mechanism to simplify the local input-output mapping of neural networks, as quantified by the LC progress measure, which empirically accompanies increased robustness.

Delayed Robustness in LLMs. We found that delayed robustness occurs in LLM pretraining, with the rise of massive activations. This finding shows that delayed robustness holds beyond the standard training settings, where it was originally discovered [27], expanding its applicability to large-scale deep learning.

Massive Activations in LLMs. In § 4 we showed that massive activations emerging in the Pythia suite induce region migration. Our framework suggests that per-token massive activations are associated with robust next token prediction, illustrated in Pythia family. However, we highlight that Sun et al. [45] found that not all model families have a per-token massive activation structure (i.e. LLaMA2 (Touvron et al., 2023)). We believe that follow-up research could investigate if these LLM families experience delayed robustness and their vulnerability to adversarial attacks. Additionally, we believe an interesting direction of future study is to develop pretraining prescriptions that better exploit delayed robustness and improve adversarial robustness.

Limitations

While this work sheds new light on the role of massive activations and why they are useful in deep learning, we identify the following limitations. It is not clear what drives the emergence of massive activations in the training and why deep networks construct a small number of exceptionally large activations, rather than distributing it across many moderately large activations. The theoretical setup analysing the connection between massive activations and region migration is based on a fully connected neural network with residual connections and does not cover operations like attention and normalization layers, which are commonplace in deep learning.

Conclusion

In this paper, we showed why massive activations [45] are useful in deep learning, via connecting them to delayed robustness [27]. Under the spline theoretic view of neural networks, we showed that massive activations reduce the network’s LC, by displacing representations away from the network’s nonlinearity boundaries, inducing region migration, which coincides with emergent robustness. We supported this claim through extensive experimental evidence and derived theoretical arguments that guarantee the simplification of the input space partitioning around data points if the activations in the representations are sufficiently large. We further showed that our findings are also relevant in the context of LLMs, by uncovering that the emergence of massive activations in LLMs closely tracks region migration and robustness to perturbations of the input token embeddings.

Review of Spline Theory of Deep Networks

This section provides the preliminaries of the Spline Theory of Deep Networks [7, 3], which builds a mathematical bridge between neural networks and splines, offering a powerful gateway to analyse their inner workings [6, 4, 27]. Section A.1 introduces splines, with the emphasis on the max affine splines, which will serve as the building blocks to establish the connection to neural networks. Section A.2 presents the precise connection between the composition of max affine spline operators and deep networks and Section A.3 presents the geometric properties of deep networks composed of splines.

Splines

This section presents the terminology and definitions for splines. Specifically, we will discuss affine splines (also called linear or first order splines). The following discussion defines affine splines and max affine splines in the multivariate input-output setting.

Affine Splines

We start by defining multivariate affine spline functions.

Definition A.1 (Multivariate Affine Spline Functions). Let Ω={ω1,…,ωR}\Omega= \{\omega_1,\ldots,\omega_R\} be a partition of a domain RD\mathbb{R}^{D} and let Φ={ϕ1,…,ϕR}\Phi= \{\phi_1,\ldots,\phi_R\} be mappings from RD\mathbb{R}^{D} to R\mathbb{R} for each partition ωr\omega_r via ϕr(x)=αrTx+βr\phi_r(x) = \alpha_r^{\mathsf{T}}x + \beta_r, where x∈ωrx \in\omega_r and α∈RR×D\alpha\in\mathbb{R}^{R \times D} and β∈RR\beta\in\mathbb{R}^{R} are the parameters of the affine mappings. Under this setup an affine spline function is defined by

s[α,β,Ω](x)=∑r=1R(αrTx+βr)1(x∈ωr)(3)s[\alpha,\beta,\Omega](x) = \sum_{r=1}^{R}(\alpha_r^{\mathsf{T}}x+\beta_r)\mathbf{1}(x\in\omega_r) \tag*{(3)}

where 1(x∈ωr)\mathbf{1}(x\in\omega_r) is the indicator function.

When approximating functions with splines, a substantial challenge is the need to jointly optimize for the partitioning of the input space RD\mathbb{R}^{D} and for the affine mapping parameters α\alpha and β\beta [7]. Next section discusses how to resolve the issue of joint optimization, by enforcing convexity on the affine spline functions.

Max Affine Splines

A simplification of the joint optimization arises when affine spline functions are constrained to be convex, in which case the function can always be written as max affine spline [7, 22, 38].

Definition A.2 (Max affine spline functions). Let α∈RR×D\alpha\in\mathbb{R}^{R \times D} be a matrix of hyperplane ”slopes” and β∈RR\beta\in\mathbb{R}^{R} be a vector of ”offsets”, then a max affine spline function is defined as

sα,β,Ω(x)=max⁡r=1,…,RαrTx+βr(4)s_{\alpha,\beta,\Omega}(x) = \max_{r=1,\ldots,R} \alpha_r^{\mathsf{T}}x + \beta_r \tag*{(4)}

A useful property of max affine spline functions is that they are completely determined by their affine mapping parameters α\alpha and β\beta, and the selection of the partition Ω\Omega is automatically determined by the choices of α\alpha and β\beta [7]. Hence a max affine spline function can be denoted as sα,βs_{\alpha,\beta}, as Ω\Omega is inferred by α\alpha and β\beta. This provides a resolution for the joint optimization of the partition and the affine mapping parameters discussed in the previous section.

Next we present max affine spline operators (MASOs), which are a natural extension of max affine splines into the multivariate outputs, by concatenating KK independent max affine spline functions.

Definition A.3 (Max Affine Spline Operators). Let A∈RK×R×DA \in\mathbb{R}^{K \times R \times D} and B∈RK×RB \in\mathbb{R}^{K \times R} be the parameters, then max affine spline operator is defined as

SA,B(x)=[max⁡r=1,…,RA1,rTx+B1,r⋮max⁡r=1,…,RAK,rTx+BK,r](5)S_{A,B}(x) = \begin{bmatrix} \max_{r=1,\ldots,R} A_{1,r}^{\mathsf{T}}x + B_{1,r} \\ \vdots\\ \max_{r=1,\ldots,R} A_{K,r}^{\mathsf{T}}x + B_{K,r} \end{bmatrix} \tag*{(5)}

A MASO is always a piecewise affine and convex with respect to each output dimension [3].

Deep Networks as Compositions of MASOs

In this section we state the connection between neural networks and spline theory. The central result in Balestriero et al. [7]; Balestriero & Baraniuk [3] is that a broad range of layers used in neural networks can be represented as MASOs, and hence a deep neural network is a composition of MASOs.

Fully Connected Layers and Activation Functions

Proposition A.4 (Fully Connected/Convolutional Layers). Any fully connected or convolutional layer is an affine mapping and hence a MASO with R=1R = 1.

A fully connected layer with parameters WW and bb is represented by WTx+bW^{\mathsf{T}}x + b, which is a single affine mapping, that is it is equivalent to SW,b(x)S_{W,b}(x) with R=1R = 1. This reasoning naturally extends to the convolutional layer.

Proposition A.5 (Activation Functions). Any piecewise affine and convex activation function (such as ReLU, Leaky ReLU or Absolute Value) is a MASO.

To exemplify the intuition behind this result, consider the ReLU activation ReLU⁡(x)=max⁡{x,0}\operatorname{ReLU}(x) = \max\{x,0\}, that is applied elementwise to xx. The output at kkth position is max⁡{ekTx,0}\max\{e_k^{\mathsf{T}}x,0\}, which is a max affine spline with R=2R = 2, with Ak,1=0A_{k,1} = 0, Ak,2=ekA_{k,2} = e_k and Bk,1=Bk,2=0B_{k,1} = B_{k,2} = 0, where eke_k is the kkth canonical basis vector. The mapping for Leaky ReLU follows the same reasoning, except Ak,1=vekA_{k,1} = v e_k, where vv is the negative slope of the Leaky ReLU activation function. For absolute value Ak,1=−ekA_{k,1} = -e_k and Ak,2=ekA_{k,2} = e_k.

Deep Networks

This section presents the main result of Balestriero & Baraniuk [3] connecting deep networks to splines.

Proposition A.6. A deep network layer constructed from any composition of fully connected or convolutional layers followed by a single activation operator is a MASO.

Proposition A.6 shows that a deep network layer composed of a fully connected or convolutional layer followed by an activation function is a MASO. Subsequently the following theorem establishes that a deep network is a composition of MASOs.

Theorem A.7. A deep neural network composed of fully connected/convolutional layers, activation functions (defined according to A.5) is a composition of MASOs.

We note that while a layer of a network is a MASO, as illustrated by Propositions A.4, A.5 and A.6, a deep network, that is, a composition of MASOs, is not a MASO in general and this is what introduces the non-convexity and the expressive power of neural networks [7, 3]. We do not provide the proofs for these theoretical results in this project for brevity and refer the reader to Balestriero & Baraniuk [3] for the detailed derivations.

General Activation Functions. While the central building block in the Spline Theory is the MASO, which covers activation functions like ReLU, LeakyReLU and the absolute value, it does not naturally extend to smooth activation functions like sigmoid. However, since any continuous function can be approximated with arbitrary precision via affine splines, the spline theoretic view of deep networks would approximately hold [7].

Extension to General Neural Networks. In addition to the discussed connection between splines and neural networks, Balestriero & Baraniuk [3] shows that various operations that are commonplace in deep learning, such as residual connections and pooling layers, can also be expressed as splines. On top of that Balestriero & Baraniuk [3] presents the detailed derivations for the neural network to spline mapping for convolutional neural networks (CNNs) [35], ResNets [24], and recurrent neural networks (RNNs) [21], illustrating that spline theory perspective is applicable in a wide range of architectures.

Input Space Geometry

A direct consequence of the max affine spline structure of deep networks is its specific geometric structure. As discussed in previous sections, each MASO layer partitions its input space and applies a region dependent affine mapping on it. Balestriero et al. [5] provides a comprehensive analysis about the geometry of the partition, revealing that it has a polytopal structure.

Theorem A.8. Let ff be a MASO layer, then it partitions its input space into a finite collection of convex polytopes.

Theorem A.8 shows that a MASO layer or a network layer divides its input space into convex polytopal regions. A composition of LL MASO layers produces an increasingly subdivided partition of the input space, where each next layers further divides the partition induced by the previous layers [7]. Next we provide the result about the geometry of the input space partitioning of a deep network.

Theorem A.9 (Deep Network Input Space Partitioning). Let f=f(L)∘⋯∘f(1)f = f^{(L)} \circ\cdots\circ f^{(1)} be a composition of LL MASO layers, then the input space partitioning consists of finite convex polytopes given by {ωr}r\{\omega_r\}_r and moreover on each cell ωr\omega_r the deep network is an affine mapping

f(x)=∑r=1R(AωrTx+Bωr)1(x∈ωr)(6)f(x) = \sum_{r=1}^{R}(A_{\omega_r}^{\mathsf{T}}x + B_{\omega_r})1(x \in\omega_r) \tag*{(6)}

Theorem A.9 states that an affine spline network partitions its input space into a finite number of convex polytopal regions, where within each polytopal region, the network is an affine map. That is let xx be in a partition ωx\omega_{x}, then the network input-output map reduces to

f(x)=AωxTx+Bωx(7)f(x) = A_{\omega_x}^{\mathsf{T}}x + B_{\omega_x} \tag*{(7)}

where AωxA_{\omega_x} and BωxB_{\omega_x} are the affine mapping parameters for partition ωx\omega_x. Figure 8 provides a visualization of the input space polytopal partitioning on a toy 4 layer ReLU multilayer perceptron. We do not provide the proofs of Theorems A.9 and A.7, as they have extensive derivations and refer the reader to Balestriero & Baraniuk [3] for the details.

Output of a SplineCam visualization

Figure 8. Output of a SplineCam visualization. The input space partitioning on a 2D slice of the input space from a 4 layer ReLU MLP. On each region the network is an affine mapping. Colors are randomly selected.

SplineCam

The spline theoretic framing of deep networks provides insights into the geometry of the input space partition, however computing and visualizing these partitions is not trivial. SplineCam (Humayun et al. [26]) was introduced to solve this problem, which is an exact and sampling free method for computing the geometry of deep network input space partitioning.

SplineCam is applicable for any affine spline network (as defined in Section A.2). Since the neural network input space is high dimensional and cannot be easily visualized, Humayun et al. [26] propose to visualize the partition on a two dimensional slice of the input space. The output of a SplineCam visualization is a 2D image, where each contiguous line represents a neuron hyperplane boundary and each region enclosed by the lines is a partition region where the network input-output map is an affine transformation. An example of a SplineCam visualization of a 4 layer ReLU MLP is provided in Figure 8.

Region Migration Guarantees

Section 3 provided a mechanistic description with extensive experimental support of how massive activations emerge, propagate in the network and cause region migration. In this section we develop a theoretical understanding of region migration induced by massive activations to further support our empirical claims. In particular, we show that, large enough massive activations in the input representations of the network layer guarantee low LC.

Setup and Assumptions

The aim of our analysis is to study the behaviour of the region migration in deep networks under massive activations. We study a fully connected neural network with residual connections with ReLU activation function (which is consistent with the definition in Proposition A.5) for ease of analysis. Specifically, we consider the following network

x(ℓ)=ReLU⁡(W(ℓ)⊤x(ℓ−1)+b(ℓ))+x(ℓ−1),ℓ=1,…,L(8)\mathbf{x}^{(\ell)} = \operatorname{ReLU}\left(\mathbf{W}^{(\ell)\top}\mathbf{x}^{(\ell-1)} + \mathbf{b}^{(\ell)}\right) + \mathbf{x}^{(\ell-1)}, \quad\ell= 1,\ldots,L \tag*{(8)}

where W(ℓ)=[w1(ℓ),…,wD(ℓ)(ℓ)]\mathbf{W}^{(\ell)} = [\mathbf{w}_1^{(\ell)},\ldots,\mathbf{w}_{D^{(\ell)}}^{(\ell)}] and D(ℓ)D^{(\ell)} is the width of layer ℓ\ell.

Quantifying Region Migration

To measure region migration and LC, we quantify the distance of the representations from the network’s nonlinearities. For a ReLU activation function, the nonlinearity occurs at the point where the pre-activations cross zero. In particular for a neuron ii in a layer ℓ\ell the nonlinearity occurs when wi(ℓ)⊤x(ℓ−1)+bi(ℓ)=0\mathbf{w}_i^{(\ell)\top}\mathbf{x}^{(\ell-1)} + b_i^{(\ell)} = 0, hence we define the neuron hyperplane

Hi(ℓ)={z:wi(ℓ)⊤z+bi(ℓ)=0}(9)\mathcal{H}_i^{(\ell)} = \left\{\mathbf{z} : \mathbf{w}_i^{(\ell)\top}\mathbf{z} + b_i^{(\ell)} = 0\right\} \tag*{(9)}

As we are interested in computing distances of the representations from such hyperplanes to assess how close the representation is from changing the pre-activation sign and falling into another affine mapping, Remark B.1 highlights the formula of the distance of a point from a hyperplane.

Remark B.1. Let w⊤x+b=0w^{\top}x+b=0, be a hyperplane, then the distance of a point x0x_0 from the hyperplane is given by

∣w⊤x0+b∣∥w∥.\frac{\left|w^{\top}x_0+b\right|}{\lVert w\rVert}.

Hence, the distance of a representation x(ℓ)x^{(\ell)} at layer ℓ\ell from the nonlinearity boundary Hi(ℓ)\mathcal{H}^{(\ell)}_i for neuron ii is given by

dist⁡(x(ℓ−1),Hi(ℓ))=∣wi(ℓ)⊤x(ℓ−1)+bi(ℓ)∣∥wi(ℓ)∥.(10)\operatorname{dist}(x^{(\ell-1)},\mathcal{H}^{(\ell)}_i)=\frac{\left|{w_i^{(\ell)}}^{\top}x^{(\ell-1)}+b_i^{(\ell)}\right|}{\lVert w_i^{(\ell)}\rVert}. \tag*{(10)}

To measure the LC of the whole network we need to quantify distance for all neurons in all layers in the network as the input xx propagates through the network. If the distances for all the nonlinearity boundaries are larger, when the representations are located deep inside the linear regions of the network, resulting in a lower LC, while if the distances are smaller, the representations are at the edge of changing the preactivations and crossing a nonlinearity boundary, resulting in a higher LC.

Bounds for Activation Magnitudes

Building on the discussion from previous sections, this section shows that massive activations if large enough guarantee low LC of the network around the data points. To satisfy this condition, we should be able to show that for any desirable distance δ>0\delta> 0, there exists a massive activation magnitude such that all the distances between the representations and nonlinearity boundaries given in equation (10) are larger than δ>0\delta> 0. Proposition 3.1 provides the derivation for the activation magnitude required to migrate the regions in a single layer and Theorem 3.2 extends the layerwise bound to the full network.

Proposition 3.1. Let 0<η<10 < \eta< 1. Assume that the massive activation at kkth entry dominates the representation

∥x−k(ℓ−1)∥<η∣xk(ℓ−1)∣\lVert x^{(\ell-1)}_{-k}\rVert< \eta\left|x^{(\ell-1)}_k\right|

and assume the neuron hyperplane parameters do not cancel out the dominance of the massive,

∣[wi(ℓ)]k∣>η∥wi,−k(ℓ)∥,i=1,…,D(ℓ).\left|[w_i^{(\ell)}]_k\right| > \eta\lVert w_{i,-k}^{(\ell)}\rVert,\quad i=1,\ldots,D^{(\ell)}.

Then x(ℓ−1)x^{(\ell-1)} is more than δ>0\delta> 0 distance away from every hyperplane in the layer whenever

∣xk(ℓ−1)∣>max⁡i=1,…,D(ℓ)δ∥wi(ℓ)∥+∣bi(ℓ)∣∣[wi(ℓ)]k∣−η∥wi,−k(ℓ)∥.(11)\left|x_k^{(\ell-1)}\right|>\max_{i=1,\ldots,D^{(\ell)}}\frac{\delta\lVert w_i^{(\ell)}\rVert+\left|b_i^{(\ell)}\right|}{\left|[w_i^{(\ell)}]_k\right|-\eta\lVert w_{i,-k}^{(\ell)}\rVert}. \tag*{(11)}

Proof. For any neuron ii in layer ℓ\ell, the reverse triangle and Cauchy–Schwarz inequalities give

dist⁡(x(ℓ−1),Hi(ℓ))=∣wi(ℓ)⊤x(ℓ−1)+bi(ℓ)∣∥wi(ℓ)∥(12)\operatorname{dist}(x^{(\ell-1)},\mathcal{H}^{(\ell)}_i)=\frac{\left|{w_i^{(\ell)}}^{\top}x^{(\ell-1)}+b_i^{(\ell)}\right|}{\lVert w_i^{(\ell)}\rVert} \tag*{(12)}
≥∣[wi(ℓ)]k∣∣xk(ℓ−1)∣−∥wi,−k(ℓ)∥∥x−k(ℓ−1)∥−∣bi(ℓ)∣∥wi(ℓ)∥(13)\geq\frac{\left|[w_i^{(\ell)}]_k\right|\left|x_k^{(\ell-1)}\right|-\lVert w_{i,-k}^{(\ell)}\rVert\lVert x_{-k}^{(\ell-1)}\rVert-\left|b_i^{(\ell)}\right|}{\lVert w_i^{(\ell)}\rVert} \tag*{(13)}
≥∣xk(ℓ−1)∣(∣[wi(ℓ)]k∣−η∥wi,−k(ℓ)∥)−∣bi(ℓ)∣∥wi(ℓ)∥.(14)\geq\frac{\left|x_k^{(\ell-1)}\right|\left(\left|[w_i^{(\ell)}]_k\right|-\eta\lVert w_{i,-k}^{(\ell)}\rVert\right)-\left|b_i^{(\ell)}\right|}{\lVert w_i^{(\ell)}\rVert}. \tag*{(14)}

Hence this lower bound exceeds δ\delta whenever

∣xk(ℓ−1)∣>δ∥wi(ℓ)∥+∣bi(ℓ)∣∣[wi(ℓ)]k∣−η∥wi,−k(ℓ)∥.(15)\left|x_k^{(\ell-1)}\right|>\frac{\delta\lVert w_i^{(\ell)}\rVert+\left|b_i^{(\ell)}\right|}{\left|[w_i^{(\ell)}]_k\right|-\eta\lVert w_{i,-k}^{(\ell)}\rVert}. \tag*{(15)}

Taking the maximum over all neurons ii concludes the proof.

Theorem 3.2. Let α=max⁡ℓ=1,…,L∥W(ℓ)∥\alpha= \max_{\ell=1,\ldots,L} \lVert W^{(\ell)}\rVert and 0<η<10 < \eta< 1. Assume that the massive activation at entry kk dominates the representation at every layer

∥x−k(ℓ−1)∥<η∣xk(ℓ−1)∣,ℓ=1,…,L\lVert x_{-k}^{(\ell-1)}\rVert< \eta|x_k^{(\ell-1)}|,\qquad\ell=1,\ldots,L

and every neuron hyperplane parameters do not cancel out the dominance of the massive,

∣[wi(ℓ)]k∣>η∥wi,−k(ℓ)∥,ℓ=1,…,L,i=1,…,D(ℓ).|[w_i^{(\ell)}]_k| > \eta\lVert w_{i,-k}^{(\ell)}\rVert,\qquad\ell=1,\ldots,L,\quad i=1,\ldots,D^{(\ell)}.

Then the propagated ball of radius δ>0\delta> 0 centered at x(0)x^{(0)} does not intersect any neuron hyperplane whenever

xk(0)>max⁡ℓ,i(1+α)ℓ−1δ∥wi(ℓ)∥+∣bi(ℓ)∣∣[wi(ℓ)]k∣−η∥wi,−k(ℓ)∥.x_k^{(0)} > \max_{\ell,i}\frac{(1+\alpha)^{\ell-1}\delta\lVert w_i^{(\ell)}\rVert+ |b_i^{(\ell)}|}{|[w_i^{(\ell)}]_k|-\eta\lVert w_{i,-k}^{(\ell)}\rVert}.

Proof. Consider any point x~(0)\widetilde{x}^{(0)} satisfying

∥x~(0)−x(0)∥≤δ,(16)\lVert\widetilde{x}^{(0)}-x^{(0)}\rVert\le\delta, \tag*{(16)}

and propagate it through the same network. Since ReLU is 1-Lipschitz, every residual layer satisfies

∥x~(ℓ)−x(ℓ)∥≤∥x~(ℓ−1)−x(ℓ−1)∥+∥W(ℓ)T(x~(ℓ−1)−x(ℓ−1))∥(17)\lVert\widetilde{x}^{(\ell)}-x^{(\ell)}\rVert\le\lVert\widetilde{x}^{(\ell-1)}-x^{(\ell-1)}\rVert+ \lVert W^{(\ell)\mathsf{T}}(\widetilde{x}^{(\ell-1)}-x^{(\ell-1)})\rVert \tag*{(17)}
≤(1+α)∥x~(ℓ−1)−x(ℓ−1)∥.(18)\le(1+\alpha)\lVert\widetilde{x}^{(\ell-1)}-x^{(\ell-1)}\rVert. \tag*{(18)}

Applying this recursively gives

∥x~(ℓ−1)−x(ℓ−1)∥≤(1+α)ℓ−1δ.(19)\lVert\widetilde{x}^{(\ell-1)}-x^{(\ell-1)}\rVert\le(1+\alpha)^{\ell-1}\delta. \tag*{(19)}

Since the massive activation also persists through the residual stream and ReLU is nonnegative

xk(ℓ)≥xk(ℓ−1).(20)x_k^{(\ell)} \ge x_k^{(\ell-1)}. \tag*{(20)}

Hence xk(ℓ−1)≥xk(0)x_k^{(\ell-1)} \ge x_k^{(0)} at every layer.

The lower bound on xk(0)x_k^{(0)} and Proposition 3.1, applied with distance (1+α)ℓ−1δ(1+\alpha)^{\ell-1}\delta give

dist⁡(x(ℓ−1),Hi(ℓ))>(1+α)ℓ−1δ(21)\operatorname{dist}\left(x^{(\ell-1)},\mathcal{H}_i^{(\ell)}\right) > (1+\alpha)^{\ell-1}\delta \tag*{(21)}

for every neuron ii in every layer ℓ\ell. Since every propagated point x~(ℓ−1)\widetilde{x}^{(\ell-1)} lies within (1+α)ℓ−1δ(1+\alpha)^{\ell-1}\delta distance of x(ℓ−1)x^{(\ell-1)} it does not belong to Hi(ℓ)\mathcal{H}_i^{(\ell)} and because the initial point x~(0)\widetilde{x}^{(0)} was chosen arbitrarily, the propagated ball intersects no neuron hyperplane in the network. ∎

These results show that, with sufficiently large activations, the layer representations lie at least distance δ\delta away from the neuron hyperplanes. This provides a sufficient condition for low LC. We note that the theoretical argument claims if the massive activation emerges at layer ℓ\ell then that the local geometry is simplified for the subsequent layers of the network. As discussed in § 3, in practice massive activations typically emerge in the first layer, so it is applied to layers and the subnetwork onwards from that point.

Experimental Details {#sec:C}

Training Details {#sec:C.1}

The following sections provide information about the optimizer and its parameters, loss functions, the setting and parameters used for measuring adversarial robustness and LC. We use the PyTorch deep learning library (Paszke et al., [40]) for all the experiments in this project.

Architectures. We utilize ResNet18 architecture without Batch Normalization (Ioffe & Szegedy, [28]), as it undoes delayed robustness (Humayun et al., [27]), a pre-norm (Xiong et al., 2020; Radford et al., [43]) Vision Transformers (Darcet et al., [16]) and pre-norm GPT based on the nanoGPT architecture (Karpathy, [31]). Unlike Batch Normalization we keep the Layer Normalization (Ba et al., [2]) operations in the transformer architectures including in the Pythia family and observe that it does not prevent delayed robustness.

Optimizer and Weight Decay. Following Humayun et al. [27], we use the Adam optimizer ([32]) across all the experiments. Liu et al. [36] claim that the delayed generalization or grokking in the network can be accelerated with weight decay, however Humayun et al. [27] found that in delayed robustness weight decay has the opposite effect and postpones the LC double descent phenomenon. Hence, we choose weight decay consistent with Humayun et al. [27] and unless specified otherwise use a weight decay of zero for all the experiments, except for the MLP architecture, where the weight decay is set to 0.01. We use a learning rate of 0.001 for MLPs, ResNets and GPTs and 3×10−43 \times10^{-4} for ViTs. For MLPs and ResNets we use a batch size of 256 and for ViTs and GPTs 64 across all the experiments.

Loss Functions. Following the experimental setup in Humayun et al. [27], we use the mean squared error loss function for training our residual MLPs and the cross-entropy loss function for ResNets, ViTs and GPTs. No label smoothing is used for any of the experiments.

Metrics

Adversarial Accuracy. We quantify adversarial accuracy with AutoAttack ([15]), which is a union of APGD-CE and APGD-DLR ([15]), FAB ([14]) and Square ([1]) attacks. Unlike Humayun et al. [27] that uses only a PGD attack, our stronger attack scheme validates that the adversarial gains persist and are not caused by phenomenon like gradient masking ([11]). Adversarial accuracy is defined as the fraction of the data points for which the network maintains its correct prediction under AutoAttack. Unless specified otherwise we use T=10T = 10 steps and 5 restarts for APGD-CE, APGD-DLR and FAB and 2000 queries for Square attack. Square attack is only applied to image tasks. For MLP, ResNet18 and ViT the adversarial attack is run on the input images and for GPT and Pythia the adversarial accuracy is measured on the next token prediction task and perturbations are applied on the input token embeddings.

Local Complexity. Following the LC metric hyperparameter choices in Humayun et al. [27] the cross-polytopal frame VxV_x is constructed with P=12P = 12 orthonormal vectors and radius r=0.005r = 0.005 for MLPs, r=0.001r = 0.001 for ResNets and r=0.005r = 0.005 for ViTs, GPTs and Pythia across all the experiments. The LC is computed by counting the number of intersections of the embedded frame with the nonlinearity boundaries.

Massive Activations Magnitudes. We track the sum of the top-3 activations in the residual stream across all the layers for all architectures. For ViTs we track the massive activations on the CLS token only, while for GPT and Pythia the activations are tracked in all token representations and the averaged value is reported.

Additional Experiments

Massive Activations and Delayed Robustness

We provide additional experiments on the emergence of massive activations and delayed robustness in ResNet18 on CIFAR10, ViT Tiny on CIFAR10 and ViT Small on Imagenette illustrated in Figure 9.

Massive Activation Patterns

Different classes exhibit different massive activation patterns, while samples from the same class have activations in the same positions as depicted in Figure 10. This indicates that the network sends different classes into separate parts of the space, that are free of nonlinearities. As a result, the nonlinearity boundaries accumulate in the part of the space, which separates the different classes, consistent with the migration towards decision boundary observation in Humayun et al. [27] as illustrated in Figure 1 (right).

Activation patterns for different classes and examples

Figure 10. The activations have different patterns for different classes and activate on the same positions for samples within the same class. This figure represents the activation patterns prior to entering the last layer for the 4 layer residual MLP with width 200 trained on MNIST. Left figure shows that the activation patterns are different from three distinct classes in MNIST. Middle-left, middle-right and right figures show the activation patterns of seven examples from the first, second and third classes outlined on the left plot respectively, showing that the indices where the large activations appear are consistent.

Suppressing Massive Activations

This section supplements § 3.3, providing more examples of the input space geometry when suppressing the dominant activations. Figure 14 shows the SplineCam visualizations of an MLP on MNIST for different classes, as the dominant activations are manually suppressed. We consistently observe that reducing these activations magnitudes pushes the input representations back to the regions where nonlinearity boundaries are densely accumulated. Importantly, the consequences get more severe with more suppression of the dominant activations as exemplified in Figure 14.

SplineCam visualization of the input space partitioning of the last layer

Figure 14. SplineCam visualization of the input space partitioning of the last layer of a depth 4 and 200 width residual MLP trained on MNIST as the dominant activations in the input are suppressed from left to right. Left represents the partitioning without any input modifications, serving as a reference, right with the dominant activation set to zero, middle left and middle right with the dominant activation set to 66% and 33% of its original value respectively.

Massive Activations in Non-Residual MLPs

This section studies the massive activation dynamics in MLP without residual connections. We use 8 layer and 200 width MLP and train it on MNIST and track the accuracy, adversarial accuracy, LC and activation magnitudes according to the methodology described in Appendix C. Figure 11 shows the result of the experiment, where massive activations emerge in the first layer however they slowly fade away in the following layers, confirming that residual stream is the primary enabler for the propagation of massive activations through the network.

Activations by layer over training steps

Figure 11. MLP without residual connections on MNIST. Massive activations emerge in the first layer, but gradually fade away with each layer unlike in residual MLP, where they are propagated through the layers via the residual stream.

Massive Activations in Qwen 2.5 and Gemma 3

Figure 12 and Figure 13 show the massive activations in the hidden representations of Qwen 2.5 and Gemma 3 model families across different sizes and similar to the Pythia suite they reside in each token representation. Additionally we observe that the activation magnitudes increase with the size of the model for each model family, which matches the trend in the Pythia suite, presented in Figure 7.

Massive activations in Qwen 2.5 family of pretrained models across different sizes

Figure 12. Massive activations in Qwen 2.5 family of pretrained models across different sizes.

Massive activations in Gemma 3 family of pretrained models across different sizes

Figure 13. Massive activations in Gemma 3 family of pretrained models across different sizes.

Massive Activation Magnitudes

We highlight that massive activation magnitudes differ in different architectures. Figure 5 shows that they are much larger in ResNet18 (≈15\approx15k) compared to ViT Small (≈2\approx2k) and GPT (≈6\approx6k). Additionally, we notice this trend in the Pythia, Qwen 2.5 and Gemma 3 LLMs as depicted in Figure 7, Figure 12 and Figure 13, where the magnitudes of the largest activations increase with the scale of the model. We conjecture that these magnitudes have a dependence on the architectural configurations of the network, such as the width and depth. We believe that these questions can be explored in future works with more extensive empirical and theoretical developments.

References

  1. [1]Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion, and Matthias Hein. Square attack: a query-efficient black-box adversarial attack via random search. In European conference on computer vision, pp. 484–501. Springer, 2020.arxiv.org/abs/1912.00049
  2. [2]Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.arxiv.org/abs/1607.06450
  3. [3]Randall Balestriero and Richard G Baraniuk. Mad max: Affine spline insights into deep learning. Proceedings of the IEEE, 109(5):704–727, 2020.arxiv.org/abs/1805.06576
  4. [4]Randall Balestriero and Richard G Baraniuk. Batch normalization explained. arXiv preprint arXiv:2209.14778, 2022.arxiv.org/abs/2209.14778
  5. [5]Randall Balestriero, Romain Cosentino, Behnaam Aazhang, and Richard Baraniuk. The geometry of deep networks: Power diagram subdivision. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper_files/paper/2019/file/0801b20e08c3242125d512808cd74302-Paper.pdf.arxiv.org/abs/1905.08443
  6. [6]Randall Balestriero, Ahmed Imtiaz Humayun, and Richard G Baraniuk. On the geometry of deep learning. Notices of the American Mathematical Society, 72(4), 2025.
  7. [7]Randall Balestriero et al. A spline theory of deep learning. In international conference on machine learning, pp. 374–383. PMLR, 2018.
  8. [8]Boaz Barak, Benjamin L. Edelman, Surbhi Goel, Sham M. Kakade, eran malach, and Cyril Zhang. Hidden progress in deep learning: SGD learns parities near the computational limit. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=8XWP2ewX-im.arxiv.org/abs/2207.08799
  9. [9]Federico Barbero, Alvaro Arroyo, Xiangming Gu, Christos Perivolaropoulos, Petar Velicković, Razvan Pascanu, and Michael M. Bronstein. Why do LLMs attend to the first token? In Second Conference on Language Modeling, 2025. URL https://openreview.net/forum?id=tu4dFUsW5z.arxiv.org/abs/2504.02732
  10. [10]Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Af lah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, pp. 2397–2430. PMLR, 2023.arxiv.org/abs/2304.01373
  11. [11]Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. arXiv preprint arXiv:1902.06705, 2019.arxiv.org/abs/1902.06705
  12. [12]Yung-Chin Chen, Chung Peng Lee, Ze-Wei Liou, and Naveen Verma. Massive spikes in llms are bias vectors: Mechanistic uncovering and spike-free quantization. arXiv preprint arXiv:2606.02288, 2026.arxiv.org/abs/2606.02288
  13. [13]Jonathan Crabbé, Pau Rodriguez, Vaishaal Shankar, Luca Zappella, and Arno Blaas. Interpreting CLIP: Insights on the robustness to imagenet distribution shifts. Transactions on Machine Learning Research, 2024. ISSN 2835-8856. URL https://openreview.net/forum?id=1SCptTFtmV.arxiv.org/abs/2310.13040
  14. [14]Francesco Croce and Matthias Hein. Minimally distorted adversarial examples with a fast adaptive boundary attack. In International conference on machine learning, pp. 2196–2205. PMLR, 2020a.
  15. [15]Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International conference on machine learning, pp. 2206–2216. PMLR, 2020b.arxiv.org/abs/2003.01690
  16. [16]Timothée Darcet, Maxime Oquab, Julien Mairal, and Piotr Bojanowski. Vision transformers need registers. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=2dnO3LLiU1.arxiv.org/abs/2309.16588
  17. [17]Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 248–255, 2009. doi: 10.1109/CVPR.2009.5206848.DOI
  18. [18]Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. GPT3.int8(): 8-bit matrix multiplication for transformers at scale. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=dXiGWqBoxaD.
  19. [19]Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mustafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=YicbFdNTTy.
  20. [20]Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1412.6572.
  21. [21]Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.arxiv.org/abs/1308.0850
  22. [22]Lauren A Hannah and David B Dunson. Multivariate convex regression with adaptive partitioning. The Journal of Machine Learning Research, 14(1):3261–3294, 2013.
  23. [23]Bobby He, Lorenzo Noci, Daniele Paliotta, Imanol Schlag, and Thomas Hofmann. Understanding and minimising outlier features in transformer training. Advances in Neural Information Processing Systems, 37:83786–83846, 2024.DOI
  24. [24]Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.arxiv.org/abs/1512.03385
  25. [25]Jeremy Howard. Imagenette. https://github.com/fastai/imagenette, 2019.
  26. [26]Ahmed Imtiaz Humayun, Randall Balestriero, Guha Balakrishnan, and Richard G. Baraniuk. Splinecam: Exact visualization and characterization of deep network geometry and decision boundaries. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3789–3798, June 2023.arxiv.org/abs/2302.12828
  27. [27]Ahmed Imtiaz Humayun, Randall Balestriero, and Richard Baraniuk. Deep networks always grok and here is why. In High-dimensional Learning Dynamics 2024: The Emergence of Structure and Reasoning, 2024. URL https://openreview.net/forum?id=NpufNsg1FP.arxiv.org/abs/2402.15555
  28. [28]Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pp. 448–456. PMLR, 2015.
  29. [29]Aishwarya Kamath, Johan Ferret, Shreya Pathak, Nino Vieillard, Ramona Merhej, Sarah Perrin, Tatiana Matejovicova, Alexandre Ramé, Morgane Riviere, et al. Gemma 3 technical report. ArXiv, 2025. URL https://arxiv.org/abs/2503.19786.
  30. [30]Andrej Karpathy. char-rnn. https://github.com/karpathy/char-rnn, 2015.
  31. [31]Andrej Karpathy. NanoGPT. https://github.com/karpathy/nanoGPT, 2022.
  32. [32]Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. URL https://arxiv.org/abs/1412.6980.
  33. [33]Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
  34. [34]Tanishq Kumar, Blake Bordelon, Samuel J. Gershman, and Cengiz Pehlevan. Grokking as the transition from lazy to rich training dynamics. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=vt5mnLVI0.arxiv.org/abs/2310.06110
  35. [35]Yann LeCun. The mnist database of handwritten digits. http://yann.lecun.com/exdb/mnist/, 1998.
  36. [36]Ziming Liu, Eric J Michaud, and Max Tegmark. Omnigrok: Grokking beyond algorithmic data. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=zDiHoIWaOq1.arxiv.org/abs/2210.01117
  37. [37]Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJzIBFZAb.arxiv.org/abs/1706.06083
  38. [38]Alessandro Magnani and Stephen P Boyd. Convex piecewise-linear fitting. Optimization and Engineering, 10(1):1–17, 2009.DOI
  39. [39]Neel Nanda, Lawrence Chan, Tom Lieberum, Jess Smith, and Jacob Steinhardt. Progress measures for grokking via mechanistic interpretability. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=9XFsbDPmdW.arxiv.org/abs/2301.05217
  40. [40]Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library.pdf.arxiv.org/abs/1912.01703
  41. [41]Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin, and Vedant Misra. Grokking: Generalization beyond overfitting on small algorithmic datasets. arXiv preprint arXiv:2201.02177, 2022.arxiv.org/abs/2201.02177
  42. [42]Enrique Queipo-de-Llano, Alvaro Arroyo, Federico Barbero, Xiaowen Dong, Michael M. Bronstein, Yann LeCun, and Ravid Shwartz-Ziv. Attention sinks and compression valleys in LLMs are two sides of the same coin. In The Fourteenth International Conference on Learning Representations, 2026. URL https://openreview.net/forum?id=c5TFhCJ6fs.
  43. [43]Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
  44. [44]Zeru Shi, Zhenting Wang, Fan Yang, Qifan Wang, and Ruixiang Tang. A single layer to explain them all: Understanding massive activations in large language models. arXiv preprint arXiv:2605.08504, 2026.arxiv.org/abs/2605.08504
  45. [45]Mingjie Sun, Xinlei Chen, J Zico Kolter, and Zhuang Liu. Massive activations in large language models. In First Conference on Language Modeling, 2024. URL https://openreview.net/forum?id=F7aAhfitX6.arxiv.org/abs/2402.17762
  46. [46]Shangwen Sun, Alfredo Canziani, Yann LeCun, and Jiachen Zhu. Anatomy of massive activations and attention sinks. In Forty-third International Conference on Machine Learning, 2026a. URL https://openreview.net/forum?id=VUiMZBfHBe.arxiv.org/abs/2603.05498

Paper details

vlnc:W_dkq22qun
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents