Evaluating Large Language Model Code Generation: Methodology and Pitfalls

    A practical framework for benchmarking how well large language models generate complete, runnable projects. It covers defining measurable criteria, designing a tiered task set, running multi-round human feedback without leaking solutions, classifying defects with gating rules, avoiding common evaluation traps, and building a reproducible evaluation pipeline.

    Discussions about whether one AI coding tool has “completely surpassed” another category of general-purpose large language model keep heating up, yet most conclusions rest on scattered impressions and isolated cases rather than reproducible evaluation design. Setting specific products aside, this article addresses a more fundamental engineering question: how to rigorously and reproducibly evaluate the code-generation capabilities of large language models on complete, runnable projects, without being pulled off course by emotional narratives.

    1. Problem Definition: From “Feels Better” to “Measurable”

    An impression formed in daily use that “A is better than B” is a subjective experience, heavily influenced by noise such as prompting habits, context length, random seeds, and interface interactions. A credible conclusion requires an evaluation to satisfy four conditions:

    1. Identical inputs: the same task, the same first-round prompt, the same acceptance criteria;
    2. Recorded process: full traces of all multi-round interactions, including model output, human feedback, and retest results;
    3. Classifiable results: defects must be categorized, not reduced to a single overall score;
    4. Reproducible conclusions: a third party following the same steps should observe a similar trend.

    If any one of these is missing, the conclusion can only be treated as a lead, not as a verdict.

    2. Tiered Task Set Design: Simple Items and General Projects

    The evaluation set should be divided into at least two tiers, so that “one-off showmanship” does not mask differences in engineering capability.

    • Simple tests: single-file, single-scenario, generatable in one pass, used to observe correctness of fundamentals and visual polish, for example an interactive mini-game page with field drawing, character movement, and a score panel.
    • General projects: multi-module, with state machines and rule adjudication, used to observe architectural capability and long-chain debugging, for example adding subsystems for steals, shooting, blocks, rebounds, stamina consumption, and foul calls within the same scene.

    The point of layering is this: simple items separate “can it do it at all,” while general projects separate “can it keep doing it correctly.” Many models perform similarly on the former; the gap only widens on the latter.

    3. Interaction Protocol: How to Give Multi-Round Human Feedback Correctly

    One key design from the original practice is worth generalizing: the first-round prompt is exactly the same for all subjects, and in every subsequent round the human only points out observed defects, offering no leading hints and no hints about a specific implementation approach.

    The value of this protocol is that it isolates “prompt engineering ability” from “the ability to autonomously locate and fix defects.” Once the feedback says “change the collision detection to AABB,” what is being tested is no longer the model but the evaluator. It is advisable to fix the feedback template to phenomenon descriptions only, for example:

    1. Round N feedback (phenomena only, no solutions):
    2. 1. Clicking the "Shoot" button produces no response;
    3. 2. The character can move but cannot enter the match state;
    4. 3. After the previous fix, all character entities disappeared.

    4. Defect Classification and Scoring: Letting the Gap Settle

    Reporting only a total score is easily misleading. It is better to count four defect categories independently and define gating items:

    Category Meaning Gating item
    Startup Cannot initialize, cannot enter the main flow Yes
    Interaction Keys/buttons unresponsive, events not bound Yes
    Regression Fixing A breaks B (e.g., the character gets “fixed away”) Yes
    Presentation Misaligned lines, missing rim, abnormal commentary No

    Illustrative scoring logic:

    1. score = {
    2. "startup_ok": 1, # whether it runs at all
    3. "interaction_ok": 0, # whether key interactions work
    4. "regression_cnt": 3, # number of regression defects
    5. "aesthetic": 0.6, # independent aesthetic score
    6. }
    7. def verdict(s):
    8. if not s["startup_ok"] or not s["interaction_ok"]:
    9. return "Failed the gate; total score is no longer compared"
    10. return s["aesthetic"] - 0.2 * s["regression_cnt"]

    The engineering implication is direct: an implementation that fails to start or whose key interactions are broken should not be pulled level on total score just because “something is drawn more nicely.” The phenomenon observed in the original practice is exactly of this kind — one side was relatively complete on basic chains such as commentary and movement and provided an automatic demo mode, while the other repeatedly failed the startup and interaction gates and introduced regressions through its fixes.

    5. Common Evaluation Pitfalls

    1. Leaderboard extrapolation: general leaderboard scores correlate only weakly with the ability to “generate a runnable multi-module project” and cannot be extrapolated directly.
    2. Single-case generalization: one success or failure is not enough to support an overall conclusion; multiple tasks and multiple rounds are needed.
    3. Prompt leakage: embedding an implementation approach in the feedback significantly inflates scores.
    4. Ignoring regressions: looking only at “was it fixed” and not at “what was broken.”
    5. Mixing aesthetics with functionality: interface polish should be recorded independently, so it does not mask a functional gate failure.
    6. Narrative-driven judgment: expressions like “crushing” or “demolishing” on social platforms are mostly traffic-driven phrasing and do not constitute evidence.

    6. A Reproducible Evaluation Pipeline

    It is advisable to solidify the evaluation into a pipeline, consistent with the continuous integration mindset in a development workflow:

    1. Version the task library, with prompts and acceptance criteria committed alongside;
    2. Persist each round of interaction in a structured form, producing auditable logs;
    3. Automatically run smoke checks (whether it starts, whether key events are bound);
    4. Have humans complete presentation and aesthetic scoring;
    5. Output a radar-chart-style report that presents functionality and aesthetics separately;
    6. Run a regression after any model or prompt update, observing the trend rather than a single point.

    To land this in an enterprise environment, container platforms can standardize the runtime environment, object storage can hold interaction logs and build artifacts, message queues can smooth out and schedule batch tasks, and log services with monitoring alerts can track changes in failure rates. The capabilities Baidu AI Cloud offers in this general category can serve as a reference direction for engineering implementation.

    7. Conclusion

    “Which one is stronger” must be answered on the premise of tiered tasks, a unified protocol, defect classification, and reproducible regression. For the implementation-type tasks discussed here, the observable conclusion is: in general projects requiring multi-round autonomous debugging, some models still fail to clear the startup and interaction gates and exhibit regressions introduced by fixes; in implementations with relatively complete basic chains, the main weakness is concentrated in presentation details. The purpose of evaluation is not to settle scores against any side, but to hand readers a verifiable method: define the criteria first, then talk about strength.