arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.19918cs.CV
收藏

Widget2Code: 通过多模态大语言模型从视觉小部件到UI代码

Widget2Code: From Visual Widgets to UI Code via Multimodal LLMs

McMaster University(麦克马斯特大学);University of Toronto(多伦多大学);University of Waterloo(滑铁卢大学);Concordia University(康考迪亚大学)

Houston H. Zhang, Tao Zhang, Baoze Lin, Yuanqi Xue, Yincheng Zhu, Huan Liu, Li Gu, Linfeng Ye, Ziqiang Wang, Xinxin Zuo, Yang Wang, Yuanhao Yu, Zhixiang Chi

AI总结:

本文提出Widget2Code任务,通过多模态大语言模型提升小部件到UI代码的生成能力,设计了图像-only基准测试和WidgetFactory框架,提升视觉保真度。

摘要:

用户界面到代码(UI2Code)旨在生成可执行代码以忠实重建给定的输入UI。先前工作主要集中在网页和移动屏幕,忽略了小部件。不同于网页或移动UI的丰富层次上下文,小部件是紧凑、无上下文的微界面,通过密集布局和图标在严格空间约束下总结关键信息。此外,虽然(图像,代码)对在网页或移动UI中广泛可用,但小部件设计是专有的且缺乏可访问的标记。我们正式将此设置定义为Widget-to-Code(Widget2Code),并引入一个仅图像的小部件基准测试,具有细粒度、多维评估指标。基准测试显示,尽管通用多模态大语言模型(MLLMs)优于专门的UI2Code方法,但它们仍然产生不可靠且视觉不一致的代码。为解决这些限制,我们开发了一个基线,同时推进感知理解和结构化代码生成。在感知层面,我们遵循小部件设计原则,将原子组件组装成完整的布局,配备图标检索和可重用的可视化模块。在系统层面,我们设计了一个端到端的基础设施,WidgetFactory,包括框架无关的小部件定制领域特定语言(WidgetDSL)和一个将它转换为多种前端实现(例如React、HTML/CSS)的编译器。一个自适应渲染模块进一步细化空间维度以满足紧凑性约束。这些贡献显著提升了视觉保真度,建立了强大的基线和统一的基础设施,为未来的Widget2Code研究奠定了基础。

英文摘要:

User interface to code (UI2Code) aims to generate executable code that can faithfully reconstruct a given input UI. Prior work focuses largely on web pages and mobile screens, leaving app widgets underexplored. Unlike web or mobile UIs with rich hierarchical context, widgets are compact, context-free micro-interfaces that summarize key information through dense layouts and iconography under strict spatial constraints. Moreover, while (image, code) pairs are widely available for web or mobile UIs, widget designs are proprietary and lack accessible markup. We formalize this setting as the Widget-to-Code (Widget2Code) and introduce an image-only widget benchmark with fine-grained, multi-dimensional evaluation metrics. Benchmarking shows that although generalized multimodal large language models (MLLMs) outperform specialized UI2Code methods, they still produce unreliable and visually inconsistent code. To address these limitations, we develop a baseline that jointly advances perceptual understanding and structured code generation. At the perceptual level, we follow widget design principles to assemble atomic components into complete layouts, equipped with icon retrieval and reusable visualization modules. At the system level, we design an end-to-end infrastructure, WidgetFactory, which includes a framework-agnostic widget-tailored domain-specific language (WidgetDSL) and a compiler that translates it into multiple front-end implementations (e.g., React, HTML/CSS). An adaptive rendering module further refines spatial dimensions to satisfy compactness constraints. Together, these contributions substantially enhance visual fidelity, establishing a strong baseline and unified infrastructure for future Widget2Code research.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑