Evaluating LLM Code Generation: Benchmarks vs. Real Engineering Practice

    This article examines why high scores on public LLM benchmarks do not guarantee usable output in real projects. Using a shared test task—generating a complete frontend project from a natural-language requirements document—it defines reproducible evaluation dimensions, reports observed capability tiers across page types, and traces the main gaps to constraint decay in long contexts. It then outlines practical engineering steps: structuring requirements, staged generation, executable acceptance checks, and human-AI division of labor.

    1. Background: Why “Similar Benchmark Scores” Does Not Mean “Usable in a Project”

    Public leaderboards for large language models keep getting refreshed, and community discussions often claim that a given model now approaches the level of top international systems. This kind of information is useful for developers, but it invites misjudgment. A leaderboard score measures single-turn answer accuracy on a specific dataset, while real development work requires a model to stay consistent across dozens of files, hundreds of fields, and interaction logic that is coupled together. The two tasks are not on the same difficulty scale.

    A more meaningful approach is to set aside brand narratives and treat LLM code generation as a measurable, reproducible engineering problem. This article uses one unified test task—generating a complete frontend project from a natural-language requirements document—to abstract a set of evaluation dimensions and summarize practices that can actually be applied.

    2. Evaluation Design: Making Results Reproducible

    For a comparison to be meaningful, the test conditions must be fixed. At minimum, fix the following variables:

    • Identical input: the same requirements document, including the page list, field definitions, validation rules, interaction flows, and style requirements.
    • Identical output constraints: whether a tech stack is specified, whether component libraries may be introduced, and whether a directly runnable complete project is required.
    • Identical environment: the same account tier and the same concurrency window, so queuing and rate limiting do not distort speed conclusions.
    • Identical scoring dimensions: score four dimensions separately—functional completeness, depth of requirement understanding, visual and engineering conventions, and response speed—rather than collapsing everything into a single total.

    It is worth stressing that generation speed is heavily affected by account permissions, service load, and context length. A single timing run is not enough to support a conclusion; samples should be collected multiple times across different time windows.

    3. Observed Results: Clear Capability Tiers

    Under the unified conditions above, model performance showed distinct tiers.

    The first tier is static display pages. Login pages are representative: clear structure, common components, and highly standardized requirement descriptions. Models can almost always produce complete implementations of carousels, forms, and button states in one pass—output that is close to ready for launch after minor adjustments.

    The second tier is data list pages. The difficulty here is not layout but the combined logic of filter conditions, pagination parameters, empty states, and loading states. In testing, a common problem appeared: the page skeleton was correct, but filter options explicitly written in the requirements document were omitted entirely, or only the visual controls were kept without any linked behavior. This suggests models tend to generate structures that “look complete” while covering conditional branches insufficiently.

    The third tier is complex form pages. Details such as field linkage, nested validation, asynchronous uniqueness checks, and error message placement are the most likely to be simplified. Models often get the main flow working but compress three layers of validation—“required,” “format,” and “business rules”—into one.

    The fourth tier is overall style. Generated results are usually more polished than a wireframe prototype, but still fall short of the consistency of a mature design system: spacing scales are inconsistent, color semantics are incomplete, and component states are missing. Engineering usability is higher than product-level visual quality.

    4. Root Causes: Constraint Decay in Long Contexts

    Summarizing the observations, the core gap is not whether a model can write code, but depth of understanding and the ability to preserve constraints. This can be abstracted into three causes:

    1. When instruction density is high, constraints that appear later lose weight, and the fine-grained rules at the end of a requirements document are the most likely to be dropped.
    2. Without executable acceptance criteria, the model cannot self-check and can only fill in logic based on language probability.
    3. Without external constraints on global consistency, field naming, state management, and API structure drift across pages.

    5. Engineering Practices

    The following workflow can be applied to the problems above.

    Step 1: Structure the requirements. Rewrite natural language into numbered items, with each item expressing only one constraint, so the model can align to them one by one.

    1. R-01 The list page must contain 4 filters: status, category, time range, keyword
    2. R-02 Any filter change triggers a query within 300ms and resets to page 1
    3. R-03 Empty results show an empty-state illustration and a "Clear filters" button

    Step 2: Generate in stages. Produce the data model and API contract first, then the page skeleton, and finally the interactions and validation. This avoids detail collapse caused by one-shot generation.

    Step 3: Establish executable acceptance. Convert constraints into test cases or type definitions so the model can self-check after generation.

    1. type FilterState = {
    2. status?: string;
    3. category?: string;
    4. range?: [string, string];
    5. keyword?: string;
    6. };
    7. // Acceptance assertion example
    8. assert(rendered.filters.length === 4, 'Filter count mismatch');

    Step 4: Divide labor between human and model. The model handles boilerplate code, type definitions, first-draft styles, and unit test skeletons; humans handle business rule confirmation, edge cases, and security review. If general-purpose capabilities such as cloud container platforms, logging services, and monitoring alerts are used, generated artifacts can be deployed quickly to an isolated environment and validated against real request data.

    6. Conclusion

    For developers, the rational conclusion is that the degree of automation achievable with “one-turn generation of a complete project” is still limited. However, when constraints are explicit, decomposition is reasonable, and acceptance is executable, LLMs can already significantly reduce the time spent writing frontend and backend boilerplate. Whether a model fits a team should be judged by repeated regression tests against the team’s own requirement base, not by community buzz or a single demo. Turning evaluation metrics, prompt conventions, and acceptance scripts into team assets is the key step from “watching demos” to “improving efficiency.”