From Generated Pages to Runnable Systems: Evaluating and Engineering Interactive Web Applications with Large Language Models
Interactive web applications provide a practical way to evaluate whether large language models can turn natural-language requirements into runnable, interactive, maintainable systems. This article examines evaluation design, draggable desktop interfaces, 3D window switchers, real-time strategy prototypes, AI-assisted technology trees, specification-driven prompting, performance and accessibility checks, and engineering safeguards. It also explains why generation latency, service queuing, visual quality, and runtime correctness must be measured separately.
1. From “Generating Pages” to “Generating Runnable Systems”
As large language models become part of frontend development, evaluation is shifting from “Can the model write a piece of code?” to “Can it build a runnable, interactive, and maintainable web application from a natural-language requirement?”
Correct answers and syntactically valid snippets do not necessarily produce a correct application. Valuable test tasks usually involve several capabilities at once:
- Requirement understanding
- Interface layout
- Event handling
- State management
- Performance trade-offs
- Error handling
An online generation and preview workspace is valuable because it compresses the workflow of entering a requirement, generating code, running the result immediately, and continuing to edit it into a single page. This significantly reduces the cost of experimentation.
However, this workflow also introduces a common source of evaluation noise. When traffic is high, queueing, code generation, and preview rendering can all increase waiting time. If service delays are not separated from poor generation quality, an experience problem may be misclassified as a model capability problem. Evaluation should therefore record latency, retry failures, first-run success rate, and code quality as separate metrics.
Anonymous trial access creates a similar issue. Anonymity can reduce brand bias, but the model version, system prompt, sampling strategy, context truncation behavior, and routing state may not be visible. A single generation result should be treated as a contextual experience record rather than direct evidence of a stable ranking.
A more rigorous approach is to use a fixed task set, sample multiple times, record failure categories, and compare outputs against the same acceptance checklist.
2. Why Use Interactive Web Pages as an Evaluation Medium?
Interactive web pages are suitable for testing the broad capabilities of large language models for three main reasons.
2.1 They Require High-Level Requirement Abstraction
Consider the requirement “Convert a turn-based game into a real-time strategy game.” On the surface, this may appear to mean removing a button. In practice, it requires the model to understand the timeline, resource growth, input scheduling, fairness between players, and fixed-step updates.
If the model changes only the interface without establishing a real-time loop, its understanding remains superficial.
2.2 Verification Costs Are Relatively Low
A single-page application can run directly in a browser. Interaction results, console errors, layout deviations, and performance bottlenecks can be checked manually or automatically.
Compared with a complex backend system, a frontend prototype is easier to generate, execute, and compare quickly.
2.3 Failure Modes Are Diverse
Interactive web tasks expose many engineering problems, including:
- Drag coordinates jumping unexpectedly
- Confused layer or z-index management
- Leaked event listeners
- Janky animations caused by animating layout properties
- AI decisions charging resources repeatedly on every frame
- Repeatedly selecting the same item when resources are insufficient
- Missing accessibility support
These issues reveal the engineering depth of an output, not just its visual appearance.
3. Task A: A Draggable Desktop with 3D Window Switching
3.1 Write Functional Requirements as Acceptance Criteria
A typical task might ask for a web desktop environment with draggable, focusable, minimizable, and closable windows, plus a 3D window switcher with a perspective effect.
The requirement should not simply say “make it look like a desktop operating system.” It should be broken down into verifiable conditions:
- Support multiple windows, and raise a window when it is clicked.
- Use pointer events during dragging to support both mouse and touch input.
- Prevent a window from being dragged completely outside the viewport.
- Make window buttons clickable without triggering dragging.
- Allow the 3D switcher to be opened and closed with the keyboard.
- Use perspective, scaling, translation, and opacity to create depth between cards.
- Ensure translucent materials do not reduce text readability, and provide clear button focus states.
- Respect the operating system’s reduced-motion preference.
- Remove event listeners when the page is closed or the component is unmounted.
During acceptance testing, pay particular attention to:
- Whether the page is usable immediately after loading
- Whether the window jumps when dragging begins
- Whether focus moves to the correct element after switching
- Whether fast dragging causes dropped frames
- Whether window buttons are accidentally triggered
Visual requirements such as “glass-like styling” should also be decomposed into concrete checks, including:
- Background blur range
- Border opacity
- Shadow intensity
- Text contrast
- Button hit-area size
Without this level of detail, different outputs may interpret the same visual requirement in completely different ways.
3.2 Key Considerations for Dragging
Coordinates are the most common source of drag-and-drop bugs. If mouse movement is simply accumulated into left and top, scaling, scrolling, or transforms can introduce offsets.
A more reliable approach is to record the pointer’s offset relative to the window’s top-left corner and update the position with transform during movement. Pointer Events provide a unified interface for mouse, touch, and pen input.
const win = document.querySelector('.window');let topZ = 10;let drag = null;win.addEventListener('pointerdown', (e) => {if (e.button !== 0) return;if (e.target.closest('[data-no-drag]')) return;const rect = win.getBoundingClientRect();drag = {id: e.pointerId,dx: e.clientX - rect.left,dy: e.clientY - rect.top};win.setPointerCapture(e.pointerId);win.style.zIndex = String(++topZ);});win.addEventListener('pointermove', (e) => {if (!drag || e.pointerId !== drag.id) return;const maxX = innerWidth - win.offsetWidth;const maxY = innerHeight - win.offsetHeight;const x = Math.max(0, Math.min(maxX, e.clientX - drag.dx));const y = Math.max(0, Math.min(maxY, e.clientY - drag.dy));win.style.transform = `translate(${x}px, ${y}px)`;});win.addEventListener('pointerup', (e) => {if (!drag || e.pointerId !== drag.id) return;drag = null;win.releasePointerCapture(e.pointerId);});
This example has four important properties:
setPointerCaptureprevents the application from losing events when the pointer leaves the window.closestexcludes interactive areas such as close and minimize buttons from drag initiation.transformreduces layout recalculation compared with repeatedly changing layout properties.- Explicit boundary checks prevent the window from leaving the viewport.
If the window can also be resized, the implementation should record the resize origin and initial dimensions. Otherwise, drag and resize events may interfere with each other.
3.3 Implementing and Optimizing a 3D Switcher
The central idea behind a 3D window switcher is to express depth using a small number of animatable properties. Prefer transform and opacity. Avoid forcing many cards to undergo continuous layout recalculation or stacking complex filters across the entire interface.
A perspective container can be combined with separate front, middle, and back states:
.switcher {perspective: 1200px;}.switch-card {transform-origin: center;transition: transform 180ms ease, opacity 180ms ease;will-change: transform, opacity;}.switch-card.active {transform: translate3d(0, 0, 120px) rotateY(0deg) scale(1);}.switch-card.left {transform: translate3d(-35%, 0, -40px) rotateY(18deg) scale(0.9);opacity: 0.82;}.switch-card.right {transform: translate3d(35%, 0, -40px) rotateY(-18deg) scale(0.9);opacity: 0.82;}@media (prefers-reduced-motion: reduce) {.switch-card {transition: none;}}
Two visual considerations are especially important.
First, translucent backgrounds and blur effects consume rendering resources. Limit their surface area instead of applying blur and shadows to every small element.
Second, visual depth must not compromise readability. Text should maintain sufficient contrast against the background, and buttons should have clear focus states and adequate hit areas.
For keyboard support, the switcher should provide directional-key navigation, Enter to confirm, and Escape to close. Focus should also be managed correctly when the switcher opens and closes.
4. Task B: A Real-Time Strategy Prototype with an AI-Assisted Technology Tree
4.1 The Core Abstractions Behind a Real-Time System
Converting a turn-based game into a real-time strategy game involves more than hiding the “Next Turn” button. At minimum, it requires the following mechanisms:
- A fixed-step loop: Separate logic updates from rendering. Resource growth, unit movement, and research progress should advance using a fixed time step.
- Time fairness: Both sides should operate on the same timeline. Opening a menu for one side must not pause the other side.
- Input scheduling: Player commands should enter a queue and execute on the next logic step.
- Pause and speed controls: Define whether pausing stops the simulation and whether the interface remains interactive.
- Determinism: The same initial state and command sequence should produce similar results, making testing easier.
- Error recovery: When the page returns from the background, accumulated time must be capped to prevent excessive catch-up work from freezing the page.
A simplified fixed-step loop looks like this:
const STEP = 1000 / 30;let last = performance.now();let acc = 0;function frame(now) {acc += Math.min(now - last, 250);last = now;while (acc >= STEP) {tick(STEP);acc -= STEP;}render(acc / STEP);requestAnimationFrame(frame);}requestAnimationFrame(frame);
The Math.min call limits the amount of accumulated time after the page returns to the foreground. Without this limit, the application might attempt to process hundreds of logic steps at once.
tick should update state, while render should only map state to the interface. This separation allows logic tests to run independently of rendering, even when the visual layer is complex.
4.2 Requirements for an AI-Assisted Technology Tree
“Let the AI assistant research technologies automatically” may look like a single button, but a robust implementation needs resource constraints, prerequisites, queues, and explainability.
Reasonable requirements include:
- When the assistant is disabled, it must not select new projects automatically.
- It may select only technologies whose prerequisites are complete.
- When resources are insufficient, it must wait rather than enter a repeated charging loop.
- A research queue should be supported, with an estimated completion time.
- If resource changes prevent a project from continuing, the system should define whether to cancel or wait.
- Only one primary research project should run at a time, unless parallel research is explicitly supported.
- Automated decisions should be explainable, for example by showing that a project was selected because its prerequisites were complete and its priority was highest.
The logic can be represented as follows:
function chooseNextTech(state) {if (!state.aiEnabled) return null;const available = state.techs.filter((tech) => {const prereqOk = tech.prereq.every((id) => {return state.techs.find((item) => item.id === id)?.done;});return !tech.done && prereqOk && state.resources >= tech.cost;});available.sort((a, b) => b.priority - a.priority);return available[0] ?? null;}function tick(state, dt) {if (state.aiEnabled && !state.researching) {const next = chooseNextTech(state);if (next) {state.researching = next.id;state.resources -= next.cost;state.techs.find((item) => item.id === next.id).progress = 0;}}if (state.researching) {const tech = state.techs.find((item) => item.id === state.researching);tech.progress += dt;if (tech.progress >= tech.duration) {tech.done = true;state.researching = null;}}}
The goal of this logic is not strategic optimality. It is to make state transitions clear, prevent resource charges from occurring once per frame, and keep prerequisites testable.
For a more advanced strategy, the valuation function can be separated from state management. It may calculate priorities from current resources, enemy pressure, and technology benefits. The automation should still be reproducible, explainable, and easy to disable.
5. Prompt Design: From Vague Descriptions to Specification-Driven Generation
5.1 Use Acceptance Criteria to Constrain Generation
For complex interactive pages, prompts should use a specification-driven structure:
Goal: Build a single-page interactive prototype with no external scripts or external fonts.Required functionality:1. Support multiple windows and bring a window to the front when clicked.2. Drag windows with pointer input, including mouse and touch.3. Ensure the close button does not trigger dragging.4. Open a 3D switcher with a specified key.5. Support keyboard navigation and Escape to close the switcher.Non-functional requirements:- Prefer transform and opacity for animation.- Keep text readable over translucent backgrounds.- Do not accumulate abnormal elapsed time when the page returns from the background.- Provide a reduced-motion fallback.Acceptance process:- Identify where each requirement is implemented.- Check that event listeners are not bound repeatedly after generation.- List assumptions for uncertain requirements instead of skipping core interactions.Output:- A single HTML file with embedded styles and scripts.- A brief test checklist.
This is more verifiable than a request such as “Build a page that looks like a classic desktop operating system.”
If the model still misses requirements, the failure can be classified more precisely: a requirement-understanding failure, a code-structure problem, or a visual implementation issue.
5.2 Do Not Rely Only on “Regenerate”
A common iteration mistake is to use vague feedback such as:
- “Optimize it again.”
- “Make it more impressive.”
- “The effect is not right.”
Effective feedback should contain four elements:
- What has already been verified
- The specific defect
- Steps to reproduce it
- The expected result
For example:
Keep the existing window layout and 3D switcher structure unchanged.Defect: When dragging the window title bar, the pointer position jumps after crossing the lower-right corner of the window.Reproduction:Place the pointer on the right side of the title bar and drag quickly toward the lower-right.Expected result:The window’s top-left corner should follow the pointer offset without leaving the viewport.Fix only this issue and list the changes.
If the system supports patch-based editing, request only the changed sections. If it can output only the full file, ask it to provide a change list first and preserve all acceptance items that have already passed.
It is not unusual for an iteration to become worse than the previous version. Common causes include:
- New instructions overriding earlier constraints
- A full rewrite causing previously working features to regress
- Visual improvements introducing performance costs
- An overly long context causing earlier requirements to be ignored
A practical solution is to preserve a baseline version and its acceptance checklist. Each iteration should address one category of issue, followed by regression testing.
6. Evaluation Metrics: Separate Visual Impression from Engineering Quality
A reusable evaluation form should include at least the following dimensions:
| Dimension | What to Observe | Suggested Method |
|---|---|---|
| First-run usability | Whether the page runs immediately and whether blocking errors exist | Open the page, trigger core interactions, and check console errors |
| Requirement coverage | Number of acceptance items that pass | Number requirements in advance and record pass/fail results |
| Interaction correctness | Dragging, keyboard input, focus, and boundary constraints | Reproduce typical and boundary interaction paths manually |
| Visual fidelity | Layering, buttons, translucency, and readability | Combine screenshot comparison with human review rather than checking only the initial viewport |
| Runtime performance | Animation smoothness, long tasks, and event leaks | Observe dragging, switching, pause/resume, and related scenarios |
| Code structure | Centralized state, released events, and clear naming | Inspect key functions and run small-scale logic tests |
| Accessibility | Keyboard reachability, visible focus, and semantic controls | Complete the core workflow using only a keyboard |
| Generation latency | Time to first preview and time to a fully usable result | Separate queueing, generation, rendering, and network transfer |
| Stability | Consistency and failure categories across repeated generations | Use a fixed task set and record multiple samples |
Generation wait time and code quality must be evaluated separately.
When access volume is high, waiting may be caused primarily by queueing and service load. Whether the generated page runs correctly, leaks event listeners, or implements its logic properly is an output-quality issue.
Combining these dimensions can lead to misleading conclusions, such as assuming that a slow response is low quality or overlooking runtime errors because the interface looks attractive.
7. Engineering Recommendations and Risk Controls
Before generated frontend prototypes are used in a real environment, basic safeguards should be established.
7.1 Isolate the Runtime
Place model-generated pages in a restricted sandbox or isolated document. Limit network requests, storage access, and script permissions. Do not execute untrusted code directly in the context of the main site.
7.2 Avoid Dangerous Execution Patterns
Avoid using eval or dynamically constructed Function objects to execute unknown strings. Disable unnecessary remote resource loading and configure a Content Security Policy where appropriate.
Escape and validate external input, especially window titles, chat content, and user-defined text.
7.3 Complete the Accessibility Layer
Window controls, close buttons, and switcher cards should all be operable with a keyboard. Focus order should be logical, and visually hidden text, ARIA labels, and focus styles should not be omitted.
3D animations should also provide a reduced-motion fallback.
7.4 Set a Performance Budget
Large areas of background blur, heavy shadows, and layered cards can cause frame drops on lower-end devices. Limit the number of simultaneously animated elements and prefer transform and opacity.
Timers and animation frames that run for extended periods should be released when the page is unloaded.
7.5 Make AI Decisions Controllable, Observable, and Testable
Automated research and configuration features need a clear enable/disable control, explicit state boundaries, and logs. They must not charge resources repeatedly on every frame.
States such as insufficient resources, incomplete prerequisites, and an active research project should have clear branches.
7.6 Treat Generated Code as a Draft
Generated code should be treated as a prototype rather than a production deliverable. At minimum, it should pass requirement regression checks, error-handling review, performance inspection, and permission review before entering a production workflow.
Critical paths should receive additional automated tests and manual inspection.
8. Conclusion
Complex interactive web pages reveal differences in a model’s ability to understand requirements, manage state, handle events, and address engineering details.
A draggable desktop with 3D window switching is useful for testing interface organization, coordinate calculations, and animation performance. A real-time strategy prototype with an AI-assisted technology tree goes further by testing the model’s understanding of timelines, resource constraints, prerequisites, and explainable automation.
Evaluation should not rely on a single sample. Use fixed requirements, explicit acceptance criteria, multiple generations, and categorized failure records. Service queueing should be separated from generation quality, and visual appeal should be evaluated separately from runtime correctness.
For developers, the most practical approach is to use large language models as rapid prototyping collaborators. Let them accelerate the first implementation and early iterations, then use engineering processes to complete regression testing, performance optimization, security review, and accessibility work.
Only a reproducible evaluation method can move generated interfaces from “impressive at first glance” to “reliably useful in engineering practice.”
