Evaluating LLM Frontend Code Generation: Analyzing the Comprehension Gap from Login Pages to Complex Forms

    This article evaluates the frontend code generation capabilities of Large Language Models (LLMs) using real-world Product Requirements Documents (PRDs). By testing the generation of login pages, list pages, and complex forms, the analysis reveals that while models excel at structural and visual generation, significant gaps remain in semantic understanding, business logic implementation, and field-level validation. The findings offer developers actionable insights into leveraging LLMs effectively and understanding the current boundaries of AI-generated frontend code.

    Recent claims suggest that domestic Large Language Models (LLMs) have matched the capabilities of top-tier international models in frontend code generation. Beyond the hype, developers need an objective benchmark: can these models handle real-world project requirements? To answer this, I used a frontend PRD from an actual project as a baseline, prompting an LLM to fully generate three types of pages—login, list, and form. Here is a detailed breakdown of the testing process and conclusions.

    1. Test Design: Why Use Real PRDs?

    Many “mind-blowing” evaluations fail because their test cases are too simple. Anyone can generate a decent TODO app with a basic prompt. Real projects contain PRDs with:

    • Explicit interaction logic (filtering, cascading, validation rules)
    • Field-level constraint descriptions (required fields, format validation, dependencies)
    • Cross-page state transitions (login state, access control)

    This genuinely tests the model’s depth of comprehension regarding the PRD, rather than just its template assembly capability.

    The test did not restrict the tech stack, and the model autonomously chose React, which aligns with mainstream expectations.

    2. Usage Experience: The Bottom Line

    Here are objective observations from the generation process:

    1. Concurrency and Queuing: Under the free quota, multiple queuing prompts appeared. This is common in high-reasoning-cost, long-context generation tasks, indirectly reflecting the significant computational overhead of end-to-end project generation.
    2. Slower Generation Speed: The entire project took over half an hour to generate. In contrast, industry-leading products typically complete similar tasks in a few minutes. The speed gap stems from comprehensive issues in inference efficiency and engineering scheduling.
    3. Complete Delivery Format: The output was a directly accessible, complete project, not just scattered code snippets. This is a qualified delivery format, indicating the model possesses a complete engineering pipeline from code to runnable application.

    3. Login Page: High Completion Rate

    The login page is the simplest test scenario. The PRD included standard requirements like carousels, which the model fully implemented. The page was fully functional with no obvious omissions.

    The experience here reached the level of “ready for production with minor tweaks.” This confirms a common pattern: when the PRD description highly overlaps with high-frequency patterns in the model’s training data (login pages are quintessential templates), the generation quality is generally high.

    4. List Page: Comprehension Starts to Falter

    Issues surfaced on the product list page. The PRD explicitly detailed filter conditions and interaction logic, but the generated results omitted the filtering functionality. This was a common issue across multiple list pages, not an isolated incident.

    The root cause is worth analyzing:

    • The page structure was correct: tables, pagination, and layout were accurately reproduced.
    • What was missing was the “functional comprehension”: the mapping relationship between filter fields in the PRD and the data structure was not correctly parsed.

    This indicates a clear capability gap between the model’s visual structure reproduction and business logic implementation. The former can be learned from abundant open-source page templates, while the latter requires genuinely “reading and understanding” the field-level semantics in the PRD.

    5. Form Page: Insufficient Reproduction of Complex Requirements

    The form page showed the most significant gap. The page ran overall, but many fields, validation logic, and interaction details did not fully align with the PRD.

    Complex forms demand multi-level capabilities from the model:

    1. Field Definition -> Validation Rules -> Inter-field Cascading -> Submission Logic -> Error Feedback

    Models can often complete the first level of listing fields, but fall short in accurately reproducing validation rules and establishing inter-field dependencies. For scenarios where the PRD is written clearly enough, this deviation suggests the issue lies in the comprehension phase rather than the input phase.

    6. Overall Style: Engineering Usability over Product Aesthetics

    The UI style evaluation can be summarized in three points:

    • Better than most prototype sketches.
    • Still lags behind the combination of mature component libraries and design systems.
    • The design feels engineering-oriented, lacking “wow-factor” details.

    The positioning is roughly: Engineering Usability > Product Aesthetics. This is sufficient for rapid validation scenarios, but for user-facing products, manual intervention in the visual layer is still required.

    7. Comparison with International Leading Models: The Gap is in “Comprehension Depth”

    The same set of requirements was previously implemented using an industry-leading model. The comparison is as follows:

    Scenario Domestic Model Leading Model
    Login Page Similar completion rate Similar completion rate
    List Page Filtering logic missing Comprehensive understanding of filtering and field structure
    Form Page Insufficient validation and cascading Accurate field relationships and validation logic
    Speed Slow (under free quota) ~3 minutes

    The conclusion is clear: The gap is not in “whether a page can be generated,” but in “the precision of requirement comprehension.” The former is an engineering problem, which is relatively easy to catch up on; the latter involves the model’s ability to parse long documents and fine-grained semantics, requiring continuous technical accumulation.

    8. Three Tips for Developers

    1. Do not judge model capability based on single-page demos. Always test list and form pages using real PRDs with field-level constraints. This is the true litmus test for comprehension.
    2. Use generation results in layers. The structural layer (layout, routing, component scaffolding) can be handed over to the model, while the logic layer (validation, cascading, state transitions) still requires manual review and supplementation.
    3. Write “machine-friendly” PRDs. Structuring filter fields and validation rules as structured lists rather than narrative paragraphs can significantly improve the model’s reproduction rate.

    Conclusion

    Domestic models are rapidly approaching the international first tier, which is a major boon for the open-source ecosystem and industry competition, as competition accelerates technical iteration. However, as front-line developers, our criteria should not be the comparison charts from press conferences, but the comprehension precision and delivery quality in real projects. From this test, structural generation is already mature, but semantic-level comprehension remains the next threshold to cross.