Evaluating How Well LLMs Reproduce Requirements in Frontend Page Generation

    A practical framework for assessing whether LLM-generated frontend pages actually implement the stated requirements, covering five measurable evaluation dimensions, requirement writing practices, common failure modes, and team adoption tips.

    1. Background: A Page That Runs Is Not a Page That Meets Requirements

    More and more teams are involving large language models in frontend development. Given a requirements document, a model can produce a runnable page project in a short time, including routing, layout, base components, and sample data. For prototyping and admin-style pages, this capability saves a great deal of repetitive work.

    But “runs” and “runs according to the requirements” are two different things. A requirements document describes business rules: which fields are required, how filter conditions interact, and which inputs should be preserved after a failed submission. If the model only captures page structure, it leaves behind many hidden gaps. A list page may look complete, yet the filter area never triggers any query. A form page may submit successfully, but phone number validation is missing and required fields do not match the document. These issues usually surface only at acceptance, when rework costs are highest.

    Therefore, evaluating a model’s frontend generation ability should not stop at whether pages render. Every requirement must be checked item by item. This article presents a reusable evaluation framework, guidance on writing requirements, and practical adoption advice.

    2. Why Open-Weight Models Matter in Engineering

    Whether a model’s weights are open directly affects how it can be used in engineering. Open-weight models allow teams to deploy on internal networks, keep business data in local environments, and fine-tune or apply prompt engineering around internal component libraries and coding standards. For industries with strict data-sovereignty concerns, such as finance, government, and healthcare, this often matters more than the quality of any single generation.

    Open ecosystems bring two additional benefits. First, researchers can inspect how the model fails on specific tasks instead of relying solely on aggregate metrics published by vendors. Second, the community can build derivative versions for code, Chinese-language business scenarios, or specific domains on top of the same base model, reducing duplicate training costs.

    Open weights do not mean ready to use out of the box. Deployment requires compute planning, inference latency and concurrency need load testing, and model version upgrades must go through change management. When selecting a model, teams should weigh openness against operational cost.

    3. Evaluation Framework: Five Quantifiable Dimensions

    Score model output across the following five dimensions. Each dimension should have explicit acceptance items so judgments are not purely subjective.

    3.1 Page Completeness

    Check each page against the page list in the requirements document: whether it exists, whether its route is reachable, and whether its main sections are present. Completeness is the most basic layer and the easiest to quantify. Record the number of missing pages and missing sections as a baseline for later comparisons.

    3.2 Interaction and Filtering Logic

    This dimension best separates “looks right” from “works right.” If the requirements state “when a filter changes, automatically query and reset the page number to 1,” verify each clause. Common deviations include: filter controls rendered but not triggering queries; multiple conditions that should be combined with AND implemented as OR; and reset buttons that fail to clear all conditions.

    Break each interaction into a triple: initial state, trigger action, expected result, and execute them one by one. Even when requirements are imprecise, reviewers can still reach consistent judgments based on the same set of triples.

    3.3 Form Fields and Validation Rules

    Form pages tend to fail in three areas: field completeness, dependencies between fields, and validation timing with error messages. For example, if the requirements say “show the tax ID only when the invoice type is enterprise,” the model may display it unconditionally. Or if the requirements say “amounts keep two decimal places and must not exceed the authorized limit,” the model may only validate the format and miss the business cap.

    During acceptance, test normal values, boundary values, and invalid values separately, and check whether the submission results and error messages match the document.

    3.4 Visual and Engineering Quality

    On the visual side, check whether spacing, font sizes, colors, and alignment are consistent and conform to the design guidelines. On the engineering side, look at directory structure, component decomposition, state management, and obvious code duplication. If the team already has a mature component library or design system, also verify that the model reuses those assets rather than reimplementing similar components.

    Do not over-weight visual scores. For internal admin pages, functional correctness matters more than visual polish.

    3.5 Delivery Efficiency and Runnability

    Record the time from submitting requirements to receiving a runnable project, along with queuing, rate limiting, and retry counts. If the output cannot start directly or depends on missing package versions, count it as one delivery failure. Compare efficiency metrics against alternative approaches for the same requirements rather than reading absolute numbers in isolation.

    4. Writing Requirements the Model Can Reproduce

    The other side of evaluation is input quality. The same model typically reproduces structured requirements noticeably better. Break page requirements into a format both humans and machines can read easily, for example:

    1. {
    2. "page": "product-list",
    3. "filters": [
    4. {
    5. "field": "status",
    6. "label": "Listing status",
    7. "type": "select",
    8. "options": ["All", "Listed", "Unlisted"],
    9. "default": "All",
    10. "on_change": "Trigger query and reset page number to 1"
    11. },
    12. {
    13. "field": "keyword",
    14. "label": "Keyword",
    15. "type": "text",
    16. "on_change": "Trigger query 300 ms after typing stops"
    17. }
    18. ],
    19. "reset_behavior": "Clear all filter conditions and query again"
    20. }

    This format offers three benefits. First, fields, types, and defaults are declared explicitly, reducing ambiguity. Second, interaction rules are described separately from data structures, making item-by-item acceptance easier. Third, the same structure serves both as a requirements specification and as input for automated tests.

    When writing requirements, also keep the following in mind:

    • List the complete field inventory for every page; avoid vague phrases like “standard fields.”
    • Use “if… then…” phrasing for conditional branches and specify the else behavior.
    • Define expected behavior for error paths (network failure, duplicate submission, insufficient permissions).
    • Provide copy, error messages, and empty states verbatim so the model does not rewrite them.

    5. Common Deviation Types and Countermeasures

    Based on the evaluation above, deviations fall roughly into three categories.

    The first is omission. The model ignores a requirement item, such as a filter condition or a field. Countermeasure: assign an ID to every requirement item, verify each ID during acceptance, and require the model to list implemented and unimplemented items in its output notes.

    The second is misunderstanding. The model implements the feature, but the logic differs from the requirements, such as inverted condition combinations. Countermeasure: rewrite key rules as pseudocode or test cases to reduce the ambiguity of natural language.

    The third is simplification. The model implements only the happy path, omitting boundary values, error states, and loading states. Countermeasure: list these states explicitly in the requirements, or ask the model to generate corresponding UI components for empty and error states.

    6. Recommendations for Team Adoption

    First, establish a fixed acceptance checklist and integrate it into the code review process. The five dimensions above can be reused directly.

    Second, treat model output as a first draft, not a final deliverable. Reviewers must confirm each item and add unit tests for critical business logic.

    Third, accumulate failure cases. Every omission and misunderstanding found should be recorded and used to improve requirement templates, gradually forming the team’s own requirements standard.

    Fourth, run regression evaluations after model version changes. Compare the same requirements on the new version against historical baselines to catch silent capability regressions after upgrades.

    Fifth, make security responsibility explicit. Model-generated code must go through the same security review as human-written code, including input validation, access control, and handling of sensitive information. The fact that a machine produced the code is no reason to lower the bar.