Evaluating LLM Front-End Development: From Requirement Understanding to Engineering Delivery

    This article explains how to evaluate front-end code generated by large language models. It covers writing requirement documents that can be verified, five evaluation dimensions with clear pass criteria, scripts for automated checks, common failure patterns, and recommendations for teams adopting code generation.

    1. Why Code Generation Needs Systematic Evaluation

    Code generation tools now produce code much faster than people can write it by hand. A page that runs, however, does not necessarily match the requirements. A page can render normally while filters, field linkage, or validation rules are still missing. If a team judges output quality only by first impressions, the gaps often surface only after release.

    Evaluation therefore needs to be broken into observable dimensions, and each dimension needs a clear method for judging the result.

    2. Preparation: Writing Requirements as Verifiable Documents

    The reliability of an evaluation depends on the quality of the requirement document. When the document is vague, evaluators cannot tell whether a deviation comes from the model or from the document itself.

    A requirement document for each page should cover four types of information:

    • Page structure: region layout, component hierarchy, and layout breakpoints.
    • Data and fields: field names, types, whether each field is required, and data sources.
    • Interaction rules: how filters combine, default values, reset logic, and linkage between controls.
    • Validation rules: when validation triggers, error message text, and state changes before and after submission.

    Below is an example requirement for a list page, written in YAML:

    1. page: product_list
    2. filters:
    3. - name: 状态
    4. type: select
    5. options: [上架, 下架]
    6. default: 全部
    7. - name: 创建时间
    8. type: date_range
    9. linkage: 与状态互不影响
    10. actions:
    11. - reset: 清空所有筛选项并恢复默认值

    When requirements are written at this level of detail, each rule can be turned into a check item.

    3. Five Evaluation Dimensions and Pass Criteria

    3.1 Engineering Runnability

    This is the most basic gate. Evaluators install dependencies in a standard environment, build the project, and start it. They check the following:

    • Whether the project starts without manual changes;
    • Whether the build log contains blocking errors;
    • Whether the project structure is clear and each directory has a defined responsibility.

    If a project needs heavy manual repair before it runs, evaluating its features has little value.

    3.2 Page Structure Completeness

    Check each page against the requirement document to confirm that all regions and components are present. This dimension tests whether the skeleton is correct. For example, a list page should include a filter area, a table area, and a pagination area. A form page should arrange its fields in the specified groups.

    A complete structure does not mean complete functionality. Pages that pass this check still need to move on to the next dimension.

    3.3 Business Rule Understanding

    This dimension is the main differentiator in generation quality. Filter conditions, linkage between fields, default values, and reset logic all count as business rules. In practice, this dimension has the most gaps. A page may show a filter area, but some filters are not implemented. Others are implemented but never connected to the data request.

    When judging, check each rule in the requirement document against the page. Assign each rule one of three results: “passed,” “partially passed,” or “not implemented.”

    3.4 Form Fields and Validation Fidelity

    Form pages are hard because they contain many fields with complex relationships. The evaluation focuses on the following:

    • Whether field types are correct. For example, a date field should use a date picker.
    • Whether required-field markers match the submission blocking behavior.
    • Whether validation triggers at the time the document specifies. If the document requires validation on input but the page validates only on submission, that is a mismatch.
    • Whether dependencies between fields take effect.

    3.5 Visual and Interaction Consistency

    Visual evaluation looks at the gap between the generated page and the design specification. Common component libraries can produce usable interfaces quickly. Details such as brand guidelines, spacing rules, and state styles still need to be compared one by one. The usual conclusion for this dimension is “usable but not polished.” This matters little for internal tools, but a user-facing product needs manual adjustment.

    4. Automating Checks with Scripts

    Manual checks take a long time. For rules that can be judged from page labels or API data, a simple script can perform a first-pass screening. The example below checks whether a list page includes all required filters:

    1. REQUIRED_FILTERS = ["状态", "创建时间", "负责人"]
    2. def check_filters(rendered_labels: list[str]) -> dict:
    3. """Compare the filters required by the spec with the labels actually rendered on the page."""
    4. missing = [name for name in REQUIRED_FILTERS if name not in rendered_labels]
    5. return {"passed": not missing, "missing": missing}
    6. if __name__ == "__main__":
    7. result = check_filters(["状态", "创建时间"])
    8. print(result) # {'passed': False, 'missing': ['负责人']}

    The script covers only rules that can be judged mechanically. Linkage logic, text accuracy, and interaction feel still require manual verification.

    Keep each rule in a test case table for reuse and traceability:

    Case ID Page Rule Description Verification Method Result
    L-01 List page The status filter defaults to the “All” option (全部) Check the initial request parameters Passed
    L-02 List page The reset button clears all filters Click reset, then check the input fields and request parameters Not implemented
    F-01 Form page The phone number field shows a prompt as soon as an invalid value is entered Enter an invalid value and observe when the prompt appears Partially passed

    5. Common Failure Patterns

    In real evaluations, the following problems appear repeatedly:

    1. Silent omission: A condition in the document is not implemented, and the page shows no error. The problem can only be found by comparing against the document.
    2. Type errors: A field exists, but its control type does not match the requirement. For example, a date field is built as a plain text box.
    3. Timing deviation: Validation logic exists but triggers at the wrong time.
    4. Systematic defects: The same kind of problem appears across several pages. This usually means the model has a capability gap for that type of requirement, not an occasional error.

    The fourth pattern deserves the most attention. Occasional errors can be fixed by patching. Systematic defects affect the delivery quality of the whole project, so the team needs to change how requirements are written or add manual review steps.

    6. Implications for the Open-Source Ecosystem and Technology Development

    The evaluation method itself has general value. Publicly shared requirement templates, test cases, and check scripts let different teams compare results under the same conditions and reduce subjective judgment.

    Open-source models can be deployed inside an organization and tuned for specific business needs. Teams can run the same set of requirement documents across models and make selection decisions based on cost, speed, and accuracy.

    A single trial is not enough to draw conclusions. Model versions get updated, service load affects response speed, and differences between free and paid plans can also change results. Continuous measurement is needed to reflect actual capability.

    7. Recommendations for Team Adoption

    1. Build a fixed set of evaluation requirements that covers at least three page types: login, list, and form.
    2. After each model or version update, re-evaluate using the same set of test cases.
    3. Focus manual review on business rules and validation logic. Structure and styling can be reviewed with more flexibility.
    4. Record generation time, rework count, and defect count, and include these as cost metrics when selecting a model.
    5. Feed evaluation results back into how requirement documents are written. The more structured the document, the more stable the generated output tends to be.

    The ability to generate code keeps changing. A reproducible evaluation process is what allows a team to stay in control over the long run.