arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2407.14679cs.CLcs.AIcs.LG

通过剪枝与知识蒸馏实现紧凑语言模型

Compact Language Models via Pruning and Knowledge Distillation

NVIDIA(英伟达)

Saurav Muralidharan, Sharath Turuvekere Sreenivas, Raviraj Joshi, Marcin Chochowski, Mostofa Patwary, Mohammad Shoeybi, Bryan Catanzaro, Jan Kautz, Pavlo Molchanov

AI总结:

本文提出通过剪枝与知识蒸馏压缩LLM,使用少于3%的训练数据重新训练,以2-4倍压缩Nemotron-4模型,节省1.8倍计算成本,并提升MMLU分数达16%。

摘要:

当前,针对不同部署规模和尺寸的大语言模型(LLMs)通常需要从头开始训练每个变体,这极其耗费计算资源。在本文中,我们研究是否可以将现有LLM进行剪枝,然后使用原始训练数据的一小部分(<3%)重新训练,作为重复完整重新训练的合适替代方案。为此,我们为LLMs开发了一套实用且有效的压缩最佳实践,该实践结合了深度、宽度、注意力头和MLP剪枝以及基于知识蒸馏的重新训练;我们通过针对每个轴线的剪枝策略、组合轴线的方法、蒸馏策略以及搜索最优压缩架构的技术的详细实证探索,得出了这些最佳实践。我们使用该指南将Nemotron-4系列LLMs压缩2-4倍,并在各种语言建模任务上将其性能与类似规模的模型进行比较。使用我们的方法从已预训练的15B模型导出8B和4B模型,每个模型所需的训练token数比从头开始训练最多减少40倍;这导致训练完整模型系列(15B、8B和4B)的计算成本节省1.8倍。与从头训练相比,Minitron模型在MMLU分数上表现出高达16%的提升,性能与其他社区模型(如Mistral 7B、Gemma 7B和Llama-3 8B)相当,并优于文献中的最先进压缩技术。我们已在Huggingface上开源了Minitron模型权重,并在GitHub上提供了相应的补充材料,包括示例代码。

英文摘要:

Large language models (LLMs) targeting different deployment scales and sizes are currently produced by training each variant from scratch; this is extremely compute-intensive. In this paper, we investigate if pruning an existing LLM and then re-training it with a fraction (<3%) of the original training data can be a suitable alternative to repeated, full retraining. To this end, we develop a set of practical and effective compression best practices for LLMs that combine depth, width, attention and MLP pruning with knowledge distillation-based retraining; we arrive at these best practices through a detailed empirical exploration of pruning strategies for each axis, methods to combine axes, distillation strategies, and search techniques for arriving at optimal compressed architectures. We use this guide to compress the Nemotron-4 family of LLMs by a factor of 2-4x, and compare their performance to similarly-sized models on a variety of language modeling tasks. Deriving 8B and 4B models from an already pretrained 15B model using our approach requires up to 40x fewer training tokens per model compared to training from scratch; this results in compute cost savings of 1.8x for training the full model family (15B, 8B, and 4B). Minitron models exhibit up to a 16% improvement in MMLU scores compared to training from scratch, perform comparably to other community models such as Mistral 7B, Gemma 7B and Llama-3 8B, and outperform state-of-the-art compression techniques from the literature. We have open-sourced Minitron model weights on Huggingface, with corresponding supplementary material including example code available on GitHub.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑