Deterministic Component Mining for Multi-Framework UI2Code Generation

Zixiong Yang, Linxiao Li, Jiaye Lin, Binrui Wu, Xiaoyu Kang, Jiechao GaoICML 2026

Introduction

Automating User Interface (UI) generation has seen massive leaps with the advent of Multimodal Large Language Models (MLLMs) like GPT-4o. However, while these models are surprisingly adept at "looking" at a design and writing HTML, they often act more like sketch artists than software engineers. They typically generate monolithic, "flat" code that repeats identical structures—such as rendering five separate blocks for five identical product cards—rather than defining a single reusable component.

Furthermore, MLLMs struggle with the strict syntactic requirements of modern front-end frameworks like React, Vue, and Angular. They frequently "hallucinate" layout positions or fail to separate visual content from structural logic, resulting in code that is difficult to maintain and nearly impossible to integrate into a professional codebase.

To solve this, researchers introduce Deterministic Component Mining (DCM), a multi-stage pipeline that shifts UI-to-code generation away from "spaghetti" HTML toward professional, modular, and maintainable development.

The Methodology: A Neuro-Symbolic Pipeline

DCM treats code generation as a structured translation task rather than a creative guessing game. It employs a three-stage neuro-symbolic pipeline to extract reusable components and repetitive patterns from screenshots:

  1. Vision-to-Structure: A lightweight vision model (Pix2Struct) analyzes a webpage screenshot to produce a coarse-grained DOM tree in JSON format. This captures the structural "skeleton" of the page—node types and their hierarchy—without getting bogged down in styling details.
  2. Deterministic Component Mining (DCM): This is the symbolic core of the framework. Instead of relying on an AI to probabilistically guess patterns, DCM uses structural hashing (akin to Merkle trees) to identify identical subtrees. If multiple UI elements share the same structure but contain different text, the system automatically extracts them into a single reusable Component with Slots for variable data.
  3. Reuse-to-Code: The resulting framework-agnostic Intermediate Representation (IR) is fed to an LLM. Crucially, the LLM is constrained by strict rules (e.g., mandating the use of v-for or .map() for repeating nodes) to ensure the final output adheres to the specific best practices of the target framework.

Datasets and Evaluation

The system was trained and evaluated on two primary datasets:

  • WebSight v0.1: A large-scale synthetic dataset of HTML/screenshot pairs, utilized for learning basic structural patterns.
  • WebCode2M: A challenging, real-world dataset harvested from live websites, featuring complex layouts and diverse styles. This dataset was split into "Short," "Mid," and "Long" subsets to test how well the system scales with codebase complexity.

Key Insights

  • The Neuro-Symbolic Advantage: MLLMs excel at perception but struggle with rigid logic. By using a deterministic algorithm to mine components, DCM eliminates the "probabilistic noise" that leads to structural hallucinations in AI-generated code.
  • Bounding Box Robustness: Because component mining relies on the topological structure of the DOM tree rather than exact pixel coordinates, the system is highly resilient to minor object detection or alignment errors.
  • The IR as a Universal Bridge: The intermediate representation decouples the visual design ("what") from the implementation details ("how"). This allows the same design to be seamlessly translated into React, Vue, or Angular without altering the underlying logic.

Results and Performance

DCM consistently outperformed state-of-the-art models like GPT-4o and Gemini-2.5-Pro across several key metrics:

  • Visual Fidelity: DCM achieved higher "Position" and "Block" scores, producing UIs that closely mirrored the original designs compared to end-to-end MLLM outputs.
  • Reusability Rate (RR): In React framework tests, DCM hit an RR of 0.85 on short samples (vs. GPT-4o's 0.80) and maintained a significant lead in structural quality on complex, "Long" samples.
  • Human Preference: Professional developers preferred DCM's modular, human-like code 48% of the time, compared to just 17.6% for GPT-4o.
  • Compilation Success: DCM achieved near-perfect compilation rates, notably in Angular, where standard MLLMs frequently fail due to complex template syntax.

Limitations and Future Directions

While highly effective for static layouts and componentization, DCM has a few areas for growth. The current system focuses on the "look and feel" of a static UI and does not yet handle dynamic interactive logic or state management (e.g., button click events). Additionally, highly intricate CSS effects may still require manual developer intervention.

Future work will focus on extending the Intermediate Representation to support dynamic state management, moving the system closer to functioning as a fully automated, "full-stack" front-end developer.

Summary updated

BibTeX
@inproceedings{yang2026deterministic,
  author = {Zixiong Yang and Linxiao Li and Jiaye Lin and Binrui Wu and Xiaoyu Kang and Jiechao Gao},
  title = {{Deterministic Component Mining for Multi-Framework UI2Code Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=IuGOrMmYCK},
}
Figure