SVD Contextual Sparsity Predictors for Fast LLM Inference
Organizations: Huawei Technologies Ltd. · Moscow State University, Russia.
Abstract
Contextual sparsity is one of the approaches used to reduce computational complexity in the inference process of large language models (LLMs). Existing techniques for efficient LLM inference acceleration based on contextual sparsity with minimal accuracy degradation require training sparse pattern predictors. This paper presents a framework for accelerating inference of ReGLU-based feed-forward networks (FFNs) within LLMs. The proposed framework provides a fast, training-free method for building sparse pattern predictors using truncation-aware singular value decomposition (SVD) of the gate projection matrix, along with a threshold calibration algorithm, and inference executors supporting conditional computation on CUDA and CANN devices. Experiments on three sparse LLMs with an average activation sparsity level of 90% in the FFNs demonstrate up to a 1.8x reduction in end-to-end decoding time while maintaining less than 1% degradation in benchmark scores on tasks involving complex math and code generation. This work advances the deployment of LLMs on edge devices.
Figures & tables
| Model | Method | Accuracy, % | Speedup | |
| ProSparse-LLaMA2-7B | Dense | 38.92 | 1.00 | |
| SVDP | 0.4 | 38.66 (-0.26) | 1.61 | |
| 0.5 | 38.78 (-0.14) | 1.64 | ||
| 0.6 | 38.77 (-0.15) | 1.67 | ||
| 0.7 | 38.57 (-0.35) | 1.71 | ||
| TurboSparse-Mistral-Instruct | Dense | 54.30 | 1.00 |
| Method | Predicted sparsity, % | TriviaQA | ARC-E | ARC-C | HumanEval | MBPP | GSM8K | BBH | CMMLU | Average | E2E |
| acc, % | acc, % | acc, % | pass@1, % | pass@1, % | acc, % | acc, % | acc, % | Score | Speedup | ||
| Dense baseline | 62.94 | 75.42 | 53.58 | 17.68 | 22.59 | 11.45 | 35.85 | 31.84 | 38.92 | 1.00 | |
| Trained predictors | |||||||||||
| Deja Vu | 20 | 59.47 | 74.87 | 53.41 | 3.66 | 2.98 | 3.03 | 34.49 | 30.97 | 32.86 | 1.38 |
| PowerInfer | 80 | 61.10 | 74.54 | 52.99 | 15.85 | 21.15 | 10.69 | 35.29 | 31.80 | 37.93 | 1.63 |
| Training-free methods | |||||||||||
| Configuration | ProSparseLLAMA2-7B | TurboSparse-Mistral-Instruct | SparseQwen2-7B | ||||||
| GSM8K | HumanEval | GSM8K | HumanEval | GSM8K | HumanEval | ||||
| Dense baseline | 11.45 | 17.68 | 38.92 | 61.71 | 34.15 | 54.30 | 77.1 | 64.02 | 65.84 |
| Parallel pipeline | |||||||||
| Naive SVD | 6.60 | 10.98 | 34.08 | 60.20 | 24.39 | 51.52 | 74.00 | 53.66 | 62.05 |
| + Data whitening | 10.16 | 16.46 | 37.10 | 60.88 | 37.20 | 53.02 | 75.89 | 61.59 | 63.99 |
| + Bias calibration | 10.54 | 17.68 | 38.72 | 62.24 | 36.59 | 54.34 | 76.65 | 62.20 | 65.37 |
| LLM architecture | Sparsity, % | FFN Speedup | |
| CUDA | CANN | ||
| ProSparseLLAMA2-7B | 20 | 1.30 | 0.76 |
| 50 | 1.90 | 1.23 | |
| 80 | 3.34 | 3.38 | |
| 95 | 4.67 | 30.67 | |
| TurboSparse-Mistral-Instruct | 20 | 1.29 | 0.76 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | TriviaQA | ARC-C | ARC-E | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average |
| acc, % | acc, % | acc, % | pass@1, % | pass@1, % | acc, % | acc, % | acc, % | ||
| Dense mode | 60.96 | 86.43 | 93.81 | 60.98 | 44.46 | 36.85 | 47.81 | 79.58 | 63.86 |
| SVDP | 51.48 | 86.43 | 93.81 | 49.39 | 36.55 | 37.83 | 47.61 | 79.58 | 60.34 |
| Method | TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | E2E | |
| acc, % | acc, % | acc, % | pass@1, % | pass@1, % | acc, % | acc, % | acc, % | Score | Speedup | ||
| Dense mode | - | 62.94 | 75.42 | 53.58 | 17.68 | 22.59 | 11.45 | 35.85 | 31.84 | 38.92 | 1.00 |
| SVDP | 0.4 | 62.38 | 75.29 | 53.67 | 17.68 | 22.38 | 10.61 | 35.46 | 31.81 | 38.66 | 1.61 |
| 0.5 | 62.74 | 75.34 | 53.67 | 17.68 | 22.07 | 11.22 | 35.58 | 31.94 | 38.78 | 1.64 | |
| 0.6 | 62.90 | 75.29 | 53.75 | 18.29 | 21.97 | 10.54 | 35.54 | 31.91 | 38.77 | 1.67 | |
| 0.7 | 62.04 | 75.42 | 53.58 | 17.07 | 21.87 | 11.22 | 35.43 | 31.90 | 38.57 | 1.71 |
| Method | TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | E2E | |
| acc, % | acc, % | acc, % | pass@1, % | pass@1, % | acc, % | acc, % | acc, % | Score | Speedup | ||
| Dense mode | - | 48.58 | 87.21 | 71.67 | 34.15 | 42.20 | 61.71 | 42.35 | 46.52 | 54.30 | 1.00 |
| SVDP | 0.4 | 45.46 | 87.08 | 71.67 | 32.93 | 42.09 | 61.49 | 42.46 | 46.55 | 53.72 | 1.67 |
| 0.5 | 43.26 | 87.04 | 71.76 | 33.54 | 42.71 | 61.41 | 42.32 | 46.47 | 53.56 | 1.73 | |
| 0.6 | 40.63 | 87.08 | 72.10 | 33.54 | 42.09 | 61.41 | 42.19 | 46.43 | 53.18 | 1.79 | |
| 0.7 | 39.21 | 87.21 | 72.10 | 37.20 | 42.09 | 60.96 | 42.33 | 46.45 | 53.44 | 1.84 |
| Method | TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | E2E | |
| acc, % | acc, % | acc, % | pass@1, % | pass@1, % | acc, % | acc, % | acc, % | Score | Speedup | ||
| Dense mode | - | 50.76 | 91.92 | 83.87 | 64.02 | 46.3 | 77.1 | 48.42 | 64.35 | 65.84 | 1.00 |
| SVDP | 0.4 | 50.87 | 91.92 | 83.87 | 62.80 | 44.56 | 76.50 | 48.40 | 64.35 | 65.41 | 1.78 |
| 0.5 | 49.96 | 91.92 | 83.87 | 62.80 | 43.53 | 76.80 | 48.40 | 64.35 | 65.20 | 1.81 | |
| 0.6 | 48.82 | 91.92 | 83.87 | 63.41 | 43.53 | 76.80 | 48.34 | 64.35 | 65.13 | 1.85 | |
| 0.7 | 47.42 | 91.92 | 83.87 | 62.20 | 41.99 | 75.82 | 48.36 | 64.35 | 64.49 | 1.86 |
| TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | |
| Dense baseline | 62.94 | 75.42 | 53.58 | 17.68 | 22.59 | 11.45 | 35.85 | 31.84 | 38.92 |
| Parallel pipeline | |||||||||
| Naive SVD | 58.19 | 69.91 | 49.32 | 10.98 | 13.35 | 6.60 | 33.98 | 30.28 | 34.08 |
| + Data whitening | 53.85 | 75.34 | 53.75 | 16.46 | 19.92 | 10.16 | 35.46 | 31.83 | 37.10 |
| + Bias calibration | 62.66 | 75.38 | 53.58 | 17.68 | 22.18 | 10.54 | 35.86 | 31.85 | 38.72 |
| Sequential pipeline | |||||||||
| TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | |
| Dense baseline | 50.76 | 91.92 | 83.87 | 64.02 | 46.30 | 77.10 | 48.42 | 64.35 | 65.84 |
| Parallel pipeline | |||||||||
| Naive SVD | 46.24 | 91.92 | 83.87 | 53.66 | 34.39 | 74.00 | 48.00 | 64.35 | 62.05 |
| + Data whitening | 42.92 | 91.92 | 83.87 | 61.59 | 43.02 | 75.89 | 48.37 | 64.35 | 63.99 |
| + Bias calibration | 50.20 | 91.92 | 83.87 | 62.20 | 45.28 | 76.65 | 48.45 | 64.35 | 65.37 |
| Sequential pipeline | |||||||||
| TriviaQA | ARC-E | ARC-C | Humaneval | MBPP | GSM8K | BBH | CMMLU | Average | |
| Dense baseline | 48.58 | 87.21 | 71.67 | 34.15 | 42.20 | 61.71 | 42.35 | 46.52 | 54.30 |
| Parallel pipeline | |||||||||
| Naive SVD | 41.40 | 87.04 | 71.76 | 24.39 | 38.91 | 60.20 | 42.13 | 46.34 | 51.52 |
| + Data whitening | 37.98 | 86.57 | 71.25 | 37.20 | 41.79 | 60.88 | 42.27 | 46.18 | 53.02 |
| + Bias calibration | 46.21 | 87.12 | 71.76 | 36.59 | 41.89 | 62.24 | 42.44 | 46.45 | 54.34 |
| Sequential pipeline | |||||||||
| hyperparameters | ||||
| Model | hidden size | intermediate size | n attention heads | n KV heads |
| ProSparse-LLaMA2-7B | 4096 | 11008 | 32 | 32 |
| TurboSparse-Mistral-Instruct | 4096 | 14336 | 32 | 8 |
| SparseQwen2-7B | 3584 | 18944 | 28 | 4 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,084 papers