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

要旨

近年、マルチターンコード生成のような実世界タスクにおいて、大規模言語モデル(LLM)を強化学習(RL)で訓練する研究が活発に行われている。オンラインRLはオフラインRLよりも優れた性能を示す傾向があるが、訓練コストの高さと不安定性が普及の障壁となっている。本論文では、マルチターンコード生成が「1ステップ回復可能なマルコフ決定過程」として定式化できるという観察に基づき、オンラインRLとオフラインRLの利点を組み合わせた新手法、Contextual Bandit Learning with Offline Trajectories(COBALT)を提案する。COBALTはまず、参照LLMを用いてコード生成の軌跡を収集し、それを部分軌跡に分割して文脈プロンプトとする。次に、オンラインのバンディット学習中に、LLMは単一ステップのコード生成により各部分軌跡プロンプトを完成させるように訓練される。COBALTは、GRPOとVeRPOに基づく2つのマルチターンオンラインRLベースラインを上回り、R1-Distill 8BおよびQwen3 8Bモデルにおいて、LiveCodeBenchでの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