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

  • 2024-08-07 18:13:59
  • Xiangyan Liu, Bo Lan, Zhiyuan Hu, Yang Liu, Zhicheng Zhang, Wenmeng Zhou, Fei Wang, Michael Shieh
  • 0

Abstract

Large Language Models (LLMs) excel in stand-alone code tasks like HumanEvaland MBPP, but struggle with handling entire code repositories. This challengehas prompted research on enhancing LLM-codebase interaction at a repositoryscale. Current solutions rely on similarity-based retrieval or manual tools andAPIs, each with notable drawbacks. Similarity-based retrieval often has lowrecall in complex tasks, while manual tools and APIs are typicallytask-specific and require expert knowledge, reducing their generalizabilityacross diverse code tasks and real-world applications. To mitigate theselimitations, we introduce \framework, a system that integrates LLM agents withgraph database interfaces extracted from code repositories. By leveraging thestructural properties of graph databases and the flexibility of the graph querylanguage, \framework enables the LLM agent to construct and execute queries,allowing for precise, code structure-aware context retrieval and codenavigation. We assess \framework using three benchmarks: CrossCodeEval,SWE-bench, and EvoCodeBench. Additionally, we develop five real-world codingapplications. With a unified graph database schema, \framework demonstratescompetitive performance and potential in both academic and real-worldenvironments, showcasing its versatility and efficacy in software engineering.Our application demo:https://github.com/modelscope/modelscope-agent/tree/master/apps/codexgraph_agent.

 

Quick Read (beta)

loading the full paper ...