通过分层稀疏与低秩分解,大幅压缩大模型内存占用且保持性能。
Hierarchical Sparse Plus Low Rank Compression of LLM
- 先剪裁大权重成稀疏矩阵,再递归分块低秩分解残差部分。
- 在LLaMA-7B上仅压缩注意力投影层,30%稀疏度下困惑度达1.64。
- 适合部署和持续训练场景,硬件友好支持端到端训练。
现代大语言模型对内存和计算资源提出巨大压力,因此系统性压缩对部署和持续训练至关重要。本文提出分层稀疏加低秩(HSS)压缩方法,分为两阶段:首先将最大幅度权重移出形成稀疏矩阵S;其次对剩余稠密残差矩阵应用递归分层稀疏可分离(HSS)低秩分解。引入递归降秩策略与反向Cuthill-Mckee(RCM)排列,使高权重集中于对角线并契合块对角层次结构,最大化非对角元素的可压缩性(因仅被访问一次)。该方法硬件友好,其矩阵-向量乘法可简化为一次稀疏乘法与一系列薄矩阵乘法,支持标准优化器端到端训练。在LLaMA-7B上的实验表明,仅压缩自注意力投影层(共16亿参数,占总70亿参数的22.9%),即可实现显著内存节省,同时在WikiText数据集测试样本上保持接近最先进的困惑度表现。例如,在30%稀疏度预算与外层秩512条件下,sHSS-RCM达到1.64的困惑度,优于密集基线与经典稀疏+SVD变体,同时实现显著内存节省。
原文摘要 · Abstract (English)
Modern large language models (LLMs) place extraordinary pressure on memory and compute budgets, making principled compression indispensable for both deployment and continued training. We present Hierarchical Sparse Plus Low-Rank (HSS) compression, a two-stage scheme that (i) removes the largest-magnitude weights into a sparse matrix S and (ii) applies a recursive Hierarchically Sparse Separable (HSS) low-rank factorisation to the dense residual matrix. A recursive rank-reducing strategy and a reverse Cuthill-Mckee (RCM) permutation are introduced to align high weights towards the diagonal with the block-diagonal hierarchy, maximising off-diagonal compressibility (because they are touched only once). HSS is hardware-friendly: its matrix-vector multiply reduces to one sparse and a sequence of thin-matrix multiplications and can be trained end-to-end with standard optimisers. Experiments on LLaMA-7B show that targeting only the self-attention projections (1.6 B parameters of Q, K, and V matrices out of a total 7B parameters) suffices to yield large memory savings while retaining comparable state-of-the-art perplexity scores on test samples of the WikiText dataset. For example, with a 30\% sparsity budget and an outer rank of 512, sHSS-RCM achieves a perplexity of 1.64, outperforming dense baselines and classical sparse-plus-SVD variants, while also achieving significant memory savings.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。