NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Interaction2Code: How Far Are We From Automatic Interactive Webpage Generation?

Jingyu Xiao, Yuxuan Wan, Yintong Huo, Zhiyao Xu, Michael R. LyuarXiv 2024 · DOI

Introduction

While Multimodal Large Language Models (MLLMs) have demonstrated remarkable proficiency in converting static UI screenshots into code, they often falter when tasked with the "dynamic" aspects of the web. Most existing "Design-to-Code" research treats webpages as static posters, evaluating a model's ability to replicate layouts and aesthetics while ignoring the functional reality that a significant portion of real-world web elements are interactive.

Distribution of interactive vs. static elements across various web domains.

When state-of-the-art MLLMs generate code from a single screenshot, they frequently produce "zombie" pages—visually accurate but functionally inert. This paper introduces Interaction2Code, a benchmark specifically designed to evaluate and improve how models like GPT-4o and Claude 3.5 generate code for interactive elements based on visual prototypes.

The Interaction2Code Task and Methodology

The authors define the Interaction-to-Code task as follows: given an "Interactive Prototype" (a pair of screenshots showing the UI before and after an interaction), the model must generate the necessary HTML, CSS, and JavaScript to replicate that specific behavior.

The Interaction2Code workflow, from webpage selection to model evaluation.

To bridge the "interaction gap," the researchers propose four key enhancement strategies:

  1. Interactive Element Highlighting (IEH): Using visual markers (like red bounding boxes) to direct the model's attention to the changing UI area.
  2. Failure-aware Prompting (FAP): Explicitly instructing the model to avoid common failure modes, such as "no interaction" or "wrong function."
  3. Visual Saliency Enhancement (VSE): Cropping and magnifying the interaction area to help models detect subtle visual changes.
  4. Visual-Textual Description Combination: Providing a natural language description alongside images to clarify intended logic (e.g., "clicking this button opens a modal").

The Interaction2Code Benchmark

The benchmark comprises a diverse dataset of 127 unique webpages sourced from CommonCrawl and GitHub, featuring:

  • 374 distinct interactions across 15 webpage categories (e.g., e-commerce, blogs).
  • 31 interaction categories (buttons, inputs, selects) and 8 visual categories (color changes, size adjustments).
  • Failure Annotations: A set of 10 categorized failure types used for both training and evaluation.

Key Insights and Results

The study reveals that visual saliency is a major bottleneck; magnifying interaction areas (VSE) significantly improved accuracy. Interestingly, the "Mark" prompt (visual highlighting) proved more effective than standard Chain-of-Thought (CoT) prompting, suggesting that "pointing" at the problem is more helpful than asking the model to "think" through it step-by-step.

Performance Highlights: * Top Models: GPT-4o and Claude 3.5-Sonnet lead in performance, while open-source models like Qwen2.5-vl-72B are becoming competitive. * Efficiency Gains: In human evaluations, developers using Interaction2Code-assisted tools saw a 32.4% increase in efficiency and a 16.1% improvement in implementation quality compared to manual coding. * Critical Failures: The most severe issues remain "missing interactive elements" and "wrong function," which render code unusable for production environments.

Conclusion and Future Directions

While Interaction2Code marks a significant step toward automated interactive web development, limitations remain. Current models lack "back-end" awareness, making them unable to handle server-side logic like database lookups. Future work will likely focus on "progressive" generation—building complex pages interaction by interaction—and expanding context windows to accommodate more complex, multi-state UIs.

Summary updated

BibTeX
@misc{xiao2024interaction,
  author = {Jingyu Xiao and Yuxuan Wan and Yintong Huo and Zhiyao Xu and Michael R. Lyu},
  title = {{Interaction2Code: How Far Are We From Automatic Interactive Webpage Generation?}},
  year = {2024},
  eprint = {2411.03292},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.03292},
}
Figure