arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2610.30016cs.SEcs.AIcs.LG
收藏

Code Comprehensor:面向大型代码仓库的分层文档生成与跨模态检索

Code Comprehensor: Hierarchical Documentation and Cross-Modal Retrieval for Large Repositories

Ericsson R&D(爱立信研发)

Sujoy Roychowdhury, Joseph H. R. Isaac, Jiangning Gao, Martin Klitte, Diarmuid Corcoran

AI总结:

提出Code Comprehensor混合框架,结合调用图、CodeScribe文档生成与CodeContrast跨模态检索,在OpenCV及500万行代码私有仓库上提升文本到代码检索准确率,输出忠实度超90%。

摘要:

理解大型、复杂且快速迭代的代码库仍是规模化软件工程的核心挑战,其阻碍了新成员上手、代码维护、重构及影响分析。将此类信息提供给大语言模型(LLM)是另一项难题,因为LLM不仅需理解所需的代码方法,还需掌握其在仓库整体架构中的关联方法。本文提出Code Comprehensor,这是一种混合检索-推理框架,结合了:(i)代码依赖调用图;(ii)CodeScribe,利用代码感知型LLM生成仓库调用图的分层文档;(iii)CodeContrast,一种CLIP风格的双编码器模型,基于CodeScribe的输出训练以学习对齐的文本-代码嵌入。CodeContrast可实现相关代码上下文邻域的快速、语义精确检索,这些邻域作为基于MCP的LLM编排器回答特定领域查询的基础证据。在OpenCV及一个拥有500万行代码的私有仓库上的评估显示,CodeScribe衍生的监督信号较基线方法显著提升了文本到代码的跨模态检索准确率;更丰富的文本监督(分层文档、父/兄弟上下文及LLM生成的合成问题)在两个仓库上均持续提升性能。使用流行的RAGAS作为评判者对Code Comprehensor输出进行LLM评估,得到的忠实度分数超过90%。

英文摘要:

Understanding large, complex, and rapidly evolving code bases remains a core challenge for software engineering at scale, hindering onboarding, maintenance, refactoring, and impact analysis. Providing this information to a Large-Language Model (LLM) is another hurdle, as the LLM must understand not only the required code method but also its associated methods in the grand scheme of the repository. We propose Code Comprehensor, a hybrid retrieval-reasoning framework combining (i) CodeGraph, a code dependency callgraph, (ii) CodeScribe, which uses code-aware LLMs to generate hierarchical documentation across repository call graphs, and (iii) CodeContrast, a CLIP-style dual-encoder model trained on CodeScribe output to learn aligned text-code embeddings. CodeContrast enables fast, semantically precise retrieval of relevant code-context neighborhoods, which serve as grounded evidence for an MCP-based LLM orchestrator answering domain-specific queries. Evaluation on OpenCV and a proprietary 5M-LOC repository shows that CodeScribe-derived supervision significantly improves cross-modal retrieval in text-to-code accuracy over baseline approaches. Richer textual supervision (hierarchical documentation, parent/sibling context, and LLM-generated synthetic questions) consistently enhances performance across both repositories. LLM-as-a-judge evaluation using the popular RAGAS of the Code Comprehensor output yields above 90% faithfulness scores.

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

↑