ChatPaper.aiChatPaper

온라인과 오프라인 강화학습의 연결: 다중 턴 코드 생성을 위한 상황별 밴딧 학습

Bridging Online and Offline RL: Contextual Bandit Learning for Multi-Turn Code Generation

February 3, 2026
저자: Ziru Chen, Dongdong Chen, Ruinan Jin, Yingbin Liang, Yujia Xie, Huan Sun
cs.AI

초록

최근 멀티턴 코드 생성과 같은 실제 과제에서 강화 학습을 통해 대규모 언어 모델을 훈련시키는 연구에 대한 관심이 크게 증가하고 있습니다. 온라인 강화 학습이 오프라인 강화 학습보다 우수한 성능을 보이는 경향이 있지만, 높은 훈련 비용과 불안정성으로 인해 널리 채택되기 어려운 실정입니다. 본 논문에서는 멀티턴 코드 생성이 단일 단계 복구 가능 마르코프 결정 과정으로 공식화될 수 있다는 관찰에 기반하여, 온라인 및 오프라인 강화 학습의 장점을 결합한 새로운 방법인 컨텍스트 밴딧 학습과 오프라인 궤적을 결합한 Cobalt를 제안합니다. Cobalt는 먼저 참조 LLM을 사용하여 코드 생성 궤적을 수집하고 이를 컨텍스트 프롬프트로 사용할 부분 궤적으로 분할합니다. 이후 온라인 밴딧 학습 동안 LLM은 각 부분 궤적 프롬프트를 단일 단계 코드 생성으로 완성하도록 훈련됩니다. Cobalt는 GRPO와 VeRPO 기반의 두 멀티턴 온라인 강화 학습 기준 모델을 능가하며, LiveCodeBench에서 R1-Distill 8B와 Qwen3 8B의 Pass@1 점수를 각각 최대 9.0점, 6.2점 절대값으로 크게 향상시켰습니다. 또한 LLM의 인컨텍스트 보상 해킹 동작을 분석하고, 이 문제를 완화하기 위해 교란된 궤적을 사용하여 Cobalt 훈련을 강화했습니다. 전반적으로 우리의 결과는 Cobalt가 멀티턴 코드 생성과 같은 반복적 의사 결정 과제에 대한 유망한 해결책임을 입증합니다. 우리의 코드와 데이터는 https://github.com/OSU-NLP-Group/cobalt에서 확인할 수 있습니다.
English
Recently, there have been significant research interests in training large language models (LLMs) with reinforcement learning (RL) on real-world tasks, such as multi-turn code generation. While online RL tends to perform better than offline RL, its higher training cost and instability hinders wide adoption. In this paper, we build on the observation that multi-turn code generation can be formulated as a one-step recoverable Markov decision process and propose contextual bandit learning with offline trajectories (Cobalt), a new method that combines the benefits of online and offline RL. Cobalt first collects code generation trajectories using a reference LLM and divides them into partial trajectories as contextual prompts. Then, during online bandit learning, the LLM is trained to complete each partial trajectory prompt through single-step code generation. Cobalt outperforms two multi-turn online RL baselines based on GRPO and VeRPO, and substantially improves R1-Distill 8B and Qwen3 8B by up to 9.0 and 6.2 absolute Pass@1 scores on LiveCodeBench. Also, we analyze LLMs' in-context reward hacking behaviors and augment Cobalt training with perturbed trajectories to mitigate this issue. Overall, our results demonstrate Cobalt as a promising solution for iterative decision-making tasks like multi-turn code generation. Our code and data are available at https://github.com/OSU-NLP-Group/cobalt.
PDF31February 5, 2026