Hands-On Evaluation of Open-Source LLMs for Front-End Code Generation: Where the Gap Really Is

    This article evaluates how well open-source large language models generate front-end code from a real requirements document, using a sample spec with a login page, a product listing page, and a form page. It explains why benchmark scores do not predict project usability, describes a reproducible test setup with per-page scoring, and shows where capability degrades: extracting constraints from long documents, modeling complex form state, and visual polish. It then outlines practical engineering fixes—structuring requirements into numbered acceptance criteria, staged generation, automated verification loops, and established design systems—and closes with the engineering value of open weights: data compliance, predictable cost, fine-tuning, and auditability.

    1. Why Benchmark Parity Does Not Mean Project Readiness

    Every time a new generation of open-source LLMs ships, the community quickly fills with claims that a model “matches a closed-source flagship.” Those claims usually rest on benchmark score comparisons. But a score measures average performance over a fixed distribution of tasks, and three properties of real engineering work distort it: requirements arrive as long documents rather than single-turn prompts; acceptance means “it runs and the interactions behave correctly” rather than “the answer text looks reasonable”; and failures accumulate, where one missing filter can make an entire page unusable.

    A more reliable approach is to run one end-to-end generation against a real requirement you know well and that has clear acceptance criteria, then watch how capability decays layer by layer across pages. The sample used here is a front-end requirements document covering three typical scenarios—a login page, a product listing page, and a form page—with feature points spanning carousel display, conditional filtering, field validation, and linked interactions.

    2. Test Setup: Turning “Gut Feeling” into a Reproducible Evaluation

    For the results to be worth anything, the variables have to be fixed first:

    • Identical input: the same requirements document and the same acceptance checklist, with no mid-run clarifications added.
    • Minimal constraints: no prescribed tech stack and no prescribed component approach, so the model’s default engineering preferences are visible.
    • Objective metrics recorded: end-to-end elapsed time, whether a complete, directly accessible project was produced, and whether the console or build reported errors.
    • Per-page scoring across four dimensions: structural completeness, functional completeness, interaction correctness, and visual finish.

    One caveat: queuing and rate limits under free tiers are service-side policies that significantly affect elapsed time, so speed is only a reference metric. Capability should be judged mainly by how faithfully functionality and interactions are reproduced.

    3. Layered Results: The Decay Shows Up in Depth of Understanding, Not Code Volume

    3.1 Login Page: Structural Reproduction Is Mature

    Common patterns such as the carousel, the form, and basic validation were implemented in full, with no obvious functional gaps—the kind of output that only needs a few configuration tweaks before shipping. The reason is that requirements for these pages are highly isomorphic to industry-standard patterns, so the model can complete the mapping from prior knowledge alone.

    3.2 Listing Page: The Dividing Line Between “Can Write It” and “Thinks It Through”

    The page skeleton was correct, but the filter options explicitly stated in the document were missing entirely, and the same problem recurred across multiple listing pages. This shows the weakness is not syntax or component invocation, but the extraction and prioritization of constraints inside a long document: the model tends to satisfy the most prominent layout goal first and treats secondary features as optional.

    3.3 Form Page: Field Relationships and Validation Logic Distort Most Easily

    The page ran, but the field set, required-field rules, linked behavior, and error messages deviated from the document. A complex form is essentially a state machine plus a constraint network; once the requirements are scattered across a document in natural language, the model struggles to build a consistent constraint model.

    3.4 Visual Style: Engineering Usability Beats Product Polish

    The overall style was tidy but engineering-flavored, still short of the finished feel of a mature design system or component template. This suggests visual quality depends heavily on whether an existing design language is introduced, rather than on the model’s own aesthetic sense.

    4. Actionable Strategies: Covering Model Weaknesses with Engineering

    Rather than expecting the model to get everything right in one pass, the more effective move is to converge uncertainty into a controllable range.

    First, structure the requirements. Rewrite the long document into a numbered acceptance checklist so every item can be verified one by one:

    1. R1 The listing page must contain 4 filters: category, price range, listing date, stock status
    2. R2 Any filter change must trigger a list refresh within 300ms
    3. R3 The form has 12 fields, 3 of which are conditionally required
    4. R4 All synchronous validation must pass before submit, with error messages shown below each field

    Second, generate in stages. Produce the page structure and data model first, then add interactions, then unify the visuals, so constraints do not overwrite each other in a single generation pass.

    Third, add an automated verification loop. Use type checks, unit tests, and end-to-end scripts to turn “document requirements” into executable assertions:

    1. // Assertion example based on acceptance item R1
    2. test('listing page renders all filters', async () => {
    3. await page.goto('/products');
    4. for (const label of ['Category', 'Price range', 'Listing date', 'Stock status']) {
    5. await expect(page.getByText(label)).toBeVisible();
    6. }
    7. });

    Fourth, hand the visual layer to a mature design system. Constraining output with a general-purpose component library and design tokens (color, spacing, radius, type scale) reliably raises the finished feel.

    5. The Real Value of Open Source: Private Deployment, Fine-Tuning, Auditability

    Once open-source models approach closed-source flagships on structural reproduction, their significance shifts to the engineering side rather than the scoreboard:

    • Data compliance: code and requirements never leave the internal network, which suits sensitive scenarios such as finance and government.
    • Controllable cost: marginal cost is more predictable under high concurrency, which makes capacity planning easier.
    • Fine-tuning: incremental training on a company’s private component library and historical requirements documents directly fixes systematic deviations such as missing filters.
    • Auditability and replaceability: owning the weights and the inference stack avoids lock-in to a single vendor.

    Private deployment typically needs supporting infrastructure: a container platform to host inference services, object storage for models and artifacts, a message queue to smooth request spikes, and logging plus monitoring and alerting for observability. On cloud platforms such as Baidu AI Cloud, these are offered as general product categories and can be combined as needed.

    6. Conclusion: Turning Model Selection into Constraint Engineering

    The evaluation shows open-source models are already production-ready for common page structures, with the gap concentrated in three places: extracting constraints from long documents, modeling complex form state, and visual polish. For developers, the right response is not to wait for the next model generation to “catch up on comprehension,” but to structure requirements, automate acceptance, and standardize visuals. Once those three layers of engineering constraints are in place, the advantages of an open-source approach in compliance, cost, and customizability translate into real delivery efficiency.