How to Evaluate Real Coding Ability of Large Language Models: Lessons from a Multi-Model Comparative Test

    This article examines why simple "run a sample" tests are insufficient for assessing the coding capabilities of large language models, drawing on structured comparative experiments that fixed the same repository and task across multiple models. It details common failure modes—such as hallucinated root-cause attribution, shotgun debugging, and execution that diverges from the model's own plan—and proposes a reproducible evaluation framework based on controlled variables, process metrics, and iterative sampling. The goal is to help engineering teams focus on problem-solving methodology rather than demo performance when selecting or benchmarking code-generation models.

    1. Background: Why “Run a Sample” Is Not Enough to Judge Model Capability

    As large language models (LLMs) increasingly handle code generation, developers face a practical challenge: models appear impressive in official demos and sample videos, but how do they perform in real projects? Many teams create a small internal task, have a few models attempt it independently, and compare the outputs by eye. This approach suffers from several flaws: tasks are not standardized, evaluation criteria are subjective, and failure modes are not recorded structurally. The conclusion often reduces to a vague, non-reproducible statement like “Model A feels better.”

    Recent community-driven comparative tests offer a more credible methodology. The core idea: fix the same code repository and the same task plan, let each model work independently, then compare both intermediate behavior and final artifacts. Based on the issues exposed by such tests, this article abstracts a rigorous evaluation methodology for assessing coding ability of LLMs.

    2. Test Design: Controlled Variables Are the Prerequisite for Credible Evaluation

    2.1 Unified Task and Explicit Acceptance Criteria

    A reliable comparative test should satisfy at least the following:

    • Same codebase and context: every model receives the same repository, the same step-by-step plan, and no difference in difficulty.
    • Explicit acceptance conditions: for example, “the code must compile and pass all existing tests” as a hard gate, with no exceptions.
    • Process logs retained: record the model’s chain-of-thought summary, every diff, and each user interaction round. These behavioral signals often expose capability gaps more clearly than the final result.

    2.2 Key Observation: Interaction Behavior Itself Is a Capability Signal

    In one typical test, three models completed the task in a single pass and passed all tests, while another model got stuck at step two of a six-step plan. The meaningful difference was not “can it do it?” but “how does it react when facing a problem?”:

    • Stronger models first validate assumptions (e.g., run a compile to confirm the error really exists) before deciding on action.
    • Weaker models tend to fabricate causes—attributing a compilation failure to a nonexistent “compiler cache issue”—and then accept the user’s suggested fix without verifying whether it is reasonable.

    This suggests: evaluation should not only look at the output, but also at whether the model’s problem-localization process is scientific.

    3. Typical Failure Modes

    3.1 Hallucinated Attribution: Inventing Nonexistent Environment Issues

    The most common failure observed: the model claims “there is a serious compiler cache problem preventing normal operation.” In reality, the build toolchain used does not have such a problem; the true cause is incorrect code. Worse, when the user, following the model’s narrative, suggests clearing the cache, the model performs the cleanup but does not recompile to verify. It then declares the issue resolved and proceeds to the next step—which of course still fails to compile.

    The essence of this failure is that the model has not internalized the basic engineering loop of “form a hypothesis → verify experimentally → draw a conclusion.” It treats explaining a failure as resolving it.

    3.2 Shotgun Editing: Debugging Without a Hypothesis

    When told explicitly “there is no cache issue; you must fix the code,” the model’s response becomes a classic “shotgun edit.” It changes a line here, a line there, accumulating thousands of modifications in two hours while never achieving a successful build. This exposes two deeper problems:

    1. Inability to build a local causal model: the model cannot map an error message to a specific location in the code, so it just makes blind changes.
    2. No rollback-friendly structure: large-scale undisciplined edits pollute the context, and even if a later change is correct, the model cannot identify which edit worked.

    A correct debugging loop should be: read the full error output → locate the exact line → form a single hypothesis → make the minimal edit → compile and verify. If it passes, continue; if not, revert and try another hypothesis.

    1. Recommended Agent debugging loop (pseudocode):
    2. while compile fails:
    3. error = capture_full_compiler_output()
    4. hypothesis = locate_and_explain(error, source_context)
    5. patch = minimal_edit(hypothesis)
    6. apply(patch)
    7. verify_compile() # verification after every edit

    3.3 Chain-of-Thought vs. Output Disconnect: Planned But Not Executed

    Another interesting failure: the model’s chain-of-thought clearly states a plan to “implement an ink-wash style renderer,” but the final output contains no such implementation at all. This indicates that the model’s internal planning layer and execution layer are not aligned—the plan remains at the text level and is never actually consumed during execution. Cross-checking the chain-of-thought against the actual diff is an effective way to identify this type of problem during evaluation.

    3.4 Missing Commonsense Physical or Business Rules

    In a game-related task (e.g., bowling simulation), some models produced code that ran, but the distance between bowling pins was so large that it was physically impossible for a single ball to knock down all pins. This is a commonsense error. It shows that the model learned the structural shape of the code but lacks validation of the fundamental rules of the simulated domain. Adding domain-specific assertion checks (such as spacing constraints, collision rules) to the evaluation set is essential.

    3.5 Numerical Correctness Issues: Convergence Differences

    In a reinforcement learning task (such as visualizing Q-values on a grid and training until convergence), different models’ implementations showed clear differences: some converged normally, others did not converge at all. This failure is the most subtle because the code “looks correct,” and only running it reveals the issue. This again confirms that evaluation must include dynamic execution verification; static code inspection is far from sufficient.

    4. Building a Reproducible Evaluation System

    Based on the failure modes above, we recommend that teams construct internal evaluations using the following framework:

    1. Task layering: divide tasks into three difficulty levels—single-function generation, multi-file refactoring, and end-to-end agent tasks—to cover different capability dimensions.
    2. Hard pass criteria: successful compilation + all tests passing + no destructive changes, with no exceptions.
    3. Process metrics: number of interaction rounds, number of ineffective edits, accuracy of error attribution, and adherence to the debugging loop.
    4. Contrast audit: check consistency between the chain-of-thought plan and the actual diff.
    5. Multiple sampling: run each task at least three times and take the median performance to eliminate randomness.

    5. Final Thoughts

    The core conclusion from the multi-model comparative tests is that current models generally perform well on visual presentation and single-point code generation. The real dividing line lies in engineering problem-solving ability—whether the model can scientifically hypothesize, verify, and fix issues, and whether its plans genuinely translate into execution. For enterprise teams, selection criteria should prioritize these deeper dimensions rather than being swayed by polished demonstrations. For model developers, converting these failure modes into training objectives and evaluation benchmarks is the essential path to improving practical utility.