Evaluating Frontend Code Generation in Large Language Models: Why "It Runs" Is Not "It Works"
This article presents a structured framework for evaluating the frontend code generation capabilities of general-purpose large language models. Moving beyond a single live demo, it breaks assessment into five weighted dimensions—requirement coverage, structural correctness, interaction completeness, data contract consistency, and maintainability—and examines where models still fall short across login, list, and form pages. It also explains the practical value of open-source models for private deployment, customization, cost predictability, and ecosystem integration, and offers a checklist for teams adopting AI-generated frontend code.
1. Background: Why “It Runs” Doesn’t Mean “It’s Usable”
Over the past year, general-purpose large language models with code generation capabilities have been widely adopted in frontend development workflows. Marketing claims often emphasize “end-to-end generation of complete projects” and “a live demo URL in one shot.” Real project acceptance criteria, however, are far stricter: every filter condition and every field validation rule in a requirements document is part of the deliverable.
The evaluation scenario in the source material is representative. When no tech stack was specified, the model chose a component-based framework on its own. From start to finish it took about half an hour, and the output was a directly accessible URL rather than scattered code snippets. The login page was fairly complete, with a carousel and basic forms in place. But on the list page, the filter options explicitly written in the document were missing entirely. The form page ran, yet its field set, validation logic, and interaction details fell clearly short of the document. The visual style was “engineering-usable” rather than “product-impressive.”
Abstracting these observations leads to one conclusion: the current gap is not about whether a model can generate code, but whether it can understand requirements. Evaluating this capability therefore calls for a structured method, not a verdict based on a single demo.
2. Evaluation Framework: Turning Subjective Impressions into Quantifiable Dimensions
A scorecard built on five dimensions is recommended, each scored from 0 to 5, with evidence required (a screenshot or a requirement item number):
- Requirement coverage: the proportion of features listed in the document that are actually implemented.
- Structural correctness: whether page hierarchy, route division, and component boundaries are reasonable.
- Interaction completeness: whether linkage, disabled states, empty states, error states, and loading states are all present.
- Data contract consistency: whether field naming, types, and required flags match the document.
- Engineering maintainability: directory organization, styling approach, accessibility, and testability.
A sample scoring logic can be written as:
WEIGHTS = {"coverage": 0.30, # Requirement coverage carries the highest weight"structure": 0.20,"interaction": 0.20,"contract": 0.20,"maintain": 0.10,}def score(result: dict) -> float:return sum(result[k] * w for k, w in WEIGHTS.items())
Coverage is weighted highest because a “missing implementation” hurts delivery more than an “unpolished implementation”: the former requires another full generation round, while the latter only needs local style adjustments.
3. Scenario Breakdown: Three Page Types Reveal Capability Boundaries
3.1 Login Page: A Mature Pattern That Scores Easily
Login and registration are highly standardized scenarios with few fields, few states, and abundant reference implementations. It is unsurprising that models perform reliably here—they are largely reproducing high-frequency patterns from their training distribution. Evaluators should avoid being misled by a high score on this page, since it cannot distinguish the real differences between models.
3.2 List Page: Filtering and Linkage Are the Dividing Line
The difficulty of a list page lies in “condition combinations + state synchronization”: multiple filters may combine with AND or OR logic, a reset button must restore default values, and pagination parameters must form a query object together with the filter conditions. In the source material, the filters were missing entirely, suggesting the model tends to build the visual skeleton first and add logic as needed—and once the context grows long, early document items get diluted.
A verifiable minimal contract example:
{"filters": [{"key": "status", "op": "in", "required": false},{"key": "priceRange", "op": "between", "required": false}],"page": {"index": 1, "size": 20},"sort": {"field": "createdAt", "order": "desc"}}
Putting such contracts into the requirements document up front can significantly reduce the chance of missing implementations.
3.3 Form Page: Field Relationships and Validation Order Test Understanding Depth
Complex forms involve constraints such as field linkage, cross-field validation, and asynchronous uniqueness checks. Common defects include validation triggered only on submit, inconsistent error message placement, and linked fields not being reset. The improvement is to write the rules as a numbered table so the model can implement them item by item.
4. Root Cause: Understanding Depth, Not Generation Speed
The source material shows that the same requirements took about three minutes on another solution, with more complete filter and field reproduction. Speed differences may be affected by quotas, concurrency, and free-tier limits, and should not be treated as a capability conclusion. The real differences concentrate in three areas: instruction retention in long contexts, adherence to structured constraints, and maintaining cross-page consistency.
The takeaway for engineering teams is this: rather than chasing how impressive a single generation looks, structure the requirements document and automate acceptance criteria. Practical steps include adding static checks and unit tests to generated output, turning “does the filter exist” into an assertion:
// Pseudocode: turn requirement items into executable assertionsexpect(screen.getByLabelText('Status')).toBeInTheDocument();expect(query.filters.map(f => f.key)).toContain('status');
5. The Real Significance of Open Source
When a class of model capabilities approaches the state of the art, the value of open source shows up in four main areas:
- Private deployment is possible, meeting data-residency and compliance-audit requirements;
- Continued training or retrieval augmentation can target internal coding standards, improving style consistency;
- The cost structure is predictable, making large-scale calls in continuous integration easier;
- The ecosystem is composable, integrating flexibly with common cloud product categories such as object storage, message queues, container platforms, log services, and monitoring/alerting to form a complete development pipeline.
It is worth stressing that open source does not mean zero cost. Inference compute, operations manpower, and security hardening are all hidden investments. Teams should first validate the benefits with a small-scale evaluation set before deciding whether to self-host or use a managed service.
6. Practical Recommendations Checklist
- Build an evaluation set of 30–50 real internal requirements covering four page types: list, form, detail, and permission.
- Standardize the requirements document template with four components: feature numbering, field table, validation table, and state table.
- Generated output must pass static checks and basic tests; direct merging is prohibited.
- Record reproducible metrics for each generation to build a trend rather than a one-off impression.
- For high-value pages, adopt a hybrid mode of “generate the skeleton + manually complete the logic.”
Overall, the progress of domestic large language models in frontend engineering generation is real, and login-page-level completeness already has practical value; list filtering and complex form validation, however, remain weak spots. Fixing the evaluation method in place yields more long-term benefit than arguing over who won a single demo.
