paperbot · PL 论文追踪

全部论文 待读 收藏

P1 RepoScope: Leveraging Call Chain-Aware Multi-View Context for Repository-Level Code Generation

RepoScope:利用调用链感知的多视图上下文进行仓库级代码生成
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 5/10 · 论文利用静态分析(调用链感知、结构语义图)增强LLM仓库级代码生成,与PL→AI方向有交叉,但核心目标是提升LLM代码生成而非用户关注的浮点/贝叶斯程序分析或Agent程序分析,匹配度中等。引用 8 inbox
Yang Liu, Li Zhang, Fang Liu, Zhuohang Wang, Donglin Wei, Zhishuo Yang, Kechi Zhang, Jia Li, Lin Shi
crossref: 2026-09-12

AI 速览

一句话:提出 RepoScope,用调用链感知的多视图上下文与结构保持序列化提升仓库级代码生成。

仓库级代码生成要求 LLM 在指定仓库上下文中生成代码。现有方法多采用检索增强生成(RAG),但难以识别真正相关、能反映仓库丰富语义的上下文,上下文视角也较为狭窄;此外,多数方法在构建提示时忽略了检索代码之间的结构关系,阻碍 LLM 准确理解上下文。为此,作者提出 RepoScope:构建仓库结构语义图(RSSG),检索融合结构与相似度的四视图综合上下文;提出一种新的调用链预测方法,利用仓库结构语义改进目标函数中被调函数的识别;并提出结构保持的序列化算法来构建提示,保证上下文对 LLM 的连贯性。RepoScope 仅依赖静态分析,无需额外训练或多次 LLM 查询,兼顾效率与泛化性。在 CoderEval 和 DevEval 上,其 pass@1 相对提升最高达 36.35%,并展现出跨任务迁移及与现有方法结合的能力。

问题
现有基于 RAG 的仓库级代码生成方法难以识别真正相关的仓库上下文,上下文视角狭窄,且提示构建时忽略检索代码的结构关系,影响 LLM 对上下文的理解。
方法
RepoScope 构建仓库结构语义图(RSSG)并检索融合结构与相似度的四视图上下文,提出调用链预测方法识别目标函数的被调函数,并用结构保持的序列化算法构建提示,全程仅用静态分析。
评估
在 CoderEval 与 DevEval 两个常用的仓库级代码生成基准上评估,pass@1 相对提升最高 36.35%,并通过进一步实验验证跨任务迁移与同现有方法结合的效果。
原文摘要(Abstract)

Repository-level code generation aims to generate code within the context of a specified repository. Existing approaches typically employ retrieval-augmented generation (RAG) techniques to provide LLMs with relevant contextual information extracted from the repository. However, these approaches often struggle with effectively identifying truly relevant contexts that capture the rich semantics of the repository, and their contextual perspectives remains narrow. Moreover, most approaches fail to account for the structural relationships in the retrieved code during prompt construction, hindering the LLM’s ability to accurately interpret the context. To address these issues, we propose RepoScope, which leverages call chain-aware multi-view context for repository-level code generation. RepoScope constructs a Repository Structural Semantic Graph (RSSG) and retrieves a comprehensive four-view context, integrating both structural and similarity-based contexts. We propose a novel call chain prediction method that utilizes the repository’s structural semantics to improve the identification of callees in the target function. Additionally, we present a structure-preserving serialization algorithm for prompt construction, ensuring the coherence of the context for the LLM. Notably, RepoScope relies solely on static analysis, eliminating the need for additional training or multiple LLM queries, thus ensuring both efficiency and generalizability. Evaluation on widely-used repository-level code generation benchmarks (CoderEval and DevEval) demonstrates that RepoScope outperforms state-of-the-art methods, achieving up to a 36.35% relative improvement in pass@1 scores. Further experiments emphasize RepoScope’s potential to improve code generation across different tasks and its ability to integrate effectively with existing approaches. We provide the replication package at https://github.com/Lorien1128/RepoScope.

链接与引用

DOI 原文 · arXiv ·

BibTeX
@inproceedings{paperbot11901,
  title = {RepoScope: Leveraging Call Chain-Aware Multi-View Context for Repository-Level Code Generation},
  author = {Yang Liu and Li Zhang and Fang Liu and Zhuohang Wang and Donglin Wei and Zhishuo Yang and Kechi Zhang and Jia Li and Lin Shi},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773211}
}