Demystifying Numerical Errors in LLM Inference: Achieving Reproducible Inference for Mission-Critical Tasks with HEAL

Zhenting Zhu, Lucas Thai, Shan Yu, Yicheng Liu, Yifan Qiao, Chenxi Wang, Harry Xu, Junyi ShuNeurIPS 2026

TL;DR

Setting temperature=0 is supposed to make Large Language Models (LLMs) completely deterministic, yet running the exact same prompt across different GPUs often produces divergent answers. The culprits aren't sloppy low-precision math inside GPU kernels, but microscopic rounding errors when saving results between kernels—errors that snowball until they flip output tokens. This paper introduces HEAL, a clever algebraic workaround that delivers 32-bit reproducibility while preserving the speed and memory footprint of modern 16-bit AI hardware.

What Problem Does This Paper Address?

Imagine deploying an LLM to assign medical billing codes or evaluate legal compliance. You set decoding to greedy (temperature=0) expecting identical inputs to always yield identical outputs. Yet in modern datacenters—which routinely mix NVIDIA A100s, H100s, and AMD MI300Xs—outputs still diverge, sometimes flipping up to 16.5% of answers on standard 16-bit (BF16) setups.

Because floating-point math isn't strictly associative ($(a+b)+c \neq a+(b+c)$), hardware differences create tiny numerical discrepancies. Existing fixes force an unpleasant choice: lock your stack into rigid, slow, vendor-specific deterministic kernels (which fail across different GPU types anyway), or run everything in 32-bit floating-point (FP32). Unfortunately, full FP32 doubles your Key-Value (KV) cache memory and bypasses specialized 16-bit hardware accelerators (like Tensor Cores), slowing down token generation by up to $13.1\times$.

Key Insights and Ideas

By profiling GPU assembly instructions (SASS) and tracking error propagation layer-by-layer, the authors uncover three major "aha moments":

  • 16-bit inference is secretly doing 32-bit math: Almost all critical GPU kernels (including Tensor Core matrix multiplications, Softmax, and RMSNorm) already accumulate math internally in FP32. Instability comes almost entirely from boundary truncation—chopping off precision when downcasting 32-bit registers back into 16-bit memory between kernels.
  • You don't need bit-for-bit perfection; you just need to stay under a cliff: Because greedy decoding picks the top token (argmax), tiny numerical noise is harmless until it grows large enough to bridge the probability gap between the #1 and #2 token choices. Below a specific Mean Squared Error (MSE) threshold, flip rates stay near zero; cross it, and answers diverge catastrophically.
Figure 1: Answer flip rate vs. total numerical error.
  • Errors snowball exponentially in later layers: Truncation noise compounds multiplicatively as it travels down the network, meaning deeper layers contribute disproportionately to the final error, while early layers barely move the needle.
Figure 2: The contribution of error sources across the network.

Methods

Instead of brute-forcing FP32 everywhere, HEAL (Hybrid Error ALleviation) keeps lightweight residual streams in FP32 while using two hardware-aware tricks to bypass memory and compute bottlenecks in Attention and Matrix Multiplication (GEMM):

  1. INT16 Quantization + Dual-FP16 Unpacking for Attention: Standard 16-bit floats waste bits on exponent ranges that Attention Q, K, and V tensors rarely use. HEAL stores these tensors in uniform INT16 format—improving precision without expanding the 16-bit KV cache memory footprint. Right before computation, it unpacks each INT16 value into a pair of FP16 numbers ($X_{\text{hi}} + X_{\text{lo}}/2^{10}$), emulating 20 bits of fractional precision. Even though this triples the math operations, Attention is memory-bound, so the extra compute essentially rides for free.
  2. Dual-FP16 Algebraic Compensation for GEMMs: To keep matrix multiplications running on fast 16-bit Tensor Cores, HEAL promotes BF16 operations to FP16 (gaining 3 extra significand bits) and rescales rare outlier channels offline to prevent FP16 overflow. It then splits the 32-bit input activation $h$ into a primary FP16 value and a residual error term ($h_{\text{hi}} + h_{\text{lo}}/2^{10}$), running two parallel 16-bit Tensor Core GEMMs to capture the lost truncation bits.

Datasets

  • MCR-Bench (Newly Introduced): The Mission-Critical Reproducibility Benchmark curates 4,500 high-stakes reasoning problems across medical, legal, and financial domains—scenarios where a single flipped token breaks downstream logic.
  • MedQA: Used during diagnostic profiling to trace token flip rates against numerical error.
  • ShareGPT: Used to measure real-world serving latency (Time Per Output Token, or TPOT) and memory usage.

Key Results

Evaluated across five open-source models (Qwen3-8B/14B/32B, Llama-3.1-8B-Instruct, and DeepSeek-R1-Distill-Qwen-14B) on NVIDIA A100, NVIDIA H100, and AMD MI300X GPUs:

  • Near-zero divergence: Standard BF16 suffers answer flip rates between 8.03% and 16.53% on MCR-Bench relative to an FP32 anchor. HEAL slashes flip rates to 0.06%–0.10%, matching the practical reproducibility of full FP32 (0.00%–0.01%).
  • Massive speedup over FP32: While full FP32 slows generation down by $4.2\times$ to $13.1\times$, HEAL reduces that performance penalty by up to $6.0\times$, incurring only a 70%–120% latency overhead over native BF16 (e.g., 91.7 ms vs. 546.5 ms for FP32 on H100 with Qwen3-14B).
  • Zero KV-cache bloat: HEAL maintains virtually the exact same base memory footprint as standard BF16 (28.5 GiB vs. 28.1 GiB on Qwen3-14B).

Limitations and Future Work

Not explicitly discussed in a dedicated section in the main text, though two practical constraints emerge from the evaluation:

  • Residual compute overhead: While dramatically faster than FP32, splitting GEMM inputs into dual-FP16 operations still roughly doubles token generation latency (70%–120% TPOT overhead) compared to native BF16—though lighter variants like HEAL-Base+Attn+Skip offer a middle ground (~20%–30% overhead for ~1% flip rates).
  • Low-bit quantization incompatibility: The authors note that aggressive activation or low-bit KV-cache quantization inherently reintroduces boundary truncation, degrading reproducibility (whereas static, weight-only quantization remains compatible with HEAL).

Summary updated

Abstract

As Large Language Models (LLMs) deploy into mission-critical domains (e.g., finance, medicine, and law), output reproducibility has become a strict system requirement. While practitioners use greedy decoding to eliminate algorithmic stochasticity, empirical deployments with 16-bit precisions still exhibit catastrophic output divergence across heterogeneous GPUs. Through SASS-level profiling, we reveal that this inconsistency is fundamentally driven by truncation errors introduced during downcasting at kernel boundaries. However, achieving reproducibility via a global FP32 pipeline incurs prohibitive system penalties: bypassing 16-bit hardware accelerators hurts compute efficiency, while upcasting the KV cache doubles memory overhead. To bridge this gap, we propose Hybrid Error ALleviation (HEAL), a targeted intervention that approximates FP32 precision while resolving hardware constraints through two targeted mechanisms. First, recognizing that floating-point formats underutilize their bit-width for Q, K, V tensors, HEAL applies INT16 quantization that preserves numerical stability without expanding the KV cache footprint. Second, HEAL synthesizes high-precision matrix multiplications via an algebraic error compensation strategy, executing entirely on high-throughput 16-bit Tensor Cores. To evaluate our approach practically, we introduce MCR-Bench, a benchmark targeting reproducibility in mission-critical tasks. HEAL achieves the same level of reproducibility on downstream tasks as the FP32 baseline while reducing the performance overhead by up to 6.0$\times$.
BibTeX
@inproceedings{zhu2026demystifying,
  author = {Zhenting Zhu and Lucas Thai and Shan Yu and Yicheng Liu and Yifan Qiao and Chenxi Wang and Harry Xu and Junyi Shu},
  title = {{Demystifying Numerical Errors in LLM Inference: Achieving Reproducible Inference for Mission-Critical Tasks with HEAL}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=49aQ53Ipde},
}
Figure