NutePrune: Efficient Progressive Pruning with Numerous Teachers for Large Language Models

Shengrui Li, Xueting Han, Jing BaiarXiv 2024 · DOI

TL;DR

NutePrune is a novel structured pruning framework that enables Large Language Models (LLMs) to reach high sparsity levels with minimal performance loss. By using lightweight snapshots of the model itself as a sequence of "intermediate teachers," it bridges the capacity gap between full and pruned models without the massive memory overhead typically required for multi-teacher knowledge distillation.

What Problem Does This Paper Address?

As Large Language Models (LLMs) grow, deploying them on consumer-grade hardware becomes increasingly difficult. Structured pruning—which removes entire components like attention heads or feed-forward network (FFN) dimensions—is a promising solution because it leads to direct hardware speedups. However, it often results in a significant "capacity gap": jumping from a 100% dense model to a 50% sparse model is a "difficult" learning task that often leads to a sharp decline in reasoning and linguistic capabilities.

While Knowledge Distillation (KD)—using a large "teacher" model to guide a smaller "student"—can help, it faces a major bottleneck in the LLM era: memory. Loading a single 7B teacher and a 7B student already pushes the limits of standard GPUs (like an A100 80GB). Loading multiple teachers to provide a progressive learning path (from easy to hard) has traditionally been impossible due to these VRAM constraints.

Conceptual comparison of traditional Knowledge Distillation versus NutePrune's progressive distillation with numerous teachers.

Methods

The authors introduce NutePrune (Numerous-teacher Pruning), which utilizes two key mechanisms to make progressive pruning efficient:

  1. Mask-based Structured Pruning: The model learns three types of masks ($z_{head}, z_{int}, z_{hid}$) to control which attention heads, FFN dimensions, and hidden dimensions to keep. They use $L_0$ regularization to encourage the model to reach a target sparsity.
  2. LoRA-based Parameter Recovery: Instead of updating the massive weight matrices directly, NutePrune integrates LoRA (Low-Rank Adaptation). This allows the model to adapt and recover its capabilities during the pruning process with very few trainable parameters.
  3. The "Numerous Teachers" Strategy: This is the core innovation. Instead of loading separate teacher models, NutePrune takes "snapshots" of the student model at various sparsity levels during the pruning process. Because a snapshot only consists of the tiny LoRA weights and masks (which are highly parameter-efficient), NutePrune can store dozens of these "intermediate teachers" in CPU memory and swap them into the GPU as needed with negligible cost.
Detailed architecture of NutePrune, showing the use of snapshots as teachers and the distillation process across sparsity levels.

The process follows Progressive Knowledge Distillation (PKD) in two stages:

  • Stage 1 (Warm-up): The student is guided by a teacher that is consistently slightly less sparse (e.g., a 10% gap), providing a "stepping stone" for learning.
  • Stage 2 (Recovery): Once the target sparsity is reached, the model undergoes distillation from all previous teachers (from weak to strong) to consolidate knowledge and recover performance.

Datasets

The researchers evaluated NutePrune across a wide array of benchmarks:

  • Pruning/Training Data: 20,000 sentences sampled from the C4 dataset.
  • Post-Pruning Fine-tuning: The Stanford Alpaca dataset.
  • Evaluation (Zero-shot Reasoning): BoolQ, PIQA, HellaSwag, WinoGrande, ARC-easy, ARC-challenge, and OpenBookQA.
  • Evaluation (In-context Learning): MMLU (5-shot) and BBH (3-shot).
  • Language Modeling: WikiText-2 (for perplexity measurements).

Key Insights and Ideas

  • Bridging the Capacity Gap: The most important finding is that "easier" teachers (those closer in sparsity to the student) provide a better supervisory signal than a single, perfect teacher. It prevents the student from being overwhelmed by a target it cannot yet represent.
  • Memory is the Real Constraint: The authors realized that the bottleneck for LLM distillation isn't compute, but VRAM. By treating masks and LoRA modules as the "identity" of a teacher, they decoupled the teacher's knowledge from the base model's weight footprint.
  • Structured Pruning "Sweet Spots": The paper observes that NutePrune tends to preserve the hidden dimensions more aggressively than heads or FFN dimensions, suggesting that the "width" of the model's internal representations is more critical for performance than the number of heads in the later layers.

Key Results

NutePrune consistently outperformed existing structured pruning methods like LLM-Pruner and Compresso:

  • Performance Retention: On LLaMA-7B, NutePrune retained 97.17% of the original model's performance at 20% sparsity and 95.07% at 25% sparsity.
  • Efficiency: NutePrune required only 28.7 GB of GPU memory during pruning, compared to 42.1 GB for standard Knowledge Distillation.
  • Latency: Pruning LLaMA-7B resulted in real-world inference speedups of 11% (at 20% sparsity) and 29% (at 50% sparsity) using the vLLM library.
  • Generalization: The method proved effective across different architectures, including LLaMA-1, LLaMA-2, LLaMA-3, and Mistral-7B.

Limitations and Future Work

  • Post-Training Requirement: While NutePrune is highly efficient, it still benefits significantly from post-pruning fine-tuning on instruction datasets (like Alpaca), which adds a step to the pipeline.
  • Multi-Query Attention (MQA): The authors noted that models using MQA (like LLaMA-3) experience a steeper performance decline during pruning compared to standard Multi-Head Attention models, suggesting that MQA architectures might require even more specialized pruning strategies.
  • Data Scaling: Future work could explore how using more extensive datasets for the pruning phase might further close the gap to the original model's performance.

Summary updated

BibTeX
@misc{li2024nuteprune,
  author = {Shengrui Li and Xueting Han and Jing Bai},
  title = {{NutePrune: Efficient Progressive Pruning with Numerous Teachers for Large Language Models}},
  year = {2024},
  eprint = {2402.09773},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.09773},
}
Figure