The Lazy Neuron Phenomenon: On Emergence of Activation Sparsity in Transformers

Zonglin Li, Chong You, Srinadh Bhojanapalli, Daliang Li, Ankit Singh Rawat, Sashank J. Reddi, Ke Ye, Felix Chern, Felix Yu, Ruiqi Guo, Sanjiv Kumar

Introduction

Modern Deep Neural Networks (DNNs) are notoriously resource-hungry. While biological brains are incredibly energy-efficient because only a tiny fraction of neurons fire at any given time (sparse activity), artificial neural networks are typically designed for "dense" computation, where every neuron participates in every calculation.

This paper investigates a curious phenomenon: why do Transformers—the backbone of modern AI—perform so well despite this apparent inefficiency? By looking "under the hood" at the Multi-Layer Perceptron (MLP) blocks within Transformers, researchers discovered that the vast majority of neurons are "lazy"—they stay at zero for almost every input. This emergent sparsity, which occurs without any explicit programming or regularization, can be harnessed via a "Top-$k$ Transformer" to significantly reduce computational costs while simultaneously improving model robustness and calibration.

Methodology

The researchers conducted an extensive empirical study across different architectures (T5, ViT, BERT) and modalities (Language and Vision), utilizing industry-standard benchmarks like C4, ImageNet-21k, and ImageNet-C.

  1. Sparsity Measurement: They measured the percentage of non-zero entries in the activation maps after the ReLU function in the first MLP layer of Transformer blocks.
  2. Top-$k$ Transformer: To see if they could force even more efficiency, they introduced a simple modification: replacing the standard activation with a "Top-$k$" threshold. This ensures that only the $k$ largest activations are kept, and the rest are zeroed out during both training and inference.
  3. Theoretical Analysis: They provided a mathematical proof showing that at the start of training, the gradient of common loss functions naturally tends to push positive activations toward zero, explaining why sparsity emerges as a byproduct of the optimization process itself.

Key Insights: The Nature of Lazy Neurons

Sparsity is Emergent Unlike older methods that used specific penalties (like $L_1$ regularization) to force sparsity, Transformers become sparse all on their own. At initialization, about 50% of neurons fire; by the end of training, this drops to as low as 1-3%.

Emergence of sparsity during T5 Encoder training

The "Larger, Sparser" Rule Counter-intuitively, as you scale a model up (more layers, wider hidden dimensions), the percentage of active neurons actually decreases. Bigger models are "lazier" but more efficient in their information processing.

Sparsity across different model architectures and sizes

Not Just Dead Neurons It’s not that 97% of the neurons are useless. Different inputs activate different small subsets of neurons. Across a whole dataset, almost every neuron gets a turn to "fire," but they are highly selective about when they do so.

Results and Implications

  • Extreme Sparsity: In a T5-Base model, the average sparsity across all layers was found to be 2.7%. For ViT-B16, it was 6.3%.
  • Performance Parity: The "Top-$k$ Transformer" can match the accuracy of a vanilla Transformer while being significantly sparser. For example, a ViT with only 256 active neurons (out of 3072) saw only a 0.3% drop in accuracy.
  • Improved Robustness: Enforcing sparsity via Top-$k$ acts as a powerful regularizer. It prevents the model from "overfitting" to noisy training labels because the model lacks the "dense capacity" to memorize random noise. Top-$k$ models were significantly more robust to input corruptions and achieved better calibration.
  • Efficiency Gains: As a proof of concept, the authors demonstrated a 10% wall-time reduction for unbatched decoding on TPUv4 hardware by skipping computations for zeroed-out neurons.

Limitations and Future Directions

The biggest hurdle to fully exploiting the Lazy Neuron phenomenon is hardware. Current AI chips (GPUs and TPUs) are optimized for massive, dense matrix multiplications. "Unstructured" sparsity—where the zeros are scattered randomly—is difficult for current hardware to skip efficiently, meaning the theoretical FLOP reduction (up to 90%+) outpaces actual wall-time speedups.

Future work will likely focus on designing hardware or kernels that can better exploit this unstructured sparsity, exploring "structured" versions of the phenomenon, and investigating if this sparsity can help explain the high generalization capabilities of Transformers.

Summary updated

BibTeX
@inproceedings{li2023lazy,
  author = {Zonglin Li and Chong You and Srinadh Bhojanapalli and Daliang Li and Ankit Singh Rawat and Sashank J. Reddi and Ke Ye and Felix Chern and Felix Yu and Ruiqi Guo and Sanjiv Kumar},
  title = {{The Lazy Neuron Phenomenon: On Emergence of Activation Sparsity in Transformers}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=TJ2nxciYCk-},
}
Figure