Revisiting Transformers through the Lens of Low Entropy and Dynamic Sparsity

Ruifeng Ren, Yong LiuarXiv 2025 · OpenReview

Abstract

Compression has been a critical lens to understand the success of Transformers. In the past, we have typically taken the target distribution as a criterion to evaluate a model's compression performance. Nevertheless, it often remains challenging to precisely assess how well the model achieves compression and to compare the information content of the learned distribution with that of the target distribution during compression, as the target distribution is typically unknown and entropy computation often incurs exponential cost. In this work, we explore these issues under a controlled experimental setup. We find that Transformers exhibit a unique inductive bias in data compression: beyond approaching the target distribution, they tend to favor learning lower-entropy distributions, with this tendency becoming more pronounced as the model size increases. This preference prevents Transformers from perfectly aligning with the target distribution, instead further compressing its information content. Furthermore, we show that the FFN module plays a critical role in driving this bias. In addition, while models remove informational redundancy from data during compression, they also exhibit redundancy within their parameters, which enables compression and can be characterized through dynamic sparsity. However, the dynamic sparsity patterns in Transformers, particularly in attention and FFN modules, demand further exploration. As for this, we show that larger Transformers show stronger preferences for bypassing attention computations via residual connections and have lower proportion of active neurons. Interestingly, we also find that training instability in larger models strongly correlates with sudden increases in dead neurons. Our work contributes to a deeper understanding of Transformers from the lens of entropy and dynamic sparsity.

Introduction: The Entropy Gap in Data Compression

Large Language Models (LLMs) are often described as powerful compression engines. Theoretically, a perfect model should match the entropy of its target data distribution. However, in real-world scenarios, the "true" distribution of natural language is unknown, making it nearly impossible to measure exactly how well a Transformer is compressing or if it possesses specific biases in how it represents information.

This research addresses two primary questions:

  1. The Entropy Gap: Do Transformers simply aim for the target distribution, or do they prefer certain types of distributions (e.g., lower entropy)?
  2. The Sparsity Mystery: How does "dynamic sparsity"—the tendency of models to only use a fraction of their parameters for any given input—evolve during training, and how does it relate to training stability?

Experimental Methodology

To bypass the "unknown distribution" problem, the researchers utilized controlled experiments with predefined target distributions ($p_{tgt}$) of known entropy. This allowed for precise measurement of KL divergence and the entropy of the learned model ($p_\theta$).

Experimental setup using a controlled synthetic distribution and a Transformer architecture.

The setup involved several key methodological choices:

  • Architecture Ablations: Variants like "Attention-only" and "FFN-main" were used to isolate which components drive specific behaviors.
  • Dynamic Routing: The attention mechanism was modified to include a routing function, allowing the model to choose between an attention head or a residual shortcut (bypassing the computation).
  • Exhaustive Traversal: Using a small vocabulary ($|V|=5$) and short sequences ($n=5$), the researchers could analyze every possible sequence (3,125 total) to identify "dead neurons" that never activate, regardless of the input.

The Low-Entropy Inductive Bias

A central finding of the study is that Transformers possess an inherent inductive bias to "over-compress" data into lower-entropy, more deterministic states than the original source. Unlike Recurrent Neural Networks (RNNs) such as GRUs and LSTMs, which tend to settle near the target entropy, Transformers actively seek out lower-entropy distributions.

Entropy of different models across varying dimensions (d). Transformers (TF) exhibit a unique bias toward lower-than-target entropy as they scale.

As shown in the figure above, for a target distribution with an entropy of approximately 3.57, larger Transformers ($d=64$) learned distributions with significantly lower entropy, whereas RNNs remained close to the target. This preference becomes more pronounced as model size increases, suggesting that Transformers don't just learn the data; they "over-regularize" it. The Feed-Forward Network (FFN) module was identified as the primary engine behind this low-entropy preference.

Dynamic Sparsity and Training Stability

The study also reveals that larger Transformers are "lazier," showing a stronger preference for bypassing attention computations via residual connections. In larger models, more than half of the attention weights were assigned values close to zero. Furthermore, only about 15% of FFN neurons were active on average for any given input in larger models, compared to over 40% in smaller models.

One of the most striking findings is the correlation between training instability and sparsity. The "loss spikes" commonly observed during LLM training coincide exactly with sudden "jumps" in the number of dead neurons. The model essentially "prunes" itself in bursts. Second-order optimizers like Adam and RMSprop were found to trigger these sudden jumps in neuronal death, while simple SGD with momentum resulted in smoother training and fewer dead neurons.

Conclusion

While this work provides deep insights into the inductive biases of Transformers, it is limited by the scale of the synthetic datasets. Future research will aim to provide a more rigorous theoretical analysis of the proposed "implicit regularization" and explore how these insights can predict and prevent training instability in large-scale, real-world models.

Summary updated

BibTeX
@misc{ren2025revisiting,
  author = {Ruifeng Ren and Yong Liu},
  title = {{Revisiting Transformers through the Lens of Low Entropy and Dynamic Sparsity}},
  year = {2025},
  eprint = {2504.18929},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.18929},
}
Figure