GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Models
GitChameleon,一个包含116个基于Python的版本条件化问题的数据集,用于评估大型语言模型在生成特定版本代码方面的能力。
更新于 2024-11-12。作者:Nizar Islah、Justine Gehring、Diganta Misra、Eilif Muller、Irina Rish、Terry Yue Zhuo、Massimo Caccia。
中文摘要
软件库的快速进化对代码生成模型构成了重大挑战,这些模型必须适应频繁的版本更新,同时保持与先前版本的兼容性。现有的代码补全基准测试往往忽略了这一动态方面,而考虑这一方面的测试则依赖于静态代码预测任务,没有基于执行的评估,这只能提供对模型实际可用性的有限视角。为了填补这一空白,我们引入了GitChameleon,这是一个新颖的、手动编纂的数据集,包含116个Python代码补全问题,每个问题都针对特定的库版本,并附有可执行的单元测试。GitChameleon旨在严格评估现代大型语言模型(LLMs)生成针对特定版本代码的能力,这些代码不仅在语法上正确,而且在执行时功能准确。我们的全面评估显示,最先进的LLMs在这个任务上挣扎;例如,GPT-4o的通过率仅为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 \GitChameleon{}, a novel, manually curated dataset comprising 116 Python code completion problems, each conditioned on specific library versions and accompanied by executable unit tests. 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, 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, 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 https://github.com/NizarIslah/GitChameleon.
解读
一句话总结
GitChameleon,一个包含116个基于Python的版本条件化问题的数据集,用于评估大型语言模型在生成特定版本代码方面的能力。
问题1:这篇论文想要解决什么具体问题?
• 问题背景:现有代码生成模型难以适应软件库的频繁版本更新,且现有基准测试往往忽略了这一动态特性。 • 现有方案不足:现有基准测试依赖于静态代码预测任务,缺乏基于执行的评估,无法全面反映模型的实际可用性。 • 研究目标:提出GitChameleon,一个包含可执行单元测试的Python代码补全问题数据集,以严格评估现代大型语言模型生成特定版本代码的能力。
问题2:论文的核心创新点是什么?
• 技术创新:GitChameleon数据集包含116个Python代码补全问题,每个问题都与特定的库版本相关,并附带可执行的单元测试。 • 方法改进:提出执行基准,强调代码库的动态性,评估模型的实际可用性。 • 优势:提供了一种更全面、更实际的代码生成模型评估方法。
问题3:实验结果如何验证了方法的有效性?
• 关键实验:在GitChameleon数据集上评估了最先进的代码生成大型语言模型。 • 性能提升:GPT-4o的pass@10仅为39.9%(在有错误反馈的情况下为43.7%),突显了问题的复杂性和当前模型的能力限制。 • 对比结果:与基线方法相比,GitChameleon提供了一种更严格的评估标准。
问题4:这个研究的实际应用价值是什么?
• 应用场景:GitChameleon可用于评估和改进代码生成模型,使其能够更好地适应软件库的版本变化。 • 实施建议:将GitChameleon作为代码生成模型评估和改进的工具。 • 局限与展望:数据集规模相对较小,未来可以扩大数据集范围,并引入更多类型的编程语言和框架。