Evaluating LLM Code Generation: Where Capabilities Degrade and How to Fix It in Engineering
This article examines why large language models lose accuracy on long, multi-constraint frontend requirements, proposes a reusable set of evaluation dimensions, and outlines practical engineering strategies for turning generated output into deliverable software. It covers typical failure points across login, list, and form pages, the impact of latency and delivery format, and the role of open-weight models in private, domain-specific pipelines.
1. Background: From “Demo-Ready” to “Delivery-Ready”
Over the past year, the code generation capabilities of large language models have advanced quickly, and debates about how a domestic open-source model compares with an overseas closed-source flagship model are everywhere. For developers, the real value of these comparisons is not the leaderboard ranking. It is an engineering question: when you hand a model a real requirements document, can it produce something that runs, is maintainable, and can ship?
A representative evaluation case illustrates the point. Given a frontend requirements document covering a login page, a product listing page, and a form page, with no technology stack prescribed, the model was asked to generate a complete project end to end. The results were then compared across page completeness, interaction fidelity, visual style, and generation time. The conclusion was measured: completeness on the login page was close, while the listing and form pages showed a clear drop in “depth of understanding.” The overall style was usable for engineering work but average in design, and generation took significantly longer.
This article does not restate the results of any specific product evaluation. Instead, it abstracts these observations into a general technical question: on long-chain, multi-constraint frontend requirements, where does model capability degrade, and how can engineering practices fill the gaps?
2. Building Reusable Evaluation Dimensions
To decide whether a model is ready to enter the development workflow, break subjective impressions into observable metrics:
- Requirement coverage: the proportion of explicitly stated features in the document that are actually implemented (for example, carousels, filter options, field validation).
- Constraint adherence: whether the technology stack, naming conventions, directory structure, and component granularity are respected.
- Interaction fidelity: whether linkage, validation timing, error messages, empty states, and loading states are complete.
- Runnability: whether dependencies install and the project starts with a single command, and whether there are obvious runtime errors.
- Accessibility and shareability: whether the result is delivered as a previewable project rather than only code snippets.
- Iteration cost: the amount of manual rework needed to go from “it runs” to “ready to ship.”
- Latency and stability: end-to-end time, queuing and rate limiting, and the cost of retrying failures.
The value of these dimensions is that they turn “feels good” into a regression baseline. Swapping models or prompts later becomes a controlled experiment.
3. Three Typical Points of Capability Degradation
3.1 Simple pages: hardly a challenge
Requirements like a login page are structurally stable, with few fields and mature patterns. Models can usually get them right in one pass, covering carousels, form validation, and basic layout. At this level, the output is close to “tweak it and it works.”
3.2 Listing pages: failure starts as constraint density rises
The difficulty of a listing page is not layout but constraint density: combinations of filter conditions, pagination and sorting, URL state synchronization, empty-state handling, and request races. The “filter options missing entirely” outcome in the evaluation was not a fluke. When multiple constraints coexist, models tend to preserve the main structure and drop secondary features. The underlying cause is attention allocation in a long context: the longer the document, the more easily constraints that appear later or are nested more deeply get compressed away.
3.3 Form pages: relational constraints are the hardest to reproduce
A complex form must simultaneously satisfy field linkage, conditional required fields, asynchronous validation, and idempotent submission. These are relational constraints. If a model captures only the list of fields and loses the relationships between them, the output will “look right and fail at runtime.”
Illustrative code can make such constraints explicit and reduce the model’s room for improvisation:
// Describe field relationships with a schema instead of scattering them in natural languageconst schema = {fields: [{ name: 'account', type: 'string', required: true },{ name: 'verifyCode', type: 'string', requiredWhen: { field: 'account', notEmpty: true } },{ name: 'channel', type: 'enum', options: ['web', 'app'], default: 'web' },],rules: [{ when: { field: 'channel', equals: 'app' }, set: { verifyCode: { required: true } } },],};
4. Speed, Style, and Delivery Format
Differences in generation time are often tied to compute quotas, queuing, and free-tier limits, so they should not be treated directly as conclusions about model capability. Even so, latency is an engineering metric that affects the rhythm of human-AI collaboration. On style, model output is usually “engineering-usable rather than product-impressive,” still short of directly applying templates from a mature component library. On delivery format, providing an accessible project URL is closer to a real workflow than returning scattered code snippets, and it removes the friction of assembling everything locally.
5. Engineering Strategies to Close the Gap
- Structure the requirements: rewrite natural language into a numbered feature list with acceptance criteria that can be checked off item by item.
- Prompt in layers: produce the information architecture and routes first, then generate page by page, instead of swallowing all constraints at once.
- Supply context: on platforms such as Baidu AI Cloud, you can use object storage to hold requirements and artifacts, a message queue to decouple long-running tasks, and logging plus monitoring and alerting to track generation failure rates, forming an observable pipeline.
- Backstop with automated checks: use type checking, unit tests, and end-to-end scripts to run automatic regression on generated output, turning “misunderstanding” into failure cases you can pinpoint.
- Focus human review: concentrate manual effort on relational constraints and interaction details rather than basic layout.
6. Implications for Open Source and the Industry
The value of open weights and an open ecosystem is that capabilities can be deployed privately, further trained on domain data, and embedded in your own development pipeline, turning general capability into stable productivity inside an organization. The gap in depth of understanding exposed by the evaluation points to the next stage of optimization: preserving constraints in long contexts, parsing structured requirements, reproducing relational logic, and building verifiable generation workflows. For developers, the rational approach is not to chase a single leaderboard but to build your own evaluation baseline and use engineering practices to amplify model capability to a deliverable level.
