Pruning and Compression: Prune-and-Distil
By the end of this lesson you will be able to tell depth pruning from width pruning and structured from unstructured, say why a method that reports impressive sparsity may make your model no faster at all, describe the prune-then-distil recipe in the terms its authors use, judge when it is worth doing rather than starting from a published small model, and name the tools with their state on a stated date. This is the one lesson in the part about what publishers do rather than what you will do this afternoon, and it says clearly which is which.
Part 3 drew the distinction between the three shrinking operations: distillation trains a new model, quantisation rounds the numbers, and pruning removes parameters. This lesson is the third one, and its punchline is that pruning on its own is rarely the answer, and pruning followed by distillation often is.
Two axes, and only one of them makes a model smaller in a useful way
Section titled “Two axes, and only one of them makes a model smaller in a useful way”Depth pruning removes whole layers, or whole transformer blocks. The model has fewer layers afterwards, every one of them full size. It is the crudest thing you can do and it is surprisingly effective, because a deep network’s later layers are more alike than they look.
Depth pruning: whole blocks removed from the middle
- EmbeddingUnchanged. Its size is set by the vocabulary, not by depth.
- Blocks 1 to 12Kept. Early layers do the work that later layers build on and are the least redundant.
- Blocks 13 and 14Removed. A redundancy metric decides which; the middle and later layers are where the candidates are.
- Blocks 15 to 32Kept, and now sitting directly on the output of block 12.
- Output headUnchanged. Vocabulary by hidden size, and usually tied to the embedding.
Width pruning shrinks the dimensions instead: fewer attention heads, a smaller hidden size, a narrower MLP intermediate dimension. Every layer survives and each is thinner. This is more surgical and more disruptive, because it changes the shape of every weight matrix in the model.
Both of these are structured: the removed parts disappear from the computation, so the model is genuinely faster and genuinely smaller on disk and in memory.
Unstructured pruning zeroes individual weights wherever they are, leaving the matrix the same shape with holes in it. This is where the sparsity numbers in the literature come from, and it is also where the disappointment comes from at home.
One-shot pruning: what the methods actually claim
Section titled “One-shot pruning: what the methods actually claim”“One-shot” means no retraining: prune the finished model and use it as it is.
SparseGPT showed the idea works at scale. Its abstract reports that large generative pretrained transformer models can reach “at least 50% sparsity in one-shot, without any retraining, at minimal loss of accuracy”, pruning models such as OPT-175B and BLOOM-176B “in under 4.5 hours” and reaching “60% unstructured sparsity with negligible increase in perplexity”. The paper also notes it works with semi-structured patterns and “is compatible with weight quantization approaches”, which is what makes it interesting on hardware that has a fast path for a specific sparsity pattern.
Wanda made the same kind of result far cheaper to obtain. Its abstract describes pruning “weights with the smallest magnitudes multiplied by the corresponding input activations, on a per-output basis”, and stresses that it “requires no retraining or weight update, and the pruned LLM can be used as is”. The idea is the same one AWQ uses for quantisation, which Part 3 introduced: decide what matters from how the model is used, not from the weights alone.
ShortGPT attacks depth instead. It introduces a “Block Influence (BI)” metric to score how much each layer changes its input, removes the layers that change it least, and its abstract claims that the method “significantly outperforms previous” published pruning methods as of its 2024 publication, while remaining compatible with quantisation. Its title states the finding: layers are more redundant than you expect.
The practical reading of those three, for somebody with one machine:
- Depth pruning produces something you can actually serve, because the result is the same architecture with fewer layers.
- Width pruning produces something you can serve if the tooling writes a valid config, which is the part that breaks.
- Unstructured sparsity produces a research artefact unless you have a runtime that exploits the pattern.
Prune-then-distil, as its authors describe it
Section titled “Prune-then-distil, as its authors describe it”Removing a fifth of a network damages it. The recipe that makes pruning practical is to repair the damage with distillation, using the original model as the teacher.
NVIDIA’s Minitron work is the clearest public account. The first paper asks “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”, and answers it with “a set of practical and effective compression best practices for LLMs that combine depth, width, attention and MLP pruning with knowledge distillation-based retraining”.
The economics are the reason to care. The same abstract reports that deriving 8B and 4B models from an already pretrained 15B model “requires up to 40x fewer training tokens per model compared to training from scratch”, giving “compute cost savings of 1.8x for training the full model family”. Those are figures reported by the authors for their own family and hardware, not a prediction for yours, and the compression factor they work at is 2 to 4 times.
The follow-up paper is the practitioner’s version, applying the recipe to models the authors did not train: it “presents a comprehensive report on compressing the Llama 3.1 8B and Mistral NeMo 12B models to 4B and 8B parameters, respectively, using pruning and distillation”, exploring “(1) depth pruning and (2) joint hidden/attention/MLP (width) pruning”. Its most useful sentence for anyone working outside a model’s original lab is this one:
We found that with no access to the original data, it is beneficial to slightly fine-tune teacher models on the distillation dataset.
That is a real, transferable finding. You will never have the teacher’s pretraining corpus. Bringing the teacher onto the distribution of the data you do have, before using it as a teacher, is a step you can take on any of the four tracks.
The published result is a model you can inspect. The Llama-3.1-Minitron-4B-Width-Base card, read on 2026-09-09, describes a model produced by pruning Llama-3.1-8B, reducing its embedding size and MLP intermediate dimension, then continuing training with distillation over 94 billion tokens from the Nemotron-4 15B corpus, released under the NVIDIA Open Model License Agreement. Note the name: it begins with “Llama”, which is what section 1.b.i of the Llama 3.1 Community License requires of a model created by training on the Llama Materials or their outputs.
When does this beat training small from scratch?
Section titled “When does this beat training small from scratch?”The comparison the Minitron papers make is with training the small model from scratch, and their answer is that pruning plus distillation wins on compute by a wide margin. But that comparison assumes you would otherwise have trained the small model yourself, which is the assumption to examine.
Prune-and-distil is the right answer when:
- You need a size that nobody publishes. A 3B model in a family that ships 1.7B and 4B, or a model with your context length and nothing else changed.
- You have the teacher and a large, relevant corpus, and 94 billion tokens of training is a sentence you can say without laughing.
- The teacher is your own fine-tune, so no published small model has its behaviour.
Training small from scratch is the right answer when: almost never, at home. Part 12 has you do it once, deliberately, at a size where it finishes in an afternoon, because doing it once teaches you what the pipeline is. It is not a route to a useful model on one machine.
Neither is the right answer when: a published model of the size you want already exists in the family you want. This is the common case and it deserves stating plainly. Qwen3 ships 0.6B, 1.7B, 4B, 8B, 14B, 30B and larger. Somebody has already spent the compute to make each of those as good as it can be at that size. Pruning the 8B to make a 4B, at home, will not beat the 4B they published, and the fair comparison is against that model rather than against your own from-scratch attempt.
The tools, and their state on 2026-09-09
Section titled “The tools, and their state on 2026-09-09”This is where the honest answer diverges from the interesting one.
NVlabs/Minitron publishes the recipe and the checkpoints. Its README describes the method as “We prune model embedding size, attention heads, and MLP intermediate dimension, following which, we perform continued training with distillation to arrive at the final models”, and lists releases including Llama-3.1-Minitron-4B in width and depth variants, Mistral-NeMo-Minitron-8B and the Nemotron-H and Nemotron-Nano models, under the NVIDIA Open Model License Agreement. What it gives you is the published models and the description; the pruning and retraining pipeline itself belongs to NVIDIA’s training stack rather than to a script you run on one machine.
LLM-Pruner is the closest thing to a runnable structured-pruning tool for a single machine. Its README describes it as compressing large language models to any size and lists support for Llama-3 and Llama-3.1, Llama-2, LLaMA, BLOOM, Vicuna, Baichuan and TinyLlama. Its most recent notable update, read on 2026-09-09, is dated 27 July 2024, adding grouped-query attention support, with the README noting that pruning results for newer models were still being tested. That is a year and a half old at the time of writing, and the model families this course uses are not on its list.
SparseGPT and Wanda publish reference implementations aimed at reproducing their papers. They produce sparse weights, and the gap between sparse weights and a faster model is the runtime, which for llama.cpp, MLX and the GGUF format is not there.
What to do instead, on your machine
Section titled “What to do instead, on your machine”Three things, in order of usefulness.
Use the published small model. It is the fair baseline and it is usually the winner. Part 4’s landscape lesson and the model reference list what exists.
Distil into it. Everything in this part applies: take the published small model as the student, your large one as the teacher, and move the behaviour rather than the parameters. That is the same goal as prune-and-distil with the pruning step replaced by “somebody already did this properly”.
Quantise. If the problem is that the model does not fit, quantisation is a download or one command, no training, and Part 16 measures exactly what it costs you. Pruning is not a cheaper version of quantisation; it is a much more expensive version with a training run attached.
Distinguish fewer values from less work
Section titled “Distinguish fewer values from less work”Setting weights to zero produces sparsity, but a dense kernel may still load and multiply the full matrix. Removing channels, heads or layers changes shapes and can reduce work directly, provided the resulting architecture is valid and supported by the serving engine. Storage reduction and runtime acceleration are therefore different claims.
Before pruning, define the structural unit, importance criterion and recovery-training budget. Save the original checkpoint and configuration. After pruning, check shapes, residual connections, attention configuration and tokeniser compatibility before evaluating quality. Recovery distillation can compensate for some damage, but its benefit must be measured against the additional training cost.
Use a staged report: original, pruned before recovery, recovered and deployed representation. Compare task quality, file size, resident memory and actual latency at every relevant stage. If zeros compress on disk but latency stays unchanged, report that result accurately. It identifies a mismatch between the sparsity pattern and available kernels, not necessarily a failure of the pruning algorithm’s numerical objective.
Pruning removes parameters along two axes: depth takes whole blocks, width shrinks dimensions inside every block. Both are structured and both make the model genuinely smaller and faster. Unstructured pruning zeroes individual weights and, without a runtime that exploits the pattern, makes nothing smaller or faster on the hardware in this course. One-shot methods are strong and cheap: SparseGPT reaches high sparsity without retraining, Wanda does it with no weight update at all by combining weight magnitude with input activations, and ShortGPT scores whole layers by how little they change their input. Pruning damages a model, and the repair is distillation from the original: the Minitron papers report deriving a family this way with far fewer training tokens than from-scratch training, and note that when the original data is unavailable it helps to fine-tune the teacher on the distillation data first. At home, prune-and-distil is rarely the right call, because a published model of the size you want usually exists and starting from it, then distilling into it, is cheaper and better. The tooling picture on 2026-09-09 supports that conclusion: the maintained pruning tool this course could find last saw a significant update in July 2024 and does not list the model families the course uses.
Check your understanding
Sources for this lesson
9 verified · checked 2026-09-09
- 01Compact Language Models via Pruning and Knowledge Distillation (Muralidharan et al., arXiv:2407.14679)§ Abstractarxiv.org/abs/2407.146792026-09-09
- 02LLM Pruning and Distillation in Practice: The Minitron Approach (Sreenivas et al., arXiv:2408.11796)§ Abstractarxiv.org/abs/2408.117962026-09-09
- 03SparseGPT: Massive Language Models Can Be Accurately Pruned in One-Shot (Frantar and Alistarh, arXiv:2301.00774)§ Abstractarxiv.org/abs/2301.007742026-09-09
- 04A Simple and Effective Pruning Approach for Large Language Models (Sun, Liu, Bair and Kolter, arXiv:2306.11695)§ Abstractarxiv.org/abs/2306.116952026-09-09
- 05ShortGPT: Layers in Large Language Models are More Redundant Than You Expect (Men et al., arXiv:2403.03853)§ Abstractarxiv.org/abs/2403.038532026-09-09
- 06NVlabs/Minitron repository§ README; released modelsgithub.com/NVlabs/Minitron2026-09-09
- 07Llama-3.1-Minitron-4B-Width-Base model card§ Model architecture; training; licencehuggingface.co/nvidia/Llama-3.1-Minitron-4B-Width-Base2026-09-09
- 08LLM-Pruner repository§ README; supported models; update historygithub.com/horseee/LLM-Pruner2026-09-09
- 09Llama 3.1 Community License Agreement§ 1.b Redistribution and Usedeveloper.meta.com/ai/llama3_1/license2026-09-09
Every technical claim on this page was checked against the official documentation of the tool, vendor or model publisher on the date shown, at the version pinned for the course. Where the course disagrees with folklore, the source is how you can tell which one to trust.