Pure Reinforcement Learning on Open-Source Base Models: A Practical Guide to Training Coding Agents
This article analyzes the emerging practice of post-training coding agents with pure reinforcement learning (RL) on open-source base models. It covers the technical pipeline, reward function design, base model selection, a multi-model comparison experiment on an algorithmic decision-making task, why frontend capabilities degrade under pure RL, and practical recommendations for teams building their own coding models. Readers will gain a clear understanding of both the strengths (algorithmic reasoning, multi-step planning) and limitations (capability imbalance, frontend regression) of this approach.
Pure Reinforcement Learning on Open-Source Base Models: A Practical Guide to Training Coding Agents
1. Background: Why Coding Models Are Embracing Pure Reinforcement Learning
Over the past two years, most mainstream coding LLMs have followed the classic pipeline of “pre-training + supervised fine-tuning (SFT) + preference alignment.” This approach depends on large volumes of human-annotated, high-quality code samples—expensive to produce and capped by the distribution of the annotation data. A new generation of coding models has taken a more aggressive route: starting directly from an open-source base model and applying pure reinforcement learning (Pure RL) for post-training, letting the model evolve on its own through a closed loop of “submit code → run tests → receive reward” while interacting with real environments.
The appeal of this approach comes down to three points:
- Data efficiency: No manual annotation of “gold answers” is needed; executable test cases serve as the reward signal.
- Higher capability ceiling: The model learns “how to solve problems” rather than “how to imitate code humans have written,” often yielding significant jumps in algorithmic reasoning and multi-step planning.
- Reproducibility: Both the base model and the training method can be made public, making it easy for the community to verify and extend the work.
But there is another side to the coin: pure RL shows a clear capability imbalance—reasoning and algorithmic skills surge, while certain engineering skills (such as frontend pixel-fidelity) actually regress. This article provides a complete analysis of that phenomenon.
2. The Technical Framework of Pure RL Post-Training
2.1 Overall Pipeline
A typical pure-RL coding model training flow looks like this:
Base model (open-source code model)↓Task sampling (real repository-level issues / algorithm problems)↓Agent trajectory generation (browse code → locate → modify → submit patch)↓Sandbox execution of test cases↓Reward computation (pass rate / compile success / partial pass ratio)↓Policy update (PPO / GRPO-style algorithms)↓Iterate
2.2 Reward Function Design Is the Make-or-Break Factor
The effectiveness of RL depends heavily on how dense and how correct the reward signal is. Widely accepted practices include:
- Binary reward: 1 if all tests pass, 0 otherwise. Simple and stable, but sparse and hard to converge early in training.
- Partial reward: Score proportional to the fraction of tests passed. Mitigates sparsity but may encourage the model to “game” the system by only passing easy cases.
- Format penalty: Direct negative rewards for patches that fail to apply or contain syntax errors, suppressing invalid trajectories.
- Process rewards (PRM): Auxiliary signals for intermediate steps (e.g., whether the localization is accurate, whether the edit is minimal). More expensive but more stable convergence.
2.3 Why Base Model Selection Matters
Practice has repeatedly shown that RL amplifies a base model’s existing tendencies rather than creating capabilities from scratch. Choosing a base with abundant code corpora, context lengths reaching hundreds of thousands of tokens, and basic tool-calling ability is a prerequisite for successful training. If the base is already weak at frontend generation and the RL stage rewards mainly algorithmic test results, frontend degradation is nearly inevitable—this is precisely the mechanism behind the “algorithms up, frontend down” phenomenon.
3. How to Evaluate a Coding Model: Methodology
Benchmark scores alone are not enough. A rigorous evaluation should cover at least three dimensions:
- Repository-level bug fixing: Locating bugs and submitting mergeable patches in real engineering environments, testing multi-file understanding and tool orchestration.
- Algorithmic and reasoning ability: Complex logic, search, and dynamic-programming tasks, testing the model’s capacity for deep thinking.
- Engineering skills: Frontend fidelity, code maintainability, and adherence to existing project conventions.
In addition, control groups are essential: the same base model’s SFT version, versions at different scales, and “main model + lightweight assistant model” combinations. Only then can the contribution of RL itself be isolated. Combination testing is especially relevant in practice—in real-world coding-agent deployments, lightweight models are often configured as the default model for sub-agents to control costs, and their weaknesses directly drag down overall performance.
4. Case Study: A Multi-Model Comparison Experiment
We used a simplified 2v2 soccer strategy game as the algorithmic testbed (models must encode decisions within a limited number of turns), comparing multiple model combinations across thousands of games. Key results:
| Configuration | Win Rate | Observations |
|---|---|---|
| Top flagship model combination | ~99% | Nearly flawless decisions; the ceiling reference |
| Strong reasoning model + strong partner | ~84% | Individually strong, but redundant decisions when cooperating |
| Same-base SFT version combination | ~39% | Steady but lacks deep search |
| Base + pure RL post-trained version (protagonist) | ~58% | ~20 percentage points over the same-base SFT version |
| Strong reasoning model + weaker partner | ~21% | Confirms the “weakest link” effect: a weak partner drags the whole down |
Three findings worth expanding on:
- The RL version shows clearly deeper decision-making: It no longer greedily picks the local optimum, but instead sets up positions several turns ahead, demonstrating stronger multi-step planning.
- The weakest-link effect is real: No matter how strong the main model is, if its partner (e.g., a lightweight model in an assistant role) makes low-quality decisions, overall performance collapses. This is a lesson for engineering teams: sub-agent selection matters as much as main model selection.
- Improvement has a ceiling: The RL version still trails the top flagship by roughly 40 percentage points, suggesting pure RL today is more about “squeezing out the base model’s potential” than crossing the gap in model scale.
5. Why Frontend Capabilities Regress: Causes and Countermeasures
The root causes of degradation can be summarized in three points:
- Reward distribution shift: Training tasks are dominated by automatically judged algorithm problems and backend tests. Whether a frontend “looks right” is hard to measure with unit tests, so the model receives no gradient signal pushing it in that direction.
- Exploration collapse: RL tends to converge to high-reward output patterns; diverse stylistic expression gets suppressed, and outputs become conservative and template-like.
- Amplified base bias: As noted above, the base model’s weakness in frontend work gets further cemented by the training objective.
Practical mitigations include adding rendering similarity as a reward component (e.g., screenshot comparison scoring), keeping a proportion of SFT data in mixed training (as an “anchor”), and maintaining a separate fine-tuned branch specifically for frontend tasks.
6. Practical Recommendations and Outlook
For teams that want to build their own coding models on open-source bases, we recommend the following path:
- Step 1: When selecting a base, focus on its code fundamentals, long-context capability, and tool-calling ability.
- Step 2: Set up an elastically scalable sandbox execution environment (leveraging container platforms and object storage to manage task data) to ensure reward signals are trustworthy.
- Step 3: Evolve reward design from sparse to dense—start with binary rewards working, then layer in partial and process rewards.
- Step 4: Establish a multi-dimensional evaluation system covering algorithms, repository-level fixes, and frontend in parallel, preventing “lopsided” models from reaching production.
Looking ahead, as process reward models, automated frontend evaluation, and related infrastructure mature, pure RL has the potential to move from “breakthrough in a single dimension” to “balanced improvement” and become the default paradigm for coding-agent training. For developers, understanding the underlying mechanics is what enables clear-headed decisions in model selection and engineering deployment.
