Evaluating Frontend Code Generation in Large Models and Why Open Weights Matter
This article examines the capability boundaries of large language models when generating a complete frontend application from a requirements document. Using a single self-written spec across three page types—login, list, and form—it shows where model output diverges from the document, analyzes the root causes, and explains how open weights turn evaluation from marketing claims into reproducible experiments. Readers will find a layered evaluation method, practical engineering recommendations, and a clear conclusion about current strengths and gaps.
1. Background: Why “It Runs” Does Not Mean “It Works”
Over the past year or two, code generation has been discussed repeatedly, and community posts often claim that a new model is approaching the level of top-tier closed-source models. These conclusions usually come from scattered samples: a polished landing page, a runnable script, or a flashy interactive component. Real frontend requirements, however, are not about showing off a single feature. They are systems engineering that combines requirements documents, state management, boundary conditions, validation rules, permissions, and exception flows.
So instead of reviewing any specific product, this article frames the topic as a general technical question: When a large model generates a complete frontend application from a requirements document, where are its capability boundaries, how can they be measured scientifically, and what changes when the weights are open?
The method is straightforward: use the same self-written requirements document covering three typical page types, then observe how the model output deviates from the document. Note that this is a single-run, single-document subjective experience. It is not a benchmark conclusion. The focus is on methodology and engineering implications.
2. Method: Three Prerequisites for Reproducible Evaluation
For this kind of experience to be useful, at least three things must be fixed:
- Fixed input: The requirements document explicitly lists the page inventory, field definitions, validation rules, and interaction states (loading, empty, error, no permission).
- Runnable output: Do not just look at code snippets. Require a complete project that can be accessed directly, including routing, directory structure, and dependency declarations.
- Layered evaluation criteria: Split into four layers—“visual completeness,” “structural correctness,” “functional fidelity,” and “performance and maintainability”—to avoid drawing conclusions from screenshots alone.
A sample requirements fragment can look like this:
## List Page Requirements- Filters: category (multi-select), price range, listing status; trigger query with 300ms debounce after changes- Interaction: filter conditions must sync to URL query and persist after refresh- States: loading skeleton, empty-state guidance, retry on request failure
If the document spells out these details but the generated result omits the filters entirely, that is not an occasional mistake. It is a capability gap.
3. Observations: Deviation Distribution Across Three Page Types
Login page: highest completeness. Patterns like carousels, forms, and basic validation are extremely dense in public corpora. The model can almost “recite” the standard answer, so the output is close to expectations and is at a level that can go live after minor edits.
List page: comprehension starts to slow down. The page skeleton is correct, and routing and layout are fine. But filters, URL sync, and linkage logic—all explicitly written in the document—are omitted entirely. This suggests the model tends to generate an interface that “looks complete” rather than strictly aligning with constraints.
Form page: largest deviation. Field relationships, conditional visibility, asynchronous validation, and error message placement are not faithfully reproduced. Forms have the highest requirement density and most easily expose insufficient “depth of understanding.”
On style, the output is generally “engineering-usable > product-attractive”: clean structure but a plain design language, lacking distinctiveness compared with mature component libraries or mature design systems. On speed, end-to-end generation of a complete project usually takes tens of minutes, while top closed-source models often finish within minutes and with higher comprehension accuracy.
4. Root Cause Analysis: Why Pages Look Right but Functions Fail
- Training distribution bias: Interface boilerplate is abundant, while business constraints are scarce, so the model naturally favors high-frequency patterns.
- Constraint decay in long context: The longer the document, the more likely later details are “averaged out.”
- No executable feedback loop: With one-shot generation and no compile or test feedback, errors cannot self-correct.
- Misaligned evaluation: Focusing on screenshot appearance masks missing functionality.
One actionable improvement is to put the model into a “generate-validate-fix” loop:
// Pseudocode: turn document constraints into executable checksconst checks = [() => expect(page.getByRole('checkbox', { name: 'Category' })).toBeVisible(),() => expect(page.getByText('No data')).toBeVisible(), // empty state];for (const c of checks) { try { await c(); } catch { await agent.fix(); } }
5. Why Open Weights Matter: From “Watching Ads” to “Running Experiments”
When weights are open, evaluation shifts from “trusting marketing” to “doing it yourself”: you can fix randomness, control decoding parameters, and run side-by-side comparisons on the same hardware; you can fine-tune or add retrieval augmentation for failure cases; you can keep the model inside a private data boundary to meet compliance requirements; and you can quantify inference cost and make trade-offs with quantization, distillation, and batching. These are degrees of experimental freedom that closed-source APIs can hardly provide. Open weights push AI development from “leaderboard competition” toward “reproducible causal analysis.”
6. Engineering Recommendations
- Structure the document: Write requirements as items with IDs for item-by-item acceptance.
- Externalize constraints: Put validation rules in a rules file executed by the pipeline, rather than relying on model memory.
- Closed-loop fixing: Connect logging services, monitoring alerts, and automated tests, and feed failures back.
- Hybrid architecture: Let the model handle boilerplate and keep human review on critical business logic; use a container platform for isolated builds when necessary.
- Layered acceptance: Score visual, structural, functional, and performance layers separately to avoid misleading single metrics.
7. Conclusion
A single-run experience shows that current generative models are already quite mature at “interface reproduction” but still have a clear gap in “constraint understanding and functional delivery,” and speed is not in the same class. Real progress does not depend on slogans from a particular release. It depends on whether we can build reproducible evaluation, executable validation, and a sustainable feedback loop. The value of open weights is precisely that it turns this path into a public experiment everyone can join.
