GitChameleon:揭示代码生成模型的版本切换能力
GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Models
AI总结:
针对代码生成模型难以适应软件库版本更新的问题,作者提出了包含116个附带可执行单元测试的Python代码补全数据集GitChameleon,用于严格评估LLMs生成特定版本代码的能力,实验表明GPT-4o等先进模型表现不佳,为开发更具适应性的模型提供了关键基准。
摘要:
软件库的快速演进给代码生成模型带来了巨大挑战,这些模型必须适应频繁的版本更新,同时保持与先前版本的兼容性。现有的代码补全基准通常忽略了这一动态特性,而唯一考虑了该特性的基准依赖于静态代码预测任务,且没有基于执行的评估,这为模型的实际可用性提供了有限的视角。为了填补这一空白,我们引入了GitChameleon,这是一个新颖的、人工策划的数据集,包含116个Python代码补全问题,每个问题都以特定的库版本为条件,并附有可执行的单元测试。GitChameleon旨在严格评估现代大型语言模型(LLMs)生成特定版本代码的能力,这些代码不仅在语法上正确,而且在执行时功能准确。我们的综合评估表明,最先进的LLMs在此任务上表现挣扎;例如,GPT-4o的pass@10仅为39.9%(在提供错误反馈时为43.7%),突出了问题的复杂性和当前模型的局限性。通过提供一个强调代码库动态特性的基于执行的基准,GitChameleon作为推进更具适应性和可靠性的代码生成模型开发的关键工具。为了促进对版本条件代码生成的进一步探索,我们在https://github.com/NizarIslah/GitChameleon公开了我们的代码库。
英文摘要:
The rapid evolution of software libraries presents a significant challenge for code generation models, which must adapt to frequent version updates while maintaining compatibility with previous versions. Existing code completion benchmarks often overlook this dynamic aspect, and the one that does consider it relies on static code prediction tasks without execution-based evaluation, offering a limited perspective on a model's practical usability. To address this gap, we introduce \textbf{\GitChameleon{}}, a novel, manually curated dataset comprising 116 Python code completion problems, each conditioned on specific library versions and accompanied by executable unit tests. \GitChameleon{} is designed to rigorously assess the ability of modern large language models (LLMs) to generate version-specific code that is not only syntactically correct but also functionally accurate upon execution. Our comprehensive evaluations reveal that state-of-the-art LLMs struggle with this task; for instance, \textbf{GPT-4o} achieves a pass@10 of only 39.9\% (43.7\% when provided with error feedback), highlighting the complexity of the problem and the limitations of current models. By providing an execution-based benchmark that emphasizes the dynamic nature of code libraries, \GitChameleon{} serves as a critical tool to advance the development of more adaptable and reliable code generation models. For facilitation for further exploration of version-conditioned code generation, we make our code repository publicly accessible at \url{https://github.com/NizarIslah/GitChameleon}.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。