Beyond Adjacent Layers: Graph-Guided Layer Fusion for Compressing Large Language Models
Usama Muhammad ⋅ Summer Y Jung
Abstract
Existing depth-compression methods for large language models (LLMs) score layers individually or group only adjacent or contiguous layers, implicitly assuming that functional redundancy is local. We test this assumption by computing full pairwise Centered Kernel Alignment (CKA) similarity matrices for thirteen LLMs from six architecture families (1.6B--14B parameters). Non-adjacent layers turn out to have 3.6--15.9$\times$ more high-similarity pairs than adjacent ones, a structure that prior similarity-based layer merging has not systematically exploited. We propose Fusion via Community Mining (FCM), which builds the full $L \times L$ similarity graph, uses spectral community detection to find clusters of functionally equivalent layers, keeps the highest-Block-Influence layer in each cluster, and then applies LoRA recovery; a pre-specified rule computed only on calibration data decides whether to use cosine or CKA similarity. At 2$\times$ compression, FCM lowers mean perplexity below ShortGPT on twelve of thirteen models, and the gain is statistically significant on ten under a Welch's $t$-test with Holm--Bonferroni correction (up to 50\% on Qwen3-4B, $p_\text{corr}<0.001$). Two models are ties, and Mistral-7B is the only loss ($+$13.4\%). Against three recent adjacent-pair methods (FlattenGPT, SWM, DeltaLLM) under matched calibration and recovery, FCM gives the best perplexity on ten of thirteen models (mean rank 1.15), and it also outperforms the similarity-based merging method MKA on three anchor models. The gains carry over to downstream tasks. FCM matches or exceeds ShortGPT on 15 of 20 (model, benchmark) cells of a five-benchmark zero-shot reasoning suite (ARC-Easy, ARC-Challenge, HellaSwag, WinoGrande, PIQA), and it also improves MMLU (5-shot), LAMBADA generative perplexity, HumanEval pass@1, and free-form generation quality. The 2$\times$-compressed Qwen2.5-7B has 46\% fewer parameters, 42\% lower peak VRAM, and 84\% higher decode throughput on a single A100. Ablations show that spectral grouping outperforms Fisher contiguous segmentation by 41\% and uniform partitioning by 51\%, and a compression sweep reveals a 2$\times$ crossover beyond which FCM's advantage keeps growing up to 3$\times$ and persists at the 14B scale. Code and an interactive project page are available at https://github.com/Usama1002/fcm-layer-fusion and https://usama1002.github.io/fcm.
Successful Page Load