OfMonth...Benchmarking LLM Frontend Code Generation: Where Open-Source Models Fall Short of Commercial Ones

    LLM code generation is now routine, but real gaps emerge in complex business logic. This hands-on comparison of a Chinese open-source model ("Model A") and a commercial closed-source model ("Model B") on a real frontend project reveals where they diverge—state management, cross-field validation, instruction following—and offers practical advice worst-case caveats, along with actionable advice for teams choosing between them.

    Benchmarking LLM Frontend Code Generation: Where Open-Source Models Fall Short of Commercial Ones

    LLMs writing code is no longer news. Autocomplete and repository-level understanding have become everyday tools. When a request like “generate a login page” is mostly handled, what actually separates models is whether they can hold the line on rules in complex business scenarios.

    Chinese open-source models have recently claimed capabilities rivaling international commercial flagships. There is no shortage of benchmark numbers, but performance in real projects is more informative. This article uses a real frontend project to observe the frontend engineering capabilities of a Chinese open-source model (“Model A”) versus an international commercial closed-source model (“Model B”). Note that the conclusions come with clear conditions—please read them alongside the results.

    1. Test Conditions: The Caveats First

    The test environments for the two models were not identical. Model A ran in a public sandbox environment, where shared compute is subject to queuing and load fluctuations. Model B’s results were taken from historical records of a similar previous test and were not re-run on the same day.

    Therefore, this article reports observations under uncontrolled conditions. Differences in page fidelity can serve as a reference, but the timing data cannot be used directly to compare model capabilities. This article also does not fully disclose model parameters, sampling temperature, context length, number of runs, or scoring rubrics. Treat these conclusions as directional reference, not definitive verdicts.

    2. Test Sample: Why a Frontend Project

    Frontend development is a high-frequency use case for LLMs. Complex pages typically combine interaction logic, state management, and data validation—closer to day-to-day work than algorithm puzzles. Instead of algorithm problems, this test used a real business requirements document covering login authentication, product создании auth, product list filtering, and a complex form. The models had to generate a runnable frontend project directly from natural-language requirements.

    The requirements document specified expected behaviors, making it possible to verify results item by item. For example, one requirement for the list page read: set the price range to 0–500 yuan, select both the “Digital” category and the “In Stock” tag, and switch sorting to price ascending. After refreshing the page, all three filter states should persist. Descriptions like this reveal whether a model truly understands the business loop.

    3. Module-by-Module Observations

    1. Login Page: Baseline Capabilities Are Close

    The login page included a carousel, multi-device adaptation, form validation, and captcha logic. Both models reproduced the visual layout reasonably well, handled required-field and non-empty validation correctly, and organized components fairly cleanly.

    Differences in page structure were minimal. On low-complexity, highly reusable interfaces, both model types performed similarly.

    2. List Page: State Management Starts to Diverge

    The list page required combined filtering by price range, category tags, and stock status, plus sort switching. Model A produced a complete page structure, but multi-select tags could not stack. When the price range and sorting changed simultaneously, the trigger logic deviated from requirements.

    More critically, Model A failed to correctly map filter fields to URL parameters, so states were lost on page refresh. Model B’s code included complete state transitions and accounted for filter debouncing and empty-result displays.

    3. Form Page: The Biggest Gap in Business Validation

    The form page involved cross-field linked validation, dynamic row add/remove, and mocked asynchronous validation APIs. For example, when the company type was set to “Foreign-Invested,” the registered address and Unified Social Credit Code became required, and the credit code had to match a specified pattern. When registered capital exceeded a threshold, a capital verification attachment had to be uploaded.

    Model A’s visuals were acceptable, but most validation was limited to static checks at submission time, lacking responsive, in-flight linkage during input. Newly added dynamic rows also suffered from tangled data binding—rows could not maintain state independently. Model B handled field dependencies more completely, its validation functions were more reusable, and it correctly performed state lifting across components.

    4. Results Summary

    The table below summarizes the main observations from this test. The percentages are evaluators’ rough estimates; the full scoring rubric was not disclosed.

    Dimension Model A Model B Notes
    Basic layout fidelity ~90% ~92% Rough estimate; small gap
    Complex state management State lost on refresh Complete state transitions Judged by whether state persisted after refresh
    Linked validation fidelity Many gaps Rules reproduced fairly accurately Verified item by item against the requirements document
    End-to-end wait time ~35 minutes ~4 minutes Model A includes public sandbox queuing; Model B is a historical record—different bases, not directly comparable
    Manual rework effort Considerable Less No count of modified files or rework hours; qualitative only

    The timing row is the most easily misread. The 35 minutes includes queue time, which cannot be separated from actual generation time. That row only reflects a difference in user experience, not in model capability.

    5. Where the Gap May Come From

    Judging by the page outputs, the differences between the two models concentrated in three areas: instruction following on long requirements, task decomposition before generation, and consideration of edge cases.

    When handling longer requirements, Model B was better at breaking them into modules and implementing them step by step, with cleaner code structure. Model A tended to generate everything in one go—local details could be quite good, but overall architectural maintainability was weaker. These are tendencies observed in this test, not yet verified by controlled experiments.

    6. Open Source vs. Commercial: The Trade-Off

    The value of open-source models lies in deployment flexibility. Enterprises can deploy them privately, fine-tune them for their domain, and keep data inside their own networks. For data-sensitive businesses, this may outweigh the performance gap. However, the capability ceiling of open-source models and the compute required to reach it need separate evaluation.

    Commercial closed-source models work out of the box with low operational overhead, making them well suited for rapid validation. The costs are ongoing API fees and the fact that business data must pass through external services. When choosing, enterprises need to factor data compliance requirements into the decision.

    The pros and cons of each depend on the specific scenario. Selection should weigh data sensitivity, team size, budget, and business complexity.

    7. What Teams Can Do

    First, run a small-scale POC. Pick 3–5 real pages, fix the prompt templates, run everything on the same day in the same environment, and record queue time separately from generation time.

    Second, route tasks by data sensitivity. Tasks involving sensitive data or core infrastructure code can go to a privately deployed model. Tasks requiring complex business reasoning can be evaluated against commercial models.

    Third, estimate total cost. For open-source solutions, factor in GPUs, operations, and maintenance headcount. For commercial solutions, factor in API call volume, data compliance review, and data retention requirements.

    Fourth, manually review AI-generated business-critical logic and back it up with automated tests. A page that runs does not mean the rules are correct—form linkage, permission checks, and money calculations especially need item-by-item verification.

    AI-generated code can shorten initial development time, but acceptance responsibility still rests with the development team.