A New Approach to Evaluating Coding Models: From Code Patching to Complete Projects

    This article compares two approaches to evaluating coding models: single-point code patching tasks and end-to-end project-level tasks in containerized environments. It explains why end-to-end evaluation better reflects real engineering ability, how to build reproducible evaluation environments, which metrics to track beyond pass rate, how to scientifically compare output quality across different API access channels, and how to measure cost-effectiveness using cost per passed task.

    1. The Fundamental Difference Between Two Evaluation Approaches

    When evaluating coding models, a common practice is to give the model a bug description or a feature requirement, have it modify existing code, and then judge correctness using test cases. These tasks are typically drawn from real issue records or generated synthetically or semi-synthetically by researchers. The advantages are clear input boundaries, highly automated scoring, and low cost per evaluation run. The disadvantages are equally clear: tasks tend to focus on localized changes, the model only needs to understand a small slice of context, and the evaluation cannot reveal its ability to locate problems in large codebases, coordinate across files, or handle builds and dependencies.

    The other approach places the model inside a containerized terminal environment. The repository is prepared in advance, and the model must read the directory structure, execute commands, install dependencies, run builds and tests, and ultimately be judged on the behavior of the project as a whole. This is much closer to the full workflow of an engineer’s daily work. The differences between the two approaches show up mainly in the following areas:

    • Task granularity: single-point patching corresponds to a single function or file, while end-to-end tasks correspond to a complete project.
    • Interaction environment: the former is a static code snippet, while the latter is a terminal where commands can be executed and output read.
    • Scoring method: the former relies on whether unit tests pass, while the latter combines build results, runtime results, and acceptance scripts.
    • Data contamination risk: public single-point problems are easily absorbed into training data, so models may simply memorize answers. End-to-end tasks have more complex environments and acceptance logic, and generative variants are easier to design.

    2. Why End-to-End Tasks Better Reflect Real Capability

    Real development is rarely “see one error line, change one line of code.” A single problem may involve configuration files, dependency versions, environment variables, and the test framework all at once. An end-to-end task requires the model to complete the following stages in sequence:

    1. Understand the project structure and coding conventions.
    2. Reproduce the problem and collect evidence such as logs and stack traces.
    3. Formulate a modification plan and execute it step by step.
    4. Run verification and iterate based on failure information.
    5. Deliver the result without breaking existing functionality.

    Every stage can go wrong, and errors accumulate in later steps. For example, if the model misreads a configuration option, every subsequent modification will be built on a wrong assumption. Therefore, the final score of an end-to-end task reflects planning ability, tool-use ability, and error-recovery ability.

    A model that scores high on single-point tests does not necessarily maintain the same performance on end-to-end tasks. The two kinds of results should be examined together. Single-point results indicate the model’s level of local code understanding and generation, while end-to-end results indicate whether the model can organize those abilities into a complete workflow.

    3. Building a Reproducible Evaluation Environment

    The credibility of an evaluation depends on whether the environment is reproducible. Keep the following points in mind when building one:

    • Pin image versions: the base image, system libraries, and toolchain should all be version-locked to prevent environment drift from changing results.
    • Pin dependencies: project dependencies should be installed via lock files, with hashes verified before evaluation.
    • Limit resources and time: set CPU, memory, disk, and timeout limits for each task to prevent a single task from dragging down the entire evaluation cluster.
    • Control network access: block external network access by default and only open necessary package sources. This ensures reproducibility and reduces the risk of the model unexpectedly accessing external resources.
    • Record complete traces: save the commands, outputs, and reasoning summaries for every step, making it easier to review failure causes afterward.

    Below is an illustrative evaluation loop. The functions are placeholder interfaces that need to be implemented against actual infrastructure.

    1. def evaluate(model, tasks, runs=3):
    2. records = []
    3. for task in tasks:
    4. for seed in range(runs):
    5. env = start_container(
    6. image=task.image,
    7. seed=seed,
    8. cpu=2,
    9. mem_gb=4,
    10. )
    11. try:
    12. trace = run_agent(model, env, task.prompt, max_steps=200)
    13. passed = env.run_check(task.check_script, timeout=600)
    14. changed_tests = env.diff_protected_paths(task.protected_paths)
    15. finally:
    16. env.destroy()
    17. records.append({
    18. "task": task.id,
    19. "seed": seed,
    20. "passed": passed and not changed_tests,
    21. "steps": trace.step_count,
    22. "elapsed": trace.elapsed_sec,
    23. "tokens": trace.total_tokens,
    24. })
    25. return summarize(records)

    Here, protected_paths records the acceptance test files. If the model modifies these files, the task should be judged as failed even if the script returns success. This is a basic measure to prevent the model from “cheating by modifying the tests.”

    4. Metric Design: Pass Rate Alone Is Not Enough

    Pass rate is the most intuitive metric, but using it alone can be misleading. It is recommended to track the following categories of metrics at the same time:

    • Task pass rate: the proportion of tasks successfully completed on the same evaluation set.
    • First-attempt pass rate versus pass rate after multiple rounds of correction: the larger the gap, the more the model relies on repeated trial and error.
    • Average number of steps and tool calls: reflects execution efficiency. Too many steps usually indicates unclear planning.
    • Number of dangerous operations: for example, deleting non-target files, modifying acceptance test cases, or executing high-risk commands. These metrics should be tracked separately and must not be masked by the pass rate.
    • Resource consumption: including token usage, elapsed time, and cost, which forms the basis for later cost analysis.
    • Result stability: the variance across multiple runs of the same task. Two models with the same pass rate can differ greatly in stability.

    Every evaluation should report confidence intervals rather than a single number. When the number of runs is small, the fluctuation of a single result may exceed the gap between different models, so conclusions need a sufficient sample size to be supported.

    5. Access Channels and Output Quality: How to Judge Scientifically

    Behind the same model name, there may be multiple service paths. Common ones include the service provided directly by the model provider, a version deployed by the team itself, third-party services that apply quantization or compression, and aggregated services with routing and distribution. These paths may differ in numerical precision, context length, default inference parameters, and version update cadence. Such differences directly affect output quality.

    Many community discussions about “capability degradation” stem from inconsistent comparison targets or the lack of a unified test set. For example, one side uses default parameters while the other uses custom parameters; one side tests during peak hours while the other tests during off-peak hours; one side runs once while the other runs multiple times. All of these factors make comparisons meaningless.

    A scientific judgment method can follow these steps:

    1. Fix the evaluation set, random seeds, and sampling parameters, keeping all conditions identical except for the access channel.
    2. If the API returns a model version or service identifier, record it to verify the actual version being called.
    3. Run the same task multiple times on each channel.
    4. Use statistical methods to determine whether differences are significant, such as computing confidence intervals for pass rates or using permutation tests to compare two groups of results.
    5. Combine quality results with cost data to calculate cost-effectiveness.

    It is important to emphasize that price differences alone cannot serve as a basis for judging quality. A lower price may come from greater concurrency, different hardware, or different optimization strategies—or it may come from genuinely different service quality. Only data obtained through unified testing can support a conclusion.

    6. Cost and Willingness to Pay

    Users are usually willing to pay for a service because it provides stable output quality, clear data processing terms, reliable service-level commitments, and support channels when problems arise. These values are hard to measure with unit price alone, so teams need a cost metric that enables unified comparison.

    The recommended core metric is “cost per passed task”:

    Cost per passed task = total cost during the evaluation period ÷ number of passed tasks

    This metric accounts for unit price, pass rate, and the number of retries at the same time. A more expensive option with a noticeably higher pass rate may have a lower unit cost. Conversely, a seemingly cheap option that requires many retries may end up costing more than expected.

    When calculating, be sure to include the cost of failed tasks in the total; otherwise, the true cost of low-pass-rate options will be underestimated.

    7. Practical Recommendations

    • Keep both types of evaluation: localized patching tasks are suitable for quick regression checks, while end-to-end tasks are suitable for periodic model selection. The two complement each other and should not replace each other.
    • Regularly update the evaluation set: public problems easily enter training data, so continuously add new, unpublished tasks and record when each problem was created.
    • Arrange manual spot checks: automated scoring cannot detect code style, maintainability, or potential security issues. A portion of passing results should undergo manual review.
    • Control data boundaries: no production credentials should be placed in the evaluation environment. Before sending code to external services, confirm data compliance requirements and verify the scope of authorization with the responsible party.
    • Maintain least privilege: when the agent runs inside the container, grant only the file and network permissions needed to complete the task, and set blocking rules for high-risk commands.

    The evaluation of coding models is shifting from “can it write a correct function” to “can it reliably complete tasks in a real engineering environment.” The closer the evaluation method is to actual workflows, the more valuable its results are for model selection decisions.