
Specify what is being quantized
A label such as four-bit does not describe the whole execution. It may refer to weight storage while activations, accumulators, or selected tensors use higher precision. Other methods also quantize activations or the KV cache.
MLX supports multiple quantization modes, including affine and low-precision floating-point formats. Group size, scale format, and kernel support are part of the model configuration. There is no universal four-bit arithmetic path.
Weight-only quantization can reduce memory capacity and traffic. Actual speed also depends on unpacking, dequantization, matrix shape, and available kernels. A smaller file is not sufficient evidence of a faster workflow.
Work through a simple affine grid
For an illustrative group with minimum m and maximum M, choose b bits and scale s = (M − m) / (2^b − 1). Store q = round((w − m) / s), and reconstruct the value as q × s + m.
At four bits there are 16 codes. If m = −1 and M = 1, s = 2/15. A weight of 0.2 maps to code 9 and reconstructs exactly as 0.2; a weight of 0.25 maps to the same code and reconstructs as 0.2.
For this unclipped nearest-grid scheme, ideal arithmetic gives an error bound of s/2. Quantized scales, clipping, and other formats change that bound. If every weight in a group is equal, the implementation must handle the zero-range case.
The figure uses 16 values so the rounding is visible. Production group sizes vary; 64 is one common configuration, not a requirement of quantization.
- Representable values
- 16
- Step between values
- 3.15e-3
- Mean error (ordinary weights)
- 6.7%
- Stored bits per weight
- 4.50
- 70B-parameter model
- 39 GB
| weight | code | stored as | error | error % |
|---|---|---|---|---|
| 0.00250 | 8 | 0.00403 | 0.00153 | 61% |
| -0.00260 | 6 | -0.00228 | 0.00032 | 12% |
| 0.01280 | 11 | 0.01349 | 0.00069 | 5% |
| 0.00210 | 7 | 0.00087 | -0.00123 | 58% |
| -0.01070 | 3 | -0.01174 | -0.00104 | 10% |
| 0.00720 | 9 | 0.00718 | -0.00002 | 0% |
Include metadata and outliers
Suppose 64 four-bit weights share a 16-bit scale and a 16-bit offset. The codes require 256 bits and metadata adds 32, giving 4.5 bits per weight. Other formats have different overheads.
A large outlier widens a min-to-max grid and reduces resolution for ordinary values. Smaller groups can localize the effect while increasing metadata. Calibration-based methods use additional information about the model's behavior.
GPTQ optimizes reconstruction using approximate second-order information. AWQ uses activation information when choosing weight scaling. Neither turns one bit width into a universal quality guarantee.
Do not assume rounding errors are independent or always cancel. Their effect depends on the weights, inputs, nonlinearities, and the rest of the network.
Distinguish changed text from failed work
The final scores, or logits, determine the next-token distribution. Perturbing close scores can change the selected token. That alters the later context, so continuations may diverge; they need not differ at every later position.
The output illustration is a synthetic experiment, not a benchmark of a deployed model. It demonstrates sensitivity. It cannot establish a production error rate or prove that numbers and names are always the first capabilities to fail.
The model picks earnings. Full precision picked income; the changed context can alter later tokens.
- Same top choice as 16-bit
- 90.7%
- Top-5 overlap
- 88.5%
- Distribution drift (KL)
- 0.0415
- Bytes per weight
- 0.562
Compare formats on the same acceptance set
Hold the base checkpoint, tokenizer, prompt template, task inputs, and scoring rules fixed. Record the quantization format, calibration procedure, runtime version, memory use, latency, and task scores for each candidate.
Evaluate evidence extraction, exact identifiers, structured outputs, and refusal to invent missing fields where those matter.
A distribution metric or a general benchmark is useful context; neither replaces the workflow's acceptance criteria.
Use deterministic tools for calculations at every model precision. Validate units and source values when a model incorporates the result into prose. A formatting error or copied digit can occur without quantization being its cause.
Choose the smallest format that meets the measured quality and operating requirements. Preserve the prior model artifact so a regression has a practical rollback.
Frequently asked questions
Does four-bit mean every operation uses four-bit arithmetic?
No. It identifies a representation for some tensors. Activation, accumulation, and dequantization precision depend on the format and kernel.
Does removing one bit exactly double the error?
No. In the simple fixed-range grid, spacing changes with 1/(2^b − 1). Actual error also depends on the values, clipping, scales, and method.