arXiv:2610.26416cs.CLOct 2026

Manuscript Offprint

arXiv:2610.26416

Co-Evolving Policy and Reward for Code Generation: A Mechanistic Study of Single-Adapter Drift

Amarsaikhan Batjargal, Noriko Tomuro

Amarsaikhan Batjargal

Jarvis College of Computing and Digital Media

DePaul University

Chicago, IL, USA

abatjarg@depaul.edu

Noriko Tomuro

Jarvis College of Computing and Digital Media

DePaul University

Chicago, IL, USA

tomuro@cs.depaul.edu

Abstract—Reinforcement learning with verifiable rewards (RLVR) is particularly well suited to code generation because generated programs can be objectively evaluated through execution. Execution also provides behavioral information that can be reused as additional supervision. The Synergistic Policy and Reward Co-Evolving Framework (SPARK), originally proposed for reasoning tasks, exploits this idea by recycling training rollouts and their evaluation results to train a model not only to generate solutions but also to evaluate and improve them. We investigate whether this policy-reward co-evolution approach transfers effectively to code generation and whether execution-grounded reflection provides an additional source of self-improvement. We compare SPARK-style rollout recycling with execution-only Group Relative Policy Optimization (GRPO) using Qwen2.5-Coder-3B-Instruct. Our results do not support either hypothesis under the configuration tested. Although co-evolution improves training performance, these gains do not generalize to held-out problems. Compared at the same stage of training, rollout recycling produces roughly 34×34\times greater KL divergence from the reference policy than execution-only GRPO. Over training, trained tokens per GRPO sequence fall from 185 to 86 as training pass rate increases, while held-out performance declines or fails to sustain early gains. We characterize these patterns as single-adapter policy drift: the shared trainable parameters increasingly depart from pretrained code-generation behavior without corresponding gains in generalization. The results show that higher training reward alone is not evidence of generalizable code self-improvement and highlight the importance of held-out evaluation and drift diagnostics.

Index Terms—code generation, reinforcement learning, verifiable rewards, GRPO, policy-reward co-evolution, self-correction, large language models, LoRA

I. INTRODUCTION

Large language models (LLMs) have become increasingly capable of code generation, but functional correctness remains challenging. A generated program may be syntactically valid yet fail edge cases, implement an incorrect algorithm, or crash at runtime. Because generated programs can be objectively evaluated through execution, code generation provides a natural setting for reinforcement learning with verifiable rewards (RLVR), unlike many natural-language tasks that require subjective judgments of response quality. Moreover, execution provides information about program behavior that can serve as additional supervision.

This work investigates whether such information can be exploited through policy–reward co-evolution. We build on the Synergistic Policy and Reward Co-Evolving Framework (SPARK) [1], a self-improvement framework originally developed for reasoning tasks. In conventional RLVR, model-generated solutions, or rollouts, are used to compute rewards and update the policy, but are not typically reused for further training. SPARK instead recycles these rollouts and their evaluation results to train the model to evaluate and improve its own outputs. These capabilities co-evolve with the policy within a single model. We investigate whether this approach transfers effectively to code generation.

We test two hypotheses. First, we hypothesize that SPARK-style co-evolution can improve code generation beyond an execution-only RLVR baseline based on Group Relative Policy Optimization (GRPO) [2], including its ability to generalize to problems not seen during training. Second, we hypothesize that execution-grounded reflection, in which the model learns to revise failing code using unit-test feedback, can provide an additional source of self-improvement.

We evaluate these hypotheses using the Mostly Basic Python Problems (MBPP) [3] and HumanEval [4] datasets. We train on a subset of MBPP and evaluate generalization both on held-out MBPP problems and on HumanEval as a separate, fully held-out benchmark. This design allows us to distinguish improvements on the training problems from in-distribution generalization within MBPP and cross-benchmark generalization to HumanEval.

Our experiments do not support either hypothesis under the configuration tested. Although co-evolution improves performance on the training problems, these gains do not generalize to unseen problems. At the same time, the model increasingly departs from its pretrained behavior, as measured by KL divergence. The model also produces progressively shorter outputs during training. We characterize these patterns as

© 2026 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses.

single-adapter policy drift, arising when the same trainable parameters are used both to generate code and to learn to evaluate it.

This paper makes three contributions. First, we adapt SPARK-style policy–reward co-evolution to code generation by using information from program execution as additional supervision. Second, we evaluate whether this approach improves code-generation performance and generalization beyond execution-only GRPO. Third, we analyze policy drift to examine the relationship between training improvement and held-out generalization. Our findings highlight limitations of the single-adapter co-evolution design studied here and motivate further investigation of alternative designs for code generation.