Front-End Code Generation with LLMs: What a Real Project Test Shows About Chinese Open-Source Models

    This article tests how well current large language models generate front-end code from a real project that includes login, list, and form pages. It evaluates requirement understanding, engineering completeness, and restoration accuracy, and compares an open-source model with a closed-source flagship model on the same tasks. It also explains why open weights matter for private deployment, cost control, and customization, and offers practical guidance for developers who use AI in front-end work.

    1. Background: From Benchmark Scores to Hands-On Testing

    Each time a new large language model is released, social media fills with praise such as “on par with leading international models” and “a source of national pride.” These reactions are encouraging, but for developers working on real products, leaderboard scores and marketing claims cannot replace testing on actual engineering work. A model’s score on standard benchmarks often says little about whether it can understand a product requirements document and produce a front-end project that is ready to ship.

    This article uses a typical front-end project with login, list, and form pages as the test case. It objectively assesses the practical capabilities of current large language models for front-end code generation across four dimensions: requirement understanding, code restoration accuracy, UI quality, and generation efficiency. It then discusses what the open-source approach means for the development of AI.

    2. Test Method: Using Real Requirements Instead of Toy Demos

    Real project requirements expose three core capabilities of a model more clearly than simple demos do:

    1. Requirement understanding: Can the model accurately parse business rules, filter conditions, and field validation logic in the document?
    2. Engineering completeness: Does the output form a complete project that runs directly, or only scattered code fragments?
    3. Restoration accuracy: Do the page structure, interaction details, and component relationships match the document?

    The input is a structured requirements document that covers the following:

    • Login page: a carousel, form validation, and login state management.
    • List page: multi-condition filtering, pagination, and sorting.
    • Form page: linked fields, validation rules, and error messages.

    When no tech stack is specified, models usually choose React, the mainstream choice in the industry.

    3. Test Results: Clear Differences in Capability by Task Type

    3.1 Login Page: Close to Production-Ready

    The login page is a highly standardized page, and training data contains a large number of similar examples. As a result, the model performed consistently. It implemented common requirements such as the carousel and form layout, and the page had no obvious missing features. The output reached a level that needed only minor changes before launch.

    This shows that for high-frequency, standardized requirements, current models can generate engineering-ready code.

    3.2 List Page: Filter Logic Is a Clear Weakness

    The problems became visible on the list page. The document clearly described the filter conditions and interaction logic, but the generated code often lacked the filter implementation. The problem appeared repeatedly across several list pages, so it is a systematic weakness rather than an occasional error.

    The root cause is that list page filtering depends on the mapping among the data structure, the query parameters, and the UI state. This mapping requires multi-step reasoning rather than pattern matching. The result points to a limitation of current models in complex business logic reasoning.

    3.3 Form Page: Insufficient Detail Restoration

    The form page was generally runnable, but its field validation rules and interaction details deviated noticeably from the document. For complex forms with linked fields and conditional validation, the model’s restoration accuracy dropped significantly.

    3.4 Efficiency and Quality Comparison

    In a comparison with a closed-source flagship model on the same tasks:

    • Simple pages: Both models reached similar levels of completion.
    • Pages with complex logic: The closed-source flagship model clearly outperformed the open-source model in understanding filter logic, field relationships, and validation rules.
    • Generation speed: The closed-source flagship model usually finished within a few minutes, while the open-source model was noticeably slower.

    Overall, the open-source model prioritized engineering usability over product polish. Its UI style was adequate and above the level of a basic prototype, but it still fell short of mature component library templates.

    4. The Value of Open Source: Meaningful Beyond the Gap

    Despite the gap in these tests, the value of open-source models should not be underestimated. Their significance appears on three levels.

    4.1 For Developers: Private Deployment Brings Engineering Certainty

    Open weights let companies run models in their own environments, such as a private inference cluster on a container platform. This provides three benefits:

    • Data security: Business requirement documents stay inside the internal network.
    • Controllable cost: Inference costs can be spread across self-managed GPU resources, which avoids long-term spending on per-call billing.
    • Customization: Models can be fine-tuned on a company’s own codebase to learn internal component conventions and business terminology. Closed-source APIs do not offer this option.

    4.2 For the Industry: Lowering Barriers and Strengthening the Ecosystem

    Open-source models let small teams and independent developers access code generation capabilities close to the frontier at very low cost. This moves AI-assisted programming from a tool reserved for large companies toward broadly accessible use. Open weights also give academic researchers a reproducible foundation, which helps prevent research in the field from being dominated by a few closed systems.

    4.3 For Technical Progress: The Speed of Catching Up Is a Signal

    These tests show that open-source models have matched flagship performance on standardized tasks. The remaining gaps are concentrated in complex reasoning and generation efficiency. Open-source communities typically iterate much faster than closed-source release cycles. Community fine-tuning, quantized inference, and inference framework optimization will continue to narrow the gap. Being able to compete at all is itself evidence that the open-source approach works.

    5. Practical Advice for Developers

    Based on the analysis above, we suggest the following:

    1. Use models according to task complexity: Let models generate standardized pages automatically. For complex business logic, have developers lead the design and use models to assist with implementation.
    2. Structure requirement documents: Writing filter conditions and validation rules as explicit structured descriptions can significantly improve restoration accuracy. For example:
    1. {
    2. "filter": [
    3. { "field": "status", "type": "select", "options": ["active", "disabled"] },
    4. { "field": "createdAt", "type": "dateRange" }
    5. ],
    6. "validation": [
    7. { "field": "phone", "rule": "required + regex(^1[3-9]\\d{9}$)" }
    8. ]
    9. }
    1. Review model output collaboratively: Treat model output as a first draft. Put code review and automated tests in place before merging anything.
    2. Treat hype with caution: Benchmark scores and community opinions are only a reference. Run a small-scale validation on your own business scenarios before deciding whether to adopt a model.

    6. Conclusion

    The tests show that open-source models are already engineering-ready for simple front-end tasks, but they still lag behind international flagship models in understanding complex business logic. Even so, private deployment, cost advantages, and an active ecosystem give open-source models strategic value that goes well beyond the result of a single evaluation. For developers, the more useful question is not which model is stronger. It is how to integrate model capabilities into their development workflow. Structured requirements, tiered tasks, and human review can turn AI productivity into better delivery quality.