TL;DR
MACKO-SpMV introduces a novel GPU-optimized sparse matrix format and execution kernel tailored specifically for the low and unstructured sparsity (30–90%) typical of pruned Large Language Models. By co-designing a delta-encoded storage format with strategic zero-padding, MACKO achieves up to a 1.5× memory reduction and 1.5× faster end-to-end inference over dense baselines at 50% sparsity. This effectively unlocks the practical benefits of unstructured LLM pruning on consumer hardware.
What Problem Does This Paper Address?
To run Large Language Models (LLMs) on consumer-grade GPUs, compression is essential. Unstructured network pruning is a highly effective compression technique because it allows engineers to zero out a massive portion of the model's weights with negligible impact on accuracy.
However, a major bottleneck arises during the LLM generation (decoding) phase, where the dominant mathematical operation is Sparse Matrix-Vector Multiplication (SpMV). Existing sparse computing libraries (like NVIDIA's cuSPARSE or Google's Sputnik) are designed for high sparsity architectures (often >90% empty). When applied to moderately sparse models (around 50% sparsity), these libraries actually run significantly slower than standard dense operations (cuBLAS). This creates a frustrating paradox: a pruned model takes up less space on disk but requires more time and memory to execute. MACKO addresses this gap by optimizing SpMV specifically for the low-sparsity regime.
Methods
The core innovation of MACKO is the co-design of its storage format and its GPU execution kernel:
- The MACKO Storage Format: Traditional Compressed Sparse Row (CSR) formats store full 16-bit or 32-bit column indices for every non-zero value, creating massive metadata overhead. MACKO replaces these with delta encoding—storing only the distance between consecutive non-zero elements using a tiny, fixed bit width ($b_\Delta = 4$ bits). If the gap between two non-zero elements is too large to fit in 4 bits, MACKO strategically pads the data array with a dummy zero value to reset the counter.
- GPU Execution Kernel: MACKO maps each matrix row to a single GPU warp (32 threads) using a modified SplitK algorithm. Instead of fetching indices from slow global or shared memory, the kernel loads the tightly packed 4-bit deltas directly into registers. It then uses fast, hardware-level warp-shuffling primitives (
__shfl_up_sync) to compute an exclusive prefix sum on the fly, reconstructing the absolute column indices entirely in parallel.
Datasets
The authors evaluated MACKO using a comprehensive suite of matrix shapes directly extracted from popular open-source LLMs, including:
- Llama2 and Llama3 series
- OPT-Series
- Qwen2
- Mixtral-8x7B MoE
For end-to-end evaluation, they used the Llama2-7B model, pruned to various sparsity levels using the popular Wanda pruning algorithm.
Key Insights and Ideas
- Memory Bandwidth is the True Bottleneck: Because SpMV is strictly memory-bound on modern GPUs, reducing the total byte footprint of the matrix format is the fastest way to achieve speedups.
- Strategic Padding is Cheaper than Index Overhead: Counterintuitively, inserting dummy zeros into the data array to keep the delta indices small (4 bits) consumes far less memory than storing full 16-bit column indices.
- Compute is "Free": Reconstructing absolute column indices on the fly using register-based warp shuffles introduces minor compute overhead. However, because the GPU execution units would otherwise sit idle waiting for memory transfers, this computation is practically free.
Key Results
- Breaking the Crossover Barrier: On an NVIDIA RTX 4090, MACKO outperforms dense cuBLAS at a sparsity level as low as 25%. In comparison, legacy libraries require the matrix to be at least 65% to 71% sparse just to break even with dense performance.
- Substantial Baselines Speedups: At 50% sparsity, MACKO achieves a 1.2–1.5× speedup over dense cuBLAS. It also outperforms cuSPARSE by 2.8–13.0×, Sputnik by 1.9–2.6×, and DASP by 2.2–2.5×.
- End-to-End LLM Acceleration: When integrated into an end-to-end Llama2-7B pipeline at 50% sparsity, MACKO delivers a 1.53× memory reduction and a 1.4× generation speedup over standard dense execution.
Limitations and Future Work
While MACKO excels at low-to-moderate sparsities, it is not a silver bullet for every workload:
- High Sparsity Degradation: At extreme sparsities (above 95%), the value-padding strategy becomes inefficient, causing MACKO to be outperformed by Sputnik.
- Quantization Integration: The current implementation focuses purely on FP16 precision. The authors note that extending MACKO to support mixed pruning and quantization (e.g., 4-bit or 8-bit weights) is a crucial next step.
- Batch Size Constraints: MACKO is optimized for a batch size of 1 (pure matrix-vector multiplication). Adapting the kernel to handle larger batch sizes (matrix-matrix multiplication) remains an open challenge.
Summary updated