Coding Model Training in Three Stages and a Practical N-Back Test Method
This article reviews a cloud provider's three-stage training approach for coding models—mid-training, supervised and rejection-sampling fine-tuning, and agent reinforcement-learning scaling—and then describes a reproducible N-Back page test. It covers task specifications, reference decision logic, test cases, a prompt template, test steps, observations, selection criteria for closed-source versus open-source versions, industry trends, and usage risks. The source report does not disclose model names, parameter sizes, context lengths, licenses, or release dates, so those details must be verified against official documentation.
Scope Note
This article discusses a series of in-house coding models recently released by a cloud provider, including a closed-source flagship version and open-source small and medium-sized versions. The source report does not provide model names, parameter sizes, context lengths, licenses, or release dates. This information is critical for model selection, so refer to the official technical report, model card, and license text. The training details cited here come from the source report’s overview and were not independently verified.
The hands-on section comes from one personal task with one page, one environment, and one main round of testing. It demonstrates a method but does not represent the overall capability of the models.
1. What the Three Training Stages Do
The report divides training into three stages. The objectives of each stage are relatively clear, but their effectiveness requires data support.
| Stage | Goal described in the report | Key publicly described approach | Points to verify independently |
|---|---|---|---|
| Mid-training | Improve foundational agent capabilities | Strengthen instruction following, tool use, multi-turn conversation consistency, code knowledge, and understanding of Git commit and pull request workflows while preserving general reasoning ability | Training data mix and whether general reasoning actually does not regress |
| Supervised fine-tuning and rejection-sampling fine-tuning | Bring the model closer to real development needs | Cover 8 categories of high-frequency user tasks and 8 categories of common code scenarios; introduce multiple reference answers | Rejection-sampling filtering criteria, number of samples, and correctness determination method |
| Agent reinforcement-learning scaling | Improve training efficiency | Use entropy-guided tree pruning to prioritize high-information trajectories; use SeamlessFlow heterogeneous scheduling to reduce cluster idleness | Specific efficiency gains, cluster scale, and comparison baseline |
The first stage’s design is reasonable. Modern coding assistants need to participate in the full loop of requirement understanding, solution design, code implementation, testing, and submission. Without foundational agent capabilities, later code-specific training will be limited.
Two points in the second stage should be treated cautiously. The source says that introducing multiple reference answers can increase the search freedom of reinforcement learning and thereby improve training efficiency. This is the author’s explanation, and the article provides no controlled experiment. In addition, the source does not explain how rejection sampling filters trajectories, what criterion is used to determine correctness, or how many samples are taken. Without clear definitions for these points, it is difficult to tell where the effect comes from.
The core of the third stage is ranking by entropy value and visit probability, concentrating compute on high-information trajectories. The report uses “zero bubble” to describe cluster utilization, but it does not define idle time or provide a measurement method. This article interprets it as reducing idle waiting; the specific magnitude should be based on data in the official report.
2. Testing Coding Models with an N-Back Page
N-Back is a common paradigm in cognitive psychology for studying working memory. In the experiment, a stimulus is presented every 1 second, and the participant judges whether the current stimulus is the same as the stimulus N steps earlier. If they are the same, select “Yes”; if different, select “No.” The logic is simple, but it includes timing, asynchronous responses, state switching, and recording. It is suitable for testing whether a model understands business semantics and for exposing loopholes in boundary conditions.
Task Specification
- Stimuli: 10 common Chinese characters.
- N values: 2, 3, and 4, selected by the user at the start of each experiment.
- Pace: present one stimulus every 1 second.
- Boundary: when fewer than N historical stimuli are available, do not make a judgment and show a prompt.
- When switching N: clear history, reset the timer, and reset the score.
- Recording: correctness of each response, reaction time, and timeout cases.
Reference Decision Logic
The following function can serve as the reference answer during testing to check the judgment result of model-generated code.
// history: stimuli already presented before the current stimulus, in chronological order, excluding the current item// current: current stimulus// n: number of steps to look backfunction expectedAnswer(history, current, n) {if (history.length < n) return null; // Not enough history; cannot judgereturn history[history.length - n] === current ? 'Yes' : 'No';}
Test Cases
| Case | Input | Expected result |
|---|---|---|
| Insufficient history | N=2, first stimulus | No judgment; show a prompt |
| All same | N=2, sequence A A A A | From the third stimulus onward, all answers are “Yes” |
| All different | N=3, sequence A B C D E F | All answers are “No” |
| Switch N | Switch from N=2 to N=3 | History cleared, timer reset, score reset to zero |
| Timeout without answer | User does not answer | Counted as a miss according to the rules; the rules must be stated on the page |
| Timing precision | Run a continuous set of stimuli | Record mean and maximum interval deviation |
Prompt Template
It is recommended to use the same prompt for each model and save the original text. The template is as follows:
Please implement an N-Back experiment page using native HTML, CSS, and JavaScript. Requirements:
- Use 10 common Chinese characters as stimuli and present one every 1 second.
- Before the experiment starts, allow the user to select N as 2, 3, or 4.
- The user judges whether the current stimulus is the same as the stimulus N steps earlier and answers through buttons.
- When fewer than N historical stimuli are available, show a friendly prompt and do not make a judgment.
- Reset the experiment state when switching N.
- After the experiment ends, show the accuracy rate and record the reaction time for each response.
Test Procedure
- Record environment information: model version, invocation method, date, and adjustable sampling parameters.
- Submit the prompt and save the complete first-round output.
- Run the code in an independent environment and record whether the first run produces an error.
- Verify each test case one by one and record the pass status.
- For failed cases, use a fixed follow-up statement to request corrections, and record the result of each correction round.
- Count the amount of manual modification, including changed lines and change types.
- Measure elapsed time, separating “model generation,” “manual debugging,” and “user confirmation.”
Author’s Observations
The author’s records show that the model understood the N-Back business logic well, generated the core framework in one interaction, correctly implemented the per-second flashing timer logic, and handled N-value switching and score feedback. The model also proactively added a prompt for insufficient historical stimuli.
Problems also existed. In more complex nested interaction scenarios, the model occasionally missed part of the logic and needed follow-up questions to correct it. The author considers the code readability and structure to be good, but these judgments are subjective, with no fixed scoring standard or repeated experiments, so they can only be used as a reference.
The source mentions that the author previously implemented this page manually in another environment, spending about one month intermittently. The scope of this time is unclear, including whether it includes learning costs, debugging time, and task scope. Therefore, it cannot be used directly to compare efficiency.
3. How to Choose Between Closed-Source and Open-Source Versions
The report divides the series into a closed-source flagship version and open-source small and medium-sized versions. Differences between the two should be based on official documentation. The following table lists dimensions to check during selection.
| Dimension | Why it matters | Source to check |
|---|---|---|
| Parameter size | Determines deployment cost and inference speed | Model card |
| Context length | Determines whether multiple files or repository-level code can be read | Official documentation |
| Tool calling | Determines whether tests can be run automatically, logs read, and code committed | API documentation and self-test results |
| License | Determines whether commercial use and private deployment are allowed | License text |
| Usage cost | Determines the budget for large-scale use | Pricing page |
| Multimodal input | Determines whether UI sketches and architecture diagrams can be processed directly | Official documentation |
Selection can follow this checklist:
- If the task involves multi-file or repository-level changes: confirm context length and retrieval capability first.
- If tests need to be run automatically and error logs read: test the stability of tool calling first.
- If code cannot leave the local environment: confirm the license and private deployment method first.
- If the task is simple and the budget is limited: try an open-source small or medium model first, then decide whether to upgrade.
- If front-end development requires reading design drafts: confirm whether the selected version includes multimodal capabilities.
4. Industry Trends and Usage Risks
Competition among AI coding assistants currently focuses on roughly four directions. The first is the depth and breadth of context, meaning whether the model can find code relevant to the current task in a large code repository. The second is native support for tool calling, including running tests, modifying files, and committing code. The third is multimodal input, such as diagrams and UI sketches. The fourth is training efficiency, meaning whether the compute cost of the reinforcement-learning stage can be reduced.
These directions are general industry judgments, not an evaluation of a specific product. Plugin-based agent tools are also advancing repository-level awareness, but this article does not compare their relationship with this model.
The following risks require attention during use:
- Generated code must be tested and cannot be deployed directly to production.
- File, terminal, and repository permissions granted to the model should be as limited as possible.
- Do not paste keys, account credentials, or customer data into prompts.
- Use of open-source models must comply with their license terms.
- Results from a single person and a single task do not represent overall capability; multi-task and repeated tests are needed.
5. Conclusion
In this N-Back task and a single environment, the series generated a runnable first version of the code and correctly handled most core logic. Complex interaction scenarios still required follow-up corrections, so the result is closer to a “runnable starting point that needs adjustment” than a finished product that can be delivered directly.
This conclusion applies only to this test. To judge whether the model fits a team, use the test protocol above on real tasks, record pass rate, modification volume, and elapsed time, and then compare it horizontally with other models.
