TL;DR
This paper introduces "Entropy-Lens," a novel framework for understanding how Large Language Models (LLMs) make decisions at the token level. By analyzing the entropy of token predictions across model layers, Entropy-Lens reveals distinct "expansion" and "pruning" strategies that are characteristic of different LLM families, tasks, and output formats, offering a new lens into their internal workings.
What Problem Does This Paper Address?
Interpreting the decision-making process within LLMs is a significant challenge. While much research focuses on the internal, high-dimensional latent representations, the dynamics of token-space predictions—how LLMs choose the next word—remain underexplored. This is partly due to the high dimensionality and unordered nature of token distributions, making standard statistical analysis difficult. The authors aim to bridge this gap by providing a low-dimensional, interpretable, and per-layer metric to understand these token-space dynamics.
Methods
The core of Entropy-Lens is the computation of entropy on the probability distributions of next-token predictions. This is achieved by using a "logit-lens" (projecting intermediate activations to the vocabulary space) and then applying a softmax to get probabilities. The entropy of this distribution provides a single scalar value per layer and token. By tracking these entropy values across layers, an "entropy profile" is generated.
Crucially, the authors propose that changes in entropy between consecutive layers ($\Delta H$) can be interpreted as two distinct strategies:
- Expansion: An increase in entropy, indicating the model is considering a wider range of potential next tokens.
- Pruning: A decrease in entropy, suggesting the model is narrowing down its choices to a more specific set of tokens.
This framework is model-agnostic and does not require gradients or fine-tuning.
Datasets
The paper utilizes several datasets for evaluation:
- TinyStories dataset: Used for task-type classification (generative, syntactic, semantic).
- Topic-format dataset: Constructed by pairing topics with specific output formats (poem, scientific piece, chat log) to test format-specific dynamics.
- Massive Multitask Language Understanding (MMLU) benchmark: Used to assess the relationship between entropy profiles and answer correctness.
- ImageNet-1K: Used for preliminary experiments on Vision Transformers (ViTs).
Key Insights and Ideas
- Token-space dynamics are structured: LLMs don't just process information; they actively expand and prune their candidate sets for the next token in predictable ways.
- Family-specific "fingerprints": Different LLM families (e.g., GPT, Llama, Gemma) exhibit unique entropy profiles, suggesting distinct underlying computational structures and decision-making strategies, independent of model size.
- Depth-rescaling invariance: Smaller models within the same family often mirror the entropy dynamics of their larger counterparts, just at a coarser resolution, implying that scaling primarily refines existing strategies rather than introducing entirely new ones.
- Task and format matter: The way an LLM expands and prunes its candidate set is influenced by the specific task (e.g., generative vs. semantic) and the desired output format (e.g., poem vs. scientific text).
- Expansion is often more critical: Disrupting layers associated with maximal entropy increase (expansion) tends to have a more detrimental effect on downstream performance (e.g., accuracy on MMLU) than disrupting pruning layers, highlighting the importance of exploring possibilities.
Key Results
- High classification accuracy: A k-Nearest Neighbors (kNN) classifier can accurately distinguish between different model families, tasks, and output formats based solely on their entropy profiles, achieving ROC-AUC scores often above 95%.
- Family-specific dynamics: Figure 3 shows clear clustering of models by family in a t-SNE projection of entropy profiles. Figure 4 illustrates distinct entropy trajectories for different families (e.g., GPT models sharpening predictions vs. Llama models having extended high-entropy plateaus).
- Task and format distinctiveness: Tables 2 and 3 show high AUC scores for classifying tasks and formats using entropy profiles. Figure 5 further visualizes this distinctiveness through PCA.
- Impact of strategy disruption: In multiple-choice tasks (MMLU), skipping layers associated with maximal entropy increase (expansion) significantly degrades accuracy, often to random chance levels, more so than skipping pruning layers. An exception was noted for Gemma2-2B-it, where pruning was more critical.
Limitations and Future Work
- Mechanistic understanding: While entropy profiles reveal what strategies are used and when, the authors lack a mechanistic understanding of which specific architectural components or training schemes cause these patterns.
- Training stage impact: It's unclear how different training stages (pre-training, fine-tuning, RLHF) alter the relative importance of expansion and pruning for downstream performance.
- Modality extension: The current work focuses on decoder-only Transformers. Extending the framework to other architectures like ViTs (Vision Transformers) and Mixture-of-Experts models is a promising future direction. Preliminary results on ViTs suggest the approach is applicable.
- Memorization connection: The paper outlines a theoretical connection between entropy profiles and memorization, suggesting future work could formalize this link and explore its implications.
Summary updated