The Rise of AI Coding Models: Technical Approaches and Hands-On Evaluation

    This article breaks down how modern AI coding models are built and evaluated, moving beyond single-turn code completion to task-level software engineering. It explains a three-stage training paradigm—Mid-Training, SFT with rejection-sampling fine-tuning (RFT), and large-scale agentic reinforcement learning—along with practical scheduling techniques such as trajectory prefix trees, entropy-guided pruning, and decoupled training/inference. It then outlines a three-layer evaluation framework, walks through a hands-on cognitive experiment page case study with a reusable prompt skeleton and acceptance criteria, and covers the surrounding context engineering and toolchain. The article closes with selection advice and three trends shaping the field.

    1. Why the Space Is Crowded—and What Really Drives It

    Over the past two years, AI coding tools have evolved rapidly from “code completion” to “task-level code generation,” and the space has become crowded. Crowding itself is not the problem. The real issue is that a clear gap remains between what these tools can deliver and what software engineering actually demands.

    Real development tasks tend to share three characteristics: incomplete requirement descriptions, heavy reliance on repository context, and the need for multiple rounds of trial, error, and verification. This means that simply competing on single-turn generation quality is not sustainable. The real dividing line is whether a model can reliably complete the full loop of “understand—plan—edit—verify.”

    From a technical supply perspective, the industry is converging on a shared path: inject foundational capabilities using large-scale code corpora, then align agentic capabilities around task trajectories. Using publicly available technical details from a self-developed coding model series as a reference, we can abstract a general methodology.

    2. Breaking Down the Three-Stage Training Paradigm

    2.1 Mid-Training: Injecting Agentic Capabilities Up Front

    The goal of the Mid-Training stage is not to teach the model a specific programming language, but to fill in the general foundation required to act as an agent. This typically includes instruction following, tool calling and argument organization, state retention across multi-turn interactions, code knowledge injection, version control and commit message generation, and general reasoning ability.

    One engineering detail worth noting is ordering. Placing tool use and multi-turn interaction before fine-tuning allows later stages to amplify capabilities from an already high baseline, rather than “hard-teaching” basic behaviors with a small set of high-quality trajectories. This yields noticeably better data efficiency.

    2.2 SFT and RFT: Aligning to the Real Task Distribution

    The key to the supervised fine-tuning stage is task distribution design. A common approach covers multiple categories of high-frequency development tasks—such as bug fixing, feature additions, test generation, code explanation, refactoring, script writing, dependency and configuration changes, and documentation generation—across a variety of real code scenarios and language ecosystems.

    Supervision alone is often insufficient to produce stable output, so rejection-sampling fine-tuning is introduced. For the same requirement, multiple candidate trajectories are sampled, and verifiable signals such as test cases, static checks, and compilation results serve as ground truth for filtering. Only trajectories that pass verification are retained for further training. The benefits are twofold: it improves data quality, and it significantly improves the sampling efficiency and stability of the subsequent reinforcement learning stage.

    2.3 Scaling Agentic Reinforcement Learning: Solving “Compute Idling”

    The biggest engineering bottleneck in the reinforcement learning stage is scheduling fragmentation caused by long trajectories. Task lengths vary enormously, and synchronous waiting creates large compute bubbles. Two combinable approaches are relatively mature in the industry:

    • Trajectory prefix trees + entropy-guided pruning: Compress massive sampled trajectories into a prefix-tree structure, rank them by entropy and visit probability, and expand only high-information nodes within budget—spending compute on the branches where “the model is most uncertain and can learn the most.”
    • Heterogeneous scheduling with decoupled training/inference: Fully separate sampling from parameter updates, and use a unified queue for pipeline orchestration to keep the cluster running near full capacity.

    The scheduling logic can be abstracted schematically as:

    1. # Pseudocode: entropy-guided budget allocation
    2. def allocate_budget(tree, budget):
    3. nodes = flatten(tree)
    4. nodes.sort(key=lambda n: (n.entropy, n.visit_prob), reverse=True)
    5. expanded, cost = [], 0
    6. for n in nodes:
    7. if cost + n.cost > budget:
    8. continue
    9. expanded.append(n); cost += n.cost
    10. return expanded # expand only high-signal nodes

    3. How to Scientifically Evaluate Coding Models

    Leaderboard scores are only useful for initial screening. Real adoption depends on three layers of metrics:

    1. Task pass rate: Use unit test and integration test results as hard metrics. For example, bug-fixing benchmarks focus on “whether the patch actually turns tests green.”
    2. Process efficiency: Number of turns, ineffective edits, context consumption, and average latency directly determine usage cost and experience.
    3. Safety and maintainability: Whether unrelated changes are introduced, whether existing interfaces are broken, and the readability and test coverage of generated code.

    Teams are advised to build their own small internal benchmark set, constructing 20–50 tasks from real issues in real repositories, and to look only at relative changes during regression testing to avoid being misled by public leaderboards.

    4. Hands-On Case: Decomposing a Cognitive Experiment Page

    Consider a typical psychology experiment page. The requirement can be described as: present a stimulus image at fixed intervals, and have the participant judge whether the current image is identical to the one N positions earlier; the stimulus set consists of several common Chinese characters; and the value of N can be selected before the experiment begins. Such a requirement looks simple, but it is a good test of a model’s ability in “state machine design + timing control + interaction constraints.”

    A reusable prompt skeleton is as follows:

    1. Build a single-page cognitive experiment app:
    2. - Stimulus set: 10 common Chinese characters, randomly drawn
    3. - Pace: present one every 1000ms, with no consecutive-repeat constraint
    4. - Task: judge whether the current stimulus matches the one N positions earlier; respond by keypress or click
    5. - Startup config: allow selecting N (e.g., 2/3/4)
    6. - Logging: accuracy, reaction time, trial index, with export support
    7. - Requirements: clear state, no memory leaks, timers correctly cleaned up

    It is best to state acceptance points explicitly in the prompt, which significantly reduces rework:

    • The first N trials should skip judgment or be marked as practice and excluded from accuracy;
    • Timers must be cleaned up when the page unloads or the experiment ends, to avoid stacked triggering;
    • Feedback and result statistics must correspond strictly one-to-one with trials;
    • Both keyboard and mouse input must work, with duplicate counting prevented.

    The general lesson from such cases: the more verifiable the requirement, the more stable the model’s performance. Making implicit constraints explicit is the cheapest way to improve generation quality.

    5. Context Engineering and Toolchain Support

    Model capability is only half the equation; the other half comes from surrounding engineering:

    • Retrieval and repository indexing: Recall relevant files and symbols on demand to control context noise;
    • Diff-based editing rather than whole-file rewrites: Reduce conflicts and regression risk;
    • Sandboxed execution and automated verification: Form a closed feedback loop with compilation, testing, and static checks;
    • Observability: Track call volume, failure rates, and latency distributions through logging services and monitoring/alerting systems;
    • Elastic compute: Container platforms host sampling and evaluation tasks, while object storage holds trajectories and artifacts.

    When deploying in the cloud, these capabilities are typically combined as general product categories, and a complete pipeline can be built without binding to a specific vendor’s interfaces.

    6. Selection Advice and Trend Outlook

    Faced with a crowded space, the rational strategy is “scenario-driven, layered validation”: first screen with public benchmarks, then retest with an internal task set, and finally run a small-traffic canary to observe real adoption and rework rates. Closed-source high-performance versions suit complex refactoring tasks that pursue the upper limit, while open-source, self-deployable versions suit scenarios with strict data compliance requirements or a need for private fine-tuning. The two can be combined.

    Three trends are foreseeable. First, evaluation is moving from “can it pass” to “is the process efficient.” Second, the training focus is shifting from data scale to trajectory quality and scheduling efficiency. Third, toolchains and models are being co-designed, with context management and verification feedback becoming core competencies. Understanding these underlying principles is more valuable in the long run than chasing any single version update.