ChatPaper.aiChatPaper

CodexGraph:通过代码图数据库搭建大型语言模型与代码库之间的桥梁。

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

August 7, 2024
作者: Xiangyan Liu, Bo Lan, Zhiyuan Hu, Yang Liu, Zhicheng Zhang, Wenmeng Zhou, Fei Wang, Michael Shieh
cs.AI

摘要

大型语言模型(LLMs)在像HumanEval和MBPP这样的独立代码任务中表现出色,但在处理整个代码库方面表现不佳。这一挑战促使研究人员致力于增强LLM-代码库交互的规模。目前的解决方案依赖于基于相似度的检索或手动工具和API,每种方法都有显著的缺点。基于相似度的检索在复杂任务中通常召回率低,而手动工具和API通常是针对特定任务的,需要专业知识,降低了它们在不同代码任务和实际应用中的泛化能力。为了缓解这些限制,我们引入了\framework,这是一个系统,将从代码库中提取的图数据库接口与LLM代理集成。通过利用图数据库的结构特性和图查询语言的灵活性,\framework使LLM代理能够构建和执行查询,实现精确的、了解代码结构的上下文检索和代码导航。我们使用三个基准测试评估了\framework:CrossCodeEval、SWE-bench和EvoCodeBench。此外,我们开发了五个真实世界的编码应用程序。通过统一的图数据库模式,\framework展示了在学术和实际环境中的竞争性表现和潜力,展示了它在软件工程中的多功能性和有效性。我们的应用演示: https://github.com/modelscope/modelscope-agent/tree/master/apps/codexgraph_agent.
English
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 \framework, 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, \framework enables the LLM agent to construct and execute queries, allowing for precise, code structure-aware context retrieval and code navigation. We assess \framework using three benchmarks: CrossCodeEval, SWE-bench, and EvoCodeBench. Additionally, we develop five real-world coding applications. With a unified graph database schema, \framework 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.

Summary

AI-Generated Summary

PDF182November 28, 2024