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.
- 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.
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):
- INT16 Quantization + Dual-FP16 Unpacking for Attention: Standard 16-bit floats waste bits on exponent ranges that Attention
Q,K, andVtensors 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. - 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+Skipoffer 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