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

ComUICoder: Component-based Reusable UI Code Generation for Complex Websites via Semantic Segmentation and Element-wise Feedback

Jingyu Xiao, Jiantong Qin, Shuoqi Li, Man Ho Lam, Yuxuan Wan, Jen-tse Huang, Yintong Huo, Michael R. LyuarXiv 2026

TL;DR

ComUICoder is a novel framework that enables Multimodal Large Language Models (MLLMs) to generate clean, reusable, and visually accurate code for complex, multi-page websites. By combining semantic layout segmentation, graph-based component merging, and element-wise visual feedback, it drastically reduces code redundancy and layout errors compared to standard end-to-end approaches.

What Problem Does This Paper Address?

While MLLMs excel at converting simple, isolated UI mockups into code, real-world web development involves large-scale, multi-page, and feature-rich layouts. When applied to these complex scenarios, current MLLM-based approaches face three major hurdles:

  1. Fragmented Segmentation: Existing methods split webpages using rigid, rule-based dividers or inaccurate MLLM bounding boxes. This often cuts cohesive sections (like a footer or a product card) into meaningless fragments, complicating the final code assembly.
  2. Monolithic & Redundant Code: MLLMs typically generate duplicate code for repeating elements across a site instead of abstracting them into modular, reusable components. This severely damages code maintainability.
  3. Visual Inconsistencies: Jarring element-level errors—such as incorrect sizing, misaligned text, or missing icons—frequently slip through coarse-grained self-refinement loops.
Figure 1: Problems encountered by the model when facing complex websites. The same icon denotes the components with similar structure. The bounding box denotes the seg- mentation results.

Methods

ComUICoder addresses these challenges through a three-stage pipeline built on top of a backbone MLLM (Gemini-2.5-Pro):

  • Hybrid Semantic-aware Block Segmentation (HSBS): This stage combines the semantic reasoning of MLLMs with the pixel-precise boundary detection of traditional computer vision tools (like UIED). The MLLM identifies functional blocks (e.g., "product card"), while UIED refines the exact coordinates to prevent over-segmentation.
  • Visual-aware Graph-based Block Merge (VGBM): To enable code reuse, ComUICoder models the internal structure of UI blocks as UI Structure Graphs, where nodes represent elements and edges capture spatial and alignment relationships. By combining graph matching with visual similarity metrics (SSIM and LPIPS), the framework clusters structurally identical blocks across multiple pages, allowing the model to write modular component code (e.g., Vue components) instead of hard-coded markup.
  • Priority-based Element-wise Feedback (PEF): Instead of feeding the entire webpage back to the MLLM for generic "self-correction," PEF performs fine-grained element matching between the rendered output and the ground truth. It ranks errors based on visual saliency and severity, generating explicit, localized instructions (e.g., "move title 20px right") for iterative refinement.
Figure 2: The overview of ComUICoder.

Datasets

The authors introduce ComUIBench, the first multi-page complex webpage benchmark with component annotations. It includes:

  • 40 real-world web projects curated from the Moz Top 500 rankings.
  • 150 subpages in total.
  • 2,055 annotated semantically coherent UI blocks grouped into 1,134 component groups.

Compared to existing benchmarks like WebSight or Design2Code, ComUIBench features significantly greater DOM depth, more unique tags, and explicit cross-page component relationships, making it a much more realistic testbed for front-end automation.

Key Insights and Ideas

  • The Hybrid Sweet Spot: Pure MLLMs understand what a component is but struggle with exact pixel boundaries. Traditional CV layout tools are pixel-precise but lack semantic context. Merging them via an overlap threshold yields clean, functional layout blocks that neither tool could achieve alone.
  • Layout as an Attributed Graph: Code reusability isn't just about visual matching; it's about structural matching. Treating UI layouts as attributed graphs allows the framework to identify components that share the same underlying code structure, even if their text content or color schemes differ.
  • Saliency-Weighted Debugging: Not all layout bugs are equally important. Prioritizing feedback based on the size and severity of the visual error prevents the MLLM from getting overwhelmed by long, noisy feedback prompts, leading to faster and cleaner convergence during code repair.

Key Results

ComUICoder was evaluated against several state-of-the-art baselines (including DCGen, UICopilot, and LayoutCoder) and demonstrated substantial improvements:

  • Visual Fidelity: It achieved a Block-Match score of 0.9301 and an SSIM of 0.7021, significantly outperforming layout-driven baselines.
  • Code Cleanliness: It reduced the code Repetitive Ratio to just 2.10% (compared to 22.78% for direct prompting and up to 57.43% for other segmentation baselines) while maintaining a Reuse Rate of 59.96%.
  • Human Evaluation: In blind pairwise preference tests, human web developers preferred ComUICoder's generated pages over direct prompting 58.8% of the time, citing better layout structure and fewer missing elements.

Limitations and Future Work

While ComUICoder represents a major step forward, the authors note a few limitations:

  • Upstream Tool Dependency: The framework relies heavily on the initial object detection quality of UIED; missed low-level elements can propagate errors into the graph-matching phase.
  • Static Focus: The current benchmark and method focus primarily on static visual layouts and do not yet account for complex dynamic interactions, such as hover states, animations, or JavaScript-driven state management.
  • Framework Specifics: The implementation is currently tailored to the Vue framework; extending this architecture to support React, Angular, or vanilla Web Components automatically remains an open area for future exploration.

Summary updated

BibTeX
@misc{xiao2026comuicoder,
  author = {Jingyu Xiao and Jiantong Qin and Shuoqi Li and Man Ho Lam and Yuxuan Wan and Jen-tse Huang and Yintong Huo and Michael R. Lyu},
  title = {{ComUICoder: Component-based Reusable UI Code Generation for Complex Websites via Semantic Segmentation and Element-wise Feedback}},
  year = {2026},
  eprint = {2602.19276},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.19276},
}
Figure