Evaluating Open-Source LLMs for Frontend Code Generation: A Practical Framework

    This article presents a reproducible framework for evaluating how well open-source large language models generate production-ready frontend projects from real requirement documents. It covers the evaluation methodology, page-by-page observations where model capabilities degrade, root-cause analysis showing that models reproduce form better than constraints, and the practical significance of open weights for private deployment and domain adaptation. Readers will find a scoring structure, acceptance-criteria examples, and a practical checklist for using these models as implementation engines rather than all-in-one architects.

    1. Background: Why “It Runs” Is Not the Same as “It’s Usable”

    Over the past year, open-source large language models have improved rapidly at code generation. Discussions comparing an open-source model to a closed-source flagship appear frequently in the community. These comparisons are exciting, but the question that actually matters to developers is not a leaderboard ranking. It is whether a model can take a real requirement document and produce, in one pass, an engineering artifact that is ready to ship and maintain.

    I ran a complete validation in a real project. I provided a requirement document covering page structure, interaction logic, fields, and validation rules, left the tech stack unconstrained, and asked the model to generate an accessible frontend project end to end. The conclusion up front: the login page was close to expectations; the list page and form page showed clear degradation at the level of functional understanding; the overall style was engineering-usable but visually average; and end-to-end time was noticeably longer than a closed-source flagship approach.

    This article abstracts that practice into a reusable evaluation framework and discusses what the open-source attribute means for AI engineering adoption.

    2. Methodology: Turning Subjective Impressions into Reproducible Metrics

    To make a comparison meaningful, fix the variables first. Control at least the following four:

    • Identical input: the same requirement document, the same version, with no mid-run clarifications.
    • Comparable output: record whether a runnable project was produced (not code snippets) and whether an accessible preview URL was provided.
    • Dimension breakdown: score per page or module instead of giving one vague overall score.
    • Cost tracking: end-to-end time, queuing or rate limiting, and whether a paid tier was required.

    A sample scoring table structure:

    1. {
    2. "project": "frontend-demo",
    3. "stack": "unconstrained",
    4. "modules": [
    5. {"name": "login", "completeness": 0.95, "fidelity": 0.9, "style": 0.7},
    6. {"name": "list", "completeness": 0.7, "fidelity": 0.5, "style": 0.7},
    7. {"name": "form", "completeness": 0.75, "fidelity": 0.45,"style": 0.7}
    8. ],
    9. "duration_minutes": 30,
    10. "artifact": "accessible preview link"
    11. }

    Here, completeness measures whether functionality is complete, fidelity measures how faithfully the output matches the document, and style measures visual and interaction polish. Separating the three makes problem localization much clearer.

    3. Page-by-Page Observations: Where Capability Degrades

    Login page: stable when the structure is clear

    For pages with mature, fixed patterns such as carousels, forms, and basic validation, the model’s fidelity is high, roughly at the “tweak it and ship” level. The reason is that this kind of requirement is extremely dense in training data, so pattern-matching cost is very low.

    List page: filtering and linkage are the dividing line

    Problems concentrate on missing filter options and unimplemented linkage between filters and the list. Notably, this is not occasional but a systemic weakness that appeared across multiple list pages. The page skeleton is correct, which shows the model understood the layout intent, but it did not translate the conditional logic in the document into state-management code.

    Form page: field relationships and validation distort most easily

    The form runs, but details such as field linkage, validation timing, and error messages deviate from the document. A form is essentially a state machine plus a constraint system. Once the document contains conditional required fields or cross-field validation, the model often degrades to stacking static fields.

    4. Root Cause: Depth of Understanding, Not Generation Speed

    Placing the three phenomena side by side reveals one common thread: models are good at reproducing form and poor at reproducing constraints.

    • Form is spatial and can be inferred from context in one pass; constraints are logical and require explicit state and branches.
    • The longer the document, the later the constraints appear, and the more pronounced attention decay becomes, so rules defined early are easily dropped.
    • Without executable acceptance criteria, the model cannot self-check and can only produce something that “looks right.”

    The corresponding engineering countermeasure is to make implicit constraints explicit:

    1. ## List page acceptance criteria
    2. 1. After clicking "Filter", the list is filtered by the status field, and the URL query parameters are updated accordingly
    3. 2. On empty results, show an empty-state placeholder and provide a "Clear filters" entry
    4. 3. When pagination and filtering coexist, a filter change must reset to page 1

    5. Style and Experience: Engineering Usability over Visual Wow

    The visual level of the generated results is roughly “a bit better than a generic prototype, but below a mature component library template.” This matches the general capability distribution of current models: reasonable layout and spacing, restrained color, and a lack of branded design language. The practical recommendation is not to expect the model to produce a design system. Instead, the team should accumulate tokens and component standards, positioning the model as an implementer rather than a designer.

    6. What the Open-Source Attribute Means

    The real value of open source lies not in a single benchmark run but in three points: data boundaries stay controllable through private deployment; there is room for domain adaptation through fine-tuning and distillation; and reproducibility and auditability come from available weights. For frontend work like this, a team can build an evaluation set from its internal component library and historical tickets and run continuous regression, rather than depending on external leaderboards.

    For cloud deployment, the common approach is to combine model serving, a container platform, object storage, logging, and monitoring with alerting into an observable, rollback-capable loop, avoiding binding capability to a single interface.

    7. Practical Checklist

    1. Write requirement documents as verifiable items, not adjectives.
    2. Generate module by module, skeleton first then constraints, avoiding one long context.
    3. Build an internal evaluation set and regress on the three dimensions completeness/fidelity/style.
    4. Include rate limiting and time in the cost model, and clarify the difference between free and paid tiers.
    5. Leave visuals to design standards and logic to the model, keeping responsibilities separate.

    Overall judgment: open-source models have already crossed the threshold of generating runnable projects, and the weakness is concentrated in the depth of understanding complex constraints. Treating them as a private, fine-tunable implementation engine rather than an all-capable architect is currently the most pragmatic approach.