Evaluating LLMs for Front-End Requirement Restoration: Methods and the Value of Open Source

    This article explores methods for evaluating the ability of Large Language Models (LLMs) to accurately restore front-end requirements from design documents. It covers the importance of separating "runnable" code from "requirement-accurate" code, the role of structured requirement documents, evaluation dimensions for different page types (login, list, form), and the construction of a reusable evaluation process. It also discusses the significance of open-source models in AI-driven front-end development and provides actionable insights for development teams.

    1. Why Evaluate Requirement Restoration Separately

    Handing design documents to automated tools to generate page code has become a common development practice. Many teams focus on generation speed and whether the page runs, but rarely check the correspondence between the generated result and the requirements. A page that opens does not mean the business rules are fully implemented. Missing filter conditions, omitted validation logic, and lost field dependencies are issues that are hard to expose before launch but will increase subsequent rework costs.

    Therefore, when evaluating code generation capabilities, “runnable” and “requirement-accurate” should be examined separately. The former is the engineering baseline, while the latter determines whether the generated result can truly reduce the development burden.

    2. Requirement Document Quality Determines the Evaluation Baseline

    Before evaluation, it is necessary to ensure the input is reliable. If the same requirement is given to different systems, the result differences may stem from the document itself. Common document issues include:

    • Page states only describe the normal flow, lacking branches for empty data, loading, and error prompts.
    • Filter conditions are described in natural language without specifying field types, value ranges, and default values.
    • Dependencies between form fields are scattered across multiple paragraphs, requiring readers to piece them together.

    It is recommended to break down requirements into structured items, each corresponding to a verifiable behavior. An example is as follows:

    1. requirement = {
    2. "page": "product_list",
    3. "filters": [
    4. {"name": "category", "type": "select", "default": None},
    5. {"name": "price_range", "type": "range", "min": 0, "max": 10000},
    6. ],
    7. "interactions": ["Reset pagination after filtering", "Sync filter conditions to URL parameters"],
    8. }

    Structured descriptions allow verification scripts to directly read expected values, avoiding missing details during manual comparison.

    3. Evaluation Dimensions by Page Type

    1) Login Pages
    The functionality of a login page seems simple, but details are easily overlooked. During evaluation, check whether input fields are complete, password inputs are masked, error prompts are consistent with requirements, usernames are retained after login failure, and guiding or carousel content switches normally. The completion rate of such pages is usually high, making them suitable as a starting point for benchmark testing.

    2) List Pages
    The core of a list page is data querying and state management. It is necessary to confirm whether each filter actually participates in the query, whether changing filter conditions triggers new data requests, whether pagination is reset, and whether sorting and filtering can be combined. Many generated results only complete the table structure, where the filter area has appearance but no logic. Such issues usually indicate that the model’s understanding of interaction logic is not deep enough and should be a key inspection item.

    3) Form Pages
    Form evaluation focuses on three points: whether fields are complete, whether validation rules are consistent with the documentation, and whether field dependencies are correctly implemented. For example, after a certain option is selected, another field should become required or display different selectable values. When checking, boundary inputs can be constructed, such as empty values, overly long text, and illegal formats, to observe whether the prompt information and submission behavior comply with the rules.

    4. Building a Reusable Evaluation Process

    A practical process can be divided into four steps:

    Step 1: Prepare requirements and checklists. Break down the behavior of each page into assertive judgments.
    Step 2: Generate code and run it. Record generation time, whether it starts normally, and console errors.
    Step 3: Execute assertions one by one. For interactive requirements, use automated testing to simulate user operations and compare page states.
    Step 4: Manual review of visuals and experience. Parts difficult for automation to judge should be evaluated by experienced developers.

    Here is an example function to check if filter items are implemented:

    1. def check_filters(rendered_fields, spec_filters):
    2. missing = [f["name"] for f in spec_filters if f["name"] not in rendered_fields]
    3. return {"passed": not missing, "missing": missing}

    When scoring, it is recommended to use a weighted approach, scoring functional coverage, requirement understanding accuracy, engineering usability, and visual consistency separately. A simple conclusion of “good” or “bad” cannot guide improvement and makes horizontal comparison between different solutions difficult.

    5. The Significance of Open Source Models

    Open source first makes evaluation reproducible. When model weights, inference interfaces, or relevant documents are public, researchers can repeat tests on the same data to verify capability claims. Open, reproducible benchmarks are more convincing than a single experience, which is crucial for the long-term healthy development of the industry.

    Open source also lowers the barrier for private deployment. When handling internal requirement documents, business rules, and user data, enterprises can deploy models in their own environments, reducing the risk of data leakage. For industries with compliance requirements, this is a factor to prioritize during selection.

    Furthermore, open source enables the community to fine-tune models for specific scenarios. For example, accumulating training data for a certain type of business form or a set of design specifications to form vertical domain capabilities. This collaborative approach can accelerate the iteration speed of the entire field.

    Open source itself does not automatically bring capability advantages. Model size, training data quality, inference cost, and long-context processing capabilities still determine actual performance. Evaluation should simultaneously consider performance, cost, and deployment complexity, not just whether it is open source.

    6. Insights for Developers and Teams

    1. Writing requirements as verifiable text yields more stable results than repeatedly tweaking prompts.
    2. Establish an internal page checklist for the team to allow horizontal comparison of outputs from different solutions.
    3. Treat generated results as drafts, retaining code review and automated testing phases.
    4. Pay attention to response speed and service queuing strategies. They directly affect iteration efficiency and should be included in selection costs.

    7. Conclusion

    The value of code generation lies in shortening the path from requirements to runnable pages. To truly leverage this value, teams need structured requirement descriptions, quantifiable evaluation methods, and a rational judgment of the open-source ecosystem. Separating “can run” from “did it right” ensures that technological progress translates into actual development efficiency.