Precision Format Selection for Large Models: BF16, FP8, MXFP4, and INT4

    This article explains how to choose numerical precision formats for large language model training and inference. It compares BF16, FP16, FP8, MXFP4, and INT4 in terms of dynamic range, accuracy, scaling granularity, and hardware support; explains why low-precision computing addresses memory capacity, bandwidth, and communication bottlenecks; and provides selection matrices, an engineering workflow, pseudocode, and common pitfalls to help engineers make quality-budget-driven precision decisions.

    Precision Format Selection for Large Models: BF16, FP8, MXFP4, and INT4

    1. Why Low-Precision Computing Became a Core Variable in LLM System Design

    As modern large models continue to grow in parameter count, compute pressure is no longer just about peak FLOPS. It concentrates in three bottlenecks: memory capacity, memory bandwidth, and cross-device communication bandwidth.

    Memory capacity. Model parameters, optimizer states, gradients, activations, and the KV cache all consume GPU memory. For a model on the order of hundreds of billions of parameters, storing weights in FP16 or BF16 takes 2 bytes per parameter—671B parameters would require roughly 1.34 TB of memory. Even with multi-GPU sharding, capacity planning for a single machine or cluster remains tight. Dropping to FP8 theoretically halves weight storage; moving further to a 4-bit format can reduce it to about a quarter, at the cost of additional scaling-factor overhead and more complex numerical stability strategies.

    Memory bandwidth. During autoregressive generation, producing each token typically requires reading the full model weights once (or at least the activated experts/layers). Inference latency is often constrained not by matmul compute alone but by weight-read bandwidth. The value of low-bit formats lies not only in smaller storage but also in reducing the bytes of weights read per token, thereby improving decoding throughput.

    Communication bandwidth. After sharding a very large model across GPUs, activations, gradients, or expert-routing results must be broadcast and aggregated many times. Lower-precision communication reduces bytes transferred per operation, but introduces accumulated numerical error that must be managed alongside training stability strategies.

    Therefore, precision format selection is not simply “the fewer bits, the better.” It is a systematic trade-off among numerical range, accuracy loss, hardware throughput, software stack maturity, calibration cost, and the business quality budget. A common evolution path is: FP32 → FP16/BF16 → FP8/INT8 → FP4/INT4. Each step down in bit width can significantly reduce matmul cost, but distortion risk, quantization strategy complexity, and engineering validation cost rise in parallel.

    2. The Numerical Semantics of Precision Formats: Bit Width Alone Is Not Enough

    2.1 FP32, FP16, and BF16

    FP32 provides an 8-bit exponent and 23-bit mantissa, offering both high dynamic range and high precision. It is typically used for master weights, optimizer states, or numerically sensitive accumulation. FP16 provides a 5-bit exponent and 10-bit mantissa—higher mantissa precision but a narrow dynamic range—so training is prone to overflow or underflow and requires mechanisms like loss scaling. BF16 provides an 8-bit exponent and 7-bit mantissa: dynamic range close to FP32, mantissa precision lower than FP16, but more friendly to large-model training because gradients, activations, and weights span wide magnitude ranges, where range stability often matters more than mantissa precision.

    BF16 has become the common baseline for mixed-precision training of large models: master weights and optimizer states stay in higher precision, forward and backward matmuls use BF16, and with proper accumulation precision and normalization strategies, throughput and stability can both be achieved in most scenarios. FP16 is not unusable, but large-model training with it requires more careful loss scaling and overflow monitoring.

    2.2 The Two Typical Semantics of FP8

    FP8 generally comes in two common encodings: E4M3 and E5M2. E4M3 has fewer exponent bits and more mantissa bits—better precision but narrower dynamic range—making it suitable for forward weights and activations. E5M2 has more exponent bits and fewer mantissa bits—wider dynamic range but lower precision—and is often used for gradients or tensors with highly variable dynamic range. FP8 training typically requires scaling factors, amax history statistics, delayed scaling, per-layer or per-block scaling, and fallback mechanisms for sensitive layers.

    The engineering value of FP8 is that weights, activations, and some gradients can be represented in 1 byte, noticeably improving matmul throughput and memory footprint. The difficulty is that quantization distortion propagates through layers, especially around attention outputs, before and after normalization, residual branches, and long-tailed activation values. Published results have shown that carefully designed FP8 training and native low-precision inference can work in production—but only with a complete system of numerical monitoring, calibration, and fallback.

    2.3 MXFP4 and the Microscaling Paradigm

    MXFP4 belongs to a family of 4-bit floating-point formats with microscaling. Its element format is typically E2M1: 1 sign bit, 2 exponent bits, 1 mantissa bit, with an exponent bias of 1. Representable positive values include a limited set such as 0, 0.5, 1, 1.5, 2, 3, 4, and 6, with negatives as their opposites. The element format does not encode special values like NaN or Infinity; block-level anomalies can be flagged via special encodings of the shared scale factor. With such limited dynamic range and precision, E2M1 alone cannot cover the local dynamic range of LLM tensors, so a scaling mechanism is mandatory.

    The core of microscaling is “a shared scale factor for every few elements”—for example, one 8-bit exponent-style scale factor shared by every 32 elements. Compared with tensor-level scaling, microscaling adapts to local dynamic range and suppresses the impact of outliers on an entire block; compared with channel-level scaling, it is finer-grained and better aligned with the tiling of low-precision matmul hardware. The cost is extra storage and decoding overhead for scale factors: adding an 8-bit scale to every 32 4-bit elements raises the theoretical bit width from 4 to about 4.25 bits, an overhead of roughly 6.25%.

    Published microscaling format specifications define block size, scale-factor encoding, special-value marking, and rounding behavior, aiming for a reproducible balance between hardware efficiency and numerical accuracy. When evaluating options, do not focus only on the capacity gains of “4-bit”; also assess whether the hardware natively supports the block-scaled format, whether the software stack can correctly generate scale factors, and whether the calibration set represents the production data distribution.

    2.4 The Uniform Quantization Semantics of INT4

    INT4 is a 4-bit integer format with 16 quantization levels. It typically uses symmetric or asymmetric quantization: weights can use symmetric quantization, while activations can use asymmetric quantization with a zero point. Scaling granularity can be per-channel, per-group, or finer. INT4’s advantages are simple encoding, mature integer-arithmetic hardware support, and clear weight-compression benefits. Its drawbacks are sensitivity to outliers under uniform quantization, limited dynamic range, and the need for careful group size, clipping thresholds, and error-compensation strategies at low bit width.

    The difference between INT4 and MXFP4: INT4 is a uniform grid, suitable when weight distributions are relatively concentrated and calibration is thorough; MXFP4 combines floating-point elements with block scaling, offering more flexible dynamic-range representation but demanding more from decoding and hardware support. Both can be used for extreme-compression inference, but usually in combination with higher-precision activations, KV cache, or fallback for sensitive layers.

    3. Scaling Granularity: From Tensor-Level to Microscaling

    Scaling granularity directly determines how quantization error is distributed. Tensor-level scaling gives the whole tensor one shared scale factor—simple to implement with minimal metadata, but too coarse to accommodate both large and small values, making it nearly infeasible below 8 bits. Channel-level scaling maintains one scale factor per output channel—a finer granularity often used for weight quantization—but it is still not robust enough against extreme outliers in activations. Microscaling maintains one scale factor per 32 elements, adapting to local dynamic range, suppressing outlier impact, and aligning well with the tiled computation of low-precision matmuls.

    When selecting a format, consider scaling granularity together with bit width. An 8-bit format may be sufficient with channel-level scaling; a 4-bit format usually needs finer group scaling or microscaling; if the hardware only supports tensor-level scaling, the quality risk of a 4-bit format rises significantly. The storage, loading, and decoding of scale factors also affect real-world throughput—do not estimate gains based on element bit width alone.

    4. A Selection Matrix for Training and Inference

    4.1 Training

    Pretraining usually takes BF16 as the main compute format, with master weights and optimizer states kept in FP32 or higher precision, matmuls in BF16, and FP8 forward/backward experimented with on supported hardware. FP8 training requires per-layer sensitivity analysis, dynamic scaling, outlier monitoring, and fallback switches. Using INT4 or MXFP4 directly for large-scale pretraining is extremely challenging and generally not a default option, though they can be used for communication compression, layer-specific experiments, or post-training compression research.

    Fine-tuning offers more flexibility: if the goal is preserving quality, the BF16 baseline is the safest; if the goal is reducing memory, try FP8 weights and activations alongside high-precision master weights; if the goal is an extremely compressed inference model, quantize to INT4/MXFP4 after fine-tuning and validate with a small calibration set and task-level evaluation.

    4.2 Inference

    For inference, distinguish prefill from decoding. The prefill phase is compute-intensive, so low-precision matmuls deliver clear gains; the decoding phase is memory-bandwidth-bound, so lower weight bit width improves throughput more directly. Common combinations include: BF16/FP16 as the quality baseline; FP8 or INT8 for high-throughput serving; MXFP4/INT4 for memory-constrained or edge deployment; and FP8/INT8 for the KV cache—though long-context and attention-sensitive tasks need separate evaluation.

    A robust strategy is mixed precision: keep weights at a lower bit width, activations at FP8 or BF16, and fall back sensitive layers (such as normalization, the output head, the first and last layers, and routing layers) to higher precision. Build separate evaluation sets for math, code, long-context, multilingual, and safety-alignment tasks rather than relying on perplexity alone.

    5. Engineering Workflow and Pseudocode

    The rollout workflow can be summarized as: establish a high-precision baseline; prepare a representative calibration set; perform per-layer sensitivity analysis; enumerate candidate formats and scaling granularities; generate a mixed-precision plan; roll out gradually while monitoring quality and performance; and keep a fallback switch. When running training and inference pipelines on a cloud platform, general-purpose capabilities such as container platforms, object storage, log services, and monitoring/alerting can help manage quantized versions, calibration data, and gray-release rollbacks—but the specific format decision should always be based on evaluation of the model and the business workload.

    1. # Pseudocode: precision format selection
    2. def choose_precision(stage, hw_support, quality_budget, memory_budget):
    3. plan = {
    4. "master_weight": "FP32",
    5. "compute": "BF16",
    6. "weight_store": "BF16",
    7. "activation": "BF16",
    8. "kv_cache": "BF16",
    9. "fallback_layers": []
    10. }
    11. if stage == "pretrain":
    12. if "FP8" in hw_support and quality_budget >= 0.98:
    13. plan["compute"] = "FP8"
    14. plan["activation"] = "FP8"
    15. return plan
    16. if stage == "inference":
    17. if memory_budget > 0.5:
    18. plan["weight_store"] = "FP8" if "FP8" in hw_support else "INT8"
    19. plan["activation"] = "FP8"
    20. else:
    21. plan["weight_store"] = "MXFP4" if "MXFP4" in hw_support else "INT4"
    22. plan["activation"] = "FP8"
    23. plan["fallback_layers"] = sensitive_layer_scan()
    24. return plan

    6. Common Pitfalls and Conclusion

    Common pitfalls include: equating lower bit width with linear throughput gains while ignoring the extra overhead of dequantization, scale-factor loading, and missing hardware support; evaluating only on a small calibration set, which degrades quality on long-tail samples; applying the same strategy to activations, KV cache, and weights despite their different numerical distributions; and lacking per-layer fallback and gray-release monitoring, making online quality fluctuations hard to diagnose.

    In conclusion: BF16 is a stable baseline for both training and inference; FP8/INT8 are currently important choices for high-throughput training and inference, but require a scaling and calibration system; MXFP4 and INT4 suit extreme memory-compression scenarios and must be combined with microscaling, group quantization, sensitive-layer fallback, and task-level evaluation. Precision format selection should be constrained by the quality budget, bounded by hardware throughput curves, and implemented through mixed precision and a rollback-capable engineering system—rather than simply chasing fewer bits.