Manuscript Offprint

arXiv:2610.18860

AesCode: Aesthetic Code Generation with Decoupled Cross-Modal Rewards

Xin Gao, Yifan Yang, Xin Li, Pan Wang, Yan Li, Muzhao Tian, Mingxi Cheng, Bei Liu, Kai Qiu, Qi Dai, Dong Chen, Yue Dong, Leandros Tassiulas, Rex Ying, Ji Li, Chong Luo

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Xin Gao2,∗^{2,*} Yifan Yang1,†^{1,\dagger} Xin Li3^{3} Pan Wang4^{4} Yan Li5^{5} Muzhao Tian6^{6} Mingxi Cheng1^{1} Bei Liu1^{1} Kai Qiu1^{1} Qi Dai1^{1} Dong Chen1^{1} Yue Dong1^{1} Leandros Tassiulas2,†^{2,\dagger} Rex Ying2,†^{2,\dagger} Ji Li1^{1} Chong Luo1^{1}

1^{1} Microsoft 2^{2} Yale University 3^{3} Nanyang Technological University

4^{4} University of Pittsburgh 5^{5} Shanghai Jiao Tong University 6^{6} Fudan University

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 parable 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.

Project Page: https://microsoft.github.io/AesCode/

Correspondence: yifanyang@microsoft.com, {leandros.tassiulas, rex.ying}@yale.edu

†^{\dagger} Corresponding authors. ∗^{*} Work was done during an internship at Microsoft Research Asia.

1 Introduction

Information-rich visual artifacts such as slides, posters, and dashboards pack dense content into a single canvas [1, 2]. Generating them as code is highly desirable because the output remains structured, editable, and verifiable. However, code models suffer from a fundamental limitation: they cannot “see” the canvas. Spatial layout, hierarchy, and color are declared line by line, resulting in outputs that satisfy content constraints but often appear visually dated. In contrast, image generators excel at

Figure

Figure 1 Information-rich infographics generated as code. Prompts specify content, while image-generator references offer visual design guidance. The examples show a landscape dashboard and portrait poster rendered from generated HTML/CSS.

composing visually striking pages [3, 4], yet frequently misrender text, numbers, and logical relations, producing raster outputs that cannot be edited or verified [5, 6].

These complementary strengths motivate a novel setting where an image generator provides an aesthetic guidance for the code model. Specifically, a reference image generated from the same prompt serves as a conditional input to supply layout and style inspiration. While existing image-to-code methods [7–9] also use images as input, they treat them as absolute ground truth for pixel-level reconstruction. This rigid replication and its associated image-level metrics [10–12] fail in our setting because they force the code model to mimic the hallucinated content of the generated prior and penalize valid design variations. Our fundamental setting therefore challenges the code model to strictly satisfy the prompt's content while flexibly extracting layout and style from a noisy reference image.

Simply providing the reference image as an input is insufficient. Off-the-shelf vision-language models (VLMs) naturally entangle visual features with text semantics. When given a noisy reference, they tend to either reproduce its hallucinated content or ignore its layout entirely. The model therefore requires explicit training to extract the aesthetic prior while adhering to the text prompt. To facilitate this, we propose AesCode, which conceptualizes the generated target as a Design Graph. This structured intermediate representation explicitly separates semantic information from visual cues. Within this graph, nodes represent distinct functional elements such as text blocks, tables, and charts. Each node possesses decoupled attributes for its required content (e.g., specific strings or data series) and its visual properties (e.g., bounding boxes and colors). Edges explicitly define structural relationships, including hierarchical containment and spatial alignment.

Because the graph structure makes individual properties explicitly attributable, it naturally enables decoupled reward channels tailored to distinct objectives. Blending mixed outcomes into a single score (e.g., rendering correct text but a chaotic layout) often misaligns training gradients. To preserve specific learning signals, we derive synergic cross-modal rewards directly from the graph: deterministic verifiers provide fast, absolute checks for properties readable from code and DOM rendering, while a VLM judge assesses aesthetics through a Visual Graph Rubric (VGR), avoiding unstable holistic scoring by answering node-specific binary questions. We then balance these channels using Group reward-Decoupled Normalization Policy Optimization (GDPO) [13], preventing dense verification signals from overwhelming sparse aesthetic feedback.

We also release an infographic benchmark evaluating verifiable correctness and visual quality separately, with automated visual scores closely matching human judgments. Ablations confirm that reference images consistently improve visual quality as an aesthetic prior across all tested models. Given the same references, our AesCode-8B and AesCode-32B gain 31.1 and 22.4 Visual points over their Qwen3-VL backbones, achieving visual quality comparable to frontier models like GPT-5.5 and Claude Opus 4.8 while making noticeably fewer content errors.

Our contributions are summarized as follows:

  • We introduce a novel paradigm for aesthetic code generation that utilizes image generators as an aesthetic prior. A reference image generated from the same prompt conditions the code model as input and provides visual signals during training.

  • We propose AesCode, which introduces decoupled cross-modal rewards driven by a design graph. It pairs deterministic verifiers for structural correctness with a sample-specific, graph-based VLM judge for aesthetic quality.

  • We release an infographic benchmark that evaluates correctness and visual quality separately, with human-aligned visual scores. References help every model we test, and AesCode matches leading proprietary models visually while following the prompt more closely.

References (43)