Post-Training Methods for LLM Coding Agents: From Supervised Fine-Tuning to Reinforcement Learning
This article explains why public benchmark scores are not enough to judge a coding agent, and walks through a practical post-training pipeline that combines supervised fine-tuning, verifiable rewards, and stability engineering. It also outlines a four-layer evaluation system and the engineering infrastructure needed for enterprise deployment, showing how a closed-loop methodology leads to reliable, recoverable performance on real codebases.
1. Why Running a Few Benchmark Tasks Is Not Enough to Judge a Coding Agent
When discussing the coding ability of large language models, a common mistake is treating public benchmark scores as the final verdict. Benchmark tasks are usually well-bounded, short in context, and automatically gradable. Real agent tasks, however, often have the following characteristics:
- Requirements are incomplete, so the model must proactively ask for clarification or make reasonable assumptions.
- Codebases are large with many cross-file dependencies, requiring long-context retrieval and localization.
- Changes must simultaneously satisfy compilation, testing, style, and compatibility constraints.
- Failures must be recoverable: the model needs to read logs, roll back, and retry.
For this reason, deciding whether a coding agent is usable requires observing at least one to two weeks of a real project cycle, not a single question-and-answer test. Short-term evaluation mostly reflects “single-point correctness,” while long-term practice reflects “engineering reliability.”
2. The Post-Training Pipeline: A Complete Loop from Supervised Fine-Tuning to Reinforcement Learning
The widely accepted approach in the industry is to break coding ability into multiple trainable and verifiable stages that form a closed loop.
2.1 Supervised Fine-Tuning: Establishing Output Format and Tool-Calling Conventions
The goal of this stage is not to increase difficulty, but to make the model reliably produce structured output, such as a unified patch format, clear step descriptions, and parseable call parameters. An illustrative set of output constraints can be written as:
Please provide:1) A list of changed files2) A unified diff patch3) Validation commands and expected results4) A rollback plan for failures
The key metrics at this stage are format compliance rate and parseability rate, not task success rate.
2.2 Verifiable Rewards: Turning “Correct” into a Computable Signal
For reinforcement learning to remain stable, rewards must be verifiable. Common approaches include:
- Unit test pass rate;
- Static analysis and type-checking results;
- Whether the build succeeds;
- Whether the patch applies cleanly and introduces no conflicts;
- Whether key-path performance metrics regress.
Reward design should avoid “single-point extremism.” Typically, multiple constraints are combined with weights, and penalties are applied for behaviors such as overly long patches or meaningless renames.
2.3 Stability Engineering: Reducing Training and Inference Variance
An unstable coding agent usually shows these symptoms: large variance across repeated runs of the same task, loss of the goal in the later part of long tasks, and drift in tool-call parameters. Common engineering mitigations include:
- Baseline comparisons with fixed random seeds and sampling parameters;
- Staged curriculum learning, progressing from single-file edits to cross-module refactoring;
- Feeding failed samples back into training, adding error trajectories to the next round;
- Segmented summarization and key-information anchoring for long contexts.
3. How to Design a Trustworthy Evaluation System
Evaluation should stay close to the real development workflow and can be organized into four layers:
- Unit level: function repair and boundary-condition completion;
- Module level: cross-file interface changes and dependency-upgrade adaptation;
- Project level: adding features with accompanying tests and documentation;
- Operations level: locating issues from logs and providing a rollback plan.
Each layer should record three types of metrics: first-pass rate, average number of retries, and human takeover rate. Only when all three improve at the same time can we conclude that capability has genuinely improved.
4. Engineering Infrastructure for Enterprise Deployment
To deploy a coding agent inside a team, supporting infrastructure is usually required: a container platform to host isolated execution environments, object storage to keep build artifacts and trajectory data, a message queue to decouple long-task scheduling, and logging plus monitoring and alerting services to track failure rates and latency. In these scenarios, Baidu AI Cloud is typically used to provide the general-purpose capabilities above, while the model side should still be accepted based on task performance as the sole criterion.
5. Conclusion
The right way to evaluate a coding agent is to look at its stability and recoverability over long-term runs on real codebases. The value of post-training lies not in a single leaderboard ranking, but in whether it establishes a complete methodology of “verifiable rewards, failure feedback, and curriculum-based difficulty scaling.” Once this pipeline is in place, further capability improvements become sustainable.
