Evaluating LLM Code Capabilities: Methods and Practices for Engineering-Grade Tasks
This article explains why passing a demo does not mean a model can handle real engineering changes, breaks down common failure modes such as misattributed errors, missing verification loops, scattered edits, and disconnected plans, and proposes a reusable evaluation framework across instruction following, verification discipline, error recovery, and change quality. It also covers prompt and workflow guardrails, evaluation of frontend and visualization tasks, and practical recommendations for building regression assets and gated pipelines.
1. Background: Why “Running the Demo” Is Not the Same as “Modifying the Project”
In real development work, asking a model to modify a complex project with many dependencies is fundamentally different from asking it to generate a standalone code sample. The former requires the model to understand the existing architecture, follow project conventions, and continuously self-correct within a compile-and-test feedback loop. The latter only requires local syntactic correctness. The impressive results many teams see during evaluation often come from the latter, while what they encounter in production is the former.
A representative case from practice: given the same refactoring plan and the same codebase, several models passed on the first attempt, while one model claimed completion very early, then attributed the failure to a “compilation cache anomaly” and kept going without verification, eventually falling into large-scale random edits. What this exposed was not a single capability gap, but the absence of three engineering capabilities: task decomposition, verification discipline, and error attribution.
2. Breakdown of Failure Modes
2.1 Biased Error Attribution
Interpreting a reproducible compilation error as an environment or cache issue is the most dangerous type of bias. It terminates the model’s own correction loop and shifts responsibility to uncontrollable factors. Determining whether a cache problem actually exists is simple: clean the build artifacts and run a full build again. If the error persists, it is a code problem.
2.2 Missing Verification Loop
The reliable approach is “small commits, verify each step”: after each atomic change, run the build and relevant tests, and proceed only after they pass. Skipping verification while pushing forward continuously causes errors to compound across steps, making them impossible to localize.
2.3 Shotgun-Style Edits
Making changes at multiple points simultaneously without locating the root cause is a typical low-quality strategy. It strips the changeset of semantic boundaries, making it hard to roll back and sharply increasing code review costs.
2.4 Disconnect Between Plan and Execution
However detailed a step-by-step plan is, without an enforced acceptance gate it is just text. The value of a plan lies in each step carrying a clear, verifiable criterion.
3. A Reusable Evaluation Design
Break the evaluation into four dimensions and score them separately, avoiding “overall impression” conclusions:
- Instruction following: whether it strictly follows the given steps and whether it expands the change scope on its own;
- Verification discipline: whether it proactively builds and tests after each step and speaks with evidence;
- Error recovery: whether it can locate the root cause within two rounds after the first failure;
- Change quality: whether the changeset is focused and whether naming and style are consistent with the existing code.
Evaluation tasks should cover three difficulty levels: function-level local changes, cross-module interface adjustments, and build and dependency configuration changes. Prepare automatically verifiable acceptance scripts for each category, outputting binary results plus elapsed-time statistics.
4. Prompt and Workflow Design
Write “verification” into the prompt as a hard constraint rather than expecting the model to be self-disciplined:
Constraints:1. Complete only one step of the plan at a time;2. After each step, run the build and relevant tests, and paste the key output;3. If it fails, locate the root cause before making changes; simultaneous multi-point trial edits are forbidden;4. After two consecutive failures, stop and report assumptions and evidence, and wait for confirmation;5. Do not claim an environment or cache problem unless reproduction commands and output have been provided.
Combined with gating in the workflow, the results are more stable:
for step in plan.steps:apply(step)if not build_and_test(step):report(root_cause, evidence)break
5. Additional Notes on Frontend and Visualization Tasks
The source material also mentions visual-presentation tasks: whether the layout is aligned, whether physical common sense holds, whether the training process converges, and whether interface readability meets the standard. Correctness for such tasks cannot be judged only by “does it run.” Introduce quantifiable metrics: element overlap rate, whether key objects go out of bounds, whether the iteration curve decreases monotonically, and whether contrast meets the readability threshold. Also watch for “narrative inconsistent with the artifact,” where the model describes a certain style during reasoning but the final artifact does not reflect it at all. This is a typical form of self-reported hallucination, and the artifact must be the source of truth.
6. Implementation Recommendations
- Build an internal “refactoring task set” and accumulate it as regression evaluation assets;
- Wire build, test, and static checks into the pipeline as mandatory gates for model changes;
- Keep human review for model output, especially cross-module and configuration changes;
- Record the failure mode of each task to form team-level prompt templates and a red-line checklist;
- On Baidu AI Cloud, you can combine the container platform, log service, and monitoring alerts to bring the output of AI-assisted programming into a unified observability system for easier tracing and measurement.
7. Conclusion
Whether a model is suitable for engineering refactoring depends not on demo results but on whether it has the working habits of “verification first, root-cause oriented, and converging in small steps.” Only by solidifying these three points into processes and gates can uncertain model capabilities be turned into measurable, reproducible, and deliverable engineering productivity.
