INT4 Quantization Calculator (Signed Symmetric) – Free

This INT4 quantization calculator maps a list of real numbers onto 4-bit signed integers with one shared scale, then converts them back so you can see how much precision 15 levels cost.

How to use the INT4 quantization Calculator tool

  1. Paste your numbers into the Numeric values box. Separate them with commas, spaces or line breaks.
  2. Select Quantize. To try it without data, select Example, which loads -1, -0.2, 0, 0.7, 1.
  3. Read the Scale line, then compare the Quantized integers with the Dequantized values to see the error per element.
  4. Select Copy to take the four result lines to your notebook or test file.

How symmetric INT4 quantization works

Four bits in two's complement cover -8 to 7. Symmetric quantization drops -8 and uses -7 to 7, so that positive and negative values get the same step and real zero maps to integer zero. That leaves 15 usable levels.

The tool finds the largest absolute value in your list and divides it by 7. The result is the scale, the real-world size of one integer step. Each value is divided by the scale, rounded to the nearest integer and limited to -7 to 7. The Zero point line is always 0, because a symmetric scheme has no offset. Multiplying a code by the scale gives the dequantized value, shown to nine significant digits.

Worked example with five values

With the example list, the largest magnitude is 1, so the scale is 1/7. The value 0.7 divided by the scale is 4.9 and rounds to 5, which dequantizes to 0.714. The value -0.2 becomes -1.4, rounds to -1 and comes back as -0.143, an error of 0.057. The worst case for any element is half a step, here about 0.071.

Input: -1, -0.2, 0, 0.7, 1

Scale: 0.14285714285714285
Zero point: 0
Quantized: -7, -1, 0, 5, 7
Dequantized: -1, -0.142857143, 0, 0.714285714, 1

Outliers, ties and other effects of 15 levels

With so few levels, the shape of the data matters more than at 8 bits. These are the effects you will see most often in the output.

  • One outlier sets the scale for everything. For the list 1e3, 2 the codes are 7, 0: the small value vanishes.
  • Values smaller than half the scale become 0. In the example that threshold is about 0.071.
  • Exact ties round toward positive infinity: 2.5 becomes 3 and -2.5 becomes -2. Libraries that round half to even can differ by one.
  • A list of zeros gives a scale of 1 and all-zero codes instead of a division by zero.

Input rules and limits

Each item must be a finite decimal number, optionally in scientific notation such as 2.5e-3. NaN and Infinity are refused with the message Value must be finite. A comma at the very start or end of the list leaves an empty item and is refused too. The box takes at most 100,000 values, and the list is processed in your browser without being uploaded.

The whole list shares one scale, as in per-tensor quantization. For per-channel or per-group schemes, run each channel or group as its own list.

Where 4-bit integers are used

INT4 is mostly a storage format for neural network weights. Large language models are often distributed with weights near 4 bits, roughly a quarter of their 16-bit size. Production formats add refinements this calculator leaves out, such as a scale per small block of weights, offsets, or error-aware rounding. Use it to check hand calculations, not to predict the accuracy of a specific model.

Frequently asked questions

What is the range of INT4?

A signed 4-bit integer holds -8 to 7. This calculator uses the symmetric part, -7 to 7, so the same scale serves both signs.

How big is the INT4 rounding error?

At most half the scale for each value. Since the scale is the largest magnitude divided by 7, the worst-case error is about 7.1 percent of that magnitude. Compare the Dequantized line with your input to see the actual error.

How is INT4 different from INT8 quantization?

The method is the same but the divisor changes: 7 for INT4 and 127 for INT8. INT8 steps are about 18 times finer, so the error drops by the same factor while storage per value doubles.

Can I paste a column of numbers from a spreadsheet?

Yes. Line breaks, tabs and spaces all work as separators, alone or mixed with commas. Each cell must hold a plain number. Remove thousands separators first, because 1,000 is read as two values, 1 and 0.

Related tools