AesCode 用图像引导强化学习提升代码生成的视觉质量
AesCode: Aesthetic Code Generation with Decoupled Cross-Modal Rewards
做幻灯片、海报生成的朋友看看这篇:代码模型配上参考图做 RL,8B 小模型的视觉分数追上了 GPT-5.5,方法拆得很细。
arXiv 论文 AesCode 针对代码模型无法看到布局和配色最终效果的问题,让同一提示词生成的图像作为审美引导,将目标表示为可归因的设计图。奖励分为两路:确定性验证器打分代码和渲染中可解析的属性,VLM 判官用 Visual Graph Rubric 评估不可解析部分,并通过每通道归一化的强化学习联合优化。AesCode-8B 和 AesCode-32B 相比同规模的 Qwen3-VL 基线(给定相同参考图)视觉质量分别提升 31.1 和 22.4 个百分点,达到与 GPT-5.5 和 Claude Opus 4.8 相当的水平。作者还构建了一个分别计分可验证正确性和视觉质量的基准,视觉分数与人类判断高度一致。
AesCode: Aesthetic Code Generation with Decoupled Cross-Modal Rewards
Generating information-rich visual artifacts such as slides, posters, and dashboards as code is appealing because the outputs are structured, editable, and verifiable. Yet code models cannot see how their choices of layout and color come together on the canvas, often limiting spatial planning and aesthetic quality. Image generators excel at visual design but can misrender requested content, making their outputs unreliable targets for direct reproduction. We therefore introduce AesCode, which generates code grounded in the content prompt while using an image generated from the same prompt as an aesthetic guidance. To do so, AesCode represents the target as a design graph that describes the whole canvas and makes each property attributable. From this graph, we derive complementary cross-modal rewards: deterministic verifiers score properties parsable from code and rendering, while a VLM judge assesses the non-parsable ones with a sample-specific Visual Graph Rubric (VGR) tied to graph elements and relations. We optimize these decoupled rewards through reinforcement learning with per-channel normalization to jointly improve spatial planning, aesthetic quality, and verifiable correctness. To evaluate this setting, we build a benchmark that scores verifiable correctness and visual quality separately, with visual scores highly consistent with human judgments. We find that reference images substantially improve the visual quality of code generated by existing models, and ablations show that AesCode benefits from references both as model input and as a source of visual rewards. Relative to same-scale Qwen3-VL baselines given the same references, AesCode-8B and AesCode-32B improve visual quality by 31.1 and 22.4 percentage points, reaching scores comparable to those of closed-source frontier models such as GPT-5.5 and Claude Opus 4.8.