Q-Sparse: All Large Language Models can be Fully Sparsely-Activated
Summary
Q-Sparse applies top-K (absolute-value) masks on activations of all linear layers, STE so non-selected grads are not zeroed, optional 8-bit quantized top-K, squared-ReLU/ReLU²GLU in FFNs, and Block Q-Sparse (N:M, e.g. 16:32) for batched GPU kernels. Inference-optimal sparsity ~45.58% full-precision (1.84× params at matched activated N_a) and ~61.25% for 1.58-bit. From-scratch 40% sparsity matches dense loss at the same size/tokens (RedPajama 50B). Continue-train Mistral-7B: 3.8B activated avg 63.7 vs dense 64.6 (ARC/HS/MMLU/WG/TQA); 2.9B 61.7, beating ReLUfication 60.8 and dReLU 61.0. Works with BitNet b1.58. No official code on abs.
- Venue
- arXiv / Microsoft Research / University of Chinese Academy of Sciences
- Purpose
- Enable full activation sparsity in every linear projection via top-K sparsification and a straight-through estimator
- Scale
- From-scratch 300M–7B, 50B RedPajama tokens. Continue-train Mistral-7B 40B FineWeb-Edu (10k updates, 4M tok/step). SFT Mistral-7B and Qwen1.5-7B on Open-Orca 1 epoch. Block Q-Sparse block size 32.
- Time period
- 2024-07-15 (arXiv 2407.10969 v1); last revised 2024-07-24 (v3). Comment: Work in progress. HF paper publishedAt 2024-07-15.
- Added
- Oct 1, 2026
- Research status
- done
From the source
- Published
- Jul 15, 2024
- Last revised
- Jul 24, 2024
- arXiv categories
- cs.CL, cs.LG
- Author comment
- Work in progress
- Citations
- 31 (2 influential)
- References
- 30
Abstract (from arXiv)
We introduce, Q-Sparse, a simple yet effective approach to training sparsely-activated large language models (LLMs). Q-Sparse enables full sparsity of activations in LLMs which can bring significant efficiency gains in inference. This is achieved by applying top-K sparsification to the activations and the straight-through-estimator to the training. We also introduce Block Q-Sparse for batch training and inference. The key results from this work are, (1) Q-Sparse can achieve results comparable to those of baseline LLMs while being much more efficient at inference time; (2) We present an inference-optimal scaling law for sparsely-activated LLMs; (3) Q-Sparse is effective in different settings, including training-from-scratch, continue-training of off-the-shelf LLMs, and finetuning; (4) Q-Sparse works for both full-precision and 1-bit LLMs (e.g., BitNet b1.58). Particularly, the synergy of BitNet b1.58 and Q-Sparse (can be equipped with MoE) provides the cornerstone and a clear path to revolutionize the efficiency, including cost and energy consumption, of future LLMs.
Tags
Topics
activation sparsity, LLM inference, quantization
Research notes
- Primary: arxiv abs (cs.CL; also cs.LG). License: arXiv.org perpetual non-exclusive on HTML at check. Equal contrib Wang/Ma; corresponding Shuming Ma and Furu Wei (Microsoft Research). H. Wang and R. Wang at University of Chinese Academy of Sciences. No official code URL on abs (OpenReview version: “The code will be released”). Later github.com/ustcwhy/Q-Sparse not treated as abs-linked. HF paper page 23 upvotes; no linked models/datasets. Discord posted PDF. Trains on public RedPajama/FineWeb-Edu/Open-Orca rather than a new hosted corpus, so no datasets_local row. License field left blank per catalog convention.
Cited by, within this collection
Similar entries
- Paper BitNet a4.8: 4-bit Activations for 1-bit LLMs
- Model BitNet b1.58 2B4T
- Paper Optimizing Large Language Model Training Using FP4 Quantization
- Paper AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
- Paper Disaggregated Quantization: Specializing LLM Prefill and Decode
- Paper FlashHead: Efficient Drop-In Replacement for the Classification Head in Language Model Inference