NF4, short for 4-bit NormalFloat, is a 4-bit data type for storing neural network weights whose 16 representable values are placed at quantiles of a normal distribution, so that each level is used about equally often by typical pretrained weights. In Edge AI and in fine-tuning on limited hardware, NF4 lets a large language model occupy roughly a quarter of its 16-bit memory footprint while losing less accuracy than a uniformly spaced 4-bit integer format.
The format was introduced together with QLoRA, a method for fine-tuning quantized models with low-rank adapters, and is also known as NormalFloat4. It is a weight-only quantization scheme: weights are stored in NF4, but arithmetic is performed in a higher precision such as BF16 after the weights are dequantized on the fly.
How NF4 places its quantization levels
NF4 rests on the observation that pretrained weights are approximately normally distributed with a mean near zero. A uniform 4-bit grid wastes levels in the tails, where few weights lie, and spaces levels too coarsely near zero, where most weights cluster. NF4 instead derives its levels from the quantile function of the standard normal distribution, which makes it close to information-theoretically optimal for zero-centered normal data.
The levels are normalized to the range from minus one to plus one. The construction is deliberately asymmetric: it uses eight positive levels and seven negative levels plus an exact zero, because representing zero exactly avoids errors for padding values and pruned weights. Before mapping, each block of weights is divided by its absolute maximum, so the largest weight in the block lands on plus or minus one.
| Property | Value | Effect |
|---|---|---|
| Bits per weight | 4 | 16 representable levels |
| Level spacing | Normal quantiles | Dense near zero, sparse in tails |
| Value range | -1.0 to 1.0 | Scaled per block by absmax |
| Zero representation | Exact | No error on zero weights |
| Typical block size | 64 weights | Limits the impact of outliers |
Block-wise scaling and double quantization
NF4 is applied in blocks of consecutive weights, each with its own scaling constant. Small blocks protect accuracy because a single outlier weight only stretches the scale of its own block. The cost is storage for the constants: with a block size of 64 and a 32-bit constant per block, the overhead is 0.5 bits per parameter.
Double quantization reduces that overhead by quantizing the scaling constants themselves to 8-bit floats in a second level of blocks, typically of 256 constants. This lowers the overhead to roughly 0.127 bits per parameter, which saves around 3 GB on a 65-billion-parameter model. The table compares effective storage costs.
| Configuration | Weight bits | Constant overhead | Effective bits |
|---|---|---|---|
| BF16 baseline | 16 | None | 16 |
| INT8 per-channel | 8 | Negligible | About 8 |
| NF4, block size 64 | 4 | 0.5 | About 4.5 |
| NF4 with double quantization | 4 | 0.127 | About 4.13 |
How NF4 compares with other 4-bit formats
NF4 is one of several ways to reach 4-bit quantization. Its distinctive trait is that it requires no calibration data, because the level placement is fixed in advance. Calibration-based methods such as GPTQ and AWQ adjust rounding or scaling using sample activations and often achieve slightly lower perplexity at the same bit width, while NF4 is quick to apply and works well as a base for fine-tuning.
| Format or method | Level spacing | Calibration data | Typical use |
|---|---|---|---|
| NF4 | Normal quantiles | Not required | QLoRA fine-tuning, quick loading |
| INT4 | Uniform | Optional | Integer accelerators, mobile runtimes |
| FP4 (E2M1) | Floating-point exponent spacing | Not required | Hardware with native FP4 support |
| GPTQ | Uniform, error-compensated rounding | Required | Inference-optimized checkpoints |
| AWQ | Uniform, activation-aware scaling | Required | Fast GPU and edge inference |
Because NF4 is a lookup-table format, not an integer grid, hardware cannot multiply NF4 values directly. Kernels must dequantize each block to BF16 or FP16 before matrix multiplication, which is why NF4 saves memory and bandwidth but rarely speeds up compute-bound workloads.
Practical use on constrained hardware
NF4 is most valuable when memory capacity is the binding constraint, as on consumer graphics cards, laptops and workstation-class edge devices. A 7-billion-parameter model needs about 14 GB in BF16 but roughly 4 GB of weights in NF4, so it fits comfortably on an 8 GB card with room for the key-value cache.
- QLoRA fine-tuning: the frozen base model is stored in NF4 while small LoRA adapters train in BF16.
- Memory-limited inference: large models load on single devices that could not hold them in 16-bit precision.
- Rapid experimentation: models can be quantized at load time without a calibration pipeline.
- Not ideal for microcontrollers: integer-only runtimes and NPUs usually expect INT8 or INT4 formats instead.
Limitations and common misconceptions
A frequent misconception is that NF4 makes inference faster. In memory-bound decoding with small batches, reduced bandwidth can help, but the dequantization step adds overhead, and throughput is often lower than with optimized INT4 kernels. NF4 is primarily a memory-saving format, not a speed format.
NF4 also assumes roughly normal weight distributions. Layers with heavy outliers or unusual distributions lose more accuracy, and activations are not quantized, so peak memory during long-context inference still depends on the 16-bit activations and cache. Support is concentrated in specific libraries and GPU kernels; deploying NF4 models to mobile NPUs typically requires conversion to another format, with an additional accuracy check.
A non-technical view
An AI model is made of billions of numbers. Normally each number takes 16 bits of memory. NF4 squeezes each number into just 4 bits, so the model needs about a quarter of the space.
The clever part is where NF4 puts its 16 possible values. Most numbers in a model sit close to zero. So NF4 places more values near zero and fewer at the extremes. It is like a ruler with fine marks where you measure most often. The result is a much smaller model that stays nearly as accurate.
A concrete example
A research group at a hospital wants to adapt a 13-billion-parameter language model to summarize radiology reports, but privacy rules require all processing on a single local workstation with one 24 GB graphics card. In BF16, the model weights alone need about 26 GB, so neither fine-tuning nor inference fits.
The team loads the base model in NF4 with double quantization, which reduces the weights to roughly 7 GB, and trains LoRA adapters with QLoRA on de-identified reports. Training completes overnight on the single card. On a held-out evaluation, summary quality is within about one point of a reference adapter trained on a 16-bit model in a cloud environment. For deployment, the group keeps the NF4 base with the merged adapter configuration, accepting slightly slower generation in exchange for keeping all patient data on site.