Evaluating LLM Code Generation: Benchmarks vs. Real Engineering Delivery

    This article examines why high scores on public coding benchmarks do not guarantee deliverable code, and presents a reusable evaluation framework based on a multi-page frontend project experiment. It breaks down four dimensions that determine real usability—requirement fidelity, cross-page consistency, interaction fidelity, and latency and stability—and summarizes observed capability gaps across page types. The article then analyzes the root causes of these gaps and outlines six engineering practices for improving generation quality, including structured requirements, contract-first generation, divide-and-conquer workflows, machine-verifiable acceptance checks, design-system integration, and caching with asynchronous execution. It closes with scenario-based selection advice for adopting AI coding tools into a development pipeline.

    1. Background: Why Benchmark Parity Does Not Equal Deliverable Code

    Over the past year, the capability curve of large language models in code generation has risen noticeably. Scores on various evaluation leaderboards are neck and neck, and community discussions about a domestic model “matching” an international flagship model appear frequently. For frontline engineering teams, however, what matters is not leaderboard ranking but a much simpler question: if you hand a real requirements document to the model, can it produce complete, logically consistent engineering code in one pass—code that only needs minor tweaks before shipping?

    There is an easily overlooked mismatch here. Problems in public evaluation sets are typically isolated tasks with clear boundaries, short context, and explicit dependencies. Real projects are systems engineering with long context, multiple pages, strong coupling, and many implicit constraints. The former tests single-point problem-solving ability; the latter tests requirements-restoration ability. Therefore, evaluating code models requires an assessment framework that is close to delivery scenarios, rather than looking at a single aggregate score.

    This article uses “fully implementing a multi-page frontend project with a large model” as the experimental paradigm, abstracts a reusable evaluation method and engineering practices, and helps readers judge whether a given AI coding tool is worth adding to their development pipeline.

    2. Evaluation Framework: Four Dimensions That Determine Real Usability

    2.1 Requirement Fidelity

    This is the core metric that separates model tiers. The checkpoints include: whether all fields explicitly written in the document are implemented; whether implicit business rules (such as state transitions and permission differences) are inferred; and whether boundary conditions (empty states, overly long text, abnormal input) are handled proactively.

    A practical way to quantify this is to define a “requirement point coverage rate”:

    1. Requirement coverage = correctly implemented requirement points / total explicit + implicit requirement points in the document

    It is recommended that teams number their acceptance points when writing requirements, then check them off one by one during evaluation to avoid the illusion that “it looks done.”

    2.2 Cross-page Consistency

    Making a single page look good is easy; the hard part is getting ten pages to share one design language and one data contract. Key checkpoints: whether field naming is consistent between list pages and form pages; whether common interactions such as filtering, pagination, and sorting are abstracted into shared components; and whether routing and state management form a coherent system rather than each page writing its own.

    2.3 Interaction Fidelity

    Form validation timing (validate on blur or on submit), error message placement, cascading disable logic, and duplicate-click prevention during asynchronous submission are the details most likely to be “simplified away” by the model. During evaluation, each interaction point should be marked in three tiers: fully implemented, partially implemented, or missing.

    2.4 Latency and Stability

    This includes time to first token, overall generation time, result variance across multiple runs of the same prompt, and availability during peak concurrency. In engineering practice, the variance of long-task duration often affects user experience more than the average duration.

    3. Observed Results: Capability Distribution Is Uneven

    Reviewing a complete project generation process against the framework above reveals a typical capability distribution:

    • Login-related pages: highest completion. Requirements such as carousels, forms, and remembered login state are basically all present, at a level of “ready to ship with minor adjustments.”
    • List pages: the structural skeleton is correct, but functional requirements such as filtering, sorting, and bulk operations are missing to a large extent, and these are systematic omissions rather than occasional oversights.
    • Form pages: the main flow works, but field linkage, validation rules, and error copy deviate from the document description.
    • Visual style: overall engineering quality is decent, better than a rough prototype, but still short of the refinement of a mature design system—positioned closer to “engineering-usable > product-beautiful.”
    • Generation form: it can directly produce a complete, accessible project artifact (rather than scattered code snippets), which is very valuable for reducing integration costs.
    • Time consumption: generating the complete project takes on the order of half an hour, clearly longer than the minute-level performance of international flagship models; part of the difference may come from queuing and rate limiting on the free tier.

    The conclusion is not that “a certain model is bad,” but rather: the current capabilities of code models are clearly uneven across task types—tasks with high patternization and short context perform excellently; tasks requiring long-chain reasoning and global constraint retention remain a weakness.

    4. Root Cause Analysis: Where Do the Weaknesses Come From?

    1. Constraint decay in long context. The longer the requirements document, the more the constraints in the middle and tail sections get “diluted,” manifesting as later pages deviating further from the document.
    2. Lack of external constraints for global consistency. The model has no shared entity definitions or component inventory and can only rely on context memory to maintain consistency; drift is inevitable as the number of pages grows.
    3. Implicit requirements need to be made explicit. Human developers fill in empty states, permissions, and exception branches based on experience, while the model defaults to “implement the main trunk, omit the edges.”
    4. Training objectives favor runnability. The priority of “can compile, can start” is higher than “align with the document item by item,” resulting in the phenomenon of “correct structure, missing functionality.”

    5. Engineering Practices: Six Ways to Raise Generation Quality

    5.1 Structure the Requirements Document

    Transform natural language descriptions into numbered structured items, and explicitly distinguish “must implement (P0) / expected (P1) / optional (P2).” Example:

    1. - id: P0-003
    2. page: product-list
    3. desc: Support combined filtering by category and price range
    4. accept:
    5. - Both conditions take effect simultaneously, using the intersection
    6. - Reset button clears all conditions and returns to the first page

    5.2 Define Contracts First, Then Generate Pages

    First have the model produce type definitions, API signatures, and a component inventory; after confirmation, generate pages one by one. Contract-first significantly suppresses cross-page drift:

    1. interface ProductQuery { category?: string; priceMin?: number; priceMax?: number; page: number; }
    2. interface Product { id: string; name: string; price: number; category: string; }
    3. interface ListProps<T> { data: T[]; loading: boolean; query: ProductQuery; onQueryChange: (q: ProductQuery) => void; }

    5.3 Divide and Conquer, Not One-Shot Generation

    Proceed in four stages—scaffolding → shared components → single-page implementation → integration—with one acceptance check per stage. Divide and conquer not only improves accuracy but also makes failures locatable and rollback-able.

    5.4 Build a Machine-Verifiable Acceptance Checklist

    Turn P0 items into automatically executable checks (type checking, unit tests, end-to-end scripts), turning “whether it is implemented according to the document” from a subjective judgment into a pipeline signal:

    1. typecheck && unit-test --coverage && e2e --grep "@P0"

    5.5 Leave Visual Consistency to the Design System

    Do not expect the model to spontaneously produce high-aesthetic interfaces. Integrate the team’s existing design tokens (colors, spacing, font sizes, border radii) and a mature component library, narrowing the model’s responsibility to “structure and logic” while the system covers the look and feel.

    5.6 Cache and Asynchronize to Offset Latency Fluctuations

    For long generation tasks, adopt asynchronous submission + progress pushback + result caching; establish template caching for stable prompts. On the engineering side, you can also use object storage to save artifacts, message queues to decouple long tasks, container platforms for isolated builds, and logging services with monitoring and alerting to track failure rates and duration distributions.

    6. Selection Advice: Match by Scenario, Not by Pursuing a Single Strongest Model

    • High-repetition, patternized tasks (admin pages, form skeletons, script tools): prioritize generation speed and artifact completeness.
    • Complex business systems (multiple roles, strong validation, long documents): prioritize long-context constraint retention and requirement coverage, and accept that “human-AI collaboration” is the norm.
    • Cost-sensitive scenarios: pay attention to rate-limiting policies and quota models; splitting tasks smaller and templating prompts often yields more benefit than switching models.

    Whatever type of AI coding tool you choose, it is recommended to keep a replaceable abstraction layer to avoid deep coupling between the business and a single tool. In relevant practices at Baidu AI Cloud, a combination of general-purpose model services, container platforms, and logging and monitoring products is often used to build this kind of “pluggable, observable, rollback-able” code generation pipeline.

    7. Conclusion

    “Matching the flagship model” is a valuable signal, indicating that domestic large models have entered the first-tier discussion in the code direction; but what engineering teams truly need is not a leaderboard ranking, but a measurable, reproducible, and integrable evaluation and implementation method. Structure the requirements, put contracts first, automate acceptance, and leave visuals to the design system—the short-term weaknesses in model capability can then be largely compensated by engineering means. The meaning of evaluation ultimately lands on delivery quality.