用强化学习让小模型生成美观可用的多页网站。
WebGen-R1: Incentivizing Large Language Models to Generate Functional and Aesthetic Websites with Reinforcement Learning

- 用结构化框架约束生成过程,保持网页架构完整。
- 设计多模态奖励机制,兼顾功能、渲染和视觉美感。
- 7B小模型效果超72B大模型,媲美671B顶尖模型。
尽管大语言模型在函数级代码生成上表现优异,但生成功能完善且视觉美观的多页网站仍是重大挑战。现有工作多局限于单页静态网站,而代理框架通常依赖多轮执行与私有模型,导致高延迟、高成本且集成脆弱。训练小型LLM端到端使用强化学习是可行方案,但关键瓶颈在于如何设计可靠且计算高效的奖励机制。与可由单元测试验证的单文件任务不同,网站生成需评估主观审美、跨页交互和功能正确性。为此,我们提出WebGen-R1,一个专为项目级网站生成设计的端到端强化学习框架。首先引入基于模板的结构化生成范式,约束开放动作空间并保持架构完整性;随后设计新型级联多模态奖励,无缝融合结构保证、执行反馈与视觉美学监督。大量实验表明,WebGen-R1将7B基础模型从几乎无法运行的网站生成能力,提升至可部署、视觉一致的多页网站。显著的是,该方法不仅持续优于高达72B的开源模型,且在功能成功率上媲美671B的DeepSeek-R1,同时在有效渲染和美学一致性上大幅超越。这些结果证明WebGen-R1为小规模开源模型实现从函数级到项目级应用生成提供了可行路径。
原文摘要 · Abstract (English)
While Large Language Models (LLMs) excel at function-level code generation, project-level tasks such as generating functional and visually aesthetic multi-page websites remain highly challenging. Existing works are often limited to single-page static websites, while agentic frameworks typically rely on multi-turn execution with proprietary models, leading to substantial token costs, high latency, and brittle integration. Training a small LLM end-to-end with reinforcement learning (RL) is a promising alternative, yet it faces a critical bottleneck in designing reliable and computationally feasible rewards for website generation. Unlike single-file coding tasks that can be verified by unit tests, website generation requires evaluating inherently subjective aesthetics, cross-page interactions, and functional correctness. To this end, we propose WebGen-R1, an end-to-end RL framework tailored for project-level website generation. We first introduce a scaffold-driven structured generation paradigm that constrains the large open-ended action space and preserves architectural integrity. We then design a novel cascaded multimodal reward that seamlessly couples structural guarantees with execution-grounded functional feedback and vision-based aesthetic supervision. Extensive experiments demonstrate that our WebGen-R1 substantially transforms a 7B base model from generating nearly nonfunctional websites into producing deployable, aesthetically aligned multi-page websites. Remarkably, our WebGen-R1 not only consistently outperforms heavily scaled open-source models (up to 72B), but also rivals the state-of-the-art DeepSeek-R1 (671B) in functional success, while substantially exceeding it in valid rendering and aesthetic alignment. These results position WebGen-R1 as a viable path for scaling small open models from function-level code generation to project-level web application generation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。