用图结构增强大模型,实现无需代理的代码库级开发任务
Code Graph Model (CGM): A Graph-Integrated Large Language Model for Repository-Level Software Engineering Tasks
- 将代码库图结构融入大模型注意力机制
- 在SWE-bench Lite上达43%解决率,超越现有开源模型12.33%
- 适合关注代码理解与隐私安全的开发者
大型语言模型在函数级代码生成方面展现潜力,但代码库级软件工程任务仍具挑战。当前方案多依赖专有LLM代理,导致不可预测且限制可访问性,引发数据隐私与模型定制顾虑。本文探究开源大模型是否可在不使用代理的情况下有效处理代码库级任务。我们通过语义信息和结构依赖使大模型理解代码库中的函数与文件,提出代码图模型(CGM),将代码库图结构整合至大模型注意力机制,并用专用适配器将节点属性映射到大模型输入空间。结合无代理图RAG框架,该方法在SWE-bench Lite基准上使用开源Qwen2.5-72B模型取得43.00%的解决率,位居开源权重模型第一、开源系统方法第二、总体第八,较前最佳开源模型方法提升12.33%。
原文摘要 · Abstract (English)
Recent advances in Large Language Models (LLMs) have shown promise in function-level code generation, yet repository-level software engineering tasks remain challenging. Current solutions predominantly rely on proprietary LLM agents, which introduce unpredictability and limit accessibility, raising concerns about data privacy and model customization. This paper investigates whether open-source LLMs can effectively address repository-level tasks without requiring agent-based approaches. We demonstrate this is possible by enabling LLMs to comprehend functions and files within codebases through their semantic information and structural dependencies. To this end, we introduce Code Graph Models (CGMs), which integrate repository code graph structures into the LLM's attention mechanism and map node attributes to the LLM's input space using a specialized adapter. When combined with an agentless graph RAG framework, our approach achieves a 43.00% resolution rate on the SWE-bench Lite benchmark using the open-source Qwen2.5-72B model. This performance ranks first among open weight models, second among methods with open-source systems, and eighth overall, surpassing the previous best open-source model-based method by 12.33%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。