Training Paradigms and Engineering Practices for Coding Models: An Evaluation Guide
This article breaks down the three-stage training paradigm behind modern coding models—mid-training, supervised and rejection-sampling fine-tuning, and agentic reinforcement learning scaling—and explains why instruction following, tool-call correctness, and state retention matter more than feature checklists. It includes a hands-on evaluation design using a cognitive psychology experiment page, a failure-mode tuning table, and recommendations for embedding coding agents into CI, review, and monitoring pipelines.
1. The Real Problem Behind a Crowded Field: From “Can It Write Code” to “Can It Ship”
Over the past year, the number of coding tools has grown quickly, with nearly every cloud vendor and model team releasing a code model or an assistant. On the surface, this is a highly homogeneous space: they all support code completion, single-turn Q&A, repository-level understanding, and agentic execution inside a terminal. But if you shift the lens from a feature checklist back to engineering delivery, the real dividing line is not whether a given entry point exists. It comes down to three things: the stability of instruction following, the correctness of tool calls, and the ability to retain state across multiple turns.
These three things map exactly to the fundamental difference between a coding agent scenario and a traditional completion scenario. Completion only needs to predict the next chunk of text within a local context. Agentic coding requires the model to keep its goal from drifting while looping through “read files, modify code, run commands, inspect errors, fix again,” and to select and use external tools correctly. So evaluating a coding model cannot rely on how polished a single sample looks; it has to look at the success rate and rework cost on long-chain tasks.
Using the publicly described training approach of a recently released coding model series as a thread, this article abstracts a transferable engineering methodology and uses a typical cognitive psychology experiment page generation task to show how to design prompts, how to verify results, and which metrics a team should watch when building in-house or selecting a model.
2. The Three-Stage Training Paradigm: From Capability Injection to Agentic Reinforcement
Public model cards usually split training into three stages. This split is common across the industry and is worth using as a reference framework when assessing the capability structure of a model.
2.1 Mid-Training: Filling in the Foundational Capabilities Agents Need
The goal of this stage is not to teach the model to write code, but to fill in the low-level capabilities that agent behavior depends on. Common dimensions include:
- Instruction following: precision in honoring format constraints, boundary conditions, and prohibitions;
- Tool use: understanding function signatures, assembling arguments, parsing return values;
- Multi-turn interaction: maintaining the task goal even after context is compressed or truncated;
- Code knowledge injection: language features, framework conventions, correct usage of common libraries;
- Understanding of collaboration workflows: the semantics of commit history, branches, and merge requests;
- General and reasoning ability: translating natural-language requirements into executable steps.
The engineering implication is direct: if your business scenario needs the model to operate a terminal, read and write files, and call retrieval interfaces, then tool-call correctness and multi-turn stability must be validated separately during selection. A “competitive programming pass rate” cannot substitute for that.
2.2 Supervised Fine-Tuning and Rejection-Sampling Fine-Tuning (SFT & RFT): Aligning the Distribution to Real Tasks
The supervised stage typically covers high-frequency user tasks and common code scenarios, with the goal of bringing the output distribution close to the real workload. Rejection-sampling fine-tuning introduces multiple candidates and ground-truth verification, keeping only the trajectories that pass verification, which improves sampling efficiency and training stability in the subsequent reinforcement learning stage.
The takeaway for practitioners: a model usually performs noticeably better on common tasks than on long-tail tasks. When rolling out, teams should first map their own requirements into high-frequency categories, then prepare clearer acceptance criteria and examples for the long-tail portion.
2.3 Agentic RL Scaling: Solving the Cost Problem of Long Trajectories
The largest cost in agentic training comes from trajectory length: a single task may involve dozens of tool calls, and every trajectory is expensive. The public approach mentions two engineering techniques:
- Entropy-guided tree pruning: compress a massive set of trajectories into a prefix tree, rank nodes by entropy and visit probability, and expand only high-information nodes within budget;
- Heterogeneous scheduling with decoupling of training and agent logic: keep compute resources continuously saturated and reduce pipeline bubbles.
The following illustrative pseudocode shows the skeleton of “expanding high-signal nodes within budget”:
# Pseudocode: entropy-guided expansion of a trajectory prefix treeroot = build_prefix_tree(trajectories)budget = compute_budget(step)frontier = [root]while budget > 0 and frontier:node = max(frontier, key=lambda n: entropy(n) * visit_prob(n))if node.is_terminal or node.depth >= MAX_DEPTH:frontier.remove(node)continuefor action in sample_actions(node, k=4):child = rollout(node, action) # real environment interaction, the most expensive partbudget -= child.costfrontier.append(child)frontier = prune(frontier, keep_top=BEAM)
This idea transfers to in-house evaluation: instead of spreading effort evenly across the full test suite, prioritize expanding the branches with the largest disagreement and the highest failure information content.
3. Capability Boundaries and Free Quotas: How to Read Release Announcements Rationally
A model series usually includes a closed-source flagship and open-source lightweight versions, often accompanied by some trial quota. For a team, the right move is to treat the quota as an “evaluation budget,” not as “production capacity.” Three kinds of validation are recommended within two weeks:
- Reproducibility: run the same prompt multiple times and check whether the output structure stays stable;
- Tool compatibility: check whether behavior is consistent across three environments—a terminal agent, an editor plugin, and a CI pipeline;
- Cost model: count rework rounds and human review time into total cost, rather than comparing unit price alone.
4. Hands-On Evaluation: Testing Agent Capability with a Cognitive Experiment Page
When picking a task, choose a goal that is clearly specified but detail-heavy, because that is what exposes a model’s real level. Here we use a typical dual-task memory paradigm page: a stimulus image is shown at fixed intervals, and the subject judges whether the current stimulus is identical to the one from N steps earlier.
Key requirement points (usable directly as a prompt skeleton):
Build a single-page cognitive experiment app:- The stimulus set is 10 common Chinese characters, sampled randomly at runtime;- One stimulus is shown every 1000ms, and the subject presses a key within a limited window to judge "same/different";- N can be selected before the start, with values 2, 3, or 4;- Record the correct answer, the subject's response, and the reaction time for each round, and output accuracy;- After the run, show summary statistics and support exporting to a spreadsheet file;- The UI must clearly distinguish three states: ready, running, and finished.
This task is effective because it stress-tests several things at once: state machine design, timers and race-condition handling, random sampling and deduplication rules, data structures and serialized export, and UI state transitions. Any vague link in that chain will surface at runtime.
A suggested acceptance checklist:
- Is the sequence buffer length exactly N, with no misjudgment at the boundaries?
- Does the timer drift when the page loses focus or the tab is switched?
- Does reaction-time statistics exclude unanswered trials?
- Are the exported fields consistent with what the UI displays?
- Run it 5 times: is there any functional regression?
5. Common Failure Modes and Tuning Techniques
Typical problems with agentic generation on this class of task, and how to address them:
| Failure mode | Symptom | Tuning technique |
|---|---|---|
| Requirement drift | Switches to a different feature midway | Pin the “acceptance checklist” in the prompt and require a self-check item by item |
| Confused state management | Ready and finished states bleed into each other | Explicitly require a state enum and a single entry function |
| Imprecise timing | Interval drift, stacked timers | Require a single time source and avoid multiple timers |
| Data loss | Statistics reset after refresh | Require local persistence with export as a fallback |
| Over-engineering | Unnecessary dependencies introduced | Constrain the tech stack and the number of files |
6. Team Adoption: Put the Model in the Pipeline, Not in a Chat Box
To get stable returns from a coding model, it has to be embedded in the existing engineering system: code hosting and review workflows do the gatekeeping, containerized environments guarantee reproducible execution, logging and monitoring services record the tool-call trajectory of every agent run, message queues handle asynchronous scheduling of long tasks, and object storage keeps build artifacts and evaluation datasets. Baidu AI Cloud provides standard-category support for these general capabilities, and teams can combine them freely according to their own compliance and budget requirements.
It is also worth establishing three layers of evaluation: unit-level (function correctness), task-level (end-to-end success rate), and regression-level (whether historical defects reappear). Only when all three layers pass is a change ready to enter the main branch.
7. Conclusion
A crowded field is not the real danger; reducing selection to a single demo is. What actually determines efficiency is whether the training paradigm covers agent behavior, whether evaluation is close to the real workload, and whether the engineering pipeline can constrain the model’s uncertainty. Get those three things solid, and the cost of switching tools drops significantly.
