AesCode: Aesthetic Code Generation with Decoupled Cross-Modal Rewards
Organizations: Yale University · Microsoft · Nanyang Technological University · University of Pittsburgh ·
Abstract
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.
Figures & tables
| Model | Text | Bound | Chart | Rule | Content | Layout | Style | Visual | Overall |
|---|---|---|---|---|---|---|---|---|---|
| Frontier Closed-Source | |||||||||
| GPT-5.5 | 88.67 | 86.18 | 82.85 | 85.90 | 79.27 | 68.09 | 52.80 | 66.72 | 76.31 |
| GPT-5.4 | 76.37 | 86.14 | 65.30 | 75.94 | 71.05 | 63.29 | 47.31 | 60.55 | 68.24 |
| GPT-5.1 | 80.42 | 78.64 | 73.68 | 77.58 | 73.17 | 59.76 | 43.12 | 58.68 | 68.13 |
| GPT-4o | 73.64 | 78.37 | 55.64 | 69.22 | 51.34 | 33.33 | 15.95 | 33.54 | 51.38 |
| Claude Opus 4.8 | 91.40 | 85.03 | 87.69 | 88.04 | 84.98 | 64.88 | 46.72 | 65.53 | 76.78 |
| GDB/lica | SlidesBench | Design2Code | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | NIMA | CLIP | Pick | FID ↓ | Harm. | OCR | Cont. | Layout | Color | Block | Text | Pos. | Color | CLIP |
| GPT-5.5 | 4.362 | 30.2 | 19.53 | 0.439 | 70.6 | 71.9 | 4.54 | 2.85 | 3.63 | 92.3 | 98.5 | 94.2 | 95.3 | 94.3 |
| GPT-4o | 2.589 | 24.1 | 17.82 | 0.673 | 69.3 | 43.3 | 3.41 | 2.00 | 2.81 | 77.5 | 93.0 | 77.9 | 82.1 | 89.5 |
| GLM-4.5V | 3.682 | 26.4 | 18.49 | 0.541 | 70.3 | 65.1 | 4.22 | 2.14 | 3.00 | 76.7 | 88.2 | 73.8 | 84.7 | 90.3 |
| Qwen2.5-VL-72B | 3.564 | 26.0 | 18.40 | 0.537 | 69.1 | 62.6 | 4.03 | 2.02 | 2.83 | 82.6 | 97.3 | 78.0 | 78.8 | 88.9 |
| Qwen3-VL-30B-A3B | 3.461 | 26.1 | 18.38 | 0.532 | 68.8 | 57.6 | 3.95 | 2.10 | 2.97 | 86.1 | 95.6 | 80.5 | 91.3 | 91.4 |
| Model | Text | Bound | Chart | Rule | Content | Layout | Style | Visual | Overall |
|---|---|---|---|---|---|---|---|---|---|
| Reference input removed at inference only | |||||||||
| GPT-5.5 | 88.67 | 86.18 | 82.85 | 85.90 | 79.27 | 68.09 | 52.80 | 66.72 | 76.31 |
| Qwen3-VL-32B | 66.00 | 80.31 | 41.36 | 62.55 | 49.81 | 34.85 | 19.34 | 34.67 | 48.61 |
| Qwen3-VL-8B | 58.32 | 77.23 | 43.30 | 59.61 | 38.33 | 23.97 | 13.22 | 25.17 | 42.39 |
| AesCode-8B | 93.74 | 88.19 | 82.36 | 88.09 | 84.92 | 86.84 | 52.63 | 74.80 | 81.45 |
| Reference input removed during training and inference | |||||||||
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Split | Items | Reference image |
| Cold-start SFT | original human design | |
| RL, 8B and 32B | GPT-Image-2 from the prompt | |
| Benchmark | GPT-Image-2 from the prompt | |
| Benchmark composition | ||
| CLIP clusters covered | to items each | |
| Orientation | landscape, portrait, square | |
| Model | Text | Bound | Chart | Rule | Content | Layout | Style | Visual | Overall |
| Image-to-code systems | |||||||||
| Design2Code | 39.60 | 54.13 | 0.92 | 31.55 | 19.26 | 9.75 | 2.79 | 10.60 | 21.08 |
| UI2Code n | 80.10 | 62.38 | 7.56 | 50.01 | 69.70 | 68.11 | 41.93 | 59.92 | 54.96 |
| WebSight | 25.28 | 62.48 | 0.06 | 29.27 | 27.46 | 20.56 | 7.43 | 18.48 | 23.88 |
| Reconstruction objective, our data, Qwen3-VL-8B | |||||||||
| Qwen3-VL-8B (backbone) | 64.07 | 70.99 | 42.35 | 59.14 | 52.90 | 51.33 | 29.92 | 44.72 | 51.93 |
| Channel | Applicability | Recorded evidence | Output |
|---|---|---|---|
| Execution | all rollouts | render status, timeout, blank-page and console flags | pass / severity score |
| Text | required text exists | required, matched, missing, and unsupported strings | normalized fidelity |
| Boundary | rendered DOM exists | element and canvas boxes, overflow events, aspect ratios | containment and shape score |
| TableChart | table or chart required | parsed cells or ECharts type, categories, series, and values | structural accuracy |
| SemanticLayout | matched text blocks exist | block matches, normalized centers, distances, and coverage | spatial proximity |
| Whitespace | usable screenshots exist | coarse/fine occupancy grids and per-cell differences | multi-scale similarity |
| ID | Target | Question | Pass |
|---|---|---|---|
| q1 | H | Is the large headline block positioned in the upper-left quadrant of the poster? | Yes |
| q2 | P | Is the central product image slot the largest visual element on the page? | Yes |
| q3 | B | Are the two badge/logo-like tiles arranged as a horizontal pair below the headline area? | Yes |
| q4 | A | Are the two accessory image slots placed along the lower half of the poster rather than near the top? | Yes |
| q5 | P | Is the central product image slot fully visible without being cropped by the page edges? | Yes |
| q6 | L | Are the three left-side callout blocks readable as separate blocks with clear spacing between them? | Yes |
| ID | Target | Question | Pass |
|---|---|---|---|
| q1 | Canvas | Is the overall composition a vertical poster with all major content stacked from top to bottom? | Yes |
| q2 | G | Are the six FAQ cards arranged as a 3-column by 2-row grid? | Yes |
| q3 | C | Is the contact information strip a single wide rounded panel spanning most of the poster width? | Yes |
| q4 | F | Does the bottom area use a two-part layout with the warning block on the left and the QR-code slot on the right? | Yes |
| q5 | G | Is each FAQ card fully visible within its rounded card boundary? | Yes |
| q6 | Q | Is the QR-code placeholder area fully visible as a square slot in the lower-right section? | Yes |
| Content | |||
|---|---|---|---|
| ID | Target | Question | Pass |
| N10 | Canvas | Are there more than zero chart visualizations in the content sections? | No |
| N11 | P1–P3 | Are all three numbered policy pillars drawn whole, with no part of any pillar severed by the canvas edge? | Yes |
| N12 | S3 | Is the cross-provincial direct settlement content, including “98.2%”, drawn wholly inside the canvas rather than cut off by a page edge? | Yes |
| N14 | S3 | Are all digits of “98.2%” fully visible, with none clipped by a page edge or by the boundary of whatever element holds the value? | Yes |
| N15 | S1 | Is the subsidies group, including the “670 ¥” metric and its unit, drawn whole rather than cut off by a page edge? | Yes |
| Layout | |||
|---|---|---|---|
| ID | Target | Question | Pass |
| q1 | H | Is the title block, carrying “XX Health Insurance Bureau” and “2024 Key Policy Interpretation”, encountered before the three numbered policy pillars? | Yes |
| q2 | G / P1–P3 | Does the section heading “Three Pillars of Policy” read as introducing the three numbered pillars, rather than attaching to the title block or to the later content groups? | Yes |
| q3 | P1–P3 | Does each numbered policy pillar keep its own supporting text with it? Answer no if any pillar’s supporting text sits closer to a different pillar than to its own. | Yes |
| q4 | S1–S3 | Do the three metric content groups read as one later section, encountered after the three numbered pillars rather than interleaved with them? | Yes |
| q6 | S1–S3 | Are all three post-pillar content groups present and legible on the page? | Yes |
| Style | |||
|---|---|---|---|
| ID | Target | Question | Pass |
| H06 | S1 | In the subsidies group, is the unit “/person/Year” rendered with the “670 ¥” metric so it clearly belongs to that value? Answer no if the unit is not fully readable, or if it appears to label a different metric. | Yes |
| SL01 | Canvas | Is there a visible hierarchy across the page, and do the title block, the section heading “Three Pillars of Policy”, the three numbered pillars, and the three content groups read as distinct levels rather than one undifferentiated block? Answer no if any of the four reads at the same weight as its neighbours, or if a reader cannot tell where one level ends and the next begins. | Yes |
| SL02 | P1–P3 | Does every numbered policy pillar keep its number clearly associated with its own pillar title, and does the visual reading order of the pillars match 1, 2, 3? Answer no if any number appears closer to a different pillar title, or if the numbers are encountered out of order. | Yes |
| SL03 | Canvas | Do the title block, every numbered policy pillar, and every post-pillar content group use coordinated but distinct visual treatment so the pillars read as one set and the content groups as another? Answer no if any member of either set is given visibly different treatment from its peers. | Yes |
| SL04 | S1–S3 | Do all specified metric values in the three post-pillar content groups read with their own unit or label as clear metric pairings? Answer no if any metric pairing is unreadable or visually attaches to the wrong content group. | Yes |
| ID | Target | Question | Pass |
|---|---|---|---|
| DG01 | Canvas | Is the colour work already at that standard, so that a designer taking this over would change nothing about it? Answer no if the palette is a default or a safe choice rather than a considered one, if colour only fills shapes instead of carrying structure and meaning, if the page falls back on plain white and grey because no palette was committed to, if any hue is off, or if the tints and neutrals have not been tuned to sit together. | Yes |
| DG02 | Canvas | Is the typography already at that standard, so that a designer taking this over would change nothing about it? Answer no if the type reads as browser defaults dressed up, if the scale is a few sizes chosen by eye rather than a system, if two sizes do the same job, if the page never commits to a display size where it needs one, or if line length, line spacing or optical alignment would be corrected in review. | Yes |
| DG03 | Canvas | Has the material on this page actually been designed rather than merely placed, so that a designer would neither add anything nor take anything away? Answer no if a section is a plain list or a plain block that a designer would have given form to, if a region is empty because nothing was developed for it rather than because the composition wanted the rest, if anything reads as a placeholder, if filler is occupying space, or if something important was given less room than it deserves. | Yes |
| DG04 | Canvas | Is this page composed, so that the eye is led first, second and third exactly as intended and nothing would be adjusted? Answer no if the page is only stacked in a reasonable order without being composed, if nothing on it is genuinely dominant, if the first thing seen is not the most important thing, if two elements compete for the same rank, or if any part goes flat and stops directing the eye. | Yes |
| DG05 | Canvas | Is every repeated component resolved to the standard of released work, so that none of them would be revisited? Answer no if any card, row, tile, chip, label or control is a default container rather than a designed one, if one instance is less resolved than its neighbours, if spacing inside repeated elements varies without reason, or if a designer picking this up would rebuild the components rather than adjust them. | Yes |
| Metric | of range | – of range | of range |
|---|---|---|---|
| Our Visual | 66.72% | 80.00% | 93.76% |
| Design2Code | 44.67% | 66.84% | 82.50% |
| SlidesBench | – | 74.00% | 91.25% |
| GDB/lica | 52.63% | 74.67% | 90.23% |
| Mode (scope) | Metric | AesCode-32B | GPT-5.5 |
|---|---|---|---|
| Severe boundary ( ) | recurrent | ||
| Relational subgraph ( ) | recurrent | ||
| mean pass | |||
| Semantic element ( ) | recurrent | ||
| mean pass |
Code Generation
Code generation studies methods for turning natural-language, visual, or formal specifications into executable programs and code edits.
See all 313 papers