arXiv:2411.05830cs.SEcs.LG2024-11被引 9

测试大模型在不同版本库中生成正确代码的能力,发现当前模型表现不佳。

GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Models

  • 构建可执行的版本化代码补全数据集,模拟真实软件演进场景。
  • GPT-4o在版本相关任务中仅39.9%通过率(有反馈时43.7%)。
  • 适合关注代码生成鲁棒性与版本兼容性的研究者使用。

软件库的快速迭代给代码生成模型带来挑战,模型需适应频繁版本更新同时保持对旧版本的兼容性。现有代码补全基准多忽略这一动态特性,且依赖静态预测任务而无执行验证,难以评估实际可用性。为此,我们提出 extbf{GitChameleon},一个手工构建的116个Python代码补全问题数据集,每个问题基于特定库版本,并配有可执行单元测试。该数据集旨在严格评估现代大语言模型(LLMs)生成既语法正确又执行准确的版本化代码的能力。全面评估显示,当前顶尖模型在此任务上表现欠佳:例如, extbf{GPT-4o} 的 pass@10 仅为 39.9\\(提供错误反馈后提升至 43.7\%),凸显问题复杂性与模型局限性。通过引入基于执行的基准,强调库版本动态性, extbf{GitChameleon} 成为推动更适应、更可靠代码生成模型发展的关键工具。代码仓库已公开于 exttt{https://github.com/NizarIslah/GitChameleon}。

原文摘要 · Abstract (English)

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}.

代码生成版本兼容大模型评估

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。