Evaluating Large Models for 3D and Front-End Visual Generation: A Systematic Evaluation Method
Large models are increasingly used to generate front-end pages and 3D scene code. This article presents a systematic evaluation method covering task design, visual quality assessment, code runnability and engineering quality, and cost-efficiency. It explains how to build verifiable test cases, standardize screenshots, combine quantitative and human scoring, run static and dynamic checks, calculate effective cost using pass rate, and interpret results while avoiding common pitfalls.
1. Why Systematic Evaluation Is Needed
Large models are improving quickly at generating front-end pages and 3D scene code. Many teams still rely on demo screenshots to make judgments, but screenshots often come from carefully selected samples and cannot reflect the model’s average performance. When selecting a model, teams need to answer three questions: Can the generated code run directly? Does the visual result meet design requirements? Is the overall cost per task acceptable?
The value of systematic evaluation is that it turns these three questions into repeatable metrics. Test results can be used to compare different models horizontally and to track changes in the same model across version updates.
2. Evaluation Goals and Scope
Three things should be clarified before evaluation.
First, the evaluation goal. The goal is to measure the model’s completion quality, stability, and cost on specified tasks, not to produce a vague overall ranking.
Second, the evaluation scope. This article discusses code generation tasks, focusing on input prompts, output code, and runtime results. Model training details and internal structure are out of scope. Test conclusions are valid only for a specific test set, runtime environment, and prompt template, and should not be directly extrapolated to all scenarios.
Third, the evaluation dimensions. At minimum, the following five dimensions should be covered: functional correctness, visual fidelity, code engineering quality, response time, and cost per task.
3. Task Design: From Requirements to Verifiable Cases
The quality of the test set determines the credibility of the evaluation conclusions. Tasks should be organized as follows.
1. Layer by difficulty
- Basic components: independent elements such as buttons, forms, and cards.
- Layout pages: responsive lists, data dashboards, and multi-page structures with navigation.
- Interactive effects: hover feedback, drag-and-drop sorting, and state transition animations.
- 3D scenes: scene setup, camera control, lighting and material settings, and model loading.
After layering, teams can see at which layer the model begins to degrade significantly. This is more instructive than a single total score.
2. Standardize input specifications
Each task should include the following: a requirement description, a design mockup or reference image, technical stack constraints (for example, a required framework version or prohibited libraries), and acceptance conditions. Acceptance conditions should be programmatically verifiable, such as “after clicking the submit button, the page displays a success message.”
3. Sample multiple times
The same task should be called multiple times. Generation results are stochastic, and the quality of a single output says little about the model. It is recommended to sample each task at least five times and record both the number of passes and the dispersion of results.
4. Protect the test set
If test items are publicly released, they may enter the training data of later models, causing inflated evaluation results. The test set should be kept confidential and partially refreshed on a regular basis.
4. Visual Quality Assessment
Visual assessment can easily become subjective scoring, so measurement conditions should be standardized first.
Screenshot standardization
- Fix browser viewport sizes, for example, use one desktop size and one mobile size.
- Wait for page load and animations to settle before taking screenshots to avoid capturing intermediate frames.
- Use a unified font loading strategy to prevent layout deviations caused by missing fonts.
Quantitative comparison
The generated page screenshot can be compared with the design mockup using structural similarity comparison, or the position offsets of key elements can be calculated. These metrics are objective and repeatable, but they cannot fully reflect aesthetics.
Human scoring
Human review should compensate for the limitations of quantitative metrics. A double-blind approach is recommended, where reviewers do not know which model produced a screenshot, and a unified scale should be used:
| Scoring item | Score range | Description |
|---|---|---|
| Layout structure | 0 to 5 | Whether element positions, hierarchy, and alignment are reasonable |
| Color and spacing | 0 to 5 | Whether the result follows the design specification |
| Interaction feedback | 0 to 5 | Whether hover, click, and loading states are complete |
| 3D scene completeness | 0 to 5 | Whether models, lighting, and camera viewpoint are complete |
Additional checks for 3D content
3D scenes require additional rendering checks: whether rendering errors occur, whether the frame rate is acceptable on target devices, whether model assets are fully loaded, and whether there are signs of memory leaks after scene switching.
5. Code Runnability and Engineering Quality
Good visuals do not mean the code is usable. Evaluation should be divided into three layers: static checks, dynamic checks, and engineering quality review.
Static checks
These include syntax parsing, type checking, and code style rule checks. This layer is fast and can filter out outputs that clearly cannot execute.
Dynamic checks
Load the generated page in a headless browser and collect console errors and uncaught exceptions. Then write automated assertions for each acceptance condition, such as simulating clicks and text input and then checking page state. Dynamic checks are the core basis for judging functional correctness.
Engineering quality review
Runnable code can still have maintainability problems. A review can focus on the following aspects:
- Whether component decomposition is reasonable and whether all logic is piled into one file.
- Whether duplicate code or magic numbers exist.
- Whether loading failures, empty data, and other error states are handled.
- Whether event listeners, timers, 3D objects, and other resources are released on teardown.
Engineering quality can be set as a bonus item or a hard fail criterion, depending on project requirements.
6. Cost and Efficiency Calculation
Comparing only the per-call price does not reflect real cost. A model with a low unit price may require extensive manual rework due to a low first-pass rate, making the final cost higher.
The following formula can be used to estimate effective cost:
Effective cost = cost per call ÷ first-pass rate + average repair cost per task
For example, assume the cost per call is 1 unit, the first-pass rate is 50%, and the repair cost is 0.5 units. The effective cost is 1 ÷ 0.5 + 0.5 = 2.5 units. If another model has a per-call cost of 2 units, a first-pass rate of 90%, and a repair cost of 0.1 units, its effective cost is approximately 2.32 units, which is actually lower. This example only illustrates the calculation method; specific values need to be obtained through actual testing.
Repair cost can be converted from labor hours or measured from the time spent on repairs. Teams should define a unified conversion standard before evaluation to avoid discrepancies among different estimators.
7. Example: Evaluation Workflow Skeleton
The code below shows the basic structure of an evaluation workflow. run_browser_tests and score_visual are placeholder functions and need to be implemented according to the team’s runtime environment.
from dataclasses import dataclass@dataclassclass CaseResult:case_id: strruns: intpassed_runs: intavg_visual_score: floattotal_cost: floatdef first_pass_rate(result: CaseResult) -> float:"""First-pass rate: the proportion of passed runs to total sampled runs."""return result.passed_runs / result.runsdef effective_cost(result: CaseResult, repair_cost: float) -> float:"""Effective cost: single-run cost divided by pass rate, plus average repair cost."""rate = first_pass_rate(result)if rate == 0:return float("inf")single_cost = result.total_cost / result.runsreturn single_cost / rate + repair_costdef evaluate(model_client, cases, runs: int = 5) -> list[CaseResult]:results = []for case in cases:passed = 0visual_scores = []cost = 0.0for _ in range(runs):code, usage = model_client.generate(case.prompt)cost += usage.costif run_browser_tests(code, case.assertions):passed += 1visual_scores.append(score_visual(code, case.reference_image))results.append(CaseResult(case_id=case.id,runs=runs,passed_runs=passed,avg_visual_score=sum(visual_scores) / runs,total_cost=cost,))return results
This code reflects three design principles: multiple samples per case, separate recording of functional judgments and visual scores, and simultaneous output of cost and pass rate. Teams can add logging, checkpoint-based resumption, and result export on this basis.
8. Interpreting Results and Common Pitfalls
Pitfall 1: Looking only at the best output. The best sample represents the model’s upper bound, but business cares about stability. Focus on the pass rate and the variance across multiple results.
Pitfall 2: Assuming good visual results mean correct functionality. A page may look normal while buttons do not respond. Functional assertions must be judged separately; screenshots cannot replace them.
Pitfall 3: Ignoring the effect of prompts. The same model may perform very differently under different prompt templates. When comparing models, fix the prompt template and note its content in the report.
Pitfall 4: Replacing layered conclusions with a single total score. A model may perform well on basic components but fall short on 3D scenes. Conclusions should be given separately by task layer.
9. Implementation Recommendations
- First run the full workflow on a small test set, confirm that the scoring criteria can be consistently understood by different reviewers, and then expand the number of tasks.
- Integrate the evaluation scripts into the continuous integration pipeline and run automatic regression after model version changes or prompt template adjustments.
- Model-generated code must go through code review and testing and should not be merged directly into the main branch.
- Record the prompt, model version, runtime, cost, and results of each test to ensure reproducibility.
- If testing involves business data or internal code, first confirm data usage and compliance requirements, and choose a deployment and invocation method that complies with internal security policies.
