StructLens: A Structural Lens for Language Models via Maximum Spanning Trees
Organizations: Nara Institute of Science and Technology (NAIST)
Abstract
Language exhibits inherent structures, a property that explains both language acquisition and language change. Given this characteristic, we expect language models to manifest their own internal structures as well. While interpretability research has investigated how models compute representations mechanistically through attention patterns and Sparse AutoEncoders, the organization of the resulting representations is overlooked. To address this gap, we introduce StructLens, a framework to analyze representations through a holistic structural view. StructLens constructs maximum spanning trees based on the semantic representations in residual streams, inspired by tree representation in dependency parsing, and provides summaries of token relationships in representation space. We analyze how contiguous tokens are also nearby in representation space and find that middle layers show the strongest local-span organization. Moreover, analysis of pre-training checkpoints reveals that smaller local units become detectable earlier in pre-training, and larger units later. Our findings demonstrate that StructLens provides insights into how models organize token representations across layers and training. Our code is available at https://github.com/naist-nlp/structlens.
Figures & tables
| Metric | Layers removed | ARC-Easy | MMLU | CMMLU | GSM8K | Multinews | VCSUM | Avg. |
| Llama3.1 8B Instruct | ||||||||
| Dense | - | 85.8 | 68.4 | 55.9 | 70.4 | 26.1 | 16.6 | 53.8 |
| CosBase-BI | 24 25 26 27 | 78.3 | 66.8 | 54.4 | 43.0 | 23.1 | 8.7 | 45.7 |
| CKA-BI | 24 25 26 31 | 75.3 † | 66.9 | 54.2 | 5.8 † | 18.2 † | 1.9 † | 37.0 |
| CosStruct-BI | 23 24 25 26 | 79.3 | 67.8 † | 55.1 † | 57.1 † | 25.1 † | 16.2 † | 50.1 |
| TreeEdit-BI | 23 24 26 27 | 78.1 | 66.9 | 55.8 † | 40.9 † | 22.7 | 10.7 † | 45.8 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | k | Llama3.1 8B | Qwen2.5 7B | ||||||
| MMLU | CMMLU | MMLU | CMMLU | ||||||
| ARI | Cond. | ARI | Cond. | ARI | Cond. | ARI | Cond. | ||
| CKA | 2 | ||||||||
| 3 | |||||||||
| 4 | |||||||||
| Cos-Base | 2 | ||||||||
| Subtree |
| Llama3.1 8B |
| (72_,(86_.(414_.(471_ \CJK@punctchar \CJK@uniPunct 0"80"A6(570_ \CJK@punctchar \CJK@uniPunct 0"80"A6(788_ \CJK@punctchar \CJK@uniPunct 0"80"A6(862_ \CJK@punctchar \CJK@uniPunct 0"80"A6))))(505_.)))) |
| Layers: 1, 5, 32 |
| Absence interval: 27 |
| (14_A(36_[A(41_[B(48_[C(54_[D(143_[D(1352_[D)))(131_[C))))) |
| Layers: 1, 2, 3, 4, 5, 6, 7, 8, 29 |
| Llama3.1 8B | Qwen2.5 7B | |||
| Layers | Cond. | Layers | Cond. | |
| Cluster 1 | 0, 1, 2, 3. | .39 | 0, 1, 2, 3, 4, 5, 6, 7. | .64 |
| Cluster 2 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17. | .76 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20. | .47 |
| Cluster 3 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32. | .44 | 21, 22, 23, 24, 25, 26, 27, 28. | .54 |
| Model | Metric | Layers removed | ARC-Easy | MMLU | CMMLU | Avg. |
| Llama-3.1-8B | Dense | - | 84.6 | 65.3 | 52.9 | 67.6 |
| CosBase-BI | 24 25 26 27 | 76.8 | 62.0 | 49.0 | 62.6 | |
| CKA-BI | 24 26 27 31 | 72.4 † | 62.3 | 49.4 | 61.4 | |
| CosStruct-BI | 23 24 25 26 | 77.8 | 64.5 † | 51.2 † | 64.5 | |
| TreeEdit-BI | 23 24 26 27 | 76.8 | 64.6 † | 51.9 † | 64.4 | |
| EdgeEdit-BI | 23 24 25 26 | 77.8 | 64.5 † | 51.2 † | 64.5 |
LLM Interpretability
Large language model (LLM) interpretability studies how internal representations and computations produce outputs, and how they can be explained or controlled.
See all 778 papersUnlocking Structured Pruning for Reasoning Language Models via Attention-Preserving MLP Trimming
Qwen3-14B, LayerTrim achieves 1.24 faster prefill and 19.7% lower peak GPU memory than the dense model, while better preserving reasoning ability. It also achieves the shortest average generation length among evaluated pruned models, while retaining the highest average accuracy. These results demonstrate that LayerTrim improves reasoning efficiency through both structural compression and reduced token generation.