Defeating the Training-Inference Mismatch via FP16

AK's Picks LLM RLHF ML RL
大语言模型(LLM)的强化学习(RL)微调常常由于训练策略与推理策略之间的数值不匹配而出现不稳定现象。尽管先前的研究尝试通过算法修正或工程对齐来缓解这一问题,但我们发现其根本原因在于浮点数精度本身。广泛应用的BF16格式虽然具有较大的动态范围,但会引入显著的舍入误差,破坏训练与推理之间的一致性。在本研究中,我们证明仅需简单地恢复使用**FP16**即可有效消除这种不匹配。这一改动极为简便,现代深度学习框架均可原生支持,仅需修改少量代码,且无需调整模型结构或学习算法。我们的实验结果表明,在各种任务、算法和框架下,统一采用FP16能够带来更稳定的优化过程、更快的收敛速度以及更强的整体性能。我们希望这些发现能促使人们更广泛地重新思考强化学习微调中的精度权衡问题。
Reinforcement learning (RL) fine-tuning of large language models (LLMs) often suffers from instability due to the numerical mismatch between the training and inference policies. While prior work has attempted to mitigate this issue through algorithmic corrections or engineering alignments, we show that its root cause lies in the floating point precision itself. The widely adopted BF16, despite its large dynamic range, introduces large rounding errors that breaks the consistency between training and inference. In this work, we demonstrate that simply reverting to \textbf{FP16} effectively eliminates this mismatch. The change is simple, fully supported by modern frameworks with only a few lines of code change, and requires no modification to the model architecture or learning algorithm. Our results suggest that using FP16 uniformly yields more stable optimization, faster convergence, and stronger performance across diverse tasks, algorithms and frameworks. We hope these findings motivate a broader reconsideration of precision trade-offs in RL fine-tuning.