环境感知代码生成:我们有多远?
Environment-Aware Code Generation: How far are We?
AI总结:
本文提出环境感知代码生成的研究,通过引入VersiBCB基准测试,探讨了数据、参数和缓存三个适应轴,揭示了LLMs在环境特定代码生成中的挑战与改进机会。
摘要:
近年来,大型语言模型(LLMs)在代码生成方面取得了进展,但大多数评估仍然测试孤立的小规模代码(例如,单个函数)在默认或未指定的软件环境下的表现。因此,不清楚LLMs是否能够可靠地生成针对用户特定环境的可执行代码。我们提出了首个系统研究环境感知代码生成(EACG),其中生成的代码必须在任意软件配置下功能正确且直接可执行。为了实现真实的评估,我们引入了VersiBCB基准测试,该基准测试是多包、执行验证和弃用感知的,捕捉了先前数据集常忽视的复杂和演变环境。利用VersiBCB,我们研究了三个互补的适应轴:数据、参数和缓存,并为每个轴开发了代表性策略。我们的结果表明,当前LLMs在环境特定代码生成方面存在困难,而我们的适应方法提高了环境兼容性和可执行性。这些发现突显了在实际软件工程工作流程中部署LLMs的关键挑战和机遇。
英文摘要:
Recent progress in large language models (LLMs) has improved code generation, but most evaluations still test isolated, small-scale code (e.g., a single function) under default or unspecified software environments. As a result, it is unclear whether LLMs can reliably generate executable code tailored to a user's specific environment. We present the first systematic study of Environment-Aware Code Generation (EACG), where generated code must be functionally correct and directly executable under arbitrary software configurations. To enable realistic evaluation, we introduce VersiBCB, a benchmark that is multi-package, execution-verified, and deprecation-aware, capturing complex and evolving environments that prior datasets often overlook. Using VersiBCB, we investigate three complementary adaptation axes: data, parameters, and cache, and develop representative strategies for each. Our results show that current LLMs struggle with environment-specific code generation, while our adaptations improve environment compatibility and executability. These findings highlight key challenges and opportunities for deploying LLMs in practical software engineering workflows.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。