Compact Language Models via Pruning and Knowledge Distillation

Saurav Muralidharan, Sharath Turuvekere Sreenivas, Raviraj Joshi, Marcin Chochowski, Mostofa Patwary +4 more
7/19/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: NVlabs/Minitron (384 stars, last commit 2025-11-06). 1 more below.

Abstract

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.

View on arXivView PDF

Code Implementations(2)

NVlabs/MinitronCommunity100%

A family of compressed models obtained via pruning and knowledge distillation

38421Jul 17, 202411 months ago

Unofficial implementation of https://arxiv.org/pdf/2407.14679

5412PythonAug 12, 20242 years ago

Similar Papers

Cite this paper

@article{muralidharan2024compact,
  title  = {Compact Language Models via Pruning and Knowledge Distillation},
  author = {Saurav Muralidharan and Sharath Turuvekere Sreenivas and Raviraj Joshi and Marcin Chochowski and Mostofa Patwary and Mohammad Shoeybi and Bryan Catanzaro and Jan Kautz and Pavlo Molchanov},
  year   = {2024},
  eprint = {2407.14679},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2407.14679},
  url    = {http://arxiv.org/abs/2407.14679v2},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.14679.svg)](https://codeofpaper.com/paper/2407.14679)

Discussion