How to Evaluate LLM Coding Ability: A Methodology for Frontend UI and 3D Generation
Most LLM coding comparisons reduce to two extremes: "the output is impressive" or "it costs a fraction of the price." Neither claim is verifiable, because the answer depends on the prompts, the retry count, and the task mix. This article lays out a repeatable evaluation methodology: four task difficulty tiers with six families of metrics, quantitative frontend visual review, dual-track acceptance for 3D generation, cost accounting based on a formula, and a pipeline designed for reproducibility and contamination resistance. It also shows how to turn a single score into a failure taxonomy, and how to decide which tasks a model can deliver directly and which still need a human.
1. Why “try it out for a bit” is not enough to choose a model
Discussions of LLM code generation tend to collapse into one of two claims: “the output is impressive” or “it costs a fraction of the price.” Neither is verifiable as stated. Whether the output is impressive depends on whether the demo happened to land in the model’s comfort zone. Whether it is cheap depends on whether retries, context length, and task complexity were counted.
For an engineering team, the real cost of a wrong choice is not the subscription fee. It is the rework: generated code that will not run, dependencies invented out of thin air, missing interaction logic, or a 3D scene whose frame rate collapses on low-end devices.
The more practical approach is to treat model selection as an engineering experiment: fix the inputs, fix the environment, fix the acceptance criteria, and let the data decide.
2. Evaluation framework: four task tiers and six metric families
2.1 Tiered tasks
Split “coding ability” into four tiers of increasing difficulty with different acceptance criteria:
- Snippet level: a single function, a regex, a SQL query, a data transformation script. Verified with unit tests.
- Component level: a single frontend component with state, styling, and interaction. Verified by a successful render plus behavioral assertions.
- Page and project level: multi-file structure, routing, state management, API integration. Verified by a successful build and working critical paths.
- 3D and graphics level: scene construction, camera and lighting, model loading, animation and picking interaction. Verified by rendering without errors plus resource and frame rate metrics.
Layering matters because it locates the capability boundary. A model can score close to perfect on snippets and still fail at project level for lack of structural awareness.
2.2 Six metric families
- Runnability: the share of generations that start or build without manual edits.
- First-pass rate: the share of submissions that pass every acceptance case on the first attempt.
- Visual fidelity: how closely the structure and styling match the reference design (quantifiable, see Section 3).
- Interaction completeness: the share of interaction points listed in the requirements that are implemented correctly.
- Runtime quality: console error count, accessibility defect count, first-screen rendering and frame rate.
- Unit cost: see the formula in Section 5.
3. Frontend visual review: turning “looks right” into a number
Visual review cannot rely on screenshots alone. Use four steps — build, render, collect, compare — to turn a subjective impression into a regression-testable number.
// Illustrative: collect structured metrics from the DOM after render.// (API names may need to be adjusted to match the automation framework you use)const metrics = await page.evaluate(() => {const imgs = Array.from(document.images);return {domNodes: document.querySelectorAll('*').length, // structural complexitybrokenImages: imgs.filter(i => !i.complete || i.naturalWidth === 0).length,horizontalOverflow: document.documentElement.scrollWidth > window.innerWidth,missingAlt: imgs.filter(i => !i.alt).length, // accessibilityunnamedControls: Array.from(document.querySelectorAll('button, a, input')).filter(el => !el.textContent.trim() && !el.getAttribute('aria-label')).length,};});const consoleErrors = await collectConsoleErrors(page); // runtime errors
Add three more checks on top of this:
- Screenshots across breakpoints: capture desktop, tablet, and mobile widths once each, and check whether the layout collapses or horizontal scrolling appears.
- Pixel and structure comparison: pixel differences (for example, the share of differing pixels) reflect visual fidelity, while DOM and computed-style differences reveal whether the implementation is conventional.
- Delivery quality checks: whether semantic markup is used, whether inline styles are overused, and whether images declare dimensions to avoid layout shift.
4. 3D and graphics generation: acceptance on both correctness and performance
3D tasks are the easiest to get “looking right but running wrong,” because static screenshots hide coordinate, hierarchy, and asset problems. Use the following checklist:
- Geometry and transforms: are object proportions reasonable; are there z-axis conflicts (two surfaces at the same position, causing flicker); are origins centered; do parent-child transforms cause the whole object to drift?
- Materials and lighting: is there a clear key light with ambient fill; are material parameters within range (for example, roughness or metalness set to out-of-bounds values)?
- Asset loading: when an external model or texture is missing, is there a fallback and an error message rather than a blank screen?
- Animation and picking: is the timestep decoupled from the frame rate; does ray picking stay accurate after the window is resized?
- Performance: draw call count, triangle count, memory usage, and frame rate and frame drops on the target device.
Sample runtime statistics collection:
// Illustrative: sample frame rate and scene size after running for a few seconds.// (interfaces follow the capabilities provided by the actual renderer)const stats = await collectRuntimeStats(renderer, { sampleMs: 5000 });console.log(stats.fps, stats.drawCalls, stats.triangles, stats.memoryBytes);
During acceptance, always separate “runs on a demo machine” from “runs on mid- and low-end devices”: running the same codebase against a desktop and a mobile device profile is the most effective way to expose performance problems.
5. Cost accounting: use a formula, not the sticker price
Unit price alone can be badly misleading. The real cost must be accounted per task:
C_task = (P_in × T_in + P_out × T_out) × (1 + R)UnitCost = Σ C_task / tasks passing all acceptance criteriaValue-for-money index = first-pass rate / UnitCost
Here P_in and P_out are the input and output price per token, T_in and T_out the input and output token counts, and R the model’s average retry rate on this task set. Project-level tasks often require long context, so input tokens can be several times the output tokens; ignoring this dilutes the cost advantage of a cheap model. Conversely, if a model has a clearly higher first-pass rate, its true unit cost can be lower than that of a cheaper competitor — which is the usual source of “delivering the same result with less budget.”
During evaluation, plot the models on a single quality–cost plane, take the candidates on the Pareto frontier, and then decide with maintainability and ecosystem fit in mind.
6. Evaluation pipeline and contamination-resistant design
Isolated execution: run each task in a separate sandbox. The container platform brings up the environment, build artifacts and screenshots are archived to object storage, and log and monitoring services support long-term regression and anomaly tracking. General-purpose cloud products — Baidu AI Cloud is one example — already cover these baseline needs (containers, object storage, logging, monitoring), so there is no need to build dedicated infrastructure just for evaluation.
Reproducibility: fix sampling parameters such as temperature, pin dependency versions, and record complete call logs along with prompt version numbers. Put the evaluation scripts under version control too.
Guarding against data contamination: classic examples such as a “to-do list” or a “login page” are very likely present in the training corpus and will systematically inflate scores. Build your own tasks, and rewrite or re-constrain the classic ones — for example, change “build a dashboard” to “build an on-call ops dashboard with three fixed breakpoints, no horizontal scrolling, and all controls operable by keyboard.”
Dual-track scoring: automatic metrics provide objectivity, while blind human scoring covers overall look and feel. The scoring sheet can give 1–5 points each to functional correctness, visual fidelity, code quality, interaction completeness, and performance, with each reviewer scoring independently before disagreements are reconciled.
7. Failure attribution and common pitfalls
Classifying failures is more useful than a single overall score:
| Failure type | Typical symptom | How to improve |
|---|---|---|
| Does not run | Syntax errors, wrong import paths | Add a compile check as a prerequisite |
| Dependency hallucination | References to nonexistent libraries or methods | Provide an allowlist of dependencies in the prompt |
| Missing structure | Multi-file projects degenerate into single-file dumps | Enforce layering and directory conventions |
| Incomplete interaction | Static appearance only, no state wiring | List the interaction points explicitly in the requirements |
| Visual deviation | Off spacing, hierarchy, or color | Provide design constraints and screenshot feedback |
| Performance misses target | Frame drops, oversized assets | Specify device profiles and budgets |
Common pitfalls include looking only at screenshots without checking console errors; judging responsiveness from a single breakpoint; ignoring retry counts and therefore distorting cost; and repeatedly tuning prompts on the same task set before evaluating, which causes overfitting.
8. Practical recommendations
Make the evaluation a repeatable pipeline rather than a one-off activity: first define the acceptance criteria and write them as executable assertions, then build the tiered task set and device profiles, then sample in batches, judge automatically, aggregate metrics and cost, and finally perform failure attribution and regression comparison. Re-run the same task set whenever the model or the prompt changes — only then is a change in capability meaningful.
The final conclusion should be expressed in business language: given your task distribution, which task types can be generated by the model directly and which must be handed to a human, and what the actual unit cost and human review ratio are in order to reach the target delivery quality. The value of this methodology is that it does not depend on any vendor’s marketing claims — any candidate can be measured with the same ruler.
