Abstract
This paper studies the curious phenomenon for machine learning models with Transformer architectures that their activation maps are sparse. By activation map we refer to the intermediate output of the multi-layer perceptrons (MLPs) after a ReLU activation function, and by sparse we mean that on average very few entries (e.g., 3.0% for T5-Base and 6.3% for ViT-B16) are nonzero for each input to MLP. Moreover, larger Transformers with more layers and wider MLP hidden dimensions are sparser as measured by the percentage of nonzero entries. Through extensive experiments we demonstrate that the emergence of sparsity is a prevalent phenomenon that occurs for both natural language processing and vision tasks, on both training and evaluation data, for Transformers of various configurations, at layers of all depth levels, as well as for other architectures including MLP-mixers and 2-layer MLPs. We show that sparsity also emerges using training datasets with random labels, or with random inputs, or with infinite amount of data, demonstrating that sparsity is not a result of a specific family of datasets. We discuss how sparsity immediately implies a way to significantly reduce the FLOP count and improve efficiency for Transformers. Moreover, we demonstrate perhaps surprisingly that enforcing an even sparser activation via Top-k thresholding with a small value of k brings a collection of desired but missing properties for Transformers, namely less sensitivity to noisy training data, more robustness to input corruptions, and better calibration for their prediction confidence.
Introduction
In biological systems, neural activity is remarkably efficient, with only a small fraction of neurons firing at any given time. In contrast, artificial deep neural networks (DNNs) are traditionally viewed as dense systems where every parameter processes every input. However, recent research reveals that trained Transformers are "parsimonious learners." As these models train, they naturally transition from dense activity to extreme sparsity in their Multi-Layer Perceptron (MLP) layers. This "Lazy Neuron Phenomenon" results in only 3–6% of neurons firing for a typical input in models like T5 and ViT.
The Emergence of Sparsity
The transition from dense to sparse activations is a fundamental characteristic of the training process. At initialization, roughly 50% of neurons fire. As training progresses, the gradient descent optimization naturally pushes activations toward zero to minimize loss. This behavior is consistent across both encoder and decoder architectures.
This emergent sparsity is not merely a byproduct of "natural" data distributions. Experiments using random labels, random pixels, and even infinite data streams show that sparsity persists. This suggests that sparsity is an inherent property of the optimization of over-parameterized models rather than a specific feature of the dataset.
Scaling and Model Parsimony
A counter-intuitive finding of this study is that larger models are actually sparser than smaller ones. As the number of layers or the width of hidden dimensions increases, the percentage of active neurons per input decreases. While the model uses its entire capacity across a full dataset, it becomes highly selective for individual inputs. These are not "dead neurons" that never fire; rather, the model learns to activate specialized, small subsets of neurons for different inputs.
Methods and Experimental Setup
The researchers evaluated sparsity across several major architectures and benchmarks, including T5 for language and ViT for vision. Sparsity was measured as the percentage of non-zero entries in MLP activation maps following the ReLU function. To further explore this phenomenon, the authors introduced the "Top-k" Transformer. By replacing the standard ReLU with a function that only retains the top k highest activations, they could explicitly enforce and study the effects of extreme sparsity throughout training.
Robustness, Calibration, and Efficiency
Enforcing sparsity through Top-k thresholding acts as a powerful regularizer, yielding several benefits:
- Robustness to Noise: Sparse models are less prone to memorizing noisy labels. In tests with 80% corrupted training labels, a Top-128 ViT significantly outperformed the standard dense version (30.8% vs 25.35% accuracy).
- Improved Calibration: Sparse models exhibit lower Expected Calibration Error (ECE), meaning their confidence scores more accurately reflect their actual probability of being correct.
- Computational Efficiency: While current hardware is optimized for dense operations, the authors demonstrated a 10% wall-time reduction for unbatched decoding on TPUv4 as a proof-of-concept for the potential FLOP savings.
Conclusion
The discovery of emergent sparsity in Transformers suggests a path toward more efficient and robust AI. However, realizing the full potential of these "lazy" neurons requires overcoming hardware limitations. Current GPUs and TPUs are designed for dense matrix multiplication and struggle to exploit unstructured sparsity. Future work will likely focus on developing specialized hardware kernels and exploring sparsity in newer architectures like Mixture of Experts (MoE) or state-space models.
Summary updated