Large Language Model Code Generation: Hands-On Testing and a Selection Guide

    This article evaluates large language models for code generation through a real multi-page admin project, covering login, list, and form pages. It shows why "it runs" does not mean "it is usable," breaks down where comprehension degrades, compares model behavior across page types, and explains the practical value of open weights. It also provides a reusable evaluation checklist and three proven practices for improving generation quality.

    1. Why “It Runs” Does Not Mean “It Is Usable”

    After AI coding tools became part of everyday development workflows, many teams have run into the same awkward situation: the generated project starts, the pages render, but once you check the implementation against the requirements document line by line, systematic deviations appear. These are not occasional typos. They cluster at the “functional comprehension layer” — the structure is right, but the logic was never actually implemented.

    So evaluating a model or an AI coding tool cannot rely on whether it produces a reachable demo URL. You need a layered evaluation framework: structural fidelity, functional completeness, interaction and validation accuracy, generation efficiency, and style plus maintainability. The sections below walk through each layer based on an actual generation run.

    2. Reconstructing the Practice: Generating a Full Multi-Page Project

    To observe how models behave in real engineering work, the practice used a typical admin project with a login page, a list page, and a form page. The requirements were provided all at once as a document, with no technology stack imposed, and the model chose a component-based frontend framework on its own.

    2.1 Entry Stage: Queuing and Quotas Are Real Constraints

    During the initial access stage, the “current request volume is high, please queue or upgrade your quota” prompt appeared repeatedly, and it took several retries to get in. This tells us that integrating any AI coding capability into production means designing for rate limiting, retry logic, and quota planning — not assuming the endpoint is always available.

    A practical approach is to add exponential backoff retries on the client and distinguish “retryable errors” from “business errors”:

    1. async function withRetry(task, max = 4) {
    2. let delay = 1000;
    3. for (let i = 0; i < max; i++) {
    4. try {
    5. return await task();
    6. } catch (e) {
    7. if (!isRetryable(e)) throw e;
    8. await new Promise(r => setTimeout(r, delay));
    9. delay *= 2;
    10. }
    11. }
    12. throw new Error('retry exhausted');
    13. }

    2.2 Login Page: Close to Expectations

    The login page was the most stable part of this generation. The carousel requirement in the document was implemented correctly, and the form elements, button states, and basic layout were all in place — the kind of output that is “ready to ship after minor tweaks.” The reason is that login page requirements are highly standardized, and there are a huge number of such patterns in the model’s training data, so the cost of reproducing them is low.

    2.3 List Page: Comprehension Starts to Decay

    Problems showed up on the list page: the multi-condition filtering and linked interactions explicitly written in the document were not implemented, and several list pages shared the same gap. This is not random variance but a capability shortfall — the model captured the “page skeleton” but lost the “functional semantics.”

    There are three common root causes. First, the filter conditions were scattered across different sections of the requirements document, and the model did not consolidate them globally. Second, field names did not match the business semantics, so the model could not build a mapping. Third, the interaction chain (select conditions → trigger query → reset) is cross-component state, which exceeds the attention coverage of a single generation pass.

    2.4 Form Page: Field Relationships and Validation Logic Are Under-Reproduced

    The form page ran overall, but details such as field linkage, required-field validation, and the timing of error messages differed noticeably from the document. The essence of a complex form is a “state machine plus a set of constraints.” If the requirement only says “support validation,” the model can only produce a generic implementation and cannot reproduce the specific rules.

    The fix is to declare constraints explicitly, for example:

    1. {
    2. "field": "phone",
    3. "rules": [
    4. { "type": "required", "message": "Phone number is required" },
    5. { "type": "pattern", "value": "^1\\d{10}$", "message": "Invalid format" },
    6. { "type": "trigger", "value": "onBlur" }
    7. ],
    8. "dependsOn": ["countryCode"]
    9. }

    Once the validation rules are structured and handed to the model, reproduction accuracy improves significantly.

    2.5 Style and Efficiency: Engineering Usability Comes First

    The UI style was a conventional, engineering-oriented aesthetic — better than a rough prototype, but still short of the templated output of a mature design system. Generation took on the order of half an hour, while similar requirements can be completed in a few minutes on some closed-source solutions. That efficiency gap gets amplified in rapid validation scenarios.

    3. Side-by-Side Comparison: The Gap Is About “Depth of Understanding”

    Giving the same requirements document to different solutions reveals a clear capability gradient: the gap is tiny on standardized pages like login; it starts to widen on the list page, where the winner understands the filtering and field structure more completely; and it is largest on the form page, where the accuracy of reproducing field relationships, validation, and interaction details becomes the dividing line.

    The conclusion is not complicated: today’s mainstream models have become highly homogeneous at “generating syntactically correct code.” The real difference comes from the ability to consolidate requirements within a long context and to follow constraints.

    4. The Practical Value of Open Weights

    When a model’s capability approaches the state of the art, the value of open weights and an open ecosystem is significantly amplified, mainly across four dimensions:

    • Cost control: In high-frequency invocation scenarios, self-hosting and batching can dilute unit cost and avoid the uncertainty of per-call billing.
    • Data compliance: Sensitive code and internal documents can stay in your own environment, meeting audit and isolation requirements.
    • Customizability: Through fine-tuning, retrieval augmentation, and prompt engineering, you can turn internal team standards into model behavior.
    • Avoiding lock-in: Weights and the inference stack are portable, reducing single-vendor risk.

    It is worth stressing that open does not mean zero cost. Inference compute, operations, monitoring and alerting, logging services, and security governance all need supporting infrastructure. Container platforms and elastic scaling are common choices for hosting self-managed inference.

    5. A Reusable Evaluation Checklist

    Teams are advised to run regression evaluations against a unified benchmark set covering the following metrics:

    1. Structural fidelity: whether the number of pages, routes, and layout match the document.
    2. Functional completeness: whether secondary features such as filters, pagination, and export are implemented.
    3. Constraint-following rate: the hit rate for required fields, formats, linkage, and permission rules.
    4. Interaction consistency: whether loading, empty, and error states are complete.
    5. Generation efficiency: end-to-end time and the cost of failed retries.
    6. Maintainability: directory structure, naming conventions, comments, and test coverage.

    6. Three Practices for Improving Generation Quality

    First, structure the requirements document. Rewrite “support filtering” into a field list, operation types, and linkage relationships so the model does not have to guess.

    Second, divide and conquer. Generate in batches by page or by functional domain, producing the API contract and data model first and the view layer second, which significantly reduces information loss over long chains.

    Third, hand validation to deterministic code. Express business rules with configuration or a rules engine, and let the model only build the skeleton, avoiding the risk of entrusting hard constraints to probabilistic generation.

    7. Conclusion

    From this practice, domestic large models have reached a practical level for standardized page generation. The real shortfall lies in the depth of understanding and reproduction accuracy for complex requirements — and that is precisely the part that can be compensated for through document structuring, task decomposition, and engineering constraints. Meanwhile, the open ecosystem’s advantages in cost, compliance, and customizability make it a viable path for enterprises to build their own AI-driven development capability. The key to rational selection is not chasing a single leaderboard ranking, but building an evaluation benchmark that fits your own business scenarios and letting data drive investment decisions.