paperbot · PL 论文追踪

全部论文 待读 收藏

P1 RepoFuse: A Dual-Context Approach to Repository-Level Code Completion at Industrial Scale

RepoFuse:工业规模下仓库级代码补全的双上下文方法
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 5/10 · 论文将轻量静态分析用于仓库级代码补全的上下文构建,属于 PL 与 AI 交叉的工业落地工作,但并非用户核心关注的 Agentic 程序静态分析或 LLM 改进静态分析,相关度中等。引用 0 inbox
Ming Liang, Xiaoheng Xie, Gehao Zhang, Xunjin Zheng, Wei Jiang, Chengpeng Wang, Gang Fan, Peng Di
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出双上下文框架 RepoFuse,将跨文件上下文分为语义与相似两类,在毫秒级延迟下提升仓库级代码补全准确率。

仓库级代码补全需要理解复杂的跨文件依赖,但已有方法难以兼顾上下文丰富度与实时 IDE 集成所需的 200ms 以内延迟。本文提出 RepoFuse,将跨文件上下文系统性地划分为语义上下文(轻量静态分析得到的结构依赖)与相似上下文(相似度检索得到的功能类似模式),并设计相关性引导的选择算法优化效率与准确率的权衡。系统在蚂蚁集团部署,服务 1 万余名开发者与 5000 万行以上代码,平均延迟 156ms,补全接受率提升 18%。在 CrossCodeEval 上,Python 与 Java 的 exact match 分别提升 4.26 与 3.01,且仅需基线 25% 的 token。为期一周、含 8 万次补全请求的 A/B 实验显示,73% 的开发者认为该双上下文方法减少了跨文件切换。

问题
仓库级代码补全依赖跨文件依赖理解,但现有方法难以在上下文丰富度与实时 IDE 所要求的 200ms 以内延迟之间取得平衡。
方法
将跨文件上下文分为语义上下文(轻量静态分析的结构依赖)与相似上下文(相似度检索的功能类似模式),并用相关性引导的选择算法优化效率—准确率权衡,辅以分布式缓存与实时图更新。
评估
在 CrossCodeEval 上评测 exact match 与 token 开销;在蚂蚁集团生产环境测量延迟、接受率与 p95 延迟,并进行一周 8 万次补全请求的 A/B 测试与开发者反馈调查。
原文摘要(Abstract)

Repository-level code completion requires understanding complex cross-file dependencies, yet existing approaches struggle to balance context richness with the sub-200ms latency requirements of real-time IDE integration. We present RepoFuse, a dual-context framework deployed at Ant Group1 serving 10,000+ developers across 50+ million lines of code. In a production deployment at Ant Group, RepoFuse maintained an average latency of 156ms and improved completion acceptance rate by 18%. This was accomplished through systematic categorization of cross-file context into semantic context (structural dependencies via lightweight static analysis) and similar context (functionally analogous patterns via similarity search), combined with a relevance-guided selection algorithm that optimizes the efficiency-accuracy trade-off. Benchmark evaluation on CrossCodeEval demonstrates 4.26 and 3.01 improvements in exact match scores for Python and Java respectively, while using only 25% of baseline token requirements. More significantly, our one-week A/B test with 80,000 completion requests revealed that developers particularly valued the dual-context approach when working across microservice boundaries, with 73% reporting reduced context switching between files. The system successfully operates under production constraints with distributed caching, real-time graph updates, and p95 latency under 190ms, demonstrating that principled context categorization enables practical repository-level completion at industrial scale. We have open-sourced RepoFuse at GitHub2.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{LiangXZZJWFD26,
  title = {RepoFuse: A Dual-Context Approach to Repository-Level Code Completion at Industrial Scale},
  author = {Ming Liang and Xiaoheng Xie and Gehao Zhang and Xunjin Zheng and Wei Jiang and Chengpeng Wang and Gang Fan and Peng Di},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3805230}
}