arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.03910cs.SEcs.AIcs.CL
收藏

CodexGraph:通过代码图数据库连接大型语言模型和代码库

CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databases

National University of Singapore(新加坡国立大学);Alibaba Group(阿里巴巴集团)

Xiangyan Liu, Bo Lan, Zhiyuan Hu, Yang Liu, Zhicheng Zhang, Fei Wang, Michael Shieh, Wenmeng Zhou

AI总结:

研究旨在解决大型语言模型处理整个代码库的难题,提出通过将LLM代理与代码库图数据库接口集成的CodexGraph系统,利用图数据库特性实现精确上下文检索和代码导航,经多基准评估及实际应用开发,展现其在软件工程中的竞争力与潜力。

摘要:

大型语言模型(LLMs)在诸如HumanEval和MBPP等独立代码任务中表现出色,但在处理整个代码库时存在困难。这促使了在存储库规模上增强LLM与代码库交互的研究。当前解决方案存在缺陷,基于相似度的检索在复杂任务中召回率低,手动工具和API特定于任务且需专业知识。为缓解这些限制,我们引入CodexGraph,它将LLM代理与从代码库提取的图数据库接口集成。通过利用图数据库的结构属性和图查询语言的灵活性,实现精确的、代码结构感知的上下文检索和代码导航。我们使用三个基准进行评估,并开发了五个实际编码应用。结果表明CodexGraph在学术和实际环境中都具有竞争力和潜力。

英文摘要:

Large Language Models (LLMs) excel in stand-alone code tasks like HumanEval and MBPP, but struggle with handling entire code repositories. This challenge has prompted research on enhancing LLM-codebase interaction at a repository scale. Current solutions rely on similarity-based retrieval or manual tools and APIs, each with notable drawbacks. Similarity-based retrieval often has low recall in complex tasks, while manual tools and APIs are typically task-specific and require expert knowledge, reducing their generalizability across diverse code tasks and real-world applications. To mitigate these limitations, we introduce CodexGraph, a system that integrates LLM agents with graph database interfaces extracted from code repositories. By leveraging the structural properties of graph databases and the flexibility of the graph query language, CodexGraph enables the LLM agent to construct and execute queries, allowing for precise, code structure-aware context retrieval and code navigation. We assess CodexGraph using three benchmarks: CrossCodeEval, SWE-bench, and EvoCodeBench. Additionally, we develop five real-world coding applications. With a unified graph database schema, CodexGraph demonstrates competitive performance and potential in both academic and real-world environments, showcasing its versatility and efficacy in software engineering. Our application demo: https://github.com/modelscope/modelscope-agent/tree/master/apps/codexgraph_agent.

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

↑