提出连续可微的稀疏训练框架,让大模型高效生成硬件友好的稀疏结构。
CAST: Continuous and Differentiable Semi-Structured Sparsity-Aware Training for Large Language Models
- 全程联合优化稀疏模式与权重,实现平滑渐进式稀疏化
- 2:4稀疏下LLaMA2-7B仅用2%训练数据,困惑度仅增0.09
- 适配量化与微调场景,适合资源受限的部署需求
稀疏感知训练能将大语言模型转化为硬件友好的稀疏结构,降低推理时的延迟和内存占用。本文提出连续自适应稀疏训练器(CAST),一种针对半结构化(或“N:M”)稀疏模型的全连续可微稀疏感知训练框架。不同于以往分步优化稀疏模式与权重的方法,CAST在训练过程中实现无缝联合优化,并逐步将模型转化为目标稀疏格式。具体包括三个核心组件:1)AdamS,一种利用自适应L1衰减促进所有参数均匀稀疏化的稀疏感知优化器;2)权重缩放模块,缓解衰减带来的幅度下降问题,同时保持期望的稀疏模式;3)知识蒸馏,以密集模型作为自教师提升训练效率。我们在多个模型族(125M至13B参数)上评估2:4稀疏模式下的CAST表现。结果表明,在困惑度和零样本准确率方面均显著优于现有最优方法,且仅需极少训练资源。特别地,在LLaMA2-7B上,2:4稀疏模型仅使用原始预训练数据的2%,困惑度增加0.09,零样本准确率反而提升0.36%。此外,我们建立了准确可靠的实证缩放定律,可在充分训练资源下预测稀疏模型性能。最后,通过量化与微调场景验证了稀疏模型的实际适用性。
原文摘要 · Abstract (English)
Sparsity-aware training is an effective approach for transforming large language models (LLMs) into hardware-friendly sparse patterns, thereby reducing latency and memory consumption during inference. In this paper, we propose Continuous Adaptive Sparse Trainer (CAST), a fully continuous and differentiable sparsity-aware training framework for semi-structured (or "N:M") sparse models. Unlike previous approaches that optimize sparsity patterns and weights separately, CAST enables seamless joint optimization during training, while progressively transforming the model into the desired sparsity format. Specifically, CAST introduces three key components: 1) AdamS, a sparsity-aware optimizer that leverages adaptive L1 decay to promote uniform sparsification across all parameters; 2) Weight Scaling, a module designed to mitigate the magnitude reduction caused by decay while preserving desired sparsity patterns; 3) Knowledge Distillation, which employs the dense model as a self-teacher to enhance training efficiency. We evaluate CAST under 2:4 sparsity patterns across multiple model families, ranging from 125M to 13B parameters. Our results demonstrate significant improvements over previous state-of-the-art methods in both perplexity and zero-shot accuracy with minimal training resources. Notably, on LLaMA2-7B, our 2:4 sparse model achieves a negligible perplexity increase of 0.09 and a 0.36% gain in zero-shot accuracy compared to the dense model using only 2% of the original pretraining tokens. Additionally, we establish an accurate and robust empirical scaling law to predict sparse model performance given adequate training resources. Finally, we demonstrate the practical applicability of our sparse models by evaluating them under quantization and fine-tuning scenarios.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。