TL;DR
SlimGPT is a fast, low-cost structured pruning method for Large Language Models (LLMs) that compresses models without requiring massive computational resources for retraining. By adapting the Optimal Brain Surgeon (OBS) framework with batched greedy pruning and a non-uniform layer-wise pruning strategy, SlimGPT achieves state-of-the-art compression in under an hour on a single GPU.
Introduction
Large Language Models (LLMs) are incredibly powerful, but their massive size makes them expensive and difficult to deploy in practical, resource-constrained environments. To shrink these models, researchers rely on pruning—the process of removing less important weights.
There are two primary approaches to pruning:
- Unstructured pruning: Randomly zeroes out individual weights. While this maintains accuracy well, it creates "sparse" matrices that do not actually speed up inference on standard hardware because the matrix dimensions remain unchanged.
- Structured pruning: Removes entire rows, columns, or attention heads. This physically shrinks the model, directly speeding up inference and lowering memory usage. However, it is much more destructive to the model's performance.
To recover performance after structured pruning, models usually require heavy, expensive retraining. Advanced mathematical frameworks like Optimal Brain Surgeon (OBS) have been used to intelligently prune weights without heavy retraining, but they were designed for unstructured pruning (evaluating one parameter at a time). Applying OBS directly to structured pruning causes massive numerical errors. Furthermore, OBS prunes layer-by-layer, ignoring how errors snowball as data moves through the network. SlimGPT bridges this gap, making OBS work efficiently and accurately for structured pruning.
Methodology
SlimGPT introduces two major innovations to adapt the OBS framework for LLMs:
1. Batched Greedy Pruning
To make OBS work for structured pruning, the authors developed a way to evaluate the importance of entire structural blocks (like an attention head) at once, rather than single weights.
- Attention Heads: SlimGPT introduces grouped Cholesky decomposition. Standard OBS uses Cholesky decomposition to update matrices efficiently, but doing so breaks the comparability between different columns. Grouping the decomposition allows for accurate, head-wise error estimation without breaking the structural dependencies within the matrix.
- Feed-Forward Networks (FFNs): For FFNs, SlimGPT uses a Dynamic Group Size. Instead of pruning one column at a time (which is agonizingly slow), it prunes columns in chunks, dynamically shrinking the chunk size as it gets closer to the target pruning ratio to maintain accuracy.
2. Incremental Pruning Ratio
The authors identified that in layer-wise pruning, errors in the first few layers amplify aggressively as they pass through the network. To combat this error accumulation, SlimGPT abandons uniform pruning (e.g., pruning exactly 20% of every layer). Instead, it uses a logarithmic curve: it prunes very little in the first few layers and gradually increases the pruning ratio in the deeper layers. This zero-cost trick yields massive performance retention.
Experimental Setup
- Calibration: A tiny subset of the C4 dataset (just 256 sequences of 2048 tokens) is used to calibrate the pruning math.
- Fine-tuning: The Alpaca dataset was used for lightweight performance recovery via LoRA (Low-Rank Adaptation).
- Evaluation: The model was evaluated on language modeling (WikiText2), Commonsense Reasoning (BoolQ, PIQA, HellaSwag, WinoGrande, ARC-e, ARC-c, OBQA), and complex tasks (MMLU and LongBench).
Key Results
SlimGPT was tested primarily on the LLaMA, Vicuna, and Baichuan families, outperforming baselines like LLM-Pruner, Compresso, and LoraPrune.
- Superior Performance: When pruning LLaMA-7B by 20% (down to 5.4B parameters), SlimGPT achieved a perplexity of 16.68 and a zero-shot average of 65.07, beating the baseline LLM-Pruner (18.01 / 61.50).
- High Compression Resilience: At a massive 50% pruning ratio (down to 3.4B parameters), SlimGPT maintained an 11% better average performance than baselines, with a massive 25% improvement on specific datasets like HellaSwag.
- Pruning Efficiency: You do not need a massive GPU cluster to compress an LLM. Pruning LLaMA-7B by 20% took only ~11 minutes (678s) and required just 7.3GB of VRAM on a single A100 GPU.
- Inference Speedup: The 50% pruned 7B model reduced memory usage by ~49% and cut inference latency by ~31% (from 13.51ms to 9.21ms).
Limitations and Future Work
While SlimGPT significantly outperforms baselines, performance degradation is still noticeable at extreme pruning ratios (e.g., 50%) or on highly complex tasks like LongBench and MMLU. Lightweight LoRA fine-tuning is not always enough to fully recover this lost knowledge. Additionally, the logarithmic curve used for the Incremental Pruning Ratio is a generalized heuristic. Finding a truly optimal, dynamic non-uniform strategy for layer-wise pruning remains an open challenge for future research.
Summary updated