DesignCoder: Hierarchy-Aware and Self-Correcting UI Code Generation with Large Language Models

📅 2025-06-16
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
To address the core challenge in multimodal large language models (MLLMs)—generating frontend code that simultaneously ensures visual fidelity and functional completeness—this paper proposes a hierarchical-aware and self-correcting end-to-end code generation framework. We innovatively model UI nesting hierarchies via UI Grouping Chains and adopt a divide-and-conquer code generation strategy. Furthermore, we design a self-correction mechanism jointly evaluating rendered-image fidelity (MSE, SSIM, CLIP) and structural similarity (TreeBLEU, Container Match, Tree Edit Distance). Experiments on React Native demonstrate significant improvements: visual similarity increases by 9.52%–37.63%, and structural similarity by 24.67%–30.19%, substantially outperforming state-of-the-art methods. Developer evaluations confirm high usability, code readability, and industrial-grade maintainability.

Technology Category

Application Category

📝 Abstract
Multimodal large language models (MLLMs) have streamlined front-end interface development by automating code generation. However, these models also introduce challenges in ensuring code quality. Existing approaches struggle to maintain both visual consistency and functional completeness in the generated components. Moreover, they lack mechanisms to assess the fidelity and correctness of the rendered pages. To address these issues, we propose DesignCoder, a novel hierarchical-aware and self-correcting automated code generation framework. Specifically, we introduce UI Grouping Chains, which enhance MLLMs' capability to understand and predict complex nested UI hierarchies. Subsequently, DesignCoder employs a hierarchical divide-and-conquer approach to generate front-end code. Finally, we incorporate a self-correction mechanism to improve the model's ability to identify and rectify errors in the generated code. Extensive evaluations on a dataset of UI mockups collected from both open-source communities and industry projects demonstrate that DesignCoder outperforms state-of-the-art baselines in React Native, a widely adopted UI framework. Our method achieves a 37.63%, 9.52%, 12.82% performance increase in visual similarity metrics (MSE, CLIP, SSIM) and significantly improves code structure similarity in terms of TreeBLEU, Container Match, and Tree Edit Distance by 30.19%, 29.31%, 24.67%. Furthermore, we conducted a user study with professional developers to assess the quality and practicality of the generated code. Results indicate that DesignCoder aligns with industry best practices, demonstrating high usability, readability, and maintainability. Our approach provides an efficient and practical solution for agile front-end development, enabling development teams to focus more on core functionality and product innovation.
Problem

Research questions and friction points this paper is trying to address.

Ensuring visual consistency and functional completeness in UI code generation
Assessing fidelity and correctness of rendered UI pages
Improving error identification and correction in generated code
Innovation

Methods, ideas, or system contributions that make the work stand out.

Hierarchy-aware UI Grouping Chains for nested structures
Hierarchical divide-and-conquer code generation approach
Self-correction mechanism for error identification and rectification
🔎 Similar Papers
No similar papers found.
Yunnong Chen
Yunnong Chen
Ph.D. in Computer Science of Zhejiang University
Software EngineeringHuman Computer InteractionMultimodal Learning
S
Shixian Ding
College of Computer Science and Technology, Zhejiang University, Hangzhou, China
Y
YingYing Zhang
College of Computer Science and Technology, Jilin University, Jilin, China
W
Wenkai Chen
College of Computer Science and Technology, Zhejiang University, Hangzhou, China
J
Jinzhou Du
Huawei Technologies Co., Ltd., Shenzheng, China
Lingyun Sun
Lingyun Sun
Zhejiang University
Design IntelligenceHCIArtificial IntelligenceIndustrial DesignAIGC
Liuqing Chen
Liuqing Chen
ZJU-100 Young Professor at Zhejiang University
AI-driven designHCIHRIAI applicationscreativity