ChatPaper.aiChatPaper

Sconfiggere la discrepanza addestramento-inferenza tramite FP16

Defeating the Training-Inference Mismatch via FP16

October 30, 2025
Autori: Penghui Qi, Zichen Liu, Xiangxin Zhou, Tianyu Pang, Chao Du, Wee Sun Lee, Min Lin
cs.AI

Abstract

L'addestramento per rinforzo (RL) dei grandi modelli linguistici (LLM) soffre spesso di instabilità a causa della discrepanza numerica tra le politiche di training e inferenza. Sebbene lavori precedenti abbiano tentato di mitigare questo problema attraverso correzioni algoritmiche o allineamenti ingegneristici, dimostriamo che la causa principale risiede nella stessa precisione in virgola mobile. Il formato BF16, nonostante il suo ampio range dinamico, introduce grandi errori di arrotondamento che compromettono la coerenza tra training e inferenza. In questo lavoro, dimostriamo che semplicemente ritornando all'FP16 si elimina efficacemente questa discrepanza. La modifica è semplice, è pienamente supportata dai framework moderni con solo poche righe di codice cambiate e non richiede alcuna modifica all'architettura del modello o all'algoritmo di apprendimento. I nostri risultati suggeriscono che l'uso uniforme dell'FP16 produce un'ottimizzazione più stabile, una convergenza più rapida e prestazioni più solide su vari compiti, algoritmi e framework. Speriamo che questi risultati stimolino una più ampia riconsiderazione dei compromessi di precisione nel fine-tuning RL.
English
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 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.
PDF291December 2, 2025