Bypass Back-propagation: Optimization-based Structural Pruning for Large Language Models via Policy Gradient

Yuan Gao, Zujing Liu, Weizhong Zhang, Bo Du, Gui-Song Xia · Submission to ICLR 2025 · Rejected

TL;DR

This paper introduces a novel structural pruning framework for Large Language Models (LLMs) that optimizes pruning masks using Policy Gradients instead of traditional back-propagation. By decoupling the pruning parameters from the model's internal weights, the method achieves the high performance of optimization-based pruning while maintaining the low memory overhead of simple forward-pass heuristics.

What Problem Does This Paper Address?

Pruning is essential for deploying massive LLMs on consumer hardware, but researchers typically face a "pick your poison" scenario when choosing an algorithm:

  1. Metric-based pruning: These methods use hand-crafted heuristics (like weight magnitude) to decide what to cut. They are fast and memory-efficient but often suboptimal because they rely on "gut feeling" metrics rather than direct loss optimization. They also struggle with heterogeneous pruning—knowing exactly which layers are more redundant than others.
  2. Optimization-based pruning: These methods learn the best structure by minimizing the model's loss. However, they typically require back-propagation, which is incredibly memory-intensive for LLMs, often leading to "Out of Memory" (OOM) errors on standard GPUs.
Taxonomy of LLM pruning methods.

The authors seek a "middle way": an optimization-based approach that is as memory-efficient as a simple forward pass, bypassing the need for weight updates while still structurally pruning the model.

Methods

The core innovation is treating pruning as a reinforcement learning-style optimization problem.

Overview of the proposed optimization-based structural pruning framework using Policy Gradients.
  • Probabilistic Mask Modeling: Instead of making a hard "yes/no" decision for every channel or attention head, the authors model each component's existence as a Bernoulli distribution. They learn a probability score for each structural unit.
  • Policy Gradient Estimator (PGE): This is the "bypass" mechanism. In standard deep learning, you need the chain rule (back-prop) to see how a change in a mask affects the final loss. By using Policy Gradients (specifically a variation of the REINFORCE algorithm), the authors can estimate how to update the mask probabilities using only the forward pass of the LLM.
  • Decoupling: Because the Bernoulli parameters are separate from the LLM's weights, the LLM acts as a "fixed environment" that provides a reward (the loss value). This eliminates the need to store massive activation gradients in GPU memory.
  • Global Constraints: The optimizer is given a target pruning rate (e.g., "remove 50% of the model"). It then automatically allocates that "sparsity budget" across the entire network, naturally pruning redundant layers more aggressively than critical ones.

Datasets and Evaluation

The authors validated their approach across a wide range of models and benchmarks:

  • Models: LLaMA (7B, 13B), LLaMA-2, LLaMA-3 (8B), Vicuna, and Mistral-7B.
  • Calibration/Training: The C4 (Colossal Clean Crawled Corpus) dataset was used to "train" the pruning masks.
  • Evaluation:
    • WikiText2 for measuring language modeling perplexity.
  • Zero-shot Benchmarks: PIQA, HellaSwag, WinoGrande, ARC-easy, and ARC-challenge to test general reasoning and knowledge retention.

Key Insights and Ideas

  • Bypassing the Chain Rule: The most significant "aha moment" is realizing that we don't need to differentiate through the LLM to optimize its structure. By treating the LLM as a black box that returns a score, we can use RL techniques to find the optimal architecture.
  • The Redundancy Reality: The paper confirms that LLM layers are not created equal. Their method shows that shallow layers often require more attention heads, while deeper layers can be pruned more heavily. Metric-based methods that prune every layer at the same rate (homogeneous pruning) leave significant performance on the table.
  • Memory vs. Performance: The authors demonstrate that their PGE approach achieves performance nearly identical to Gumbel-Softmax (a popular back-prop-based masking method) but uses 38% less memory and is 122% faster because it avoids the backward pass.

Key Results

  • Superior Perplexity: On LLaMA-2-7B at a 50% pruning rate, the proposed method achieved a perplexity of 65.21, vastly outperforming the state-of-the-art metric-based method, Wanda-sp, which hit 206.94.
  • Zero-Shot Accuracy: In 5-task zero-shot evaluations, the method consistently outperformed competitors like LLM-Pruner and SliceGPT, often by 5-10 percentage points at high pruning rates.
  • Hardware Efficiency: The method pruned a LLaMA-2-13B model in just 2.7 hours using a single A100 GPU with approximately 35GB of memory, making optimization-based pruning accessible to researchers without massive compute clusters.

Limitations and Future Work

  • Optimization Time: While memory-efficient, this method is still slower than "one-shot" metric-based pruning. It takes hours to converge, whereas simple heuristics take seconds or minutes.
  • Gradient Variance: Policy gradients are known for high variance (noise). While the authors used a "moving average baseline" to stabilize training, they suggest that more advanced RL algorithms could further improve stability.
  • Dataset Sensitivity: The performance of the pruned model can be sensitive to the calibration data used. The authors noted that pruning on C4 alone sometimes negatively impacted specific zero-shot tasks like WinoGrande.

Summary updated

BibTeX
@misc{gao2024bypass,
  author = {Yuan Gao and Zujing Liu and WEIZHONG ZHANG and Bo Du and Gui-Song Xia},
  title = {{Bypass Back-propagation: Optimization-based Structural Pruning for Large Language Models via Policy Gradient}},
  year = {2024},
  eprint = {2406.10576},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.10576},
}
Figure