MaskLLM: Learnable Semi-Structured Sparsity for Large Language Models

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Fang, Gongfan, Yin, Hongxu, Muralidharan, Saurav, Heinrich, Greg, Pool, Jeff, Kautz, Jan, Molchanov, Pavlo, Wang, Xinchao
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866915052319145984
author Fang, Gongfan
Yin, Hongxu
Muralidharan, Saurav
Heinrich, Greg
Pool, Jeff
Kautz, Jan
Molchanov, Pavlo
Wang, Xinchao
author_facet Fang, Gongfan
Yin, Hongxu
Muralidharan, Saurav
Heinrich, Greg
Pool, Jeff
Kautz, Jan
Molchanov, Pavlo
Wang, Xinchao
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2409_17481
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle MaskLLM: Learnable Semi-Structured Sparsity for Large Language Models
Fang, Gongfan
Yin, Hongxu
Muralidharan, Saurav
Heinrich, Greg
Pool, Jeff
Kautz, Jan
Molchanov, Pavlo
Wang, Xinchao
Artificial Intelligence
Computation and Language
Machine Learning
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.
title MaskLLM: Learnable Semi-Structured Sparsity for Large Language Models
topic Artificial Intelligence
Computation and Language
Machine Learning
url https://arxiv.org/abs/2409.17481