用智能体反馈优化代码美感,让AI写出更优雅的代码。
Code Aesthetics with Agentic Reward Feedback
- 设计多智能体系统评估代码可执行性、静态美和交互美。
- 在AesCode-358K数据集上训练,性能超越GPT-4o和4.1。
- 适合关注代码可读性与工程美学的研究者与开发者。
大型语言模型在代码生成等任务中表现优异,但在视觉导向的代码美学方面仍显不足。本文提出一套新流程:构建包含358,000条指令的AesCode-358K代码美学数据集;设计多智能体奖励反馈系统,评估代码的可执行性、静态美学与交互美学;基于此开发GRPO-AR算法,联合优化功能与美学。此外,提出OpenDesign基准用于评估代码美学。实验表明,在AesCode-358K上进行监督微调并结合智能体反馈强化学习,显著提升OpenDesign及PandasPlotBench等基准上的表现。所提出的AesCoder-4B模型优于GPT-4o与GPT-4.1,接近参数量达480B–685B的大规模开源模型,验证了该方法的有效性。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have become valuable assistants for developers in code-related tasks. While LLMs excel at traditional programming tasks such as code generation and bug fixing, they struggle with visually-oriented coding tasks, often producing suboptimal aesthetics. In this paper, we introduce a new pipeline to enhance the aesthetic quality of LLM-generated code. We first construct AesCode-358K, a large-scale instruction-tuning dataset focused on code aesthetics. Next, we propose agentic reward feedback, a multi-agent system that evaluates executability, static aesthetics, and interactive aesthetics. Building on this, we develop GRPO-AR, which integrates these signals into the GRPO algorithm for joint optimization of functionality and code aesthetics. Finally, we develop OpenDesign, a benchmark for assessing code aesthetics. Experimental results show that combining supervised fine-tuning on AesCode-358K with reinforcement learning using agentic reward feedback significantly improves performance on OpenDesign and also enhances results on existing benchmarks such as PandasPlotBench. Notably, our AesCoder-4B surpasses GPT-4o and GPT-4.1, and achieves performance comparable to large open-source models with 480B-685B parameters, underscoring the effectiveness of our approach.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。