arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.19742cs.SE
收藏

PlayCoder: 使LLM生成的GUI代码可播放

PlayCoder: Making LLM-Generated GUI Code Playable

Shanghai Jiao Tong University(上海交通大学);LIGHTSPEED(光速);Zhejiang University(浙江大学)

Zhiyuan Peng, Wei Tao, Xin Yin, Chenhao Ying, Yuan Luo, Yiwen Guo

AI总结:

本文提出PlayCoder框架,通过生成、评估和迭代修复GUI代码,提升代码的逻辑正确性和语义对齐,实现功能正确性和交互逻辑的改进。

摘要:

大型语言模型(LLMs)在代码生成方面取得了显著成果,但其生成GUI应用,尤其是游戏的能力仍缺乏深入研究。现有基准测试主要通过测试用例评估正确性,但GUI应用具有交互性、事件驱动性和用户操作序列中的状态转换需求,因此评估应考虑交互流程和UI逻辑而非仅成败结果。为此,我们引入PlayEval,一个基于43个多语言GUI应用的仓库感知基准测试,涵盖六种主要GUI应用类别,并直接支持代码生成评估。我们进一步提出Play@k指标,衡量至少k个生成候选代码是否能完整播放且无逻辑错误。为支持可靠评估,我们开发PlayTester,一个基于LLM的代理,执行任务导向的GUI播放并自动检测逻辑违规。实验表明,尽管高编译率,LLMs在Play@3上接近零,揭示生成逻辑正确GUI应用的主要缺陷。为解决此限制,我们提出PlayCoder,一个多代理、仓库感知框架,通过闭环生成、评估和修复GUI应用代码。PlayCoder显著提升开源和闭源模型的功能正确性和语义对齐,达到38.1% Exec@3和20.3% Play@3。案例研究显示,它能发现传统指标遗漏的静默逻辑错误并通过针对性修改修复。

英文摘要:

Large language models (LLMs) have achieved strong results in code generation, but their ability to generate GUI applications, especially games, remains insufficiently studied. Existing benchmarks mainly evaluate correctness through test cases, which are inadequate for GUI applications because these systems are interactive, event-driven, and require correct state transitions across sequences of user actions. Their evaluation therefore should consider interaction flows and UI logic rather than only pass/fail outcomes. To study this problem, we introduce PlayEval, a repository-aware benchmark built from 43 multilingual GUI applications in Python, TypeScript, and JavaScript. Unlike prior GUI benchmarks that are difficult to adapt to desktop environments, PlayEval covers six major GUI application categories and directly supports code-generation evaluation. We further propose Play@k, a metric that measures whether at least one of *k* generated candidates can be played end-to-end without logical errors. To support reliable evaluation, we develop PlayTester, an LLM-based agent that performs task-oriented GUI playthroughs and detects logic violations automatically. Experiments on 10 state-of-the-art code LLMs show that, despite high compilation rates, they achieve near-zero Play@3, revealing major weaknesses in generating logically correct GUI applications. To address this limitation, we present PlayCoder, a multi-agent, repository-aware framework that generates, evaluates, and iteratively repairs GUI application code in a closed loop. PlayCoder substantially improves both functional correctness and semantic alignment for open-source and closed-source models, reaching up to 38.1% Exec@3 and 20.3% Play@3. Case studies further show that it can uncover silent logic bugs missed by traditional metrics and fix them through targeted edits.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑