Evaluating Open-Source LLMs for Front-End Code Generation: Findings and Engineering Lessons
This article presents a reproducible evaluation of open-source general-purpose LLMs on front-end code generation, benchmarked against a closed-source flagship model known for high comprehension accuracy. Using a fixed requirements document and layered acceptance criteria, the models were asked to generate runnable front-end projects across login, list, and form pages. Results show near-parity on pattern-heavy login pages, but weaker long-context requirement parsing on list and form pages, where filters, field relationships, and validation logic were often missed. The article also outlines practical engineering practices—structured requirements, per-page generation, contract-first design, and automated validation—and explains the value of open weights for private deployment, fine-tuning, and auditability.
1. Background: After the Hype, We Need a Reproducible Evaluation
Every time a new open-source LLM is released, the community quickly produces claims like “matches the closed-source flagship” or “the best tool for a specific scenario.” These conclusions usually come from single-point demos with few samples and simple tasks, so they say little about how stable a model is in real engineering work. For teams planning to integrate a model into their development workflow, the leaderboard rank is not what matters. Three questions matter:
- Can it read a structured requirements document?
- Can it reproduce complex interactions?
- Can it produce a project skeleton that runs directly and supports further development?
A more reliable approach is to fix a real requirements document and a fixed set of acceptance criteria, have the model generate an accessible front-end project end to end, and then score it page by page. This article follows that approach. The test subjects are general-purpose LLMs with open-source availability, and the reference is a closed-source flagship model widely regarded for high comprehension accuracy (referred to below as the “closed-source flagship”).
2. Test Design: Making the Results Reproducible
The credibility of an evaluation depends on controlling variables. This test followed these principles:
- Unified input: a single requirements document containing a page list, field definitions, validation rules, interaction flows, and visual requirements, with no additional verbal constraints.
- No fixed tech stack: observe the model’s default choices and engineering habits when no explicit instruction is given.
- Layered acceptance: four layers—“runnable,” “feature-complete,” “detail fidelity,” and “visual quality”—to avoid drawing conclusions from a single dimension.
- Process metrics recorded: queue and admission time, end-to-end generation time, and output form (whether a directly accessible address is provided rather than scattered code snippets).
Note that models on free tiers are typically much slower in queueing and generation than paid or closed-source options. Speed differences should not be equated with capability differences and must be evaluated separately.
3. Test Results: A Capability Gradient Across Three Page Types
3.1 Login Page: Close to Usable
The requirements document included a carousel, form validation, and remembered login state. The model fully implemented the carousel and basic validation, with all fields and buttons present and no obvious omissions—close to “ship after minor edits.” On this page, the gap between the open-source model and the closed-source flagship was small.
The reason is that the login page is a high-frequency, pattern-heavy scenario with dense training samples. The model can complete it through pattern matching, with low demand for deep reasoning.
3.2 List Page: Comprehension Starts to Slow Down
The product list page required multi-condition filtering, sorting, pagination, and empty-state handling. The generated page had a correct skeleton and reasonable layout, but the filter options were missing entirely, and the same problem appeared across multiple list pages. This indicates a capability gap rather than an occasional mistake: the model recognized that “a list is needed here” but failed to map the filtering conditions and interaction logic from the document into concrete state and events.
3.3 Form Page: Insufficient Reproduction of Complex Relationships
The form page involved field linkage, nested validation, submission states, and error messages. The output ran, but the number of fields, validation trigger timing, and linkage details deviated from the document. Forms are the most requirement-dense page type and demand the highest understanding of the “field relationship graph,” making them the clearest differentiator between models.
3.4 Visual Style: Engineering Usability Over Product Polish
The overall visuals were better than typical prototype drafts, but still fell short of finished products built with mature component systems and atomic styling approaches. The design language leaned engineering-oriented and lacked memorable elements. The positioning can be summarized as: acceptable engineering usability, average product expressiveness.
4. Comparison with the Closed-Source Flagship: The Gap Is in “Depth of Understanding”
The same document had previously been implemented by the closed-source flagship, so the comparison is clear:
| Page | Open-Source Model | Closed-Source Flagship |
|---|---|---|
| Login page | Close | Close |
| List page | Incomplete filtering and structure understanding | More complete |
| Form page | Deviations in fields and validation | Clear advantage |
| Speed | Noticeably slower (affected by free tier) | On the order of minutes |
The core difference is not “can it write code” but requirement-parsing accuracy within long contexts: whether constraints scattered throughout the document can be aggregated into a consistent data model and state machine.
5. Engineering Recommendations: Containing the Uncertainty
To introduce open-source models into a project, consider the following practices:
- Structure the requirements: describe fields, types, required flags, validation, and linkage in tables to reduce ambiguity in natural language.
- Generate per page: have the model produce one page at a time to reduce context noise.
- Contract first: have the model output the data model and API contracts before generating UI code, which can significantly improve field fidelity.
- Automated validation loop: run type checks and tests immediately after generation, exposing deviations as locatable errors.
An illustrative field contract can be written as:
{"field": "skuName","label": "Product Name","required": true,"rules": ["maxLength:60", "trim"],"visibleWhen": { "type": "eq", "value": "physical" }}
With a machine-readable contract, the model’s task degrades from “understanding prose” to “filling in structure,” and problems like missing list filters and form validation deviations are greatly reduced.
6. Why Open Weights Matter: Private Deployment, Fine-Tuning, and Auditability
The value of open weights concentrates on three points. First, deployment freedom: private inference can be completed on your own container platform and object storage, keeping data within your domain to meet compliance requirements. Second, adaptability: teams can run lightweight fine-tuning with their own front-end corpus, baking internal component library usage and page templates into the model to compensate for a general model’s weaknesses in business details. Third, auditability: behavior is observable and reproducible, making it easy to connect to logging services and monitoring/alerting systems for quality tracking.
For AI development, open-source and closed-source are complementary rather than mutually exclusive: the closed-source flagship temporarily leads in depth of understanding, while open-source models trade low cost and controllability for room to scale. The gap will narrow with iteration, but the gap in engineering methodology will not disappear on its own.
7. Conclusion
This test shows that open-source LLMs are close to the closed-source flagship on pattern-heavy pages (login) but remain limited by long-context comprehension accuracy on requirement-dense pages (list and form), with speed clearly affected by tier policies. The takeaway for developers: do not base model selection on demo videos; instead build a workflow of “structured requirements + per-page generation + contract first + automated validation.” For enterprises, general capabilities from Baidu AI Cloud—such as container platforms, object storage, logging services, and monitoring/alerting—can serve as the foundation for a private, fine-tunable, and observable model application stack, turning the open-source dividend into real delivery efficiency.
