Evaluating LLM Code Generation: Five Dimensions That Matter Beyond "It Runs"

    A practical framework for evaluating large language models on coding tasks, moving past one-shot demos to measurable engineering criteria. It covers first-pass delivery quality, interactive clarification, long-horizon debugging and error attribution, visual and spatial reasoning, and convergence stability, along with prompt constraints, engineering guardrails, and a team-level evaluation pipeline.

    1. The Starting Point: Why “It Runs” Is Not “It’s Usable”

    Once AI coding tools enter real development workflows, most teams hit the same gap: the demo looks impressive, but the same tool struggles inside their own repository. Hand the same requirements and the same code baseline to different models, and the difference usually shows up not in whether code can be generated, but in how controllable the process is after generation. The focus of evaluation should therefore shift from “does the output look good” to “is the delivery maintainable, and can the process be steered.”

    2. Dimension One: One-Shot Delivery Quality

    The most direct observation is the first-pass rate of the same task across multiple models. A common pattern in practice: most models produce a compilable, test-passing implementation on the first attempt, all sitting on roughly the same quality line. What actually separates them is how a minority of models behave when they hit an obstacle.

    A single sample’s first-pass rate carries no statistical meaning. The recommended approach is to fix the code baseline, fix the test suite, and fix the acceptance scripts, then run each model five to ten times and record three metrics: first-pass rate, average number of rework rounds, and human intervention time. A sample evaluation record looks like this:

    1. task_id | model | first_pass | rounds | human_intervene_min | note
    2. T-001 | A | yes | 1 | 0 | all tests green
    3. T-001 | B | no | 6 | 120 | repeatedly edited unrelated files

    3. Dimension Two: Interactive Clarification

    One underrated capability is asking questions. When requirements are ambiguous, a model that proactively raises a few clarifying questions and asks a human to fill in constraints usually needs less rework than one that keeps producing. In the original observations, only one model asked several explanatory questions mid-task. That behavior has engineering value: it makes implicit assumptions explicit and lowers the probability of late-stage rework.

    The reverse case is a model that fills in a large number of premises on its own when information is missing; its output is typically hard to merge directly. The engineering recommendation is to define clarification boundaries in the system prompt, for example:

    1. If the requirement lacks acceptance criteria or an interface contract, ask no more than three questions first;
    2. start coding only after receiving answers, and do not assume the framework version or directory structure on your own.

    4. Dimension Three: Long-Horizon Debugging and Error Attribution

    The stage that exposes problems most clearly is fixing a compilation failure. The ideal behavior is to locate the error, make the minimal change, and re-verify. The risky behavior is to attribute the failure to the environment or cache, then slide into “shotgun debugging” — random edits scattered everywhere, accumulating into thousands of changed points without ever passing.

    This kind of behavior can be suppressed with explicit constraints. The key is to forbid unfounded environment attribution and to require tests as the only criterion:

    1. 1. Do not claim a cache or environment problem unless you can provide a reproducible command and its output;
    2. 2. Each round may only modify files directly related to the current error;
    3. 3. After modifying, run the full test suite; if it fails, roll back this round's changes;
    4. 4. If two consecutive rounds show no progress, output the current assumptions and a list of items to verify, then wait for human confirmation.

    Engineering guardrails make this more effective: provide a clean, reproducible build environment in a container platform, retain every round of compilation and test output through a logging service, and use monitoring and alerting to set a threshold on “files changed per task,” interrupting and handing over to a human as soon as it is exceeded. This keeps the cost of a runaway run within an acceptable range.

    5. Dimension Four: Visual Presentation and Spatial Reasoning

    In graphical and visualization tasks, model weaknesses concentrate on common-sense constraints and spatial alignment. Typical symptoms include: claiming to render a certain artistic style without actually implementing it, which is a hallucination in the chain of thought; target spacing in a generated ball-physics scene that violates common sense, so the gameplay does not hold; agent size severely out of proportion with the scene; and action-layer and terrain-layer coordinates that are not aligned, so the scene renders but is not interactive.

    A workable improvement is to convert subjective descriptions into verifiable assertions, for example constraining the ratio between object spacing and field dimensions, requiring layered coordinates to use the same units and origin, and visualizing key state variables in the scene so a human can judge whether training is converging. In acceptance, hold to three hard criteria — runnable, interactive, and consistent with common sense — rather than judging by screenshots alone.

    6. Dimension Five: Convergence and Stability

    In reinforcement learning demos, stable convergence is a hard metric. Evaluation should record whether the reward curve improves monotonically, whether numerical overflow occurs, and whether hyperparameters were changed arbitrarily. Require the model to output training logs and configuration snapshots so runs can be reproduced and compared.

    7. Implementation Recommendations

    Turn these dimensions into an evaluation pipeline inside the team: a unified baseline repository and test suite, batch scheduling of multiple models in parallel, archiving of artifacts in object storage, and a unified dashboard showing pass rates and rework cost. When selecting a model, do not chase a single impressive result; look at overall variance and controllability. On Baidu AI Cloud, this pipeline can be built with general-purpose capabilities such as the container platform, logging service, and monitoring and alerting, moving AI coding from demo to sustainable engineering practice.