Lazy loaded image7.2 Pruning

7.2.1 Introduction

  • Model quantization refers to compressing a model by reducing the number of bits of weights or activations required for representation
  • Model pruning studies redundant weights in the model, attempting to remove or trim unnecessary and non-critical weights to reduce model size and computational complexity
notion image
notion image

7.2.2 Pruning Workflows

There are three main approaches to model pruning:
  • Train the model first, then prune, finally fine-tune
  • Prune during model training, then fine-tune
  • Prune the model, then retrain the pruned model from scratch
<ins/>

7.2.3 Types of Pruning

Unstructured Pruning

  • Randomly removes individual weights or neuron connections, eliminating parameters without considering the overall network structure, or
  • Prunes parameters below a certain threshold, which can lead to sparse parameter matrices with irregular structures.
As a result, it requires specially designed compression formats for storage and computation. Unstructured pruning often requires extensive retraining to restore accuracy, making it costly for LLMs.
  • Pros: Efficient pruning algorithms; high compression ratio for the model
  • Cons:
    • Accuracy may be unstable;
    • Sparse weight matrices are irregular, making it hard for hardware to effectively leverage compression and acceleration
Example of Unstructured Pruning Method:
  • SparseGPT: Introduces a one-time pruning strategy that requires no retraining. It formulates pruning as a general sparsity regression problem and solves it using approximate sparsity regression solvers, achieving significant unstructured sparsity.
    • notion image
  • LoRAPrune: Combines Parameter-Efficient Fine-Tuning (PEFT) methods with pruning to enhance downstream task performance. It introduces a unique parameter importance criterion based on LoRA values and gradients.
    • notion image
  • Wanda: Unlike traditional pruning techniques that rely solely on weight magnitudes or require expensive weight updates (e.g., SparseGPT), Wanda computes weight importance using the product of the weight magnitude and the norm of the corresponding input activation, evaluated per output neuron. It requires no retraining, no weight updates, and can be done in a single forward pass.
    • notion image

Structured Pruning

Removes connections or layer structures based on predefined rules while preserving the overall network architecture. This method prunes groups of weights at once, offering advantages in reducing model complexity and memory usage while maintaining the full structure of LLMs.
Structured Pruning Method:
  • LLM-Pruner: Uses a versatile approach to compress LLMs while preserving their multi-task reasoning and language generation capabilities. It introduces a dependency-aware scoring metric and identifies interdependencies within the model structure. It also implements an efficient importance estimation method that considers first-order information and approximated Hessian information.
    • notion image
Prev
7.1 Quantization
Next
7.3 Knowledge Distillation
Loading...
Article List
LLM Learning Roadmap
✨ Awesome-Anything
🖼️ Digital Image Processing
🍃 LLM Components
🌱 LLM Pre-training
☘️ LLM Post-Training
🍀 LLM Popular Models
🪴 LLM Applications
🌿 LLM Optimization
🌾 LLM Compression
🌵 LLM Hands-on Practice
🌴 LLM Must-read Papers
🌳 LLM Q&A
🐝 VLM Image Encoders
📝 MISC.