Skip to main content
QUICK REVIEW

[Paper Review] A Simple and Effective Pruning Approach for Large Language Models

Ming-Jie Sun, Zhuang Liu|arXiv (Cornell University)|Jun 20, 2023
Topic ModelingComputer Science52 citations
TL;DR

Wanda introduces a no-retraining pruning method for pretrained LLMs that uses a weight importance score formed by the product of weight magnitude and input activation norm, pruning per output, achieving strong zero-shot and perplexity results on LLaMA/LLaMA-2 with competitive speedups.

ABSTRACT

As their size increases, Large Languages Models (LLMs) are natural candidates for network pruning methods: approaches that drop a subset of network weights while striving to preserve performance. Existing methods, however, require either retraining, which is rarely affordable for billion-scale LLMs, or solving a weight reconstruction problem reliant on second-order information, which may also be computationally expensive. In this paper, we introduce a novel, straightforward yet effective pruning method, termed Wanda (Pruning by Weights and activations), designed to induce sparsity in pretrained LLMs. Motivated by the recent observation of emergent large magnitude features in LLMs, our approach prunes weights with the smallest magnitudes multiplied by the corresponding input activations, on a per-output basis. Notably, Wanda requires no retraining or weight update, and the pruned LLM can be used as is. We conduct a thorough evaluation of our method Wanda on LLaMA and LLaMA-2 across various language benchmarks. Wanda significantly outperforms the established baseline of magnitude pruning and performs competitively against recent method involving intensive weight update. Code is available at https://github.com/locuslab/wanda.

Motivation & Objective

  • Motivate and address the challenge of pruning billion-parameter LLMs without retraining or heavy weight updates.
  • Propose Wanda, a simple, calibration-data-driven pruning metric incorporating weights and activations.
  • Investigate per-output (per-row) pruning groups to maintain performance in LLMs.
  • Empirically evaluate Wanda on LLaMA and LLaMA-2 across zero-shot and language modeling benchmarks, comparing to magnitude pruning and SparseGPT.
  • Analyze speed and robustness of Wanda, and discuss extensions to structured sparsity and potential fine-tuning effects.

Proposed method

  • Define a pruning metric Sij = |Wij| * ||Xj||2 that evaluates weight importance using weight magnitude and input activation norm.
  • Perform pruning on a per-output basis by grouping weights connected to the same output neuron (row-wise) and removing the lowest-Sij weights to reach a target sparsity s%.
  • Estimate input activation norms using a small calibration dataset, enabling zero retraining or full-data access.
  • Prune in a single forward pass without weight updates, and compare to baselines (magnitude pruning) and SparseGPT.
  • Optionally extend Wanda to structured N:M sparsity and discuss connections to Optimal Brain Damage/Surgeon perspectives.
  • Provide fast computation of the pruning metric with O(d_hidden^2) complexity and no Hessian inverses.
  • Offer code to implement Wanda and describe its integration into existing forward passes.

Experimental results

Research questions

  • RQ1Can a simple pruning metric that multiplies weight magnitude by input activation norm effectively identify weights to prune in pretrained LLMs?
  • RQ2Does per-output (row-wise) pruning outperform layer-wise or global pruning for large language models?
  • RQ3How does Wanda compare to magnitude pruning and SparseGPT in zero-shot and language modeling benchmarks without retraining?
  • RQ4What are the speed and robustness characteristics of Wanda with respect to calibration data size and sparsity levels?
  • RQ5Can Wanda be extended to structured sparsity (N:M) and how does it relate to classical pruning methods?

Key findings

  • Wanda outperforms standard magnitude pruning across unstructured and structured sparsities on zero-shot tasks.
  • Wanda achieves competitive perplexity and zero-shot results close to SparseGPT without any weight updates.
  • Pruning metric is robust to calibration data size and remains effective with very small calibration sets.
  • In many cases, large sparse LLMs (e.g., 65B/70B) with 50% sparsity match the zero-shot performance of their dense counterparts.
  • Wanda is significantly faster to compute than SparseGPT, requiring no Hessian inverses or iterative weight updates.
  • Structured sparsity with Wanda yields notable inference speedups on linear layers (around 1.6x) and end-to-end gains on some models.

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.