reinforcement-learning llm qwen3 kl-divergence on-policy-training training-inference-mismatch numerical-discrepancy policy-lag
Abstract
On-policy reinforcement learning for large language models assumes that training responses are sampled from the current policy. In practice, an inference engine samples the responses and a separate trainer computes the gradients, and the \textbf{training-inference mismatch} between the two makes the training data off-policy. The mismatch has two sources, the numerics of the engine and the stale weights of asynchronous sampling, and a correction that stabilizes training under one source can fail under the other. \textit{We ask which property of a mismatch source decides the correction it needs.} Evaluating the trainer at the sampler's weights splits each sampled-token error exactly into a \textit{numerical discrepancy} of the engine and a \textit{policy lag} of the trainer, and we follow both through training. The numerical discrepancy stays approximately constant, so it biases the updates by a nearly fixed amount, and centering the score at each prefix removes its leading bias. The policy lag is produced by the trainer's own updates: the bias it leaves enters the next update, which enlarges the next lag and closes a feedback loop. Importance weighting cuts this loop only while the lag ratio stays concentrated, and on Qwen3-1.7B it fails at the step where the effective sample size of the ratio falls below one half. From this account we derive the \textbf{discrepancy-lag correction} (DLC), which centers the numerical discrepancy, clips the lag ratio against the sampler's weights and resynchronizes the sampler when this effective sample size falls below one half. Under a stale sampler, DLC keeps the KL divergence from on-policy training within twice the KL between two independent on-policy trainings on Qwen3-0.6B and Qwen3-1.7B, and its resynchronization prevents collapses that the per-token corrections leave and that a KL measured on the sampler's prefixes does not detect.
한국어 요약
한 줄 요약
LLM 강화학습에서 발생하는 학습-추론 불일치를 DLC라는 새로운 보정법으로 분석하고 해결한다.
핵심 기여도
- 학습-추론 불일치를 수치적 차이와 정책 지연의 두 요소로 분리하여 분석.
- Qwen3-1.7B 모델에서 중요도 가중치가 효과 샘플 수가 0.5 이하로 떨어지는 11단계에서 실패함을 밝힘.
- DLC 보정법을 제안: 수치적 차이 중심화, 정책 지연 클리핑, 샘플러 재동기화.
- Qwen3-0.6B 및 Qwen3-1.7B에서 DLC가 KL 발산을 2배 이내로 유지함을 실험적으로 검증.
핵심 아이디어
기존 학습-추론 불일치는 추론 엔진의 수치적 차이와 비동기 샘플링에 의한 정책 지연의 두 가지 원인으로 발생한다. 수치적 차이는 학습 중 거의 일정하며, 중심화(centering)로 해결할 수 있다. 반면, 정책 지연은 학습 업데이트 자체에서 유발되며, 이는 피드백 루프를 형성해 누적된다. 중요도 가중치는 정책 지연이 일정 범위 내에 있을 때만 효과적이며, Qwen3-1.7B 모델에서 샘플 수가 0.5 이하로 떨어지는 11단계에서 실패한다. 이를 해결하기 위해 DLC는 수치적 차이를 중심화하고, 정책 지연 비율을 클리핑하며, 샘플러를 재동기화한다.
기술적 접근법
- **DLC 알고리즘**: 샘플러의 가중치에서 학습기를 실행하여 수치적 차이와 정책 지연을 분리.
- **수치적 차이 중심화**: 각 prefix에서 점수 중심화로 드리프트 제거.
- **정책 지연 클리핑**: PPO 클리핑 방식으로 정책 비율(ρₜ = e^{ℓₜ})을 제한. 클리핑 범위는 ε=0.2, c=3.
- **재동기화**: 샘플러의 효과 샘플 수가 0.5 이하로 떨어질 때 학습기 가중치 복사.
- **추가 forward pass**: 샘플러의 top-128 토큰에 대한 로그 확률 저장.
- **하이퍼파라미터**: 클리핑 범위(0.2), head 크기(128), 재동기화 임계치(0.5).
주요 결과
- Qwen3-0.6B 및 Qwen3-1.7B 모델에서 DLC는 on-policy 학습과의 KL 발산을 2배 이내로 유지.
- Qwen3-1.7B에서 중요도 가중치는 11단계에서 실패 (샘플 수 0.5 이하).
- DLC는 샘플러가 오래된 상태에서도 collapse를 방지하며, prefix 기반 KL 측정이 감지하지 못하는 문제를 해결.
의의 및 한계
- **의의**: 학습-추론 불일치의 원인을 정량적으로 분리하고, 이를 기반으로 보정법을 제안. 기존 방법(PPO, 중요도 가중치, 점수 중심화)의 한계를 명확히 규명.
- **한계**: 재동기화는 추가적인 forward pass와 가중치 복사가 필요해 계산 비용 증가. 또한, 샘플러와 학습기의 수치 차이가 크면 DLC도 제한적일 수 있음.
- **학술적 기여**: 학습-추론 불일치가 학습 알고리즘과 인프라의 상호작용으로 발생한다는 통찰 제공.
실용적 활용
- 대규모 언어 모델의 비동기 강화학습에서 학습 안정성 향상.
- vLLM, AReaL, PipelineRL 등 비동기 추론 시스템과 호환 가능.
- 추론 엔진의 정밀도가 낮은 환경(예: low-precision 추론)에서 특히 유용.