解决大模型推理不一致问题,用轻量方案实现高可靠性输出。
Demystifying Numerical Instability in LLM Inference: Achieving Reproducible Inference for Mission-Critical Tasks with HEAL

- 通过整数量化与误差补偿,在16位硬件上逼近32位精度。
- 在真实任务中达成与全精度相同的可复现性,性能开销降低7.1倍。
- 适合金融、医疗等对结果一致性要求极高的场景使用。
随着大语言模型部署至金融、医疗、法律等关键领域,输出可复现性已成为系统刚性需求。尽管采用贪婪解码消除算法随机性,但使用16位精度的实测部署仍因异构GPU导致输出剧烈发散。通过SASS级分析发现,根本原因在于核函数边界处下采样引入的截断误差。若采用全局FP32管道虽能保证可复现性,却带来巨大代价:绕过16位硬件加速器降低计算效率,而升维键值缓存则使内存开销翻倍。为此,我们提出混合误差缓解(HEAL)机制,以针对性干预实现高精度近似并突破硬件限制。首先,利用Q/K/V张量对浮点格式的比特利用率不足,采用INT16量化,在不增加KV缓存占用的前提下保持数值稳定;其次,通过代数误差补偿策略合成高精度矩阵乘法,全程运行于高速16位张量核心。为实践评估,我们构建了针对关键任务可复现性的MCR-Bench基准。实验表明,HEAL在下游任务中达到与FP32基线相当的可复现性,同时性能开销降低最高达7.1倍。
原文摘要 · Abstract (English)
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 7.1x.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。