Deploying Large Language Models (LLMs) on edge devices like the NVIDIA Jetson is a constant battle against hardware limits. While pruning—removing unnecessary weights—is a standard solution, most methods treat all parts of a model the same way, aiming for a global "density" target.
A new paper, "Heterogeneous Structured Pruning Under Resource Constraints for Hardware-Efficient Large Language Models," argues that this approach is fundamentally flawed. By ignoring how specific hardware actually stores and processes sparse weights, traditional pruning often leaves performance on the table. The authors introduce Heterogeneous Structured Pruning (HSP), a framework that tailors the pruning structure of every sublayer to the specific bottlenecks of the target device.
TL;DR
HSP is a training-free framework that jointly optimizes the sparsity structure and density of each LLM sublayer based on real-world hardware costs. By moving beyond simple weight-counting to actual latency and memory profiling, HSP achieves superior quality-resource trade-offs on edge devices compared to uniform pruning baselines.
What Problem Does This Paper Address?
The core issue is that density is not a deployment cost. Retaining 50% of weights doesn't mean your model will run twice as fast or use half the memory.
- Metadata Overhead: Unstructured pruning (removing individual weights) requires storing indices for every kept value. As shown in the paper, this can actually increase memory usage compared to a dense model at certain densities.
- Hardware Incompatibility: Different processors have different "sweet spots." For example, NVIDIA GPUs have specialized hardware for 2:4 sparsity, while CPUs might prefer block-sparse structures.
- Layer Sensitivity: Not all layers are created equal. Some are highly sensitive to pruning, while others are redundant. Applying a uniform structure across the whole model is inherently inefficient.
Methods
HSP treats pruning as a Multiple-Choice Knapsack Problem (MCKP). The goal is to minimize the total "proxy loss" (a heuristic measure of how much model quality drops) while staying under a strict hardware budget (latency or memory).
The framework consists of two main stages:
- Inner Problem (Mask Construction): For every sublayer (Attention or MLP), HSP generates a variety of pruning candidates using different structures: Dense, Unstructured, 2:4, Block-sparse, and Head/Channel (H/C) pruning. It uses "Wanda" scores—a combination of weight magnitude and activation norms—to decide which weights to keep for each candidate.
- Outer Problem (Global Selection): A global solver looks at all these candidates across all layers. It uses profiled latency (measured on the actual device) or an analytical memory model to pick the single best option for each sublayer that fits the total budget.
To prevent the model from "collapsing" (where the solver prunes a few layers so aggressively that the model becomes useless), the authors introduce density floors—minimum allowed densities for each structure type.
Datasets
The authors evaluated HSP using the OPT model family (125M to 2.7B parameters) and LLaMA 7B.
- Calibration: 256 samples from the WikiText-2 training set were used to calculate importance scores.
- Evaluation: Model quality was measured using WikiText-2 perplexity and zero-shot accuracy across seven standard benchmarks: BoolQ, PIQA, HellaSwag, WinoGrande, ARC-e, ARC-c, and OpenBookQA.
Key Insights and Ideas
- The Metadata Trap: The paper highlights that at 50% density, unstructured pruning (using CSR format) can require 1.5x the memory of a dense model due to 32-bit index storage. In contrast, H/C pruning (which just makes the matrices smaller) hits exactly 0.5x memory.
- Heterogeneity is Natural: When given the choice, the optimizer rarely picks a uniform structure. As seen in Figure 6, a latency-optimized model on a GPU might favor H/C pruning for speed, while a memory-optimized model might keep many layers dense and use 2:4 sparsity for others.
- Objective-Specific Optimization: A model optimized for memory is not necessarily fast. The authors found that memory-constrained candidates often select narrow, column-wise blocks that are efficient to store but slow to execute.
Key Results
The authors tested HSP on an NVIDIA Jetson Orin Nano Super.
- Pareto Superiority: HSP-Lat (latency-optimized) and HSP-Mem (memory-optimized) consistently defined the best "frontier" for quality vs. resource use.
- Latency Gains: On the GPU, HSP-Lat was consistently the fastest candidate. For OPT-2.7B, it achieved significantly better perplexity than uniform 2:4 pruning at a similar latency budget.
- Memory Efficiency: HSP-Mem successfully fit models into memory budgets where unstructured methods failed due to metadata overhead.
- CPU vs. GPU: The method is truly hardware-aware. On the CPU, which lacks 2:4 hardware support, HSP correctly ignored 2:4 options and focused on block-sparsity and H/C pruning.
Limitations and Future Work
- Training-Free Only: This work focuses on "one-shot" pruning without further training. While this is fast (taking only seconds to minutes), combining HSP with sparse fine-tuning or distillation could likely recover even more accuracy.
- Kernel Dependency: The results are tied to the efficiency of the sparse kernels used. The authors wrote custom C++ and CUDA kernels, but further optimization of these kernels would directly improve HSP's results.
- Static vs. Dynamic: The pruning is static. Future work could explore dynamic pruning where the structure changes based on the input sequence.
For those interested in the implementation, the authors maintain a project page and code at cameronbarker.me/publications/hsp.
Summary updated