ML-Bench: Evaluating Large Language Models and Agents for Machine Learning Tasks on Repository-Level Code
作者: Xiangru Tang, Yuliang Liu, Zefan Cai, Yanjun Shao, Junjie Lu, Yichi Zhang, Zexuan Deng, Helan Hu, Kaikai An, Ruijun Huang, Shuzheng Si, Sheng Chen, Haozhe Zhao, Liang Chen, Yan Wang, Tianyu Liu, Zhiwei Jiang, Baobao Chang, Yin Fang, Yujia Qin, Wangchunshu Zhou, Yilun Zhao, Arman Cohan, Mark Gerstein
分类: cs.CL, cs.AI
发布日期: 2023-11-16 (更新: 2024-08-21)
🔗 代码/项目: GITHUB
💡 一句话要点
提出ML-Bench以评估大语言模型在代码理解中的表现
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大语言模型 代码理解 机器学习 基准测试 AI代理 GitHub 编程应用
📋 核心要点
- 现有的大语言模型在处理复杂的代码仓库时表现不佳,特别是在理解文件间的交互和生成正确的调用参数方面。
- ML-Bench通过提供9641个注释示例,旨在评估大语言模型和AI代理在代码理解和执行中的能力,特别是在长代码上下文的处理上。
- 实验结果表明,GPT-4o在ML-LLM-Bench中取得超过50%的Pass@5率,而在更具挑战性的ML-Agent-Bench中成功率为76.47%,显示出显著的改进空间。
📝 摘要(中文)
尽管像GPT-4这样的语言模型在函数级代码生成中表现出色,但在处理仓库级代码理解时仍面临挑战,尤其是在调用例程时需要深入理解复杂的文件交互。为此,本文开发了ML-Bench,一个基于真实编程应用的基准,利用现有代码库执行任务。ML-Bench包含来自18个GitHub仓库的9641个注释示例,旨在评估LLMs和AI代理在长代码上下文理解及指令转化为可执行脚本的能力。实验结果显示,GPT-4o在ML-Agent-Bench中取得了76.47%的成功率,表明迭代行动和反馈在复杂任务解决中的有效性。
🔬 方法详解
问题定义:本文旨在解决大语言模型在仓库级代码理解中的不足,特别是在调用例程时对复杂文件交互的理解能力不足。现有方法在处理长代码上下文时存在显著挑战。
核心思路:论文提出ML-Bench基准,通过真实编程应用的示例,评估大语言模型和AI代理在代码理解及执行中的表现,特别关注用户指定参数和文档复杂性。
技术框架:ML-Bench包括两个主要评估设置:ML-LLM-Bench用于评估大语言模型在特定环境下的文本到代码转换,ML-Agent-Bench用于测试自主代理在Linux沙箱环境中的端到端任务执行。
关键创新:ML-Bench的创新在于其基于真实代码库的任务评估,填补了现有基准在仓库级代码理解方面的空白,特别是在长代码上下文的处理上。
关键设计:ML-Bench包含9641个注释示例,涵盖18个GitHub仓库,设计时考虑了用户指定的参数和文档复杂性,确保评估的全面性和实用性。
🖼️ 关键图片
📊 实验亮点
实验结果显示,GPT-4o在ML-LLM-Bench中取得超过50%的Pass@5率,而在ML-Agent-Bench中成功率达到76.47%。这些结果表明,尽管当前模型表现良好,但在生成bash脚本和避免幻觉输出方面仍有显著改进空间。
🎯 应用场景
该研究的潜在应用领域包括软件开发、自动化测试和代码生成等。通过提高大语言模型在复杂代码理解中的表现,ML-Bench可以为开发者提供更高效的工具,促进编程效率的提升。未来,该基准还可能推动更智能的编程助手和自动化工具的发展。
📄 摘要(原文)
Despite Large Language Models (LLMs) like GPT-4 achieving impressive results in function-level code generation, they struggle with repository-scale code understanding (e.g., coming up with the right arguments for calling routines), requiring a deeper comprehension of complex file interactions. Also, recently, people have developed LLM agents that attempt to interact with repository code (e.g., compiling and evaluating its execution), prompting the need to evaluate their performance. These gaps have motivated our development of ML-Bench, a benchmark rooted in real-world programming applications that leverage existing code repositories to perform tasks. Addressing the need for LLMs to interpret long code contexts and translate instructions into precise, executable scripts, ML-Bench encompasses annotated 9,641 examples across 18 GitHub repositories, challenging LLMs to accommodate user-specified arguments and documentation intricacies effectively. To evaluate both LLMs and AI agents, two setups are employed: ML-LLM-Bench for assessing LLMs' text-to-code conversion within a predefined deployment environment, and ML-Agent-Bench for testing autonomous agents in an end-to-end task execution within a Linux sandbox environment. Our findings indicate that while GPT-4o leads with a Pass@5 rate surpassing 50%, there remains significant scope for improvement, highlighted by issues such as hallucinated outputs and difficulties with bash script generation. Notably, in the more demanding ML-Agent-Bench, GPT-4o achieves a 76.47% success rate, reflecting the efficacy of iterative action and feedback in complex task resolution. Our code, dataset, and models are available at https://github.com/gersteinlab/ML-bench.