Date of Award
Spring 5-28-2026
Document Type
Thesis (Undergraduate)
Department
Computer Science
First Advisor
Peter Chin
Second Advisor
Deeparnab Chakrabarty
Abstract
This thesis utilizes effective rank (erank) to study how attention and MLP sublay-
ers change their residual stream representations in toy transformers. Across the
key-value and modular addition task, we find that the attention/MLP division of
labor is task dependent because the key-value task is heavily attention-sufficient,
while the modular addition transformer heavily relies on both attention and MLP
contributions. During grokking for the modular addition task, late-layer residual
stream representations undergo much more compression than earlier-layer residual
stream representation. This suggests that generalization coincides with late-layer
residual stream compression. Furthermore, we use ablation and freezing experi-
ments to assess component’s significance toward model accuracy and training-time
plasticity. Ablation experiments demonstrate that key-value retrieval has more
localized load-bearing sublayers, while modular addition does not have strong
distinct load-bearing sublayers. Freezing experiments demonstrates that even when
models weights are frozen in layer 0 and cannot compress the residual stream in the
frozen part of the transformer, the model can still grok by moving the compression
to later layers. Together, these results suggest that compressive roles in transformer
residual streams are not fixed to certain sublayers. Instead, compression is task-
dependent and can be redistributed to other sublayers, similar to compensation
mechanism.
Recommended Citation
Kang, Christopher, "Understanding Residual Stream Compression, Expansion, and Complexity Through Erank" (2026). Computer Science Senior Theses. 63.
https://digitalcommons.dartmouth.edu/cs_senior_theses/63
