Code Aesthetics with Agentic Reward Feedback

Bang Xiao, Lingjie Jiang, Shaohan Huang, Tengchao Lv, Yupan Huang, Xun Wu, Lei Cui, Furu Wei

Introduction

Large Language Models (LLMs) have become indispensable assistants for developers, excelling at traditional programming tasks like code generation and bug fixing. However, they are notoriously "visually challenged." When tasked with generating visually-oriented code—such as a webpage or a data plot—they often produce functional but aesthetically suboptimal results, plagued by overlapping text, clashing color schemes, and disorganized layouts.

The core challenge is that "beauty" is inherently difficult to quantify. Traditional Reinforcement Learning from Human Feedback (RLHF) relies on text-based rewards or simple "pass/fail" unit tests, which fail to capture the nuance of a well-aligned UI or a responsive 3D scene. To address this gap, researchers have developed a new training pipeline called GRPO-AR that teaches LLMs not just to write code that works, but code that looks good. Using a multi-agent reward system, their 4-billion parameter model (AesCoder-4B) now outperforms giants like GPT-4o in web design and data visualization tasks.

Methodology

To bridge the gap between functional correctness and aesthetic quality, the authors propose a comprehensive two-stage training pipeline:

  1. Supervised Fine-Tuning (SFT): The model is initially trained on a massive new dataset of high-quality visual code examples to establish a baseline understanding of design patterns.
  2. Reinforcement Learning with Agentic Reward Feedback (GRPO-AR): Instead of relying on a single reward model, the researchers deploy three specialized agents to provide multifaceted feedback.
The GRPO-AR training pipeline featuring Execution, Static, and Interactive agents.

These three feedback agents include:

  • Execution Agent: Verifies that the code runs correctly and adheres to basic syntax rules using tools like HTMLHint.
  • Static Aesthetics Agent: Utilizes a high-level multimodal model (GPT-5) to evaluate a screenshot of the rendered code, scoring it on alignment, visual elements, and overall cohesion.
  • Interactive Aesthetics Agent: An autonomous GUI agent (based on WebVoyager) that interacts with the generated webpage—clicking buttons and navigating menus—to ensure the "feel" and interactive functionality are correct.

These diverse signals are integrated into the Group Relative Policy Optimization (GRPO) algorithm, allowing the model to simultaneously optimize for visual appeal, interactivity, and underlying logic.

Datasets and Benchmarks

To train and evaluate this new approach, the researchers introduced several key resources:

  • AesCode-358K: A newly constructed, large-scale dataset containing 158K high-quality Python plotting samples (Matplotlib, Seaborn, Plotly) and 200K webpage design instructions (HTML/CSS).
  • OpenDesign Benchmark: A novel evaluation suite consisting of 840 real-world webpage design cases across five categories: General Website, 3D Design, Data Visualization, Game Dev, and UI Components.
  • PandasPlotBench: An existing benchmark used to evaluate the model's ability to generate accurate and clear data visualizations.

Key Insights

  • Interactivity as Aesthetics: The authors argue that in web design, aesthetics are not merely skin-deep. If a beautiful button does nothing when clicked, the "interactive aesthetic" is broken. The Interactive Aesthetics Agent ensures models are penalized for creating hollow facades.
  • Small Models, Big Taste: A surprising finding is that a 4B parameter model can outperform 600B+ parameter models in design tasks if provided with a sufficiently rich, multimodal reward signal during training.
  • The "Alignment Tax": As the model becomes a domain expert in aesthetics, its performance on purely algorithmic coding benchmarks (like LiveCodeBench) drops slightly. This represents a conscious trade-off: trading a generalist coder for a specialized designer.

Key Results

The experimental results demonstrate the profound impact of agentic reward feedback on code generation.

Performance comparison of AesCoder against proprietary and open-source models on PandasPlotBench and OpenDesign.
  • Surpassing the Giants: AesCoder-4B achieved a total score of 81.92 on the OpenDesign benchmark, significantly outperforming proprietary models like GPT-4o (48.08) and GPT-4.1 (65.79).
  • State-of-the-Art Open Source: AesCoder matched or exceeded the performance of massive open-source models like DeepSeek-V3 and Qwen-480B, despite being a fraction of their size.
  • Human Preference: In head-to-head comparisons, human evaluators preferred AesCoder’s designs over 55% of the time when compared to other leading open-source models.
  • Visual Consistency: Qualitative case studies show AesCoder-4B producing sophisticated 3D landscapes and polished UI components that resemble professional-grade software.

Limitations and Future Work

While highly effective, the approach has limitations. The "Interactive Agent" can occasionally fail to navigate complex UIs correctly, leading to noisy reward signals where a good design is unfairly penalized. Furthermore, the observed drop in general coding performance suggests that future work must balance "aesthetic sense" with "logical rigor" to prevent the model from losing its algorithmic capabilities.

Future directions include integrating more complex multi-step interaction rewards and expanding the model's aesthetic capabilities to other domains, such as 3D modeling and video generation code.

Summary updated

BibTeX
@inproceedings{xiao2026code,
  author = {Bang Xiao and Lingjie Jiang and Shaohan Huang and Tengchao Lv and Yupan Huang and Xun Wu and Lei Cui and Furu Wei},
  title = {{Code Aesthetics with Agentic Reward Feedback}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=Q87kwGI6bx},
}
Figure