Skip to main content
QUICK REVIEW

[Paper Review] Shortened LLaMA: Depth Pruning for Large Language Models with Comparison of Retraining Methods

Bo-Kyeong Kim, Geonmin Kim|arXiv (Cornell University)|Feb 5, 2024
Natural Language Processing TechniquesComputer Science8 citations
TL;DR

Depth pruning of LLMs via Transformer block removal with LoRA retraining can rival width pruning in zero-shot tasks and yields faster inference under small-batch memory-constrained conditions.

ABSTRACT

Structured pruning of modern large language models (LLMs) has emerged as a way of decreasing their high computational needs. Width pruning reduces the size of projection weight matrices (e.g., by removing attention heads) while maintaining the number of layers. Depth pruning, in contrast, removes entire layers or blocks, while keeping the size of the remaining weights unchanged. Most current research focuses on either width-only or a blend of width and depth pruning, with little comparative analysis between the two units (width vs. depth) concerning their impact on LLM inference efficiency. In this work, we show that simple depth pruning can effectively compress LLMs while achieving comparable or superior performance to recent width pruning studies. Our pruning method boosts inference speeds, especially under memory-constrained conditions that require limited batch sizes for running LLMs, where width pruning is ineffective. In retraining pruned models for quality recovery, continued pretraining on a large corpus markedly outperforms LoRA-based tuning, particularly at severe pruning ratios. We hope this work can help build compact yet capable LLMs. Code and models can be found at: https://github.com/Nota-NetsPresso/shortened-llm

Motivation & Objective

  • Motivate improving LLM inference efficiency under memory-constrained, small-batch settings.
  • Propose a simple depth-pruning approach that removes entire Transformer blocks while keeping remaining weight shapes fixed.
  • Evaluate depth pruning against width pruning baselines (e.g., Wanda-sp, FLAP, LLM-Pruner) on public LLMs (LLaMA-7B and Vicuna-7B/13B).
  • Demonstrate that depth pruning coupled with LoRA retraining can achieve competitive zero-shot task performance while accelerating generation.

Proposed method

  • Treat Transformer blocks as the pruneable unit to reduce inference latency.
  • Assess block importance using Mag, Taylor, and PPL-based criteria, with Taylor+ and PPL selected for pruning decisions.
  • Perform one-shot pruning to remove the least important blocks and meet a target parameter count (keeping first 4 and last 2 blocks intact).
  • Retrain pruned models efficiently with LoRA (low-rank adaptation) on a calibration dataset, enabling fast recovery of performance.
  • Compare depth pruning to width-pruning baselines in zero-shot tasks and measure latency, throughput, and memory usage under small-batch conditions.

Experimental results

Research questions

  • RQ1Can simple depth pruning of Transformer blocks match or exceed width pruning in zero-shot performance for large language models?
  • RQ2Do depth-pruned models provide actual speedups in autoregressive generation under memory-constrained, small-batch scenarios?
  • RQ3Which block-level importance criteria and pruning granularities yield the best trade-offs between accuracy and efficiency?
  • RQ4Is one-shot depth pruning with LoRA retraining competitive with iterative pruning approaches in practice?

Key findings

  • Depth pruning yields faster generation speeds than the original models under small-batch conditions.
  • Depth pruning achieves zero-shot task performance competitive with width-pruned baselines (Wanda-sp, FLAP, LLM-Pruner) when retrained with LoRA.
  • Taylor+ improves commonsense reasoning accuracy, while PPL improves generation quality.
  • Depth-pruned models reduce GPU memory requirements and can handle larger batch sizes or longer outputs than the unpruned model in hardware-constrained settings.
  • One-shot pruning with LoRA retraining can approach the performance of iterative pruning, enabling efficient deployment.
  • Pruning whole Transformer blocks generally yields better results than pruning individual MHA/FFN modules at larger scales; for smaller models, block pruning remains advantageous.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.