How Coding LLMs Are Trained and Evaluated: A Practical Guide to the Three-Stage Training Paradigm and Hands-On Testing

    This article breaks down how modern coding LLMs are trained and evaluated, moving from the crowded competitive landscape to the concrete engineering behind it. It dissects the three-stage training paradigm—mid-training, SFT & RFT, and agentic RL scaling—explains how to benchmark these models across multiple capability dimensions, and lays out a reproducible testing workflow from environment setup to task design. A worked example implementing an N-Back cognitive experiment page shows how to probe a model's one-shot accuracy and engineering discipline in practice.

    一、The Competitive Landscape of Coding LLMs: Why Iteration Is So Fast

    Over the past year or two, AI coding assistants have evolved rapidly from “autocomplete tools” into “coding agents capable of autonomously completing tasks.” Vendors no longer compete on single-point code generation alone. Instead, they now compete across end-to-end engineering capabilities: instruction following, tool calling, multi-turn interaction, codebase understanding, and handling Git commits and pull requests. One notable pattern is how some in-house coding models have leapfrogged from supporting “only a few terminal-based agents” to being “compatible with more mainstream coding agent tools” in an extremely short cycle, while also releasing a closed-source flagship version alongside several open-weight size variants and generous free token quotas. This strategy of “rapid iteration plus a multi-version matrix” has become an important signal for gauging the engineering cadence of a coding model team.

    For developers, whether the field is crowded doesn’t really matter. What matters is how these models’ capabilities are actually trained, and how they can be objectively evaluated and verified. The discussion below is organized around three layers: training paradigms, evaluation methods, and hands-on testing workflows.

    二、Dissecting the Three-Stage Training Paradigm of Coding LLMs

    For a mature coding model, training is rarely a single stage. Instead, it typically follows a layered, three-stage structure.

    1. Mid-Training

    Mid-training is the “foundation-laying” phase. Its core goal is to strengthen the model’s general-purpose capabilities for agentic scenarios, specifically including:

    • Instruction following: understanding and strictly executing structured, multi-constraint natural language instructions;
    • Tool use: learning to correctly issue function/tool calls during reasoning;
    • Multi-turn interaction: maintaining context consistency across long dialogues and successive edits;
    • Code knowledge injection: supplementing specialized knowledge such as frameworks, libraries, and common engineering paradigms;
    • Engineering collaboration: for example, understanding version-control workflows and generating well-formed commit messages and PR descriptions;
    • General and reasoning capabilities: ensuring the model doesn’t regress on non-coding tasks.

    The output of this stage determines whether the model can function as a “schedulable agent” rather than a mere autocomplete engine.

    2. Supervised Fine-Tuning and Rejection Sampling Fine-Tuning (SFT & RFT)

    Once the alignment phase begins, the process is usually split into two sub-steps:

    • SFT (Supervised Fine-Tuning): collect high-quality demonstration data around high-frequency user tasks and typical code scenarios, teaching the model the “standard problem-solving paradigm.” Data coverage typically focuses on combinations of several classes of common tasks and several classes of common code scenarios, ensuring adequate coverage of the real distribution.
    • RFT (Rejection Sampling Fine-Tuning): introduce multiple reference answers (ground truth) to filter and select the best candidate solutions from samples, improving rollout efficiency in the subsequent reinforcement learning stage and enhancing training stability. In essence, RFT provides a more reliable starting point for reinforcement learning through “high-quality positive samples.”

    3. Scaling Agentic Reinforcement Learning (Agentic RL Scaling)

    This is the key differentiator that separates models today. The challenge is that agent trajectories are long and branch heavily, so running reinforcement learning directly is extremely compute-intensive. A fairly representative engineering approach in the industry combines two things:

    • Entropy-guided prefix tree pruning: compress massive sampled trajectories into a prefix tree, then rank nodes by “entropy” and “visit probability,” expanding only those nodes with high information gain and strong signal within a limited compute budget—avoiding wasted resources on low-value branches;
    • Heterogeneous pipeline scheduling: fully decouple “training compute” from “agent logic execution,” letting resources of different compute types slot into their proper roles, reducing pipeline bubbles caused by synchronization waits and thereby maxing out cluster utilization.

    The significance of this combination is that it takes “using reinforcement learning to refine agentic capabilities at scale” from a concept to something that can be scaled into production.

    三、How to Evaluate Coding Models: Benchmarks and Capability Dimensions

    Looking at benchmark scores alone is easy to distort. It’s better to cross-validate across multiple dimensions:

    1. Software engineering task benchmarks: refer to industry-standard repository-level task evaluations (such as giving the model an issue and having it locate and fix the code), focusing on whether the problem is actually solved rather than whether the change merely “looks like a patch”;
    2. Agent toolchain compatibility: whether the model can be smoothly invoked by mainstream terminal-based/IDE-based coding agents—a prerequisite for a model being truly “usable”;
    3. Engineering collaboration: whether commit messages, PR descriptions, and multi-turn edits conform to real collaboration standards;
    4. Stability and consistency: whether capability drift occurs during long tasks and multi-turn interactions.

    四、Testing Methodology: From Environment Setup to Task Design

    To objectively evaluate a coding model, the following workflow is recommended:

    • Environment setup: connect the model to mainstream coding agent tools. Most tools support specifying the model service endpoint and authentication via a unified interface protocol, with highly consistent configuration items. If you use a cloud-hosted setup, you can combine object storage to save artifacts, a logging service to record the call chain, and monitoring/alerting to observe latency and error rates.
    • Task design principles:
      • prioritize tasks with “clearly defined boundary conditions and verifiable results” so they can be scored quantitatively;
      • cover both single-turn generation and multi-turn iteration scenarios;
      • deliberately introduce a degree of complexity to observe the model’s stability on long-chain tasks.

    五、Hands-On Case: Building a Cognitive Experiment Page with a Coding Agent

    The following example uses the N-Back task, common in psychology experiments, as a test problem to assess a model’s one-shot accuracy and adherence to conventions.

    Requirement: implement an N-Back experiment page. The principle is that an image flashes roughly every second, and the user must judge whether the current image matches the one from N steps earlier—selecting “Yes” if it matches and “No” if it doesn’t. The images are drawn from 10 common Chinese characters, for example 「国、火、道、市、天、家、理、态、至、心」. The page should let the user choose the value of N (such as 2, 3, or 4) before starting.

    This is a good evaluation problem because it simultaneously tests:

    • State management: maintaining the “history sequence” and the logic to “look back N items”;
    • Timing mechanism: precise scheduled switching;
    • Interaction and feedback: judgment, scoring, and result statistics;
    • UI completeness: configurable, startable, and endable.

    A relatively clear implementation approach is to use a queue to store the most recently shown characters, then check whether the tail matches the Nth-from-last item each time a new character appears:

    1. // Core matching logic (illustrative)
    2. function isMatch(history, current, n) {
    3. // history is the sequence "before the current character appears"
    4. if (history.length < n) return false;
    5. const target = history[history.length - n];
    6. return target === current;
    7. }
    8. // Queue maintenance
    9. const queue = [];
    10. function onNewChar(ch) {
    11. const match = isMatch(queue, ch, N); // judge first
    12. queue.push(ch); // then enqueue
    13. return match;
    14. }

    During testing, pay close attention to whether the model:

    1. correctly handles the error-prone point of “judging before the current character is enqueued”;
    2. keeps the logic consistent when switching between N=2/3/4;
    3. can generate a fully runnable, complete page in one pass, minimizing repeated rework.

    六、Summary and Practical Recommendations

    The competition among coding LLMs has fundamentally shifted from “can it write code” to “can it independently complete engineering tasks as an agent.” Understanding the three-stage training logic of mid-training → SFT & RFT → agentic RL scaling helps us gauge a model’s capability boundaries. Meanwhile, cultivating the habit of multi-dimensional evaluation plus a standardized testing workflow helps developers make rational choices among a sea of products. Rather than fretting over whether the field is crowded, it’s better to focus your energy on “validating real capability with reproducible test problems”—which remains the most reliable anchor for technical decision-making.