Quantization
Coarsening the scale numbers are written on to make a model lighter
- Quantization rounds a model's numbers onto a coarser scale. The count of numbers stays exactly the same — only how many digits each one is written with shrinks.
- Fewer digits means less storage, less time moving things around, and faster computation. It's the trick behind AI running on a laptop or a phone.
- In exchange, fine distinctions get blurred. Judgment calls that were close to begin with start to waver, and the drift compounds the longer an answer runs.
- How much to shrink is a choice. Shrink a little and you'll barely notice; shrink a lot and the answer visibly falls apart.
- It's a different move from pruning, which removes unused connections outright. Quantization never throws away a single number.
Contents
1The analogy
A deli's scale reads out to the gram. Braised beans, 312 grams; stir-fried fish cake, 487 grams. With about a hundred containers on the counter, that's a hundred numbers to write in the ledger — long strings of digits that are a hassle to write and pile up into a thick book.
So the scale's markings get made coarser. It only measures in 100-gram steps now, and anything that falls between two marks gets rounded up or down to the nearer one. 312 grams becomes 300; 487 becomes 500. Shorter numbers mean a thinner ledger and a faster hand at totaling things up.
Of course, the weights are now a little off. Even so, you can still tell roughly which container is heavier, and roughly how much of today's side dishes sold. Quantization is this same move — coarsening the scale something is measured on.
2In detail
The count stays the same — only the digits shrink
A model carries billions of numbers set during training. Normally these are stored with generous room down to several decimal places — enough to capture the finest differences, but each one eating up a lot of space.
Quantization moves these numbers onto a coarser scale. Anything that falls between two marks gets rounded to the nearest one. No number disappears, and no connection gets severed. The table keeps exactly as many cells as before — only the numbers written inside those cells get shorter.
Cut the space in half and total size drops by roughly half too. Cutting it to a quarter is common as well. A model that was over ten gigabytes coming down to four or five gigabytes is often the difference between "won't run" and "runs fine" on a personal computer.
Where you set the marks is what separates good from bad
Making the scale coarser means deciding what range of values to spread the marks across. If most numbers cluster near zero but the marks get stretched out evenly across a huge range, that crowded region near zero ends up crammed into a single mark, wiping out exactly the detail that mattered.
So the mark spacing usually gets set separately, layer by layer or even row by row. Sometimes a handful of unusually large outlier values get left at full precision while everything else gets coarsened. Even at the same digit count, how carefully this step is done can leave a real gap in output quality.
Often a small batch of sample data gets run through first just to measure where values cluster, and the marks get set from that. No retraining happens, so the whole process can take minutes rather than hours.
Why AI runs on laptops and phones
When running a model, the biggest time cost usually isn't the computation itself — it's pulling the numbers out of memory. Shorter numbers mean more of them can be moved in the same amount of time, so the speed of getting an answer noticeably picks up.
Whether everything fits in graphics memory also hinges on this. If a model can't fit, pieces have to keep swapping in and out, which drags speed down badly. Chat AIs that run right in your browser, translators that work with no internet connection, and photo-sorting features on your phone are, more often than not, running a model with a coarsened scale.
Knowing what gets given up
Getting lighter comes at a cost. Rounding pulls each number a little away from its original value, and that drift accumulates as it passes through layer after layer. Producing even a single line of an answer passes through dozens of layers, so a gap that's invisible at the start becomes noticeable by the end.
Judgment calls that were close to begin with feel it the most. It shows up clearly in things like long arithmetic or code, where a single wrong character throws off the whole result, and in answers that run very long. In casual conversation or summarizing, on the other hand, the difference is often hard to notice at all.
A different move from pruning
Since both make a model lighter, quantization and pruning often come up together — but they touch different things. Quantization never throws away a single number; it leaves every one in place and only coarsens how they're written. Pruning does the opposite — it removes unused connections outright, cutting down the count.
Neither gets in the other's way, so they're often combined: trim away unused connections first to shrink the count, then coarsen the scale of what's left.
3More precisely
Quantization moves weights and intermediate values stored as floating-point numbers into a representation with fewer integer bits. It expresses a range of values using a step size and a reference point, and maps each original value onto its nearest step. There's a version applied after training finishes, and another that assumes a coarse scale from the start and trains with that in mind.
The analogy breaks down in a place too. A scale's markings stay the same spacing from start to finish, but real quantization measures where a layer's values actually cluster and sets a different spacing for each one. And a side dish's weight error ends there, but a model's number becomes the input to the next layer, so the drift carries forward. Some approaches only shrink numbers for storage and convert them back to full precision at calculation time — in cases like that, size shrinks but speed barely improves. Whichever approach is used, the model gets evaluated again afterward to check how much it actually shifted.
Choosing how far to shrink is also less like choosing a single scale and more like choosing several at once — one part of a model can often tolerate a coarser scale than another, and treating the whole thing uniformly leaves quality on the table either way.
4Try it yourself
- WebLLM Chat (a chat AI that runs in your browser) ailearn.space No install needed — it runs right in the browser. You can feel how coarsening the scale is what lets it fit on a laptop
- Netron (model structure viewer) ailearn.space Open a model file and look for the marker showing how many digits each layer's numbers are stored in
5Common misconceptions
It's easy to think quantizing a model makes it dumber, but actually up to a reasonable point, the difference is hard to notice in everyday conversation.
It's easy to think quantization cuts a piece out of the model, but actually it doesn't throw away a single number — it only shortens how many digits each one is written with.
It's easy to think smaller size always means faster speed, but actually if the numbers get converted back to full precision at calculation time, there's barely any speed gain at all.
7One-line summary
In shortQuantization coarsens the scale a model's numbers are written on, trading a little fine-grained accuracy for less size and more speed.
Spotted an error or have a better analogy? Suggest an edit · Last updated2026-09-02