Evaluating Domestic LLMs for Front-End Code Generation: A Practical Method
A practical framework for assessing front-end code generation through visual, interactive, and system-level tasks. Using two hands-on tests—a desktop-style interface with 3D window switching and a real-time strategy game—the article examines model behavior, cross-platform variation, prompt iteration, and repeatable evaluation practices.
Evaluating Domestic LLMs for Front-End Code Generation: A Practical Method
A domestic model provider recently launched its latest flagship model on its official website, along with an online workbench for writing prompts, adjusting system settings, and running generations. This kind of model-and-workbench setup gives developers a convenient way to assess coding performance in practice.
Rather than repeat the provider’s claims, this article uses two hands-on tests to develop a reusable method for evaluating front-end code generation—and highlights common pitfalls along the way.
1. Why Front-End Generation Is a Useful Test
Front-end development may appear accessible, but it puts several aspects of an LLM’s capabilities to the test:
- Visual fidelity: The model must interpret visual concepts such as transparency, blur, shadows, rounded corners, and animation, then express them accurately in CSS.
- Interaction logic: Dragging, collision handling, state management, and event propagation require sound reasoning.
- Code organization: Generated code should be clear and maintainable, rather than a pile of inline styles.
- Instruction following: When a prompt includes multiple constraints, whether the model satisfies them one by one is a direct measure of instruction adherence.
Complex front-end tasks can therefore reveal more about a model’s practical capabilities than straightforward knowledge questions.
2. Test One: A Desktop-Style Interface with 3D Window Switching
The first test was designed to assess visual detail and interaction complexity:
Create a web page inspired by a classic desktop operating system, with freely draggable windows and a window switcher that uses 3D perspective.
This brief may sound simple, but it contains three distinct requirements:
- Window management: Multiple windows must be draggable and support stacking order changes when clicked.
- Visual style: The interface should use a frosted-glass effect—transparency and background blur—along with highlighted borders and a classic color palette.
- 3D switching: Switching windows should use perspective, scaling, and layered animation, which requires an understanding of CSS 3D transforms and transition timing.
Test observations
Generation was noticeably slow in the provider’s online environment, possibly because of high concurrent usage. The output also raised an important point: the official website’s version performed less well than what appeared to be the same model, accessed earlier through a third-party inference platform under an anonymous identifier.
The differences included:
- Weaker glass effects on window buttons, with less transparency and fewer highlights.
- Less natural perspective and depth in the 3D switching animation.
- Slightly lower overall fidelity in color and visual details.
I then revised the prompt twice, adding more specific visual instructions. For example, I specified that buttons should use a translucent rgba background and backdrop-filter: blur for the frosted-glass effect, and that the switching animation should combine perspective with rotateY. The results improved, but still did not fully match the version tested on the third-party platform.
What this suggests
Differences in a model’s performance across access channels can have several causes:
- Sampling parameters: Default temperature,
top-p, and maximum output length may differ. - System prompts: Platform-provided system instructions may affect code style and output.
- Inference precision or context length: Deployment configurations may use different quantization strategies or context limits.
- Generation speed and queueing: Under congestion, requests may be truncated or handled differently.
A model should not be evaluated based on a single result from a single access channel. Use the same prompt, run multiple samples under comparable conditions, and record differences between channels.
Example: Core CSS for a Frosted-Glass Window
.window {position: absolute;background: rgba(255, 255, 255, 0.55);backdrop-filter: blur(12px);border: 1px solid rgba(255, 255, 255, 0.6);border-radius: 10px;box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);}.window-switcher {perspective: 1200px;}.window-switcher .window {transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),opacity 0.45s ease;transform: rotateY(-12deg) scale(0.9);}.window-switcher .window.active {transform: rotateY(0deg) scale(1);}
Including specific implementation details like these in a prompt can often improve the generated result.
3. Test Two: A Real-Time Strategy Game
The second test was a broader capability check: convert a classic turn-based strategy game into a real-time strategy (RTS) game, then add several specific features. The task involves coordinating a game loop, pathfinding, AI behavior, and UI controls, making it a demanding test of end-to-end reasoning.
Requirements and evaluation
Requirement 1: Convert turn-based play to real-time.
An RTS does not require players to click a “next turn” button. Both sides advance over time according to the same clock. The model correctly implemented a game loop based on requestAnimationFrame or setInterval, with units acting automatically over time. Pass.
Requirement 2: Add an AI-assisted research tree.
A selectable “AI research assistant” should automatically complete research when resources are available. This feature was not part of the original game, so it tested the model’s ability to understand the request and design new behavior. In the test, the feature worked: when resources were sufficient, the next technology unlocked automatically. Pass.
Requirement 3: Make all units seek opponents automatically.
This requires pathfinding and target selection, with units moving toward the nearest enemy unit or city. The feature worked on the first attempt, suggesting that the model handled basic pathfinding approaches, such as greedy movement or A-style reasoning, effectively. *Pass.
Requirement 4: Implement controls and presentation details.
- 4.1 Speed slider: A configurable speed from 1× to 10× was implemented by adjusting the game loop’s time step. Pass.
- 4.2 Hexagonal map: Implemented correctly, indicating that the model could handle hex-grid coordinate conversion using axial or offset coordinates. Pass.
- 4.3 Arrow-key camera controls: Implemented by listening for keyboard events and moving the camera. Pass.
- 4.4 Icons for key elements: Major elements, such as cities, were represented with icons including emoji. Pass.
Why this test matters
The challenge lies in the level of abstraction. The model must understand the mechanical difference between real-time and turn-based strategy, then reflect that difference by restructuring the game loop. The result approached the level of leading closed-source models, suggesting that current flagship domestic and open models can handle complex interactive game generation with considerable competence.
4. A Reusable Evaluation Method
The two tests suggest a practical evaluation process:
Build a layered test set
- Visual fidelity: glassmorphism, animation, and 3D transforms.
- Interaction logic: dragging, collision handling, and state management.
- Integrated systems: small applications with a game loop, pathfinding, and AI behavior.
- Instruction following: provide five to eight hard constraints and check each one.
Fix the prompt and control variables
- Specify visual details, such as colors, opacity, blur radius, and easing functions.
- Define behavioral requirements, including triggers, edge cases, and performance expectations.
- Run the same task three to five times to assess consistency, rather than judging only the best result.
Compare access channels
- Run the same prompt through the official website, API, and third-party inference platforms, where available, and record the differences.
- If results vary significantly, investigate sampling parameters and system prompts before attributing the difference to the model itself.
Refine prompts instead of simply blaming the model
- Translate shortcomings into actionable instructions. For example: “Add a 1px white inset border and 12px of background blur to the buttons.”
- Change only a small number of constraints in each iteration so it is easier to identify what improved the output.
Use a checklist for acceptance
- Evaluate requirements one by one rather than relying on a subjective impression that the result “looks good.”
- Label unmet requirements as partially implemented, not implemented, or implemented incorrectly.
5. Conclusion
These tests show that the latest generation of LLMs can handle demanding visual and interaction requirements in front-end code generation. However, output quality remains sensitive to the deployment environment and prompt wording.
For developers, establishing a standardized test set and acceptance process is more useful than debating which model is strongest. Use fixed tasks and prompts, run multiple samples, and score each requirement. This makes model selection more consistent and reproducible as models continue to evolve.
