Generating HTML Slides with LLMs: Technical Practices and Evaluation Methods
A developer recently discovered that a large model generated a complete, runnable HTML slide deck (~800KB of code) in a single pass. This case highlights a shift in generative AI: from producing content to producing runnable, verifiable, deliverable engineering artifacts. This article explains why single-file HTML slide decks are an excellent benchmark for model capability, breaks down the recommended architecture (data, view, state, and resource layers), describes a layered generation workflow with automated validation, and outlines a scientific framework for comparing models—including fixed task sets, multiple samples, quantifiable metrics, and blind review—along with a checklist of common defects and production deployment considerations.
1. The Phenomenon: A Lunchtime Surprise
A developer casually clicked a link shared in a group chat one afternoon, expecting an ordinary presentation. Instead, it turned out to be a complete work that runs directly in the browser: page numbers, transition effects, visual design—and when navigating backward, sound effects rewound and replayed in sync. The artifact was a single HTML file, roughly 800KB of code and about 5MB total with inline images, generated by a model in a single pass within about 40 minutes.
What makes this case noteworthy is not the “wow factor,” but that it marks a shift in the output form of generative models: from generating content to generating interactive, verifiable, deliverable engineering artifacts. And debates over “which model is stronger” are nothing more than subjective impressions unless you have an evaluation methodology.
2. Why Single-File HTML Slides Are an Excellent Capability Benchmark
Traditional evaluations rely on multiple-choice questions and text scoring, which fail to reflect real engineering capability. A runnable slide deck simultaneously stress-tests several fundamental model abilities:
- Long-context consistency: Dozens of pages must maintain consistent theme, terminology, color scheme, and typography. Any drift is immediately visible.
- Structured state management: The current page index, history stack, and animation playback state must remain coherent—no state corruption when navigating backward.
- Trade-offs under resource constraints: Inlining images quickly inflates file size, so the model must decide between compression, downsampling, or external links.
- Runnability: The output must work on the first try, with zero build steps, across browsers—a much higher bar than code that merely “looks right.”
In other words, it puts “does the code actually run”—the most basic acceptance criterion—back at the core of generation tasks.
3. Architecture Breakdown: What a Qualified Single-File Slide Deck Should Contain
The recommended minimal viable structure has four layers:
- Data layer: Each page’s content is described as structured objects, decoupling rendering from content for easier batch generation and validation.
- View layer: A single container with paginated rendering, avoiding a repeated DOM skeleton for every page.
- State layer: A pure, functional state machine handling forward, backward, and jump navigation.
- Resource layer: Styles, scripts, fonts, and images all inlined to guarantee offline availability.
A reference implementation of the state machine:
const state = { index: 0, history: [] };function go(target) {const next = Math.max(0, Math.min(target, slides.length - 1));if (next === state.index) return;state.history.push(state.index);state.index = next;render();// Synchronously rewind audio and animations when navigating backif (next < state.history[state.history.length - 2]) audio.rewind();}window.addEventListener('hashchange', () => {go(parseInt(location.hash.slice(1), 10) || 0);});
The key point: animations and sound effects must be bound to state, not to a timeline—otherwise rewinding will inevitably cause audio-visual desynchronization. This is the first place where most auto-generated artifacts break.
4. Engineering the Generation Pipeline
Generating 800KB of code in one shot itself shows that relying purely on “longer output” is not sustainable. A more robust approach is layered generation:
- Step 1: Generate the outline and page manifest, confirmed by humans or rules before implementation begins, to avoid directional rework.
- Step 2: Generate page components in chunks, each carrying unified style tokens (colors, spacing, typography) to ensure visual consistency.
- Step 3: Assemble and validate, automatically checking tag closure, script syntax, and resource reference integrity.
- Step 4: Manage file size, compressing bitmaps by dimensions and quality, or switching to vector graphics where appropriate, to keep total size within a fast-loading range.
The accompanying automated validation can be lightweight:
# Syntax and structure checks, independent of any specific toolchainnode --check bundle.jsgrep -c "<section" output.html # Page count checkdu -h output.html # Size check
5. How to Scientifically Compare Two Models’ Real-World Experience
“Overwhelming” conclusions found online mostly come from a single impression. To reach credible conclusions, at least four variables must be controlled:
- Fixed task set: The same requirements, the same assets, the same page count and topic, to avoid difficulty drift.
- Multiple samples: Generation tasks have high variance; a single run cannot support a ranking. Use the median across multiple runs.
- Quantifiable metrics: First-pass success rate (does it open directly), page count versus requirements, file size, load time, and number of interaction defects.
- Blind review: Hide the model identity and have multiple reviewers score along three dimensions—visual completeness, interaction correctness, and content accuracy.
Only within this framework does “how big is the gap” become a question that can actually be answered, rather than a slogan.
6. Common Defect Checklist
In practice, high-frequency problems are relatively concentrated: state inconsistency when navigating backward; runaway file size from inlined resources; style drift in the later sections of long documents; scripts failing under the file:// protocol due to security policies; and missing dual-channel input support for both keyboard and touchscreen. These should be solidified item by item in an acceptance checklist rather than relying on subjective impressions.
7. Taking It to Production
To turn these artifacts into an external-facing service, you typically need a few categories of generic cloud capabilities: object storage to host static artifacts combined with a CDN to reduce latency; a container platform to run the build and validation pipeline; and logging services with monitoring and alerting to track generation failure rates and load times. These are industry-standard categories—choose based on your own scale and compliance requirements.
8. Conclusion
The real change is not that some model “got stronger,” but that the acceptance criterion for generation tasks has upgraded from “is the text reasonable” to “does the artifact run.” For developers, the best investment right now is not picking sides, but building fixed task sets, automated validation, and blind review mechanisms—evaluation capability is the only path to turning impressions into conclusions.
