arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.06445cs.SEcs.AI
收藏

约束衰减:后端代码生成中LLM代理的脆弱性

Constraint Decay: The Fragility of LLM Agents in Backend Code Generation

EURECOM;University of Basilicata(巴利卡塔大学)

Francesco Dente, Dario Satriani, Paolo Papotti

AI总结:

研究探讨了LLM代理在多文件后端生成中处理结构约束的能力,发现随着约束累积,性能显著下降,且框架敏感性导致不同环境下的性能差异。

摘要:

大型语言模型(LLM)代理在宽松规范下表现出色,但在生产软件中需严格遵守结构约束,如架构模式、数据库和对象关系映射。现有基准测试忽视非功能需求,奖励功能正确但结构随意的解决方案。本文通过固定统一API合同,评估代理在多文件后端生成中处理结构约束的能力。使用端到端行为测试和静态验证器进行双重评估,发现约束衰减现象:随着结构要求累积,代理性能大幅下降。某些配置在完全指定任务中断言通过率下降30分,部分较弱配置接近零。框架敏感性分析揭示显著性能差异:代理在最小、显式框架(如Flask)中表现良好,但在惯例密集环境(如FastAPI、Django)中表现差。最终,错误分析发现数据层缺陷(如错误查询组成和ORM运行时违规)是主要原因。本研究强调,同时满足功能和结构要求仍是编码代理的关键挑战。

英文摘要:

Large Language Model (LLM) agents demonstrate strong performance in autonomous code generation under loose specifications. However, production-grade software requires strict adherence to structural constraints, such as architectural patterns, databases, and object-relational mappings. Existing benchmarks often overlook these non-functional requirements, rewarding functionally correct but structurally arbitrary solutions. We present a systematic study evaluating how well agents handle structural constraints in multi-file backend generation. By fixing a unified API contract across 80 greenfield generation tasks and 20 feature-implementation tasks spanning eight web frameworks, we isolate the effect of structural complexity using a dual evaluation with end-to-end behavioral tests and static verifiers. Our findings reveal a phenomenon of constraint decay: as structural requirements accumulate, agent performance exhibits a substantial decline. Evaluated configurations lose 27.28 points on average in assertion pass rates from baseline to fully specified tasks. Framework sensitivity analysis exposes performance disparities: mid-tier models succeed in minimal, explicit frameworks (e.g., Flask) but perform substantially worse on average in convention-heavy environments (e.g., FastAPI, Django). Finally, error analysis identifies data-layer defects (e.g., incorrect query composition and ORM runtime violations) as the leading root causes. This work highlights that jointly satisfying functional and structural requirements remains a key open challenge for coding agents.

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

↑