Evaluating Chinese LLMs for Frontend Code Generation: Methodology and Value
This article introduces a reproducible methodology for evaluating the frontend code generation capabilities of Chinese Large Language Models (LLMs). It outlines how to create verifiable requirement documents, standardize the evaluation process, and record key metrics such as time to first run and manual rework cycles. By highlighting common failure points across login, list, and form pages, it provides developers with a practical framework to assess whether LLMs can handle complex interactions, edge cases, and maintainable code.
The capability of Chinese large language models (LLMs) in frontend code generation has moved beyond merely “rendering a page.” Developers need to know if a model can understand requirement documents, handle field interactions, permission checks, and exception states completely, and maintain code maintainability after multiple rounds of modifications.
This article provides a reproducible evaluation methodology. By following these steps, readers can obtain comparable data within their own projects. No model rankings are provided here, as there are currently no public datasets with unified standards to support such rankings.
1. Writing Verifiable Requirement Documents
Whether evaluation results can be compared depends primarily on fixed inputs. Providing the same requirement document to different models ensures comparability. A requirement document should include at least six parts: page objectives, roles and permissions, field definitions, interaction rules, exception handling, and acceptance criteria.
Here is a requirement snippet for a login page:
- Page Objective: Employees log in to the internal management system using their employee ID and password.
- Field Rules: Employee ID is required, 6 to 10 digits; Password is required, at least 8 characters; CAPTCHA appears after 3 consecutive failed attempts.
- Interaction Rules: The submit button is disabled and shows a loading indicator while the request is processing.
- Exception Rules: Use the same prompt message for “account does not exist” and “password incorrect” to avoid leaking account existence; retain user input if the network request fails.
- Acceptance Criteria: When input is invalid, the error message is displayed below the corresponding field, rather than in a generic pop-up.
Here is a requirement snippet for a list page:
- Query Conditions: Department, status, creation time range. List data is re-requested when any condition changes.
- Pagination Rules: 20 items per page. When filter conditions are changed, the list returns to the first page.
- Empty Data: Display a “No Data” prompt and a “Reset Filters” button.
- Acceptance Criteria: Filter conditions must be included in the request parameters; merely changing the dropdown display state does not count as a pass.
2. Evaluation Process and Reproduction Steps
The evaluation should be executed in the following order. Written records must be kept for each step.
- Record the test environment. Write down the model name and version, invocation method (web interface, API, or local deployment), sampling parameters like temperature, system prompts, test date, and context length limit. If any are missing, the results cannot be reproduced.
- Fix the input samples. Use the same requirement document and the same set of initial constraints (e.g., component library, directory structure, naming conventions) for each model.
- Run generation and record the time to first runnable state. Record the minutes taken from submitting the requirement to the project being able to start. Queue time and generation time should be recorded separately, as queue time is affected by server load.
- Start the project. Check if the console reports errors, if routes are complete, and if component import paths are correct.
- Perform operations according to the acceptance checklist. The test scope includes normal flows, boundary inputs, incorrect inputs, empty data, and duplicate submissions. Mark each item as pass or fail.
- Record rework points. Write the fix requests corresponding to each failed item, the number of modified files, and the number of modified lines into the record sheet.
- Run the same input at least 3 times. Compare the directory structure, component count, and acceptance pass rate of the three runs to observe output fluctuations.
3. Evaluation Record Sheet
The table below lists the fields to be filled out during the evaluation. The data in the table should be filled in by testers based on actual execution results; no preset values are provided here.
| Record Item | Filling Requirement |
|---|---|
| Test Date | Accurate to the day |
| Model and Version | Full model name and version number |
| Invocation Method | Web interface, API, or local deployment |
| Sampling Parameters | Temperature, max output length, etc. |
| Requirement Document Version | Document name and modification date |
| Page Type | Login page, list page, or form page |
| Total Acceptance Items | Number of check items in the acceptance checklist |
| Passed Items | Number of check items passed in this run |
| Pass Rate | Passed items divided by total acceptance items |
| Time to First Runnable | Minutes from submission to project start |
| Rework Count | Number of rounds manually requested from the model for modifications |
| Manual Modification Lines | Lines of code manually changed before delivery |
| 3-Run Difference | Changes in directory structure and pass rate |
4. Common Failure Points for Three Page Types
Login pages have a fixed structure, but details are prone to errors. Common issues include: validation only triggers on submit click instead of field blur; all errors use generic pop-up prompts; password input type or autocomplete attributes are improperly set; the CAPTCHA appearance condition is not implemented.
List page issues mostly occur in data flow. Common issues include: filter dropdowns only change the UI display without entering request parameters; pagination is not reset after switching filters; the select-all state is inconsistent with the current page’s data; the list is not refreshed after data deletion.
Form page issues focus on interaction relationships. Common issues include: conditionally hidden fields still participate in validation; subordinate options are not cleared after superior options change; other filled content is lost after a file upload failure; the submitted data structure does not match the API documentation, such as inconsistent date formats.
The table below provides acceptance items and determination methods for each page type.
| Page | Acceptance Item | Determination Method |
|---|---|---|
| Login Page | Error prompt located at the corresponding field | Check prompt position after entering invalid value |
| Login Page | CAPTCHA appears after consecutive errors | Submit incorrect password 3 consecutive times |
| List Page | Filter conditions enter request parameters | View query parameters of the network request |
| List Page | Return to first page after switching filters | Go to the second page, then modify filter conditions |
| Form Page | Hidden fields do not participate in validation | Switch condition… |
