Skip to main content
QUICK REVIEW

[Paper Review] LLM-Pruner: On the Structural Pruning of Large Language Models

Xinyin Ma, Gongfan Fang|arXiv (Cornell University)|May 19, 2023
Topic ModelingComputer Science73 citations
TL;DR

LLM-Pruner introduces task-agnostic, structure-aware pruning of large language models, achieving substantial compression with minimal data and about 3 hours of post-training using LoRA.

ABSTRACT

Large language models (LLMs) have shown remarkable capabilities in language understanding and generation. However, such impressive capability typically comes with a substantial model size, which presents significant challenges in both the deployment, inference, and training stages. With LLM being a general-purpose task solver, we explore its compression in a task-agnostic manner, which aims to preserve the multi-task solving and language generation ability of the original LLM. One challenge to achieving this is the enormous size of the training corpus of LLM, which makes both data transfer and model post-training over-burdensome. Thus, we tackle the compression of LLMs within the bound of two constraints: being task-agnostic and minimizing the reliance on the original training dataset. Our method, named LLM-Pruner, adopts structural pruning that selectively removes non-critical coupled structures based on gradient information, maximally preserving the majority of the LLM's functionality. To this end, the performance of pruned models can be efficiently recovered through tuning techniques, LoRA, in merely 3 hours, requiring only 50K data. We validate the LLM-Pruner on three LLMs, including LLaMA, Vicuna, and ChatGLM, and demonstrate that the compressed models still exhibit satisfactory capabilities in zero-shot classification and generation. The code is available at: https://github.com/horseee/LLM-Pruner

Motivation & Objective

  • Aim to compress LLMs in a task-agnostic way while preserving multi-task solving and generation abilities.
  • Minimize reliance on the original training corpus during compression.
  • Enable rapid post-training to recover performance after pruning.
  • Automatically identify coupled structural groups to prune without manual design.

Proposed method

  • Build a dependency graph to identify coupled structures in LLMs so they are pruned together.
  • Estimate group-level importance using first- and (approximated) second-order information from a small public dataset or synthetic samples.
  • Prune low-importance groups according to a defined aggregation strategy (e.g., sum, product, max, last-only).
  • Recover/prune efficiently using LoRA-based post-training with limited data (~50k samples) and ~3 hours on a single GPU.
Figure 1 : Illustration of LLM-Pruner. (i) Task-specific compression: the model is fine-tuned then compressed on a specific task. (ii) TinyBERT: First distill the model on unlabeled corpus and then fine-tune it on the specific task. (iii) LLM-Pruner: Task-agnostic compression within 3 hours.
Figure 1 : Illustration of LLM-Pruner. (i) Task-specific compression: the model is fine-tuned then compressed on a specific task. (ii) TinyBERT: First distill the model on unlabeled corpus and then fine-tune it on the specific task. (iii) LLM-Pruner: Task-agnostic compression within 3 hours.

Experimental results

Research questions

  • RQ1Can task-agnostic structural pruning preserve LLM functionality across diverse tasks and generation for LLMs like LLaMA, Vicuna, and ChatGLM?
  • RQ2How does dependency-based pruning compare to non-dependent pruning in terms of zero-shot classification and generation quality?
  • RQ3What is the effectiveness of different group-importance aggregation strategies for pruning decisions?
  • RQ4How much data and time are required to recover pruned LLMs using LoRA post-training?

Key findings

  • Pruning 20% of parameters can retain about 95% of original zero-shot performance after fast LoRA recovery on LLaMA-7B.
  • Pruned LLMs with 5.4B parameters can outperform some smaller base models on several datasets after tuning, while 50% pruning causes notable degradation.
  • Dependency-based pruning is essential; removing dependencies severely harms zero-shot generation and classification even with tuning.
  • Among aggregation strategies, Sum offers a favorable balance between generation quality and classification performance.
Figure 2 : Illustration of the coupled structures in LLaMA. We simplify the neurons in each layer to make the dependent group clear. The trigger neuron, marked as a circle with a bell, cause weights with dependency pruned (dashed lines), which may propagate (red dashed lines) to coupled neurons (das
Figure 2 : Illustration of the coupled structures in LLaMA. We simplify the neurons in each layer to make the dependent group clear. The trigger neuron, marked as a circle with a bell, cause weights with dependency pruned (dashed lines), which may propagate (red dashed lines) to coupled neurons (das

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.