LLM Code Generation Tested: How to Evaluate and Ship It in Real Projects

    This article examines where large language models actually struggle when generating code from requirement documents, and why single-page demos look better than full-project delivery. It introduces a five-dimension scoring framework covering requirement coverage, constraint adherence, interaction completeness, engineering usability, and delivery efficiency, then breaks down failure patterns across login, list, and form pages. It also separates visual polish from engineering quality, argues that elapsed time is not the same as cost, and closes with phased adoption and prompt engineering practices.

    1. The Real Question: From “Generating Code” to “Delivering a Project”

    Over the past year, the capability boundaries of AI coding tools have been debated repeatedly. Benchmark scores keep getting refreshed, but teams that put these tools into production run into a more basic question: when the input is a requirements document containing business rules, field constraints, and interaction logic, can the model reliably turn it into an engineering artifact that runs, stays maintainable, and passes acceptance?

    One pattern stands out in hands-on practice: given the same requirements, a model performs close to expectations on a login page, starts dropping filter conditions on a list page, and drifts on field and validation logic on a form page. This “stable at the front, degrading toward the back” behavior suggests that evaluation cannot stop at single-point generation quality; it has to measure consistency across a long chain of requirements. This article frames that pattern as a problem of “depth of understanding” and offers a reusable evaluation and delivery method.

    2. Evaluation Framework: Turning “Feels Good” into Measurable Dimensions

    To make conclusions reproducible, fix the evaluation criteria first. Cover at least the following five dimensions, each scored 0–2 (0 missing, 1 partially implemented, 2 fully implemented):

    • Requirement coverage: the proportion of listed features actually implemented;
    • Constraint adherence: whether field types, required flags, length limits, and dependencies are applied accurately;
    • Interaction completeness: whether state transitions, empty states, error states, and loading states are all present;
    • Engineering usability: whether directory structure, component decomposition, and styling approach support further development;
    • Delivery efficiency: end-to-end time multiplied by manual rework, not generation time alone.

    A sketch of an acceptance script can turn subjective judgment into executable checks:

    1. // Pseudocode: requirement-driven automated acceptance
    2. const checklist = [
    3. { id: 'login.carousel', desc: 'Login page carousel auto-plays and supports manual switching' },
    4. { id: 'list.filter', desc: 'List page supports combined filtering by status and price range' },
    5. { id: 'form.validate', desc: 'Form field dependencies and validation rules match the document' },
    6. ];
    7. function verify(report) {
    8. return checklist.map(item => ({
    9. ...item,
    10. pass: report[item.id] === 'full',
    11. }));
    12. }

    With a shared standard, comparisons across models, versions, and prompts become meaningful, and “feels stronger” turns into a trackable regression metric.

    3. Scenario Breakdown: Where Degradation Happens

    3.1 Login Page: Clear Structure, Simple Constraints

    Login pages typically consist of a form, a carousel or background image, and basic validation: few fields, few states, shallow dependencies. Models rarely fail here because the requirement description and the implementation path are highly isomorphic, making this a task that local generation can cover. It works well as a baseline case to confirm the toolchain is connected, but not as a measure of the capability ceiling.

    3.2 List Page: Cross-Component Constraints Start to Break

    The difficulty of a list page is not rendering but the data contract: how filter conditions map to query parameters, how pagination and sorting combine, and how empty results are distinguished from failed requests. When a document describes these rules in scattered natural language, models tend to implement only a structure that “looks like a list” and miss the filtering logic that spans components. The fix is to make the data contract explicit, for example by specifying the parameter shape before asking for the implementation:

    1. interface ListQuery {
    2. status?: 'active' | 'archived';
    3. priceRange?: [number, number];
    4. page: number;
    5. pageSize: number;
    6. sortBy?: 'createdAt' | 'price';
    7. }

    Agreeing on types first and then asking the model to generate the implementation significantly reduces the chance of lost constraints.

    3.3 Form Page: Field Relationships and Validation Are the Hardest Part

    Forms are where requirement density peaks: field dependencies, conditional required fields, asynchronous validation, idempotent submission, and error message placement are each independent rules. Model drift usually shows up as “all the fields are there, but the relationships are wrong.” A workable approach is to format the rules as a table and have the model implement them line by line:

    Field Type Rule Dependency
    Phone number string Required, 11 digits Clears the verification code when changed
    Company type enum Required Expands supplementary notes when “Other” is selected

    Once the rules are structured, both the model’s reproduction accuracy and the efficiency of manual acceptance improve.

    4. Style and Engineering Quality: Evaluate Usability and Visuals Separately

    A common mistake in practice is treating visual polish as the primary metric. A more sensible layering is to guarantee engineering usability first (clear structure, reusable components, traceable state) and only then discuss visual presentation. If design quality matters, state design tokens explicitly in the prompt (spacing, border radius, color palette hierarchy) and component density, or ask the model to follow the team’s existing style system rather than improvising. Note that shipping generated output directly is risky; it must pass three gates: code review, dependency audit, and automated testing.

    5. Efficiency Perspective: Time Is Not Cost

    End-to-end time is affected by queueing policy, free-tier limits, output length, and the number of rework rounds, so judging by “finished in a few minutes” alone is misleading. A metric closer to engineering reality is total delivery cost:

    1. Total cost ≈ generation wait time + manual fix time + regression verification time

    When generation is fast but rework is heavy, total cost is actually higher. Teams should record the three time segments for each task to build their own baseline data instead of relying on external claims.

    6. Implementation Advice: Phased Adoption and Prompt Engineering

    1. Layer scenarios: pilot in low-risk areas such as scaffolding, forms, and admin pages, and keep core transaction flows human-led;
    2. Structure the input: break the requirements document into four artifacts: a page inventory, a data contract, a rules table, and an acceptance checklist;
    3. Generate in small steps: produce page by page or component by component to avoid degradation in the later part of one long output;
    4. Automate acceptance: turn the acceptance checklist into scripts, add them to continuous integration, and establish a regression baseline;
    5. Observability and governance: use logging services, monitoring alerts, and container platforms to bring the runtime behavior of generated artifacts into unified observability;
    6. Capture knowledge and assets: turn stable prompt templates, component libraries, and rules tables into team assets to reduce dependence on individual experience.

    For stronger elasticity and isolation, teams can combine general cloud capabilities from Baidu AI Cloud, for example running builds and workloads on a container platform, storing artifacts in object storage, and using logging and monitoring services for observability, moving AI coding from a personal toy to team infrastructure.

    7. Conclusion

    The real gap between models lies mainly in depth of understanding for complex constraints and consistency across long requirement chains, not single-page generation speed. Rather than chasing benchmark rankings, developers are better off building their own evaluation criteria and acceptance pipeline: structure the requirements, tabulate the rules, automate the acceptance. With those three in place, engineering delivery quality stays in your hands regardless of how the tools evolve.