Hands-On Evaluation of Open-Source LLMs for Front-End Code Generation
This article presents an end-to-end test of open-source large language models on front-end code generation, using one real requirement document covering a login page, a product list page, and a form page. It reports layered acceptance results, a comparison with a closed-source flagship solution, four recurring failure patterns, and engineering practices such as requirement structuring, staged generation, automated acceptance, and hybrid routing to turn generated code into deliverable projects.
1. Background: From Impressive Demos to Deliverable Output
Over the past year, the capability curve of open-source large language models has risen noticeably, and community discussions often claim that a given open-source model matches a closed-source flagship. These comparisons usually stay at benchmark scores and a few demo screenshots: high emotional value, limited engineering value. For developers, only three questions matter. Can it turn a real requirement document into a runnable project? Does it distort complex interactions and field relationships? Is the generated code maintainable?
To answer these questions, this article runs a hands-on test with a fixed approach: the same requirement document, the same acceptance criteria, and end-to-end delivery. The requirement comes from a real front-end project and covers three typical page types: a login page, a product list page, and a form page, along with interaction notes, field definitions, and validation rules. The evaluation does not reward isolated tricks; it looks at overall completeness and fidelity.
Note that this article does not review or recommend any specific product. The subjects under discussion are uniformly abstracted as “open-source large language models with code generation capability” and “common intelligent coding tools in the industry,” and the conclusions focus on general technical patterns.
2. Method: Making the Results Reproducible
A convincing evaluation requires fixed variables. This test followed these constraints:
- Unified input: the same requirement document, with no prompt optimization and no follow-up clarification, simulating a one-shot input in a real delivery scenario.
- No preset tech stack: no framework or language was specified, so the model’s default choices and engineering habits could be observed.
- Layered acceptance: four levels, “runnable,” “feature-complete,” “accurate reproduction,” and “style compliant,” judged one by one.
- Process metrics recorded: queue and generation time, artifact form (whether a directly accessible project URL was provided rather than scattered code snippets), and the distribution of failure points.
The value of this method is reproducibility. Any team can plug its own requirement document into the same process and get conclusions strongly tied to its own business, instead of being led by generic leaderboards.
3. Observations: Clear Capability Layers
3.1 Usage Experience: Usability and Waiting Cost
The first thing encountered was a queue notice on the service side, requiring several retries before generation began, which shows that the stability of free quota under high concurrency remains a practical constraint. Once generation started, the model defaulted to a component-based front-end framework without any tech stack being specified, and the artifact was a complete, directly accessible project rather than code snippets that are hard to assemble, which helped efficiency considerably. Overall generation took on the order of half an hour, clearly longer than the minute-level response of comparable closed-source solutions, and the speed gap was further amplified under the free quota.
3.2 Login Page: Clear Structure, Close to Deliverable
The login page was the most complete part. The carousel required in the document was implemented correctly, and the form structure, button states, and basic validation were all in place, with no obvious functional gaps. The conclusion is that this page reached the level of “ship after minor edits,” which shows the model’s understanding of single-page, pattern-based requirements is already quite mature.
3.3 List Page: Understanding Starts to Degrade
Problems surfaced in concentration on the list page. The requirement document explicitly specified filter options and linkage logic, but the filters were missing entirely, and the same omission repeated across multiple list pages. This is not an occasional random error but a systematic capability gap: the page skeleton, grid, and card structure were all correct, yet reproduction at the level of “functional semantics” fell short. In other words, the model is better at reproducing visual structure and weaker at extracting interaction constraints.
3.4 Form Page: Field Relationships and Validation Logic Distorted
The form page ran as a whole, but the field set, inter-field linkage, validation rules, and error messages were not fully implemented as documented. A form is a typical high-constraint scenario: once details such as field dependencies, required conditions, and asynchronous uniqueness validation are missing, the business flow cannot close. The gap on this page shows that as requirements move from “display” to “rules,” the model’s understanding accuracy drops markedly.
3.5 Visual Style: Engineering Usability over Product Polish
The UI style was unremarkable: better than most wireframe prototypes, but still behind output produced by directly applying a mature component system or an atomic styling approach. It leaned engineering-oriented, with high information density and weak design sense, usable but not impressive. If a product has brand tone requirements, deep involvement from the design side is still needed.
4. Cross-Comparison: The Gap Lies in Depth of Understanding
The same requirement was also executed on another closed-source flagship solution, and the comparison shows a clear layered pattern:
- Login page: the two were close in completeness; pattern-based pages are no longer a differentiator.
- List page: the closed-source solution was clearly better, reproducing filter conditions and field structures more completely.
- Form page: the closed-source advantage widened further, with more accurate field relationships, validation logic, and interaction details.
- Speed: the closed-source solution responded in minutes, while the open-source solution was an order of magnitude slower under this free quota.
One pattern can be extracted: the dividing line in model capability is not “whether it can generate a page” but “whether it can convert constraints in natural language into structured rules.” The denser the constraints and the deeper the dependencies, the more visible the gap between the open-source solution and the leading closed-source solution.
5. Failure Patterns: Four High-Frequency Issues
Combining this test with multiple earlier runs, failure modes for front-end generation tasks are highly concentrated:
- Constraint loss: cross-cutting logic such as filtering, sorting, pagination, and permissions is ignored.
- Rule simplification: complex validation is downgraded to a “non-empty check,” and linkage relationships are flattened.
- Correct structure, wrong semantics: the DOM and layout are reasonable, but field meanings and business actions are misaligned.
- Style homogenization: without design system support, output is uniform and hard to differentiate the product.
The common root cause of these four issues is that implicit constraints in the requirement document are not explicitly structured, so the model can only capture high-frequency patterns and ignores low-frequency but critical rules.
6. Engineering Practice: From “Can Generate” to “Can Deliver”
To make open-source models reliably produce usable code, the key is not switching to a stronger model but reshaping the input and the process.
6.1 Structuring Requirements
Rewrite prose-style requirements into a structured intermediate layer, for example describing pages, fields, and rules with configuration:
{"page": "product-list","filters": [{"field": "status", "type": "enum", "options": ["on", "off"]},{"field": "priceRange", "type": "range", "bind": "slider"}],"table": {"columns": ["name", "price", "status"], "pagination": true}}
Structured input significantly reduces the probability of constraint loss and makes acceptance criteria machine-checkable.
6.2 Layered Generation and Iteration
Do not generate the whole site at once. The recommended strategy is “skeleton first, pages in batches, rules last”: generate the routing and layout skeleton first, then fill in page by page, and finally implement validation and linkage in one pass. Establish regression checkpoints at each layer.
6.3 Automated Acceptance
Replace subjective judgment with a rule-based checklist, for example:
- Whether each filter field has a corresponding control and query parameter.
- Whether required conditions, regular expressions, and error messages for form fields appear in pairs.
- Whether list pagination, empty state, loading state, and error state are all present.
Writing these checks as scripts or test cases and including them in continuous integration is what prevents “looks right, fails when run.”
6.4 Hybrid Scheduling and Cost Control
Using open-source models for pattern-based pages to reduce cost and switching to more capable solutions for high-constraint pages is a cost-effective combination. In engineering terms, routing can be handled through a unified gateway, combined with caching, asynchronous tasks, and queues to smooth out peaks and mitigate queuing and timeouts. Artifacts can be hosted uniformly in object storage, with logs and metrics connected to logging services and monitoring alerts, making it easier to trace generation quality and failure causes.
7. Why Open Source Matters: Turning Capability into Public Infrastructure
Back to the original question: what does open-source models approaching closed-source flagships mean for the open-source ecosystem and AI development? This article sees three layers of value.
First, privatization and compliance control. Scenarios such as finance, government services, and healthcare have hard requirements that data must not leave their domain. Open weights allow the model to be deployed in an owned environment, with a container platform handling elastic scaling and the data path fully self-held.
Second, fine-tuning and explainability. Open source means continued training or retrieval augmentation can be done against an enterprise’s private code repositories, design specifications, and domain terminology, turning general capability into organization-specific capability. It also makes error attribution easier, showing which kinds of constraints the model systematically loses points on.
Third, a positive ecosystem feedback loop. Open weights lower the barrier to research and engineering, so evaluation methods, prompting strategies, and acceptance tools accumulate quickly in the community, forming a cycle of “find problems, improve methods, share gains” that raises the overall industry level.
8. Conclusions and Recommendations
The test shows that open-source large language models are already close to usable for pattern-based page generation, still have a clear gap in complex interactions and rule reproduction, and are at a disadvantage in speed under the free quota. The recommendation for developers is not to treat “matches the flagship” as a selection criterion, but to judge by end-to-end completeness against your own requirements; to focus investment on requirement structuring, layered generation, and automated acceptance; to prioritize self-hosted open-source options in cost-sensitive and data-sensitive scenarios; and to keep a stronger model as a fallback for high-constraint scenarios. Baidu AI Cloud, with general capabilities in model services, container platforms, object storage, and monitoring alerts, offers an optional combination space for this kind of hybrid engineering implementation.
