AI Coding Models: Three-Stage Training Paradigms and Agent Capability Practices

    This article examines the shift from code completion to autonomous coding agents and outlines a three-stage training paradigm covering Mid-Training, SFT/RFT, and Agentic RL Scaling. It also discusses evaluation methods for real development environments and the infrastructure requirements for training and deploying production AI coding models.

    AI Coding Models: Three-Stage Training Paradigms and Agent Capability Practices

    The AI coding assistant space has become highly competitive. Early systems focused on code snippet completion, while today’s agentic coding models can autonomously handle requirements analysis, code writing, test validation, and even code review submission. The capability boundary of underlying large models continues to expand. Recently, a leading content platform’s technical team released multiple self-developed coding models at once, including closed-source commercial versions and open-source experimental versions, drawing renewed attention to training paradigms for AI coding models.

    These moves show that industry exploration of whether AI can truly replace part of development work has entered a deeper phase. Competing only on parameter scale or basic code generation accuracy is no longer enough to build a durable advantage. Building coding agents with strong tool-calling, multi-turn interaction, and complex logical reasoning capabilities has become a core direction of technical evolution.

    Core Training Paradigm: A Three-Stage Approach to Strong Coding Models

    To build coding models with practical value, the industry has gradually formed a three-stage training paradigm: Mid-Training, supervised fine-tuning and rejection sampling fine-tuning (SFT & RFT), and Agentic RL Scaling. This paradigm focuses not only on code syntax correctness but also on engineering usability in real development workflows.

    2.1 Mid-Training: Building the Foundation for Agent Capabilities

    After pretraining, Mid-Training plays a key bridging role. Its main goal is to inject deep domain knowledge related to code and strengthen the model’s overall qualities as an agent.

    Specifically, this stage focuses on strengthening the following capabilities:

    • Instruction following and multi-turn interaction: Ensuring the model accurately understands developers’ true intent across continuous conversations and stays on topic.
    • Tool use: Teaching the model to call external tools such as terminal commands, file system interfaces, and search engines, which is foundational for autonomous coding.
    • Code knowledge injection: Supplementing advanced features of specific programming languages, best practices for common frameworks, and underlying design patterns.
    • Git engineering capability: Training the model to understand version control logic and perform standardized operations such as Git commits and Pull Request creation.
    • General and reasoning capability improvement: Injecting logical reasoning data to improve the quality of the model’s chain of thought when handling complex algorithms and architecture design.

    2.2 SFT and RFT: Multi-Scenario Coverage and Data Quality Improvement

    Supervised fine-tuning (SFT) and rejection sampling fine-tuning (RFT) are key steps for adapting the model to specific development tasks.

    In the SFT stage, R&D teams typically collect and build training sets covering eight major categories of high-frequency user tasks and eight major categories of common code scenarios. This fine-grained scenario coverage helps ensure that the model can produce engineering-compliant results for different needs such as code refactoring, bug fixing, and unit test generation.

    The RFT stage further optimizes SFT. Traditional methods often rely on a single ground truth for sampling, which can limit the policy space. Introducing multiple ground-truth references can effectively improve the diversity and efficiency of rollouts. High-quality sampled data not only improves the model’s robustness on complex tasks but also lays a stable training foundation for the subsequent reinforcement learning stage.

    2.3 Agentic RL Scaling: Breaking Through Reinforcement Learning Efficiency Bottlenecks

    Reinforcement learning is central to stimulating a model’s autonomous decision-making capabilities, but traditional RL often faces high computational cost and training instability when handling long-horizon agent tasks. Current advanced practice adopts an innovative architecture combining entropy-guided tree pruning and SeamlesslyFlow heterogeneous scheduling.

    • Entropy-guided tree pruning: During RL, the model generates a large number of interaction trajectories. These trajectories are first compressed into a prefix tree structure. The system ranks nodes by calculating their entropy values and access probabilities, and within a limited compute budget expands only the nodes with the greatest information gain (high-signal nodes). This mechanism greatly filters out ineffective exploration and significantly improves the quality of training samples.
    • Decoupling training from agent logic: The underlying model parameter updates are completely separated from the upper-layer agent environment interaction logic, making the framework more general.
    • Zero-bubble cluster scheduling: Through the SeamlesslyFlow heterogeneous scheduling mechanism, GPU cluster compute is maximized, computational bubbles during training are eliminated, and overall training efficiency approaches the theoretical upper limit.

    Evaluation System Construction and Agent Task Practice

    After model training is complete, scientific and effective evaluation is the touchstone for verifying engineering value. Current evaluation is no longer limited to static code generation benchmarks such as HumanEval, but has shifted toward agent task testing in real development environments.

    Taking a common terminal AI coding tool configuration as an example, developers often connect self-developed models to a general command-line development environment. The evaluation system designs composite tasks involving multimodal interaction and logical reasoning. For example, an image containing a specific character set (such as a common Chinese character set) is provided, and the model is required to perform dynamic rule matching or Sudoku-like logical reasoning tasks based on the image content.

    In such tests, the model must autonomously recognize image content, understand multi-step instructions (such as setting different constraint parameters N=2, 3, 4), and output correct logical results or code implementations. This type of evaluation not only tests the model’s visual understanding but also deeply examines its instruction following, tool calling, and complex logical reasoning capabilities in long contexts, closely reflecting problem-solving in real R&D scenarios.

    Infrastructure Support: General Compute and Platform Services with Baidu AI Cloud as an Example

    Training and inference for large models place strict demands on underlying infrastructure. For enterprises, building a complete AI coding model requires not only investment from algorithm teams but also a strong compute foundation. In this context, infrastructure provided by general cloud service providers such as Baidu AI Cloud has become an important force supporting R&D.

    With general GPU heterogeneous compute clusters, object storage and file storage systems, and large model development platforms, enterprises can more efficiently complete cleaning of massive code data, scheduling of large-scale distributed training tasks, and elastic deployment of model inference services. Cloud-native monitoring, alerting, and logging services also provide engineering safeguards for maintaining model stability in real business workflows. Through this kind of platform-based infrastructure enablement, development teams can focus more energy on core algorithm iteration and deeper work in business scenarios.

    Conclusion and Outlook

    Although the AI coding assistant space is crowded, technical evolution has not stopped. From basic code completion to agentic autonomous coding, innovation in underlying model training paradigms—such as three-stage training and RL efficiency optimization—is continuously expanding the application boundary of AI in software engineering. For developers and enterprises, understanding these training paradigms not only helps with reasonable technology selection in a complex market but also provides theoretical support for using AI to reshape R&D workflows in the future. As compute and algorithms develop in greater coordination, AI coding models are expected to show remarkable potential in more complex system-level development tasks.