Large Language Models (LLMs) are notoriously memory-hungry, making them difficult to deploy efficiently on consumer-grade hardware. Pruning—the process of removing unnecessary weights by setting them to zero—is a popular solution to this problem. However, the AI community has long faced a difficult trade-off between two types of pruning:
- Structured Sparsity (e.g., 2:4): Forces weights into rigid patterns optimized for hardware accelerators. While fast, it often degrades model accuracy.
- Unstructured Sparsity: Allows any weight to be removed, preserving accuracy much better. Historically, however, it has been too slow to be practical.
The primary bottleneck for unstructured sparsity is Sparse Matrix-Vector Multiplication (SpMV). Existing libraries like NVIDIA’s cuSPARSE or Google’s Sputnik are optimized for "extreme" sparsity (over 95%). But pruned LLMs typically sit in the 30–90% sparsity range. In this "low sparsity" zone, existing sparse kernels are often slower than dense matrix computations because the overhead of tracking the zeros outweighs the computational savings.
Enter MACKO-SpMV (Mutually Aligned Compressed coordinates Kernel Optimized), a new GPU-optimized storage format and kernel designed to finally make unstructured pruning faster than dense computation. By optimizing for the 30–90% sparsity range, MACKO bridges the long-standing performance gap between flexible pruning and rigid, hardware-constrained methods.
The MACKO Approach: Co-designing Format and Execution
MACKO's core innovation is the tight co-design of its storage format and GPU execution logic. The architecture relies on four key pillars:
- Delta Encoding: Instead of storing the full column index for every non-zero weight (which requires 16 or 32 bits), MACKO stores the distance (delta) between non-zero elements using only 4 bits.
- Strategic Padding: If the distance between two non-zero elements exceeds the 4-bit limit, MACKO inserts a "0" value as padding. While this adds a tiny amount of data, it keeps the structure perfectly aligned with how GPUs read memory.
- Mutual Alignment: By aligning the "values" array and the "deltas" array, the GPU can perform vectorized loads. It grabs 128-byte chunks of data at once, fully saturating the memory bandwidth—the primary bottleneck for SpMV operations.
- SplitK Parallelization: The kernel parallelizes work not just across rows, but also across the dot-product dimension, ensuring the GPU's thousands of cores stay busy even when processing smaller matrices.
The "Effective Density" Insight
The researchers highlight a crucial insight: SpMV performance isn't dictated by how many FLOPs (math operations) are saved, but by Effective Density—the total number of bytes (values plus metadata) moved from memory to the processor. Most sparse formats fail because they create scattered memory access. MACKO’s use of padding is a "less is more" approach; adding a few dummy zeros makes the overall memory reading process significantly more efficient.
Key Results and Performance
The researchers evaluated MACKO using synthetic benchmarks based on popular LLM architectures (Llama 2, Llama 3, OPT, Qwen2, and Mixtral-8x7B) and real-world pruning using the Wanda algorithm on a Llama2-7B model.
- Speed & Efficiency: At 50% sparsity, MACKO is the first method to achieve a 1.5× memory reduction and a 1.2–1.5× speedup over the dense baseline (cuBLAS) on an NVIDIA RTX 4090.
- Beating the Competition: MACKO significantly outperformed state-of-the-art sparse libraries in the target sparsity range: cuSPARSE (2.8–13.0× faster), Sputnik (1.9–2.6× faster), and DASP (2.2–2.5× faster).
- End-to-End LLM Gains: For a Llama2-7B model pruned to 50%, inference speed jumped from 66.5 tokens/sec to 98.6 tokens/sec.
- Bypassing the 2:4 Constraint: While modern GPUs have special hardware for 2:4 structured sparsity, MACKO proves that clever software can achieve similar or better hardware performance with unstructured sparsity, yielding significantly lower perplexity (better accuracy).
Limitations and Future Directions
While MACKO represents a major leap forward for unstructured sparsity, the authors note a few areas for future development:
- Extreme Sparsity: At very high sparsity levels (above 95%), MACKO’s padding overhead becomes a burden, and libraries like Sputnik regain the edge.
- Quantization: The current implementation focuses on 16-bit (FP16) precision. Combining MACKO with 4-bit or 8-bit quantization is a vital next step for maximizing efficiency.
- Prefill vs. Decode: The paper focuses on SpMV (batch size 1), which is critical for the "decoding" phase of LLMs. Extending this logic to SpMM (larger batches) for the "prefill" phase remains an area for future exploration.
Ultimately, MACKO proves that unstructured pruning at 50% sparsity is now practical for real-world LLM workloads, successfully bridging the efficiency gap with structured sparsity.
Summary updated