Skip to content
Friendly disclaimer: flozi00 TechHub is a solo side-project next to a full-time job — personal learning notes, no official statements. Verify critical steps yourself.

NVFP4 vs INT4 Explained Visually

Understand four-bit quantization through number lines, rounding and shared scales. See how NVFP4 differs from an INT4 integer representation.

2 min readflozi00
aibeginnervisual-learningquantizationnvfp4int4guide

Four bits provide 16 possible bit patterns. How those patterns represent numbers depends on the format. Quantization stores values using a smaller set of available numbers, usually with additional scaling information. A value between two available numbers must be rounded.1

Think of a ruler with only a few marks: the stored result lands on a mark, and the distance from the original value is the rounding error. This lesson compares two different arrangements of those marks.

Watch · explore · understand

INT4 & NVFP4: same bit count, different numbers

Move a number and see what gets lost when it is stored.

AI-assisted learning visualization · simplified worked example

Step 1 / 5Four bits

Four bits give 16 bit patterns. What matters is the number each pattern represents: an integer for INT4 or a tiny floating-point number for FP4.

INT40001

16 integers: −8 to +7. With a shared scale, their spacing is uniform.

FP4 · E2M10001

1 sign bit, 2 exponent bits, 1 fraction bit. Unequal spacing; +0 and −0 share the same numerical value.

Illustrative comparison at the same scale. For NVFP4: the selected block scale, tensor scale = 1. This is not model calibration.

INT41 × 1 = 1
-808
Absolute rounding error: 0.4
NVFP40.5 × 1 × 1 = 0.5
-808
Absolute rounding error: 0.1

Diamond = input · dot = stored value after rescaling. FP4 can offer finer steps near zero; at 5, INT4 with scale 1 is exact.

Inside an NVFP4 blockFP32 × 1

The tensor scale is shared by all blocks. Here it is set to 1 for illustration.

Shared: one FP8 E4M3 block scale · 1× · 8 bits

16 × 4 + 8 = 72 bits
That is 4.5 bits per value including the block scale. Add 32 bits once per tensor and possible layout or runtime overhead.

More detail: assumptions, values and limits

INT4 shows signed integers with symmetric scaling (zero point 0): q = round(x / s), clipped to −8…7; reconstruction is q × s. Other INT4 schemes can use different groups and zero points and also need metadata.

FP4 E2M1 magnitudes: 0, 0.5, 1, 1.5, 2, 3, 4, 6, with either sign. The 16 bit patterns give 15 distinct numbers. Both formats in this demo round to nearest; exact ties go to the even least significant bit.

This shows the common NVFP4 layout with 16 values per block. Some training recipes use two-dimensional scaling. A scalar rounding error is not a model-quality measurement. Throughput also depends on hardware and kernels; weight compression does not automatically set KV-cache precision.

Primary sources: NVIDIA NVFP4 · TensorRT quantization · Transformer Engine

Set your own pace. Pause at any time or select a step directly.

INT4: evenly spaced integer steps

Signed INT4 can represent the integers from −8 through 7. In the symmetric example used here, a positive scale multiplies those integers. With a scale of 0.5, integer 3 reconstructs the value 1.5. The reconstructed numbers are still evenly spaced.1

INT4 alone does not specify a complete quantization method. Implementations choose scales, group sizes and sometimes zero points, which shift the integer range. The diagram uses an explicitly simplified symmetric example; it does not represent every INT4 model file.

NVFP4: floating-point steps plus shared scales

NVFP4 uses a four-bit E2M1 value: one sign bit, two exponent bits and one fraction bit. Its unscaled magnitudes are 0, 0.5, 1, 1.5, 2, 3, 4 and 6. Negative values use the sign bit. There are 16 patterns but 15 distinct numerical values because positive and negative zero represent the same number.23

The marks are closer together near zero and farther apart for larger magnitudes. The common NVFP4 layout also supplies an FP8 scale shared by 16 values and an FP32 scale for the tensor, the array containing those blocks. Reconstruction multiplies the small E2M1 value by both scales.2

Watch the rounding, then the scale

Follow the input value to its reconstructed value on each number line. The displayed error is a difference between two numbers, not a prediction of a model's answer quality. A value may land closer to an INT4 mark or an FP4 mark depending on the input and scales.

Scaling stretches or shrinks the number line. For example, an E2M1 value of 1.5 with block scale 2 and tensor scale 0.5 reconstructs 1.5. These deliberately simple values illustrate the multiplication; they are not a calibration recipe or a benchmark.

What “4-bit” leaves out

Shared scales need storage too. For the illustrated NVFP4 layout, 16 four-bit values plus one eight-bit block scale occupy 72 bits: 4.5 bits per value, before the tensor scale and layout overhead. This is arithmetic for that layout, not a whole-model memory estimate. INT4 schemes also carry metadata.21

Neither format guarantees better model quality or faster execution. Calibration, the model, supported kernels and hardware matter. Quantizing model weights also does not automatically change the KV cache's storage format.

Continue with the quantization guide, revisit the KV-cache lesson, or return to the visual learning path.

Sources

Footnotes

  1. NVIDIA TensorRT, Quantization schemes. ↩ ↩2 ↩3

  2. NVIDIA, Introducing NVFP4 for Efficient and Accurate Low-Precision Inference. ↩ ↩2 ↩3

  3. Open Compute Project, Microscaling Formats specification, FP4 encoding. ↩