Benchmarking Frontend Code Generation in Chinese LLMs: A Practical Selection Guide
This article evaluates how leading Chinese large language models handle frontend generation tasks, moving beyond poetry and chat to long-chain, constraint-heavy engineering work. Using a unified two-round experiment—build an interactive 2D visualization, then convert it to 3D—it tracks three objective metrics: wall-clock latency, token consumption, and runtime viability. It summarizes three typical capability profiles, two common failure modes, root-cause analysis, a reusable prompt template, and scenario-based selection advice for demos, teaching, rapid prototyping, and cost-sensitive batch generation.
1. Why Poetry and Chat No Longer Reveal Model Differences
Model evaluation used to rely on writing poetry, casual conversation, and a few logic puzzles. At the current stage, mainstream models perform almost identically on these tasks. Score differences usually fall within the noise range and provide no meaningful separation. What actually separates models are long-chain, heavily constrained, verifiable engineering tasks: producing a structurally complete interactive page in one pass and maintaining front-to-back consistency after follow-up requirements are added.
These tasks are discriminative for three reasons:
- Context inheritance pressure: The second round must understand the component structure, variable naming, and coordinate-system conventions from the first round instead of rewriting everything.
- Output length pressure: A page with a 3D scene, geometry, materials, lighting, controls, and interaction logic naturally reaches tens of thousands of tokens, easily hitting the single-response output limit.
- Verifiable results: Whether the page opens, whether buttons respond, and whether the model actually renders the scene are binary judgments that do not depend on subjective aesthetics.
This article therefore uses a unified experiment design: send the same requirement to each model, first asking for a detailed, interactive 2D visualization page, then appending “convert it to 3D.” Three objective metrics are recorded throughout: wall-clock latency, token consumption, and final runnability.
2. Evaluation Design: Three Tasks and Three Metrics
2.1 Task Selection Principles
Tasks must have strong mechanical logic, decomposable structure, and sharply increasing complexity once converted to 3D. An engine structure visualization is a good example: it naturally includes strongly coupled parts such as the crankshaft, connecting rods, pistons, camshaft, intake and exhaust manifolds, and flywheel. The 2D stage tests layout and information labeling; the 3D stage tests spatial reasoning and kinematic correctness.
2.2 Metric Definitions
- Latency (wall-clock): Actual waiting time from submission to completion, which directly determines the experience of interactive development.
- Token consumption: Correlated with inference cost and context usage; a core input for budget estimation.
- Runnability: Presence of hard failures such as syntax errors, dependency loading failures, blank screens, or blocked rendering.
A representative record structure can be written as:
{"task": "mechanism_3d","rounds": 2,"metrics": {"latency_sec": 0,"tokens_total": 0,"runtime_errors": []},"verdict": "pass | partial | fail"}
3. Observed Results: Three Typical Capability Profiles
3.1 High Completeness but Slow Pace
The first type of model performs best in structural completeness: all 3D parts are present, with Chinese labels, an exploded view, and part visibility controls, passing on the first attempt without errors. The cost is nearly half an hour per round and more than 80,000 tokens. This output is suitable for finalizing a solution or delivering a demo, not for high-frequency trial and error.
3.2 Solid Kinematic Detail
The second type of model also runs with zero errors, with latency and consumption close to the first type, but with a different focus. It provides a standard cross-plane crankshaft, uses color to distinguish the four strokes, supports stepping observation at fixed angles, can switch to a semi-transparent cylinder block shell, and even uses browser audio capabilities to synthesize sound effects that change with rotational speed. This shows a finer grasp of domain constraints, making it suitable for teaching demos and engineering explainers.
3.3 Fast Drafting with an Industrial Style
The third type of model delivers in about five minutes with fewer than 20,000 tokens. Its appearance leans toward a faceted industrial modeling style, but the proportions of the pistons and connecting rods are correct, and interactions on the right side—part toggles, exploded view, transparency, and reset—are all present. Its role is rapid base drafting: get a runnable skeleton first, then refine it manually or through a second conversation.
3.4 Two Typical Failures
- Reasoning devours the output budget: One model spent more than twenty minutes in the 2D stage and hit the 65,536 output limit exactly. The backend showed that nearly the entire budget was consumed by the reasoning process, leaving almost nothing for code, resulting in a blank screen; the 3D stage failed outright because the content was too long.
- Fallback logic backfires: A lightweight version of another model rendered a 3D model in five minutes but fixed a line of dependency-loading failure text in the center of the scene, blocking the main subject and looking very poor.
Both problems point to the same engineering conclusion: output budget allocation strategy and error fallback design are as important as model intelligence.
4. Failure Mode Root Causes
| Failure Mode | Root Cause | Mitigation |
|---|---|---|
| Blank screen, no code | Reasoning consumes the output limit | Explicitly require “code first, explanation after,” or generate in segments |
| Generation failure | Single output too long | Split into three files—scene, geometry, interaction—and produce them in batches |
| Prompt blocks the main subject | Fallback UI layer set too high | Use non-blocking error messages (console/corner badge) |
| Second-round changes go off track | Insufficient context inheritance | Keep the first-round code and pass key interface conventions back in the prompt |
5. A Reusable Prompt Engineering Template
Rewriting vague requirements into engineering instructions with acceptance criteria noticeably improves stability:
Goal: a single-file runnable 3D mechanical structure interactive pageConstraints:1. Use only a general-purpose frontend rendering approach; do not introduce a toolchain that requires a build step;2. Output the complete code first, then no more than 100 words of explanation;3. Use English for part names and Chinese for label text;4. Provide four interactions: part visibility, exploded view, transparency, and reset;5. Any loading failure message must be in the console and must not cover the center of the canvas.Acceptance: renders on double-click open, no console errors.
When requesting follow-up changes, make “inherit” explicit rather than “rewrite”:
Make incremental changes on the previous round's code: keep variable naming and the coordinate system unchanged,replace only the 2D layout with a 3D scene, and add orbit controls and lighting.
6. Selection Advice: By Scenario, Not by Ranking
- Demos and delivery: Choose the tier with high completeness and a high first-pass success rate; accept longer waits.
- Teaching and explainers: Choose the tier that is more stable on domain constraints and detail expression.
- Rapid prototyping: Choose the low-latency, low-token tier for base drafting, then iterate and refine.
- Cost-sensitive batch generation: Prioritize setting output limits and segmentation strategies to prevent reasoning from squeezing out the code budget.
In engineering, the generation step can also be placed in a controllable pipeline: use a container platform to host a headless browser for automatic screenshots and smoke tests, use logging and monitoring/alerting services to collect latency, failure rate, and token consumption, and use object storage to archive each output for regression comparison. Baidu AI Cloud can provide general infrastructure support for this kind of “generate–verify–archive” loop.
7. Conclusion
The gap among current Chinese large models in interactive pages and 3D visualization lies mainly in three areas—long-context inheritance, output budget allocation, and runnability assurance—rather than general conversational quality. For developers, the right approach is not to ask “which one is the strongest,” but to build a small benchmark set of their own with fixed tasks, fixed metrics, and fixed acceptance scripts, choose a capability tier by scenario, and use prompt constraints and automated verification to minimize uncertainty.
