Home / Learn / AI Chips / Quantization and AI Hardware
On this page
What quantization isWhy hardware caresThe common formatsIntegers and floating pointHow models are quantizedThe trade-offsWhat to check on a chipCommon questionsRelated guidesQuantization and AI Hardware: INT8, FP8 and FP4
Quantization shrinks the numbers inside an AI model so it runs faster, uses less memory and draws less power. A model trained with 32-bit numbers can often be converted to 8-bit or even 4-bit numbers with only a small loss in quality. INT8, FP8 and FP4 are names for some of these smaller formats, and which ones a chip supports shapes what it can run efficiently.
What quantization is
A neural network is a large collection of numbers, called weights, plus the values that flow between its layers as it runs. During training these are normally stored as floating-point numbers with 16 or 32 bits each, which can represent a very wide range of values very finely.
Quantization replaces them with numbers that use fewer bits. Fewer bits means fewer distinct values can be represented, so each original number is rounded to the nearest one available. The model becomes an approximation of itself.
The surprising part is how well this works. Neural networks are tolerant of small errors in individual numbers, because each output depends on a great many of them and the errors tend to average out.
Why hardware cares
Number size affects almost every part of a chip.
- Memory. Going from 32-bit to 8-bit numbers cuts the memory a model needs by a factor of four. A model that did not fit on a device may now fit.
- Memory bandwidth. Smaller numbers mean less data to read for every operation. For large models, the speed of reading memory is often the real limit on performance.
- Arithmetic circuits. A multiplier for 8-bit integers is far smaller and uses far less energy than one for 32-bit floating point. More of them fit in the same area.
- Power. Less data moved and simpler arithmetic both reduce energy for each answer.
This is why inference chips are built around low-precision arithmetic, and why the formats a chip supports are a central part of its design.
The common formats
| Format | Bits | Type | Typical use |
|---|---|---|---|
| FP32 | 32 | Floating point | Training, reference accuracy |
| FP16 and BF16 | 16 | Floating point | Training and inference |
| INT8 | 8 | Integer | Efficient inference, especially on NPUs |
| FP8 | 8 | Floating point | Inference and some training |
| FP4 and INT4 | 4 | Floating point or integer | Aggressive compression of large models |
INT8 stores each value as an 8-bit integer, one of 256 evenly spaced levels. A scale factor maps those levels back to real values. It is the longest-established format for efficient inference and is supported by nearly all inference hardware.
FP8 is an 8-bit floating-point format. Like larger floating-point numbers, it spends some bits on an exponent, so its levels are packed closely near zero and spread out for larger values. That suits data with a wide range, which is common in large language models. There is more than one FP8 variant, differing in how the bits are divided.
FP4 pushes the same idea down to 4 bits, which allows only 16 distinct values. Used carefully, usually with a shared scale factor for each small group of numbers, it can halve memory use again compared with 8-bit formats.
Integers and floating point
The choice between integer and floating-point formats is a choice about where precision is spent.
Integer formats space their levels evenly. They work well when values fall within a predictable range, and the hardware for them is simple.
Floating-point formats concentrate precision near zero and give up precision for large values. They cope better with data whose range varies widely, at the cost of slightly more complex circuits.
How models are quantized
There are two main approaches.
Post-training quantization takes a finished model and converts it. A small sample of data is run through to see what range of values each layer produces, and the scale factors are set accordingly. It is quick and needs no retraining, but quality can suffer at very low bit widths.
Quantization-aware training simulates the rounding during training, so the model learns weights that still work well after conversion. It takes more effort and gives better results, especially at 4 bits.
Many deployments also use mixed precision. Sensitive layers keep more bits, and the rest are reduced further. The hardware and its software need to support this for it to be useful.
The trade-offs
- Accuracy. Each reduction in bits risks some loss of quality. At 8 bits the loss is usually small. At 4 bits it depends heavily on the model and the method.
- Calibration effort. Good results require choosing scale factors carefully and testing the outcome.
- Hardware support. A format only helps if the chip has circuits for it. Running an unsupported format means converting back to a larger one, which loses the benefit.
- Model sensitivity. Some models and some layers tolerate quantization much better than others.
What to check on a chip
When an accelerator claims support for low-precision formats, a few details matter.
- Which formats run natively. Native support means dedicated circuits, not emulation.
- Whether mixed precision is supported. This affects how well accuracy can be preserved.
- How performance figures were measured. Peak ratings are often quoted at the lowest precision.
- What the software can do. The toolchain has to be able to quantize your model and map it to the hardware.
Common questions
Does quantization reduce accuracy?
Usually a little. With 8-bit formats and good calibration, the difference is often hard to notice. At lower bit widths the loss can be larger and depends on the model and the method used.
What is the difference between INT8 and FP8?
Both use 8 bits. INT8 spaces its values evenly, and FP8 spaces them more finely near zero and more coarsely for large values. FP8 handles wide-ranging data better, and INT8 needs simpler hardware.
Can models be trained in low precision?
Partly. Training commonly uses 16-bit formats, and 8-bit floating point is used for some parts. Very low precision is mainly an inference technique, because training depends on small updates that coarse formats cannot represent.