Get Started
Home
Topics
Search
Library
6 min read · Code Generation · Reinforcement Learning · Added Oct 18 · Paper published Oct 13, 2026

AesCode: Aesthetic Code Generation with Decoupled Cross-Modal Rewards

Source: research paper via Hugging Face Daily Papers
Generating editable infographics where numbers must be exact AND the layout must look designed breaks both image models (garbled text) and code models (ugly layouts). AesCode decomposes the page into a graph routing content to deterministic verifiers and aesthetics to per-node yes/no VLM questions, with per-channel reward normalization preventing saturated signals from drowning sparse ones.

TL;DR

AesCode trains a code model to turn prompts plus a reference image into HTML/CSS infographics, using a Design Graph to split rewards into deterministic verifiers (text, charts, layout) and a visual rubric judge, so correctness and aesthetics train without one drowning out the other.

Why It Matters

Say you want to auto-generate a dashboard, poster, or slide where the exact numbers, labels, and chart data must be right AND it has to look like a designer touched it. Two families of tools exist, and both fail here. Image generators like BizGen produce pretty pages but misspell text, garble chart values, and output raster pixels you cannot edit. Code generators (text-to-HTML/CSS) keep everything editable and verifiable, but they write layouts blind to the final canvas, so the results look dated and plain.
A tempting fix is to feed the code model a reference image generated from the same prompt. Prior image-to-code work like Design2Code treats such an image as pixel-perfect ground truth to reconstruct. That backfires with a generated reference, because the reference itself hallucinates text and data. Copying its errors is rewarded, and legitimate design variations are punished. AesCode asks a different question: can the code model learn to borrow layout and style from a noisy reference while obeying the prompt for actual content?

How It Works

The core idea: stop scoring the rendered page as one blob. Instead, represent the target as a graph where each node is a page element (text block, chart, table, card, region) with separate attributes for content (the required string or data) and appearance (bounding box, color). Edges encode containment, alignment, and ordering. Because every property has an address in the graph, you can route each one to the right kind of grader.
Content and structural properties, things a program can check, go to six deterministic verifiers: does it render, do required strings appear, does it stay inside the canvas, do the HTML tables and ECharts charts contain the required data, do OCR’d text blocks land near their reference positions, does the whitespace distribution match. Appearance and higher-order composition go to a Visual Graph Rubric, where a VLM judge answers a list of yes/no questions tied to specific graph elements (“is the headline block in the upper-left quadrant?”). Breaking aesthetic judgment into node-bound binary questions avoids the instability of asking a model for a single holistic 1\u20137 score.
You now have seven reward channels with wildly different scales, sparsity, and saturation. Summing them lets a dense near-saturated signal (text correctness) swamp a sparse one (aesthetic rubric). AesCode uses Group Reward-Decoupled Policy Optimization (GDPO), which normalizes each channel’s advantage separately before combining. Training is a supervised cold start on 3,000 teacher demonstrations, then RL on roughly 8,000 prompts where references come from GPT-image-2.
for prompt, ref_image in batch: G_target = build_design_graph(prompt, ref_image) rollouts = policy.sample(prompt, ref_image, n=8) for code in rollouts: img = render(code) G_hat = parse(code, img) s = verifiers(G_hat, G_target) # 6 deterministic scores s.vgr = vlm_judge(img, rubric(G_target)) # yes/no pass rate advantages = gdpo_normalize_per_channel(s) # separate mean/std per channel policy.update(advantages)

What They Found

On the authors’ 300-prompt infographic benchmark, training Qwen3-VL-8B and 32B backbones with this recipe lifts Visual scores by +31.1 and +22.4 points respectively, reaching visual quality comparable to GPT-5.5 and Claude Opus 4.8 while making fewer content errors. The 32B model also leads the Table/Chart check at 90.37% because requiring HTML tables and ECharts constrains outputs to directly verifiable implementations.
The ablations are where the design choices earn their keep. Swapping GDPO for scalar GRPO (summed rewards) costs 5.12 Visual points, consistent with the claim that per-channel normalization prevents saturated signals from drowning sparse ones. Replacing the graph-bound rubric with a single holistic VLM score drops Visual from 75.80 to 68.91. Replacing it with CLIP image similarity to the reference reaches 70.49 on Visual but collapses Chart from 87.79 to 9.78, because the model learns to paint pictures of charts instead of instantiating real ones, exactly the failure mode the authors predicted for reconstruction-style rewards.
One ablation worth flagging: if you train with the reference image but withhold it at inference time, AesCode-8B loses only 1.00 Visual point, compared with 19.55 for the untrained backbone. Reference-based rewards during training transfer visual capability into the policy itself.
Human raters agreed with the automatic Visual checklist on 93.3% of predicates, and preferred the higher-scoring image in 80.66% of pairwise comparisons.

What’s Useful

•
If you are building RL for multi-objective generation (code quality plus aesthetics, correctness plus style, factuality plus fluency), the GDPO per-channel normalization result is directly reusable. Any time you have one dense near-saturated reward and one sparse noisy one, summing them before group normalization is likely hurting you. Worth testing on your own setup.
•
If you are tempted to use image similarity as a reward for code generation, the Chart collapse (87.79 \u2192 9.78) is a cautionary data point: pixel-level similarity cannot distinguish a real chart from a picture of one, so discrete structural capabilities regress even as visual scores rise.
•
If you are evaluating generated designs, decomposing a holistic “is this good” judgment into element-bound yes/no questions produced ~93% human agreement here. That is a usable recipe for building your own evaluator, not just for training.
•
If you want to reproduce or extend this, the authors release prompts, requirements, generated references, and all evaluated outputs, but not the source human designs. Reproducing the pipeline is possible; reproducing the exact training pool is not.

Caveats

Style scores stay below 60% across all tested systems, including frontier models. The authors define Style as production-ready-without-further-revision, so the benchmark deliberately leaves headroom; do not read matching GPT-5.5 on Visual as “solved.” Three failure modes persist: canvas overflow when independent fixed-pixel regions sum past the page height, relational structure (timelines, hierarchies) where the whole-subgraph predicate passes only 75.4% even when individual links pass 95%, and semantic icons that degrade into generic marks because reward design deliberately leaves depicted icon content unscored. The approach also assumes you can render candidates in a sandboxed browser and parse their DOM, which fits HTML/CSS and ECharts cleanly but would need rework for other output formats.
Topics
Code Generation
Reinforcement Learning
Code Generation
Reinforcement Learning
Up next in Code Generation
Self-Evolving Coding Agents via Harness-Policy Optimization
InfiniDream: Open-Ended Photorealistic 3D Worlds Through Procedural Generation
Don't miss new content
Log in to follow topics and personalize your feed.
Related topics you might like
Reinforcement Learning157 episodes
Code Generation72 episodes