Hands-On Evaluation of LLM Code Generation and Why Open Source Matters
This article presents a structured, hands-on evaluation of a large language model's code generation ability using a real front-end requirement: building a small system with a login page, a list page, and a form page from scratch. The model is assessed across functional completeness, interaction fidelity, visual style, and generation time, with the core gap traced to mapping natural-language requirements into a complete state machine rather than raw coding ability. The article also explains the practical value of open-source models—data boundary control, fine-tuning and distillation, and predictable cost—and offers actionable advice for developers on building evaluation sets, prompt engineering, automated validation, and tiered model selection.
1. Background: Why “Benchmarking Against a Flagship Model” Needs Real Testing
Chinese large language models are iterating quickly, and claims that a model “matches an international flagship” appear frequently in the community. Such conclusions usually come from single-point reviews or demo videos with small samples and narrow tasks, making it hard to reflect real stability in production engineering. For developers, what matters is not a leaderboard rank but three questions: does the model fully understand the requirement, does the generated result actually run, and is the iteration cost controllable.
This article uses one real front-end requirement as a sample, asking the model to generate a small system from scratch that includes a login page, a list page, and a form page. The evaluation is structured across four dimensions: functional completeness, interaction fidelity, visual style, and generation time. To avoid pointing to a specific product, the text uses “the model under test” and “the international flagship model” as generic references.
2. Experiment Design: Making the Evaluation Reproducible
The reliability of an evaluation depends on input quality. The document I prepared contains three parts: a page list and route structure, the fields and validation rules for each page, and interaction state descriptions (loading, empty state, error messages).
# Requirements Document (Excerpt)## List Page- Filters: category (multi-select), price range, listing status- Interaction: request parameters must be merged after filter changes; reset supported- Empty state: show placeholder image and guidance text when no data## Form Page- Fields: name (required, <=40 chars), category (required), price (>0), rich-text description- Validation: on-blur validation + full validation on submit; errors locate the first invalid field
The constraints keep only generic tech-stack descriptions (a component-based front-end framework, a common styling approach) without pinning specific library versions, in order to observe the model’s default choices and engineering habits.
3. Results: Clear Capability Tiers
The overall conclusion can be summarized as “high engineering usability, insufficient depth in requirement understanding.”
- Login page: good completeness. Carousel, form validation, and remember-state are all implemented, at a level that is close to production after minor adjustments.
- List page: correct structure but missing filters. This is not an occasional omission; the same issue appears across multiple list pages, indicating the model has a weak grasp of implicit logic such as “parameter merging and state linkage.”
- Form page: fields and validation rules are partially implemented; details like field linkage and error location deviate from the document.
- Visual style: clean and engineering-oriented, better than common prototypes, but lacking design hierarchy and still short of a mature template system.
- Generation time: this run took about half an hour, while the international flagship model completed the same task in about three minutes—a significant speed gap (possibly related to free-tier quota and queuing policy, not treated as a capability conclusion).
By comparison, the two are close on the login page; on the list and form pages, the international flagship model is more complete in restoring field structure and validation logic. The core gap is not “whether it can write code” but “whether it can map a natural-language requirement into a complete state machine.”
4. Root-Cause Analysis: Three Common Failure Points
- Loss of implicit constraints. The document’s “merge parameters on filter change” is a cross-component convention, but the model tends to generate page by page locally, lacking a global state perspective.
- Long-context decay. As the requirements document grows longer, constraints in later sections are weakened, showing up as “the earlier parts are well implemented, the later parts drift.”
- No self-check loop. The model rarely runs a build or checks a list on its own, so omissions cannot surface during generation.
The corresponding engineering fix is to turn “vague descriptions” into “acceptable structures”: explicitly list states, provide an acceptance checklist, and require the model to output an implementation plan before writing code.
First output: 1) page and component tree 2) global state list 3) parameter mapping for each filterThen implement, and self-check at the end: do all filters take effect? Does validation trigger both on blur and on submit?
5. What It Means for Open Source
The value of open source is not “larger parameters” but three forms of certainty: data boundary control from private deployment; scenario adaptation space from fine-tuning and distillation; and predictable cost from open weights and inference stack. When open-source models approach closed-source flagships on most engineering tasks, enterprises can keep sensitive data in their own environment while using smaller distilled models for high-frequency, standardized tasks and reserving large models only for complex reasoning, forming a tiered invocation structure.
It is worth stressing that “approaching” is not “replacing.” In scenarios like complex requirement understanding and long-chain tool calling, closed-source flagships still have advantages, and a reasonable strategy is hybrid orchestration rather than betting on a single point.
6. Practical Advice for Developers
- Build your own evaluation set: construct 20–50 samples from your team’s real requirements, with fixed scoring dimensions (functional completeness, interaction fidelity, runnability, time).
- Engineer your prompts: write the acceptance checklist into the prompt and require planning before implementation.
- Add automated validation: automatically run builds and static checks after generation, and feed error logs back for another iteration on failure.
- Tiered selection: assign standardized tasks to small or distilled models, and escalate complex tasks to flagship models.
- Keep cost controllable: combine containerized inference, logging services, and monitoring alerts to form an observable view of invocations and cost.
7. Conclusion
One hands-on test shows that Chinese open-source models already have engineering usability for page-level generation, with weaknesses concentrated in semantic restoration of complex requirements and execution speed. For developers, the rational approach is to treat “benchmarking” as a starting point rather than an endpoint, and to use a reproducible evaluation system and engineering workflow to reliably turn model capability into delivery quality.
