Chinese Open-Source LLMs for Frontend Code Generation: Where They Work and Where They Fall Short

    This article presents a directional test of Chinese open-source LLMs building a frontend project from a requirements document. It examines login pages, list filtering, complex forms, validation, speed and UI observations, the value and boundaries of open-source models, and a pre-launch checklist. The goal is to show where these models can accelerate scaffolding and template pages, and where human review remains essential for state management, cascading filters, and fine-grained validation.

    1. Why This Test Was Run

    Code generation ability is often summarized by benchmark scores, but benchmark results cannot show whether a model can understand a real requirements document. This article focuses on a frontend project that includes login, list display, and complex form submission, and observes how models perform when building the project from scratch. The test did not restrict the tech stack or UI component library; only a requirements document was provided.

    It is important to note that the original test did not disclose model names, versions, inference settings, or the requirements document. Therefore, the conclusions here should be treated as directional observations, not as a direct basis for model selection. Readers who want to reproduce the test should first record the following: model name and version, access method (web UI or API), sampling parameters, the full requirements document, and the generated code and run results for each attempt.

    2. Login Page: A Suitable Starting Point

    The login page included standard components such as a form and a carousel. Based on the carousel requirements in the document, the model generated the page structure and carousel interaction, and the page was largely functional. For this kind of template-based page, the model can quickly produce a runnable first draft.

    However, the first draft is only suitable as a prototype. Before it can enter production, it still needs code review, unit tests, security checks (for example, token storage and input escaping), and browser compatibility validation.

    3. List Page: Filtering Logic Is the Main Weakness

    The list page requirements included multi-dimensional filtering, cascading selection, and linked reset. In the test, the model built the page skeleton, but several filter items did not actually work. The DOM structure was broadly correct; the problem was in converting natural-language descriptions of state management into interaction logic.

    The code below defines the filter state:

    1. const [filterState, setFilterState] = useState({
    2. category: '',
    3. status: '',
    4. dateRange: []
    5. });

    A safer approach is to calculate the next state in the handler, then use that new object directly to make the request, rather than relying on the state after an asynchronous update:

    1. const handleFilterChange = (key, value) => {
    2. const next = { ...filterState, [key]: value };
    3. setFilterState(next);
    4. fetchListData(next);
    5. };

    If request logic needs to follow state changes, you can switch to useEffect and handle request cancellation:

    1. useEffect(() => {
    2. const controller = new AbortController();
    3. fetchListData(filterState, { signal: controller.signal })
    4. .catch((err) => {
    5. if (err.name !== 'AbortError') console.error(err);
    6. });
    7. return () => controller.abort();
    8. }, [filterState]);

    This approach has three benefits. First, request parameters always correspond to the latest state. Second, when filters are changed quickly, old requests are canceled, preventing the list from being filled with incorrect data. Third, errors can be caught and handled. For text-input filters, debouncing should also be added (for example, 300 ms) to reduce unnecessary requests.

    Model-generated code often lacks these data-flow details. Therefore, any filter involving cascading or linked behavior should be verified manually item by item.

    4. Form Page: Validation Rules Need Item-by-Item Checks

    The form page best exposes the gap in how deeply a model understands requirements. A document may include asynchronous validation based on a previous field, or cross-field conditional required rules. In the test, the model mostly implemented only non-empty validation.

    The verification method is straightforward: turn each validation rule in the requirements document into a checklist, operate the interface item by item, and record pass or fail. Cross-field rules such as “at least one of phone number and email must be provided” are the easiest to miss.

    5. Speed and UI: How to Interpret the Conclusions

    The test concluded that open-source models generated more slowly and closed-source models were faster. However, the original test did not provide a timing method, so this conclusion cannot be quantified. To compare speed, measure the total time from submitting requirements to getting a runnable project, record first-response time, and take the median across multiple runs.

    In terms of interface style, pages generated by open-source models tend toward basic engineering implementation and have weaker visual hierarchy. If a team already has a mature component library or design system, reusing them is usually more efficient than relying on model-generated styles.

    6. The Value and Boundaries of Open-Source Models

    The main value of open-source models is controllability. Teams can deploy models in their own environment, keep code and business data on the internal network, and fine-tune on internal code samples. This is especially important for small and medium-sized teams with limited budgets.

    Cloud container services, inference services, and object storage can lower the deployment barrier. When choosing, teams should compare providers based on their own security and compliance requirements and cost budget.

    The boundaries are equally clear. For complex business logic, open-source models still require substantial manual correction. In the short term, they are better suited to scaffolding, template pages, and repetitive code, rather than independently completing complex business systems.

    Future improvements may come from three directions: instruction fine-tuning with more engineering code that includes state management and data flow; stronger extraction of detailed constraints from long documents; and human-feedback training that helps models better balance feature completeness and execution efficiency.

    7. Pre-Launch Checklist

    1. Have the model version, prompt, and requirements document version been recorded?
    2. Has every validation rule been verified through the interface?
    3. Are data requests for filtering, pagination, and linked reset correct, with cancellation and error handling?
    4. Have code review and unit tests been completed?
    5. Are sensitive values (tokens, keys) kept out of frontend code?
    6. Does the page display correctly in the target browsers and screen sizes?

    8. FAQ

    Can open-source models be used directly in production projects?
    Not recommended at this stage. Model output can serve as a first draft, but it must go through code review, testing, and security validation.

    What scenarios are suitable for open-source models?
    They are suitable for scaffolding, generating template pages, writing repetitive components, and internal projects with high data privacy requirements.

    Why are complex filters prone to errors?
    Filters involve interactions among multiple states. State updates are asynchronous, so if a request reads an old value, the result will be wrong.

    Conclusion

    Open-source LLMs can already build basic pages quickly, but complex interactions and fine-grained validation still require human oversight. When selecting a model, teams should first run a small-scale test with their own real requirements, then decide how far to invest.