Multi-turn code generation usually requires online reinforcement learning, where a model learns from its own rollouts. That can be costly and unstable. The new COBALT method instead treats multi-turn code generation as a one-step recoverable Markov decision process, allowing it to train from offline trajectories collected by a reference model.

COBALT first collects full trajectories, then splits them into partial trajectories. During bandit learning, the model is trained to complete each partial trajectory with a single generation step. This avoids the need for repeated online sampling while still providing the benefits of multi-turn training.

On LiveCodeBench, COBALT improved R1-Distill 8B by up to 9.0 absolute Pass@1 points and Qwen3 8B by up to 6.2 points, matching two multi-turn online RL baselines. The authors also found that COBALT increases robustness to misleading execution feedback, reducing in-context reward hacking in perturbation-based tests.