INT4 Quantization Calculator
Quantize a decimal value to signed INT4 using a scale and zero point. Calculate the resulting 4-bit integer, binary representation, dequantized value and quantization difference.
q is clamped to the signed INT4 range -8 to 7.
What Is INT4 Quantization?
INT4 quantization maps a real-valued number into a signed four-bit integer. Signed INT4 provides only 16 possible integer codes, ranging from -8 through 7.
Because the representation is extremely compact, INT4 can substantially reduce the amount of storage required for numerical data, but the small number of available integer levels also means that quantization error can be larger than with wider integer formats.
INT4 Quantization Formula
This calculator uses affine signed INT4 quantization:
After calculation, q is limited to the valid signed INT4 range:
The represented real value can then be estimated with:
INT4 Quantization Example
1.25
Scale:
0.25
Zero point:
0
1.25 / 0.25 = 5
INT4:
5
Binary:
0101
Dequantized:
1.25
In this example, the value is represented exactly because the original value falls directly on one of the available quantization levels.
Signed INT4 Range
-8 = 1000
Maximum:
7 = 0111
Negative values are displayed using four-bit two’s-complement representation.
INT4 Clamping
If the calculated quantized code exceeds 7, it is clamped to 7. If it falls below -8, it is clamped to -8.
12
INT4 maximum:
7
Stored result:
7 = 0111
Why INT4 Quantization Is Useful
Four-bit quantization can represent two numerical values within one byte when data is packed efficiently. This makes INT4 especially interesting for workloads where model size, memory bandwidth and data movement are major constraints.
The trade-off is precision. With only 16 integer codes available, scale selection has a strong effect on how accurately the original real value can be represented.
INT4 Quantization in AI
INT4 is increasingly used in low-precision machine-learning inference and model compression. Large weight matrices can require substantially less storage when values are represented with four bits instead of 16 or 32 bits.
Quantization parameters determine how those compact integer codes map back to approximate real numerical values during computation.
Important INT4 Notes
The valid integer range is -8 through 7.
Only 16 signed INT4 codes are available.
The scale must be greater than zero.
The zero point must be an integer from -8 through 7.
Values outside the INT4 range are clamped.
Negative binary outputs use four-bit two’s complement.