Who Drew That Pixel? Fine-Grained Visual Attribution for Image-to-Code Generation and Editing
Abstract
Render attribution links rendered elements to their source code to provide element-specific advantages, improving reinforcement learning image-to-code generation and editing across SVG, TikZ, and HTML benchmarks.
Reinforcement learning for image-to-code generation typically rewards the overall visual similarity between rendered outputs and reference images. However, methods such as GRPO assign the same advantage to every token in a program, giving code that draws an element correctly the same learning signal as code that draws it incorrectly. To address this, we introduce render attribution, which traces rendered elements back to their source code, enabling fine-grained visual feedback. During training, we decompose the reference and rendered images into individual elements, match them one-to-one based on geometric similarity, and assign element-specific advantages to the responsible code tokens, even across shared definitions. Across five benchmarks (VFIG-Bench, VFIG-OOD, SVG-Bench Emoji, DaTikZ-v3, and Design2Code) spanning SVG, TikZ, and HTML with three different starting models, our method outperforms GRPO (e.g., 23% lower LPIPS on VFIG-Bench), improving all 28 benchmark-metric comparisons with at most 1.3% additional training-step time. With an additional code-aware reward and corresponding credit assignment, it also better preserves code structure and improves editability. As an agent tool, render attribution improves LPIPS by 17% at the same turn budget even for a frontier agent (Claude Sonnet 5.5), and lets an open 27B agent surpass its 16-turn result in four turns with 84% fewer tokens. By linking rendered elements to their code, render attribution turns visual feedback into precise guidance for learning and editing.
Get this paper in your agent:
hf papers read 2612.00307 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 5
render-attribution/RA-GRPO-SVG-4B
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper