Benchmarking Code Agents with Post-Trained Foundation Models: A Controlled Experiment Practice

    This article presents a structured approach to evaluating code agents built on foundation models. It explains why single benchmark scores are insufficient and how to design controlled comparisons: base versus post-trained models, primary-model and partner-model substitutions, and same-base-model combinations. It also distinguishes team-based and individual evaluation dimensions, summarizes key findings on post-training gains, partner-model impact, and the difference between individual and collaborative capability, and provides practical recommendations for reproducible, attributable benchmarking.

    1. Why Controlled Experiments Are Needed

    When evaluating the coding capabilities of large models, a single benchmark score is often not enough. Results on real software engineering tasks are affected by base-model capability, post-training data quality, sub-agent scheduling strategy, context-length configuration, and other factors. Looking only at an isolated score makes it difficult to determine where a model’s improvement comes from.

    A more rigorous approach is to design multiple controlled experiments: fix some variables, change others, and observe the effect of a single factor. For example, how much does the same base model improve after post-training? Does pairing models of different sizes affect overall performance? These questions require structured evaluation.

    2. Designing Comparison Groups

    A typical evaluation can revolve around the following combinations:

    1. Base model vs. post-trained model

    Select the original version of a base model and a version post-trained on software engineering data, then run both through the same set of test tasks. The difference between their scores directly reflects the benefit of post-training in that domain. If the post-trained version doubles performance, it indicates that domain-specific reinforcement learning or instruction tuning significantly changes the model’s behavior on coding tasks.

    2. Partner-model substitution experiments

    In practical coding tools, a common cost-control approach is to use a large-parameter model as the primary model and set a lightweight model as a sub-agent or secondary model for auxiliary tasks such as retrieval, summarization, and local edits. This architecture saves cost, but weaknesses in the secondary model may drag down overall performance. A controlled comparison can therefore be designed by keeping the primary model fixed and replacing different lightweight or flagship models as partners, then observing fluctuations in team collaboration scores.

    One notable phenomenon in experiments is that the same strong primary model paired with different partner models can produce scores that differ by several times. This suggests that in multi-role agent collaboration, overall system performance often depends on the weakest link—any insufficient model capability in the task chain can be amplified.

    3. Same-origin combination validation

    Combining two models derived from the same base model—for example, one responsible for planning and one for execution—can validate whether same-origin models have advantages in prompt understanding and output-format compatibility.

    3. Evaluation Dimensions: Team Matches and Individual Matches

    The evaluation system usually has two dimensions:

    Team matches: Each unit is a combination of a primary model and a partner model. Each group plays a large number of matches (for example, hundreds or more), and the evaluation tracks win-draw-loss records, score rate, and the ratio of correct to incorrect submissions. Team matches reflect collaboration capability in a real production environment, including task decomposition, context passing, and handoff quality in error repair.

    Individual matches: A single model independently completes the same set of tasks, excluding collaboration interference, and reflects the model’s pure capability ceiling. Flagship models with high individual scores do not necessarily perform well in team matches, and vice versa. Models post-trained for a specific domain often rank noticeably higher in team matches than in individual matches, which indicates that their gains mainly come from cooperation with the agent framework.

    Typical results can be organized as follows:

    Dimension Observation metric Analytical meaning
    Team matches Combined score rate, win-draw-loss record Reflects actual delivery capability under a collaborative architecture
    Individual matches Single-model score rate Reflects the model’s intrinsic capability ceiling
    Correct-to-incorrect submission ratio Ratio of correct submissions to incorrect submissions Reflects output stability and self-correction ability

    4. Key Conclusions from the Data

    Conclusion 1: Domain post-training gains can be quantified. For the same base model, the post-trained version compared with the original version can raise the combined score rate from below 40% to close to 60%, nearly doubling it. This indicates that the closer the task distribution used in the reinforcement learning stage is to the evaluation distribution, the more obvious the gains.

    Conclusion 2: Partner-model choice has a major impact. With the same primary model paired with different partners, the team ranking can fall from second to ninth. Cost-sensitive model routing strategies must be weighed based on measured data, not only on single-model leaderboards.

    Conclusion 3: Individual capability and collaborative capability are two independent optimization targets. General flagship models at the top of leaderboards have a clear advantage in individual matches, but the team-match champion is not necessarily the individual-match champion, because team matches also assess instruction following, format consistency, and task handoff quality.

    5. Practical Recommendations for Developers

    1. Build your own evaluation set: Sample tasks from real business scenarios, covering requirement understanding, code generation, defect repair, refactoring, and other scenarios, rather than relying only on public leaderboards.
    2. Fix the evaluation protocol: Use unified prompt templates, context windows, retry strategies, and scoring criteria to ensure comparability between groups.
    3. Run ablation experiments: Change only one variable at a time (model, routing strategy, prompt); otherwise, attribution is impossible.
    4. Focus on quantitative metrics rather than subjective impressions: Win rate, score rate, and correct-to-incorrect submission ratio are more reliable than subjective impressions.
    5. Continuous regression: Model versions iterate frequently, so rerun evaluations regularly to prevent undetected capability regressions.

    6. Conclusion

    Evaluating code agents cannot rely only on the ceiling scores of a single model. Through structured controlled experiments—fixing the base model to compare post-training gains, fixing the primary model to compare partner impact, and distinguishing team and individual dimensions—developers can establish a reproducible and attributable evaluation method. The value of this method is that it turns the vague question “which model is better” into the decision-oriented question “under a given task type and collaboration architecture, which configuration has the best cost-benefit tradeoff,” providing solid data support for technology selection.