---
id: 17249
lang: en
title: "LLM Compression Without Quantization: Pruning Cuts MLP Width from 8192 to 2048 Channels"
published_at: "2026-11-21 02:02:41"
source_name: "Machine Learning Mastery"
source_url: "https://machinelearningmastery.com/model-compression-beyond-quantization/"
canonical_url: "https://news.hamidun.com/en/news/17249"
categories: ["llm", "hardware"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# LLM Compression Without Quantization: Pruning Cuts MLP Width from 8192 to 2048 Channels

> **Краткая суть (BLUF):** You can cut LLM inference costs without quantization by physically removing part of the model. A Machine Learning Mastery walkthrough shows, in a teaching example, how the intermediate width of an MLP block, where the vector expands and then compresses back, is trimmed from 8192 to 2048 channels, a 4x reduction. But real gains only materialize if the runtime can execute the resulting structure efficiently. So check support in your own stack first, and only then prune the model.  • Pruning: zeroed weights speed things up only with sparse kernels • Structured pruning removes channels, heads, and layers, and the model stays dense • Distillation: the student copies the teacher's probabilities, not just a single token

When the GPU bill climbs, the first thing people reach for is quantization: storing weights in 8 or 4 bits instead of 16. But that is only one lever. The second is making the model itself smaller, either by removing some weights or whole blocks, or by training a compact model to mimic a large one. Adrian Tam covers this topic in a Machine Learning Mastery article: pruning, structured pruning, and knowledge distillation.

The numbers in the headline come from the author's teaching example, not from a measurement on a real model. In a transformer, each layer has an MLP block: it first expands the vector to a large "intermediate" width, then compresses it back. Suppose that intermediate part has 8192 channels. If you keep 2048, the block becomes 4 times narrower. How much this translates into speed and quality depends on the model and the hardware, and that is what the article is about.

## Why shrink a model at all

A smaller model reads fewer weights from memory. It can take up less space for the KV cache, which depends on the number of layers, KV heads, and head size. It also lets you run larger batches or use cheaper hardware. The difficulty lies elsewhere: you have to preserve the behavior the application depends on, and verify that the runtime executes the resulting structure efficiently.

## Pruning: zero out the small stuff

The simplest variant is magnitude pruning. The assumption is that weights with small absolute values influence the output less. In the author's example, for a 1024×1024 matrix, a quantile threshold is chosen and half the weights are zeroed. The matrix is then converted to the CSR sparse format, which stores only the nonzero values along with row and column indices.

Here is the trap. After zeroing, the tensor still sits in memory as a dense array, so the zeros save nothing. The sparse format saves memory only if the index overhead weighs less than the removed values. It speeds things up only if an efficient sparse kernel exists for your matrix shape, sparsity level, data type, and GPU. Otherwise, the model looks slimmer in a report but doesn't get faster in production. To check results, the author compares sparse and dense multiplication with a tolerance for numerical error, since the summation order differs between them.

## Structured pruning: cut out whole blocks

The alternative is to remove not individual weights but whole units: attention heads, MLP channels, or layers. The result can be assembled into a smaller dense model, and such models are easier to accelerate on any hardware.

In an MLP, each intermediate channel is created by one row of the first matrix and consumed by one column of the second. So if you remove a row, you must also remove its paired column. The author's code ranks rows by norm and keeps the largest ones. With keep_channels=2048, the width of 8192 shrinks to 2048.

There is an important caveat. This code preserves shape compatibility but does not prove that the removed channels were redundant. Real methods evaluate layer outputs and their interactions, and fine-tune the model after cutting. Attention heads are trickier: with GQA, several query heads share one KV head, and arbitrary removal breaks that grouping. Removing layers changes the depth of the residual stream and may require retraining the connections between the remaining layers.

Another nuance: awkward hidden sizes sometimes run slower than slightly larger sizes that suit the hardware better. It's worth aligning channel counts with the tile-size requirements of matrix-multiplication kernels.

## Distillation: teach a small model from a large one

The third path is to take a large teacher model and train a smaller student model. The student can learn from the teacher's probability distribution (it sees not only the best token but also which other options the teacher considered plausible), from intermediate representations, or from generated data.

The example uses the classic distillation loss: the Kullback–Leibler divergence between the teacher's and student's distributions, softened by a temperature T and multiplied by T². It equals zero when the distributions match and grows as they diverge. The author also names the constraints: the teacher and student must share a vocabulary and the same token positions. Obtaining teacher outputs also takes time, even though no gradients are computed for the teacher. The example uses two randomly initialized GPT-2-style models and shows only a single training step, which produces no useful model. A real experiment requires a pretrained teacher and representative text.

---
- **Первоисточник:** [Machine Learning Mastery](https://machinelearningmastery.com/model-compression-beyond-quantization/)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/17249
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
