提出高效方法优化大模型剪枝掩码,显著提升压缩后性能。
SparseSwaps: Tractable LLM Pruning Mask Refinement at Scale
- 通过行级稀疏性约束,将复杂剪枝问题转化为可高效求解的单权重交换问题。
- 相比Wanda方法,层内剪枝误差降低最高达60%,在多个GPT模型上提升困惑度和零样本准确率。
- 算法适合大规模语言模型,无需调参,可在GPU上快速运行。
神经网络可通过剪枝大幅降低资源需求——即移除看似不重要的参数。然而,对于大语言模型(LLM),完全重训以恢复剪枝导致的性能下降通常不可行,而传统方法如基于大小的剪枝在Transformer架构上表现不佳。当前先进方法解决分层掩码选择问题:在少量校准数据上寻找最小化每层剪枝误差的剪枝掩码。由于该问题具有组合性质且搜索空间巨大,精确求解计算成本极高,现有方法依赖近似或启发式策略。本文证明,在大模型规模下,该掩码选择问题可被显著简化。我们通过强制每行保持相同稀疏度,将行间解耦,从而能高效计算最优1-交换(即交换一个保留与一个剪除权重)。我们提出一种简单1-交换算法,可从任意剪枝掩码开始,能在大规模语言模型上利用GPU高效运行,基本无需超参数调整。实验显示,该方法相较Wanda(Sun et al., 2024)将层内剪枝误差降低高达60%,并在多个前沿GPT架构上一致提升困惑度与零样本准确率。
原文摘要 · Abstract (English)
The resource requirements of neural networks can be significantly reduced through pruning - the removal of seemingly less important parameters. However, for LLMs, full retraining to recover pruning-induced performance degradation is often prohibitive and classical approaches such as magnitude pruning are suboptimal on Transformers. State-of-the-art methods hence solve a layer-wise mask selection problem: finding a pruning mask that minimizes per-layer pruning error on a small set of calibration data. Exactly solving this problem is computationally infeasible due to its combinatorial nature and the size of the search space, and existing approaches rely on approximations or heuristics. We demonstrate that the mask selection problem can be made drastically more tractable at LLM scale. To that end, we decouple the rows by enforcing equal sparsity levels per row. This allows us to derive optimal 1-swaps (exchanging one kept and one pruned weight) computable efficiently via the Gram matrix. We propose a simple 1-swap algorithm that warmstarts from any pruning mask, runs efficiently on GPUs at LLM scale, and is essentially hyperparameter-free. Our approach reduces per-layer pruning error by up to 60% over Wanda (Sun et al., 2024) and consistently improves perplexity and zero-shot accuracy across state-of-the-art GPT architectures.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。