代碼圖模型(CGM):一種圖集成大型語言模型,用於倉庫級軟體工程任務
Code Graph Model (CGM): A Graph-Integrated Large Language Model for Repository-Level Software Engineering Tasks
May 22, 2025
作者: Hongyuan Tao, Ying Zhang, Zhenhao Tang, Hongen Peng, Xukun Zhu, Bingchang Liu, Yingguang Yang, Ziyin Zhang, Zhaogui Xu, Haipeng Zhang, Linchao Zhu, Rui Wang, Hang Yu, Jianguo Li, Peng Di
cs.AI
摘要
大型語言模型(LLMs)在函數級代碼生成方面的最新進展顯示出潛力,然而倉庫級軟件工程任務仍然具有挑戰性。目前的解決方案主要依賴於專有的LLM代理,這引入了不可預測性並限制了可訪問性,引發了對數據隱私和模型定制化的擔憂。本文探討了開源LLMs是否能夠在不依賴基於代理的方法的情況下有效處理倉庫級任務。我們通過使LLMs能夠理解代碼庫中函數和文件的語義信息及結構依賴性,證明了這一可能性。為此,我們引入了代碼圖模型(CGMs),該模型將倉庫代碼圖結構整合到LLM的注意力機制中,並使用專門的適配器將節點屬性映射到LLM的輸入空間。當與無代理的圖RAG框架結合時,我們的方法在SWE-bench Lite基準測試中使用開源Qwen2.5-72B模型達到了43.00%的解決率。這一性能在開源權重模型中排名第一,在開源系統方法中排名第二,總體排名第八,超越了之前最佳的基於開源模型的方法12.33%。
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%.Summary
AI-Generated Summary