bit/w
You have a fixed amount of memory. Which is smarter: a small model at 16 bits per weight, or one four times larger at four? In 2022 Tim Dettmers and Luke Zettlemoyer ran more than 35 thousand experiments on models from 19 million to 176 billion parameters. Almost always the larger model at 4 bits won. At three bits and below the advantage melted away. Why are the bits taken from the weights better spent on new weights, and where does this trade stop working? Check it in the calculator and in the “Network” experiment.
Bits per weight is how much memory, on average, one number of a model takes. A model is usually trained in 16 bits but often run in 8, 4 and even 2: each number is rounded to one of a few levels, and a shared scale is stored for a block of numbers. That is quantization. Bits per weight decides whether a model fits on a graphics card or a phone, how fast it writes and how much it costs to run. This sheet has a size calculator for 13 formats, a model picker for your memory, quantizing a block by hand, the layout of floating-point numbers, the outliers that break 8 bits, a neural network that visibly gets dumber with every bit taken away, and a breakdown of where fractional bits come from.
Calculator
How much a model takes in each format
Choose a model or enter your own parameter count, a format and a context length. Some of the weights — the vocabulary and the last layer — are usually kept more precise; that is the second figure. KV cache memory is computed from the model's layout in BF16. The chips below show which device the model fits on entirely.
Which model to take, and in which format
Enter how much memory the device has and how much context you need. For each model the most precise format that still fits together with the cache is chosen. Dettmers's rule: of those that fit, take the largest model, but do not go below 4 bits.
Etymology
How much, a little extra and a weight
Quantization is named after the Latin question “how much?”, and mantissa after a word the Romans used for the small extra added to a purchase. A neural network's weight came from biology, where it described the strength of a connection between neurons.
01 · Definition and the block of weights
Fewer levels — less memory
A trained model is billions of numbers, and almost all of them are small and form the bell of a normal distribution. Storing each in 16 bits means telling apart 65 536 values, although the network needs far fewer. Quantization takes a block of 32 or 64 neighbouring weights, finds the largest number by absolute value and divides the interval into 2^b steps. Each weight is replaced by the number of the nearest step, and the interval itself — the scale — is stored once per block.
This is where fractional bits come from: 32 weights at 4 bits plus a 16-bit scale make 4.5 bits per weight. And this is the main trouble — outliers: one huge number stretches the interval, and all the other weights of the block pile onto two or three middle steps. That is why blocks are made small, scales precise, and the most important weights are kept more carefully. Add an outlier on the left and see what happens to the error.
Lab · three experiments with bits
Floating point, outliers and a neural network
“Float” shows which bits a number in FP32, BF16, FP8 and FP4 consists of, which values the format can write at all and how your number will be rounded. In “Outliers” eight bits break on a couple of huge channels — this is how in 2022 it was found out why large models tolerate naive quantization badly. In “Network” a small network learns in the browser to tell two spirals apart, and then you take bits away from it.
03 · Where fractional bits come from
The layout of formats from the inside
Each format is an agreement on how to pack weights into bytes: how many weights are in a block, how many bits per weight, what the scale is written with and whether there is a second level of scales. The bits per weight come from that. Touch a row — the diagram shows what the bits are spent on.
04 · Quantization in code
Eight tools, eight conventions
A model can be compressed by hand in a few minutes, but the tools write bits differently and run on different hardware. A GGUF file goes to llama.cpp and Ollama, GPTQ and AWQ — to NVIDIA graphics cards via vLLM and transformers, MLX — to the Mac. Touch a row to read the details.
Compress a GGUF with an importance matrix in llama.cpp; load a model in NF4 through bitsandbytes; run FP8 in vLLM with one line.
{code}05 · Writing rules
06 · Neighbouring units
07 · Historical section
From 32 bits to one and a half
A row of pixel cells in each line — how many bits per number became the norm after the event: one cell — one bit.
In August 2022 Tim Dettmers and co-authors from the University of Washington and Meta noticed something strange: in models above six or seven billion parameters a handful of channels with numbers tens of times larger than the rest suddenly appear in the activations. There are few of them, but they are in almost every layer, and the quality rests on them. Ordinary 8-bit quantization stretches the scale to fit these giants, and all the other numbers merge into zero — the model visibly gets dumber.
The solution turned out to be simple: keep the few outlier channels in 16 bits and the rest in eight. This is how a 175-billion-parameter model was first run in 8 bits without loss of quality. Since then almost every new method — SmoothQuant, AWQ, QuaRot rotations — in one form or another fights outliers. Try it yourself in the “Outliers” experiment.
Series · AI
units of language modelsHow a neural network is measured
Bits per weight is the bridge between a model's parameters and everything that follows from them: file size is parameters times bits; writing speed is memory bandwidth divided by those bytes; the price of a token and the energy of an answer fall along with them, and perplexity shows how much quality the compression cost. On the left — details of one run, where each row leads to its own sheet; on the right — the sheets of the series.
Catalogue of quantities
the whole index →The seven SI base units
A drop of acid changes the colour of the juice, salt colours the flame, water freezes at a tap. Below them are all Simetrium sheets, by discipline and alphabetically.
Open the index →





