arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2602.05998cs.CV
收藏

VisRefiner: 从视觉差异中学习以实现截图到代码生成

VisRefiner: Learning from Visual Differences for Screenshot-to-Code Generation

Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学)

Jie Deng, Kaichun Yao, Libo Zhang

AI总结:

VisRefiner通过学习视觉差异提升截图到代码生成的准确性和自我完善能力。

摘要:

截图到代码生成旨在将用户界面截图转换为可执行的前端代码,以忠实复现目标布局和样式。现有的多模态大语言模型直接从截图进行映射,但其训练过程中并未观察到生成代码的视觉结果。相比之下,人类开发者会迭代地渲染其实现,将其与设计进行比较,并学习如何将视觉差异与代码更改联系起来。受此过程启发,我们提出VisRefiner,一种训练框架,使模型能够从渲染预测与参考设计之间的视觉差异中学习。我们构建了差异对齐的监督,将视觉差异与相应的代码编辑关联起来,使模型能够理解外观变化如何源于实现更改。在此基础上,我们引入了一种强化学习阶段用于自我完善,其中模型通过观察渲染输出和目标设计,识别它们的视觉差异,并据此更新代码。实验表明,VisRefiner显著提高了单步生成质量与布局忠实度,同时使模型具备强大的自我完善能力。这些结果展示了从视觉差异中学习在推进截图到代码生成方面的有效性。

英文摘要:

Screenshot-to-code generation aims to translate user interface screenshots into executable frontend code that faithfully reproduces the target layout and style. Existing multimodal large language models perform this mapping directly from screenshots but are trained without observing the visual outcomes of their generated code. In contrast, human developers iteratively render their implementation, compare it with the design, and learn how visual differences relate to code changes. Inspired by this process, we propose VisRefiner, a training framework that enables models to learn from visual differences between rendered predictions and reference designs. We construct difference-aligned supervision that associates visual discrepancies with corresponding code edits, allowing the model to understand how appearance variations arise from implementation changes. Building on this, we introduce a reinforcement learning stage for self-refinement, where the model improves its generated code by observing both the rendered output and the target design, identifying their visual differences, and updating the code accordingly. Experiments show that VisRefiner substantially improves single-step generation quality and layout fidelity, while also endowing models with strong self-refinement ability. These results demonstrate the effectiveness of learning from visual differences for advancing screenshot-to-code generation.

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

↑