arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.17481cs.AIcs.CLcs.LG
收藏

MaskLLM: 面向大语言模型的可学习半结构化稀疏性方法

MaskLLM: Learnable Semi-Structured Sparsity for Large Language Models

NVIDIA(英伟达);National University of Singapore(新加坡国立大学)

Gongfan Fang, Hongxu Yin, Saurav Muralidharan, Greg Heinrich, Jeff Pool, Jan Kautz, Pavlo Molchanov, Xinchao Wang

AI总结:

针对大语言模型参数冗余、推理计算开销高的问题,提出基于Gumbel Softmax的可学习半结构化剪枝方法MaskLLM,兼具高质量掩码与跨域迁移能力,在多款主流LLM的2:4稀疏任务上性能显著优于现有方法。

摘要:

大语言模型(LLM)的特点是参数量庞大,通常会带来显著的冗余性。本研究提出MaskLLM,这是一种可学习的剪枝方法,可在LLM中构建半结构化(或称“N:M”)稀疏性,旨在降低推理阶段的计算开销。MaskLLM并未提出新的重要性评估准则,而是通过Gumbel Softmax采样将N:M模式显式建模为可学习分布。该方法支持在大规模数据集上进行端到端训练,具备两大显著优势:1)高质量掩码——本方法可有效适配大规模数据集,学习得到精准的掩码;2)可迁移性——对掩码分布的概率建模使得稀疏性能够跨领域或跨任务进行迁移学习。我们在LLaMA-2、Nemotron-4、GPT-3等多款参数规模从8.43亿到150亿不等的LLM上,采用2:4稀疏配置对MaskLLM进行了评估,实验结果表明该方法相比现有最优方法实现了大幅性能提升。例如,现有主流方法在Wikitext数据集上的困惑度(PPL)达到10及以上,而稠密模型的PPL为5.12;MaskLLM仅通过在权重冻结的条件下学习掩码,就将PPL降至显著更低的6.72。此外,MaskLLM的可学习特性支持生成定制化掩码,可将2:4稀疏性无损应用于下游任务或领域。代码已开源至https://github.com/NVlabs/MaskLLM。

英文摘要:

Large Language Models (LLMs) are distinguished by their massive parameter counts, which typically result in significant redundancy. This work introduces MaskLLM, a learnable pruning method that establishes Semi-structured (or ``N:M'') Sparsity in LLMs, aimed at reducing computational overhead during inference. Instead of developing a new importance criterion, MaskLLM explicitly models N:M patterns as a learnable distribution through Gumbel Softmax sampling. This approach facilitates end-to-end training on large-scale datasets and offers two notable advantages: 1) High-quality Masks - our method effectively scales to large datasets and learns accurate masks; 2) Transferability - the probabilistic modeling of mask distribution enables the transfer learning of sparsity across domains or tasks. We assessed MaskLLM using 2:4 sparsity on various LLMs, including LLaMA-2, Nemotron-4, and GPT-3, with sizes ranging from 843M to 15B parameters, and our empirical results show substantial improvements over state-of-the-art methods. For instance, leading approaches achieve a perplexity (PPL) of 10 or greater on Wikitext compared to the dense model's 5.12 PPL, but MaskLLM achieves a significantly lower 6.72 PPL solely by learning the masks with frozen weights. Furthermore, MaskLLM's learnable nature allows customized masks for lossless application of 2:4 sparsity to downstream tasks or domains. Code is available at https://github.com/NVlabs/MaskLLM.

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

↑