arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2501.16191cs.SEcs.AI
收藏

最后的依赖攻坚战:用大语言模型解决Python依赖冲突

The Last Dependency Crusade: Solving Python Dependency Conflicts with LLMs

Antony Bartlett, Cynthia Liem, Annibale Panichella

AI总结:

本文提出PLLM,一种基于检索增强生成的大语言模型方法,通过迭代推断和测试环境反馈自动修复Python依赖冲突,在HG2.9K数据集上显著优于现有基线。

摘要:

解决Python依赖问题仍然是一个繁琐且容易出错的过程,迫使开发者手动尝试兼容的模块版本和解释器配置。现有的自动化解决方案,如基于知识图谱和基于数据库的方法,由于依赖错误类型的多样性、可能的模块版本集合庞大以及传递依赖之间的冲突而面临局限性。本文研究使用大语言模型(LLMs)自动修复Python程序中的依赖问题。我们提出PLLM(发音为“plum”),一种新颖的检索增强生成(RAG)方法,迭代地推断缺失或不正确的依赖。PLLM构建一个测试环境,其中LLM提出模块组合,观察执行反馈,并使用自然语言处理(NLP)解析错误消息来优化其预测。我们在Gistable HG2.9K数据集上评估PLLM,该数据集是真实世界Python程序的精选集合。使用此基准,我们探索了多种PLLM配置,包括六个开源LLM,分别在有无RAG的情况下进行评估。我们的研究结果表明,RAG持续提高修复率,最佳性能由Gemma-2 9B与RAG结合时实现。与两个最先进的基线PyEGo和ReadPyE相比,PLLM实现了显著更高的修复率;比ReadPyE高+15.97%,比PyEGo高+21.58%。进一步分析表明,PLLM对于具有大量依赖的项目以及使用专门数值或机器学习库的项目特别有效。

英文摘要:

Resolving Python dependency issues remains a tedious and error-prone process, forcing developers to manually trial compatible module versions and interpreter configurations. Existing automated solutions, such as knowledge-graph-based and database-driven methods, face limitations due to the variety of dependency error types, large sets of possible module versions, and conflicts among transitive dependencies. This paper investigates the use of Large Language Models (LLMs) to automatically repair dependency issues in Python programs. We propose PLLM (pronounced "plum"), a novel retrieval-augmented generation (RAG) approach that iteratively infers missing or incorrect dependencies. PLLM builds a test environment where the LLM proposes module combinations, observes execution feedback, and refines its predictions using natural language processing (NLP) to parse error messages. We evaluate PLLM on the Gistable HG2.9K dataset, a curated collection of real-world Python programs. Using this benchmark, we explore multiple PLLM configurations, including six open-source LLMs evaluated both with and without RAG. Our findings show that RAG consistently improves fix rates, with the best performance achieved by Gemma-2 9B when combined with RAG. Compared to two state-of-the-art baselines, PyEGo and ReadPyE, PLLM achieves significantly higher fix rates; +15.97\% more than ReadPyE and +21.58\% more than PyEGo. Further analysis shows that PLLM is especially effective for projects with numerous dependencies and those using specialized numerical or machine-learning libraries.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑