Change Is the Only Constant: Dynamic LLM Slicing based on Layer Redundancy

Razvan-Gabriel Dumitru, Paul Clotan, Vikas Yadav, Darius Peteleaza, Mihai Surdeanu


Abstract
This paper introduces a novel model compression approach through dynamic layer-specific pruning in Large Language Models (LLMs), enhancing the traditional methodology established by SliceGPT. By transitioning from constant to dynamic slicing, our method leverages the newly proposed Layer Redundancy (LR) score, which assesses how much change each layer changes its input by measuring the cosine similarity of the input to the output of the layer. We use this score to prune parts of individual layers based on redundancy in such a way that the average pruned percentage for all layers is a fixed value. We conducted extensive experiments using models like Llama3-8B and Mistral-7B on multiple datasets, evaluating different slicing bases and percentages to determine optimal configurations that balance efficiency and performance. Our findings show that our dynamic slicing approach not only maintains but, in many cases, enhances model performance compared to the baseline established by constant slicing methods. For instance, in several settings, we see performance improvements of up to 5% over the SliceGPT baseline.Additionally, a perplexity decrease by as much as 7% was observed across multiple benchmarks, validating the effectiveness of our method. The code, model weights, and datasets are open-sourced at - https://github.com/RazvanDu/DynamicSlicing
Anthology ID:
2024.findings-emnlp.579
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2024
Month:
November
Year:
2024
Address:
Miami, Florida, USA
Editors:
Yaser Al-Onaizan, Mohit Bansal, Yun-Nung Chen
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
9912–9920
Language:
URL:
https://aclanthology.org/2024.findings-emnlp.579
DOI:
Bibkey:
Cite (ACL):
Razvan-Gabriel Dumitru, Paul Clotan, Vikas Yadav, Darius Peteleaza, and Mihai Surdeanu. 2024. Change Is the Only Constant: Dynamic LLM Slicing based on Layer Redundancy. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 9912–9920, Miami, Florida, USA. Association for Computational Linguistics.
Cite (Informal):
Change Is the Only Constant: Dynamic LLM Slicing based on Layer Redundancy (Dumitru et al., Findings 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.findings-emnlp.579.pdf
Software:
 2024.findings-emnlp.579.software.zip
Data:
 2024.findings-emnlp.579.data.zip