UniCoder: Unified Visual-to-Code Generation via Symbolic Rewards and Reference-Guided Code Optimization

📄 arXiv: 2606.31732v1 📥 PDF

作者: Yaozhi Zheng, Yilei Jiang, Manyuan Zhang, Yuxuan Wan, Kaituo Feng, Tianshuo Peng, Bo Zhang, Xiangyu Yue

分类: cs.CV

发布日期: 2026-06-30


💡 一句话要点

提出UniCoder以解决视觉到代码生成中的奖励稀疏和探索停滞问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 视觉到代码生成 强化学习 符号属性对齐 参考引导优化 多模态学习 生成模型

📋 核心要点

  1. 现有的多模态大语言模型在视觉到代码生成中无法实现像素精确的对齐,导致生成质量不足。
  2. 提出的UniCoder框架通过符号属性对齐和参考引导代码优化,解决了奖励稀疏和探索停滞的问题。
  3. 在ChartMimic、UniSVG、Design2Code和ScreenBench基准上,UniCoder的性能超越了所有开源模型,达到最先进水平。

📝 摘要(中文)

视觉到代码生成旨在将科学图表、矢量图形和网页转换为可执行脚本,但现有的多模态大语言模型在像素精度对齐方面存在不足。虽然强化学习提供了理论上的解决方案,但面临奖励粗糙性和探索停滞等挑战。为此,本文提出了UniCoder,一个统一的强化学习框架,结合了符号属性对齐和参考引导代码优化两种新机制。通过在多个基准测试上进行广泛实验,8B参数的模型不仅超越了所有开源基线,还达到了与专有模型相当的最先进性能,建立了视觉到代码合成的新范式。

🔬 方法详解

问题定义:本文旨在解决视觉到代码生成中的奖励稀疏性和探索停滞问题。现有方法在处理细粒度元素偏差时,无法有效惩罚,导致生成结果不理想。

核心思路:UniCoder通过引入符号属性对齐和参考引导代码优化,提升了生成代码的质量和探索效率。符号属性对齐使得奖励计算更加细致,而参考引导优化则帮助模型跳出局部最优解。

技术框架:UniCoder的整体架构包括两个主要模块:符号属性对齐模块和参考引导优化模块。前者通过轻量级辅助语言模型解析生成代码,后者则动态注入真实轨迹以指导低性能的生成过程。

关键创新:最重要的创新在于引入了符号属性对齐机制,使得奖励计算能够在元素级别进行,从而提高了生成代码的精度。同时,参考引导优化策略有效地解决了探索过程中的局部最优问题。

关键设计:在模型设计中,采用了8B参数的结构,结合了特定的损失函数和网络结构,以确保在多模态数据上的有效学习和生成。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

在多个基准测试中,UniCoder的性能显著优于所有开源基线,尤其在ChartMimic和Design2Code上,模型的生成质量达到了最先进水平,展现出与专有模型相当的能力,标志着视觉到代码合成领域的重大进展。

🎯 应用场景

该研究的潜在应用领域包括科学数据可视化、网页自动化生成和图形设计等。通过提高视觉到代码生成的精度和效率,UniCoder能够在软件开发、数据分析和用户界面设计等多个领域带来实际价值,推动相关技术的发展。

📄 摘要(原文)

Visual-to-Code generation, which transforms scientific plots, vector graphics, and webpages into executable scripts, demands a level of pixel-precise alignment that standard Multimodal Large Language Models (MLLMs) fail to achieve through Supervised Fine-Tuning (SFT) alone. While Reinforcement Learning (RL) offers a theoretical pathway to bridge this gap, its application is hindered by two fundamental obstacles: (1) \textit{Reward Coarseness}, where semantic metrics like CLIP scores fail to penalize fine-grained element deviations, and (2) \textit{Exploration Stagnation}, where the sparse, heterogeneous code search space prevents the policy from bootstrapping valid trajectories. To overcome these limitations, we introduce UniCoder, a unified RL framework that integrates two novel mechanisms. First, we propose \textbf{Symbolic Attribute Alignment}, which employs a lightweight auxiliary LLM to parse generated code into discrete visual attributes (e.g., hex colors, coordinate limits), enabling dense, element-wise reward computation. Second, to escape local optima, we devise \textbf{Reference-Guided Code Optimization}, a strategy that dynamically injects ground-truth trajectories into low-performing rollout groups, transforming blind exploration into guided policy improvement. Extensive experiments on ChartMimic, UniSVG, Design2Code and ScreenBench benchmarks demonstrate that our 8B-parameter model not only surpasses all open-source baselines but also achieves state-of-the-art performance comparable to proprietary models, establishing a new paradigm for generalized visual-to-code synthesis.