Evaluating LLM Code Generation: From Runnable Code to Production Usability

    Benchmark scores do not fully capture how well large language models turn real requirements into usable software. This article examines an end-to-end evaluation across page structure, constraint adherence, and dependency handling, then outlines practical ways to improve reliability through structured requirements, staged generation, and automated acceptance checks. It also discusses the complementary roles of open-weight and proprietary models and the cloud infrastructure needed for deployment.

    1. Why Code Generation Evaluation Must Move Beyond Benchmarks

    New models regularly claim to approach or match the strongest available systems in overall capability. These claims attract attention, but engineering teams often find a substantial gap between benchmark scores and actual delivery experience.

    Public benchmarks typically assess single-turn, narrowly scoped tasks with clear boundaries. Real projects involve long contexts, multiple constraints, and tightly coupled components.

    A more useful evaluation therefore asks not simply whether a model can generate code, but how well it performs at three levels:

    • Structural fidelity: Does it produce a coherent page layout, component breakdown, and routing structure?
    • Constraint adherence: Does it implement every explicitly documented filter, field relationship, and validation rule?
    • Intent understanding: When the requirements do not cover every detail, can it make reasonable inferences consistent with engineering conventions?

    Most usability gaps emerge at the second and third levels, rather than the first. The evaluation below illustrates this distinction.

    2. Evaluation Method: An End-to-End Build from a Real Requirements Document

    To reduce the bias introduced by carefully curated demo prompts, the evaluation used a requirements document containing page inventories, interaction descriptions, field definitions, and validation rules.

    The document was submitted in a single request, with no prescribed technology stack or programming language. The requested output was a complete, runnable application that could be accessed and used—not isolated code snippets.

    The setup deliberately retained three challenges:

    • Some constraints were scattered through natural-language paragraphs.
    • List pages shared filtering logic across multiple pages.
    • Form fields had interdependent behavior and validation requirements.

    These are also common sources of implementation errors in real projects.

    3. Findings by Evaluation Layer

    Login and Entry Pages: Close to Usable

    Standard requirements such as carousels, forms, and navigation were largely covered. The structure was clear, and the results were close to something that could be released after revisions.

    These pages follow familiar patterns that are well represented in training data, making them a relative strength of current models.

    List Pages: Constraint Adherence Starts to Weaken

    The page structure was correct, but explicitly documented filters were missing. The same omission appeared across multiple list pages.

    This repeated pattern suggests a systematic limitation rather than an isolated mistake: the model favored an interface that looked complete while treating explicit functional constraints as optional details.

    Form Pages: Complex Dependencies Were Not Fully Reconstructed

    Fields rendered and the overall workflow ran, but field dependencies, validation timing, and the specificity of error messages diverged from the requirements.

    Forms are highly constrained interfaces. As the number of fields and dependencies increases, alignment with the requirements can deteriorate faster than the ability to generate working code.

    Visual Design: Functional Rather Than Polished

    The output was orderly but utilitarian. It lacked the finished quality associated with mature design systems or component templates.

    Visual judgment and adherence to design specifications are separate evaluation dimensions. Design tokens and component-library constraints can help close this gap; teams should not expect the model to supply that polish on its own.

    Response Latency: An Operational Selection Criterion

    Latency differed substantially between solutions. Queuing and rate limits on free usage allowances further amplified the perceived differences.

    Engineering evaluations should include response latency and quota stability, rather than focusing only on the quality of an individual generation.

    4. Understanding the Gap: Incomplete Reading, Not Just Incomplete Coding

    The central issue is effective context utilization. As requirements become longer and constraints more dispersed, the model may give less attention to critical clauses.

    Several practical measures can reduce this risk:

    1. Structure the requirements. Convert scattered natural-language constraints into a checklist, with one constraint per line and a unique identifier.
    2. Put constraints first and require a restatement. Present the constraint list early in the prompt, and ask the model to describe its implementation plan for each item before writing code.
    3. Generate in stages. Start with the information architecture and data model, then build the pages, and finally implement interactions and validation. Avoid asking the model to absorb all the complexity at once.
    4. Make acceptance criteria executable. Convert the checklist into test cases and use failing tests to guide the next revision.

    An illustrative constraint checklist might look like this:

    1. [C-01] List pages must support filtering by status, time range, and keyword.
    2. [C-02] Filter values must be synchronized with query parameters and persist after refresh.
    3. [C-03] When field A changes, the available options for field B must be recalculated.
    4. [C-04] Validate before submission and associate error messages with specific fields.

    A minimal acceptance-check snippet can help turn subjective impressions into repeatable checks:

    1. checks = [
    2. ("Filter controls exist", lambda p: p.locator(".filter-bar").count() > 0),
    3. ("Filters appear in query parameters", lambda p: "status=" in p.url),
    4. ("Field dependency takes effect", lambda p: p.locator(".field-b option").count() < 3),
    5. ]

    5. The Practical Value of Open-Weight Models

    The value of open weights is not defined by a single benchmark result. It lies in four engineering properties:

    • Auditability: Reproducible behavior supports investigation of hallucinations and compliance risks.
    • Private deployment: Sensitive code and data can remain within the organization’s controlled environment.
    • Fine-tuning: Internal repositories and engineering standards can support domain adaptation, helping models better understand team-specific constraints.
    • Cost control: Teams can schedule their own inference resources and reduce the impact of external quota fluctuations on delivery.

    These benefits come with clear costs. Self-hosted inference requires operations, capacity scaling, and quality tuning.

    A pragmatic approach is to assign difficult understanding and generation tasks to strong proprietary models, while using open-weight models for frequent, privacy-sensitive tasks with clearly enumerable requirements. A unified gateway can route work between them, rather than forcing an either-or choice.

    6. A General Cloud Architecture for Deployment

    Regardless of the model strategy, production deployment relies on common cloud infrastructure:

    • Model-serving services and container platforms host inference and support staged rollouts.
    • Object storage retains requirements documents, build artifacts, and evaluation datasets.
    • Message queues decouple long-running generation tasks.
    • Logging, monitoring, and alerting track latency, failure rates, and quota consumption.
    • Key management centralizes credential storage and administration.

    Baidu AI Cloud has offerings in these general infrastructure categories and can serve as a reference when evaluating an architecture. Service availability should be checked for the intended deployment region.

    7. Conclusion

    This end-to-end evaluation suggests that current code generation models are close to usable for structured page implementation. Their more significant weaknesses are following constraints across long requirements documents and reconstructing dependencies accurately.

    The more reliable engineering approach is to treat the model as an advanced implementer rather than the sole interpreter of requirements. Pair it with itemized specifications, staged generation, and automated acceptance checks.

    Open-weight models and proprietary services are not necessarily substitutes; they can divide work according to task characteristics. Once evaluation shifts from “Which model is stronger?” to “Under which constraints is this model more reliable?”, selection becomes a decision grounded in evidence rather than hype.