Evaluating Large Language Models for Web Generation: Interactive Prototypes, State Management, and Engineering Quality
This article examines how to evaluate large language models for web generation beyond whether they can produce compilable code. Using draggable desktop-style pages and real-time strategy game prototypes, it analyzes visual implementation, interaction logic, state management, requirement understanding, prompt design, iteration efficiency, and engineering quality, and provides a reusable evaluation checklist for practical development.
In recent years, evaluation of large language model (LLM) capabilities has gradually shifted from “Can it generate a piece of code?” to “Can it independently complete an application that is runnable, interactive, and has a recognizable product form?” In web development in particular, users no longer care only whether the code compiles. They care whether the page visually matches expectations, whether interactions feel natural, whether complex state can be maintained correctly, and whether the model can continue to iterate based on feedback.
The latest generation of models has already developed strong combined capabilities in web prototype generation. They can generate page structure, styles, and interaction logic from natural language descriptions, and to some extent complete the full workflow from requirement understanding to code implementation. However, model capability is not one-dimensional. A page that “looks like” the target effect does not mean that its interactions, state management, and edge cases are correct. When evaluating LLMs, visual implementation, functional implementation, requirement understanding, and iteration efficiency must therefore be assessed together.
1. Web Generation Has Moved from Static Pages to Interactive Prototypes
Traditional web generation tasks usually focus on static scenarios such as login pages, data dashboards, and product lists. These tasks mainly test HTML structure, style layout, and basic component composition, and their complexity is relatively limited.
More valuable tests require the model to generate a web application with continuous interaction. For example:
- Windows on the page can be dragged freely.
- Windows can be raised or lowered in layer order.
- Components have states such as open, closed, and minimized.
- The page includes visual effects such as translucency, shadows, rounded corners, and animation.
- One user action affects the state of other components.
- The application must maintain complete interaction logic within a single page.
Such requirements ask the model to handle three types of problems at the same time.
The first is visual expression. The model must understand natural language descriptions such as “retro desktop,” “glass texture,” and “three-dimensional window switching,” and convert them into colors, spacing, opacity, shadows, animation curves, and layer relationships.
The second is interaction logic. Dragging a window is not simply changing a coordinate value. It also requires handling pointer-down, pointer-move, and pointer-up events, while preventing the window from jumping or shifting during dragging.
The third is state management. A window’s active state, visibility state, position, size, and layer should be managed consistently. If the page is modified only through scattered event handlers, it is easy to create problems such as a closed window that cannot be restored, incorrect window layers, or multiple windows receiving focus at the same time.
Therefore, the real capability of a web-generation model is not whether it can output a large amount of code, but whether it can decompose abstract requirements into executable states and behaviors.
2. Analyzing Visual and Interaction Quality with a Desktop-Style Web Page
A typical desktop-style web page can be divided into the following modules:
- Desktop background
- Top or bottom taskbar
- Draggable windows
- Window title bar
- Window control buttons
- Window switching animation
- Active window management
- Window close and restore mechanism
When implementing dragging, a unified window data structure is recommended, for example:
const windows = [{id: "home",title: "Main Window",x: 120,y: 80,width: 640,height: 420,visible: true,zIndex: 10}];
This structure is clearer than writing positions directly into multiple DOM nodes. When a window moves, only the coordinates of the corresponding object are updated. When a window receives focus, only its layer is raised. When a window is closed, only the visible field is changed. This reduces coupling between different events.
Dragging logic usually includes three steps:
- On pointer-down on the title bar, record the mouse position and the window’s initial position.
- On pointer-move, calculate the new window coordinates from the displacement.
- On pointer-up or when the pointer leaves the page, end the dragging state.
The first version of model-generated code often ignores the following edge cases:
- The pointer-down position is not the top-left corner of the window.
- Page scrolling changes the coordinate system.
- The window is dragged outside the visible area.
- Touch devices cannot trigger traditional mouse events.
- Events are lost when the mouse moves quickly.
- Multiple windows respond to drag events at the same time.
A more robust implementation uses unified pointer events and pointer capture to keep dragging continuous. A minimum visible area should also be enforced so that a window cannot be moved completely outside the viewport and become impossible to recover.
For visuals, a semi-transparent glass effect is usually formed by a combination of background blur, translucent fill, border highlights, and shadows. A model may simply add a blur property, but whether the final result looks natural also depends on background layers, color contrast, and opacity combinations. For this type of task, the prompt should not say only “make a glass effect.” It should explicitly break the effect down into requirements:
- The background has some transparency.
- Content behind the background produces a slight blur.
- Edges use low-brightness highlights.
- There is sufficient contrast between the window and the background.
- Animation duration is moderate and does not reduce operating efficiency.
3. Complex Game Prototypes Better Test the Model’s Combined Capabilities
Compared with straightforward page reproduction, strategy game prototypes place higher demands on large models. They include not only the interface, but also rules, entities, resources, time, paths, and autonomous behavior.
Using a simplified real-time strategy game as an example, requirements can include:
- The map uses a hexagonal grid.
- Both sides of the game advance at the same time.
- Units can automatically search for enemy units or target locations.
- The player can adjust game speed.
- The research system can execute automatically when resource conditions are met.
- The view can be moved with the keyboard.
- Cities, units, and resources have clear icon representations.
The difficulty behind these requirements is not merely “writing a few buttons.” The model must understand the relationships between systems.
3.1 Converting Turn-Based Logic to Real-Time Logic
Turn-based games usually advance state when the player selects “end turn.” A real-time strategy game needs a timer or animation frame loop to continuously advance world state.
A simplified real-time loop can be represented as:
function update(deltaTime) {updateResources(deltaTime);updateResearch(deltaTime);updateUnits(deltaTime);resolveCombat(deltaTime);updateObjectives(deltaTime);}
Here, deltaTime represents the time elapsed between two updates. Game speed control is essentially scaling the time step:
const effectiveDelta = deltaTime * gameSpeed;
If the model only renames an “end turn” button to “real-time mode” without establishing a continuous update mechanism, the implementation is still a turn-based system. Tests should therefore focus on whether units can continue moving, fighting, and being produced without manual confirmation.
3.2 Implementing an Automatic Research System
Automatic research is an additional support mechanism. It needs at least three parts:
- Technology nodes and their prerequisite relationships
- Resources required for research
- An automatic selection and execution strategy
The simplest selection strategy may research technologies in technology-tree order, but a more reasonable approach filters by resources, prerequisites, and target priority. For example:
function chooseResearch(technologies, state) {return technologies.filter(item => item.unlocked && item.cost <= state.researchPoints).sort((a, b) => b.priority - a.priority)[0];}
In actual testing, the following questions need to be verified:
- Does the system incorrectly start research when there are insufficient resources?
- Does it bypass restrictions when prerequisite technologies are incomplete?
- Can the same technology be researched repeatedly?
- Does the system truly stop after automatic research is disabled?
- Are new capabilities correctly unlocked when research is completed?
This shows that evaluating complex requirements cannot rely only on whether a checkbox appears in the interface. It is also necessary to verify whether the business state behind the checkbox takes effect.
3.3 Automatic Target Seeking and Path Planning for Units
“All units automatically seek opponents” appears simple, but it actually includes at least four stages: target search, distance calculation, path planning, and state switching.
Units usually need to switch between the following states:
- Idle
- Searching for a target
- Moving toward the target
- Attacking the target
- Searching again after the target disappears
- Retreating or stopping when health is insufficient
If the map uses a hexagonal grid, the coordinate system cannot simply copy an ordinary square grid. A common approach is to use axial coordinates or cube coordinates to represent hexagonal positions, and then calculate movement directions based on adjacency relationships.
For a small demo, breadth-first search can be used. For larger maps, path search with a heuristic function can be used. Model-generated prototypes often use straight-line movement, which is visually intuitive in a demo but is not equivalent to real path planning. During testing, obstacles, narrow passages, and multiple targets should be introduced deliberately to observe whether units can detour and whether they fall into loops.
4. Designing More Effective Prompts
When a large model generates a complex application, the most common problem is not that the model cannot do anything at all. It is that the requirements are described in one concentrated block, causing the model to overlook key conditions.
A more effective approach is to express requirements in layers.
The first layer describes the product goal, for example: “Generate a real-time strategy game prototype that runs in the browser.”
The second layer describes the core mechanisms, for example: “The map is a hexagonal grid, units move continuously, resources grow over time, and combat is resolved in real time.”
The third layer describes interaction requirements, for example: “Support speed adjustment, keyboard movement of the view, window scaling, and an information panel.”
The fourth layer describes acceptance criteria, for example:
- There is no manual end-turn button.
- When game speed changes from low to high, all systems change synchronously.
- Units can find targets and attack after approaching them.
- After automatic research is disabled, resources are no longer consumed automatically.
- State changes before page refresh do not crash the interface.
Finally, the model should be asked to output implementation notes, file structure, and known limitations. This has two benefits. First, it makes it easier to check whether the model truly understands the requirements. Second, it makes it possible to modify only one module later instead of regenerating all code every time.
5. The Relationship Between Model Output Speed and Quality
In actual use, model response speed may be affected by concurrent access, task complexity, context length, and the scale of generated code. Complex web tasks usually require longer inference and output time, so models should not be evaluated by response speed alone.
More important is to observe three indicators:
- Whether the first generation covers the main requirements
- Whether the model can accurately locate problems after feedback
- Whether existing functions remain stable after multiple rounds of modification
Some models produce visually strong first results but break the layout after a button is modified. Other models produce an ordinary first version but can improve gradually based on explicit feedback. For engineering practice, the second capability is often more important, because real projects are usually not completed in one pass and require continuous iteration.
6. Building a Reusable Evaluation Checklist
To avoid subjective judgments based on “it looks good,” the following evaluation dimensions can be established.
Visual Fidelity
- Is the page hierarchy clear?
- Are typography, spacing, and color harmonious?
- Are animations natural?
- Does translucency reduce readability?
- Does the page display correctly at different screen sizes?
Interaction Correctness
- Do click, drag, keyboard, and touch operations work?
- Can multiple windows switch correctly?
- Do close, restore, and refresh behaviors match expectations?
- Do anomalies appear during rapid, repeated operations?
Business Logic
- Does real-time state continue to update?
- Do resources, research, and combat follow the rules?
- Can automated behavior be stopped and resumed?
- Do invalid inputs cause state errors?
Engineering Quality
- Is the code structure clear?
- Is state managed centrally?
- Is there a large amount of duplicated logic?
- Is it easy to add new units, technologies, and maps later?
- Does the code include basic error handling?
Conclusion
The value of the latest generation of large models in web generation is no longer limited to quickly writing page code. More important is whether they can turn natural language requirements into complete interactive systems, handle real-time state, autonomous behavior, and multi-module collaboration, and iterate reliably after user feedback.
From desktop-style web pages to real-time strategy games, these tests can provide a relatively comprehensive view of a model’s requirement understanding, interface construction, program design, and debugging capabilities. However, no single generation result should be treated as a final product. Developers still need to use acceptance criteria, edge-case testing, state inspection, and code review to confirm whether functionality truly holds.
For organizations and individual developers, the most reasonable way to use models is not to rely on them completely, but to treat them as collaborative tools for requirement decomposition, prototype generation, and iterative development. Through clear constraints, staged implementation, and continuous verification, large models can move beyond being “code generators” and become development assistants with real engineering value.
