<p>Code completion is of significant importance for improving development efficiency, reducing errors, and improving code quality. The development of code completion models is continuously evolving and has achieved significant progress, but existing code completion models still have limitations in accuracy for repository-level code-completion tasks that span multiple files and have a large number of cross-file dependencies. State-of-the-art retrieval augmented generation (RAG) results have motivated the use of the context of the entire codebase for repository-level code completion tasks to improve the prediction accuracy of large language models. In this study, we target RAG techniques to address the issues of constraints from current code completion models. To address the issue of code logic fragmentation caused by fixed-line segmentation, we prioritize code logical integrity and propose an adaptive segmentation strategy combined with a fused retrieval framework based on RAG technology and code structure analysis. We propose a structure-aware adaptive segmentation strategy that constructs functionally complete retrieval databases by analyzing structural units such as classes and functions. We use the fusion retrieval mechanism integrating both textual and functional similarity matching to enhance the quality and relevance of retrieved cross-file contexts. Experimental results on the CrossCodeEval benchmark demonstrate that our fused retrieval method achieves significant performance improvements over existing models.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Repository-level code completion with adaptive segmentation and fused retrieval

  • Yuanyuan Shen,
  • Pinle Qin,
  • Kaiyi Zhao,
  • Fuwei Zhang,
  • Fan Zhang,
  • Guiji Li

摘要

Code completion is of significant importance for improving development efficiency, reducing errors, and improving code quality. The development of code completion models is continuously evolving and has achieved significant progress, but existing code completion models still have limitations in accuracy for repository-level code-completion tasks that span multiple files and have a large number of cross-file dependencies. State-of-the-art retrieval augmented generation (RAG) results have motivated the use of the context of the entire codebase for repository-level code completion tasks to improve the prediction accuracy of large language models. In this study, we target RAG techniques to address the issues of constraints from current code completion models. To address the issue of code logic fragmentation caused by fixed-line segmentation, we prioritize code logical integrity and propose an adaptive segmentation strategy combined with a fused retrieval framework based on RAG technology and code structure analysis. We propose a structure-aware adaptive segmentation strategy that constructs functionally complete retrieval databases by analyzing structural units such as classes and functions. We use the fusion retrieval mechanism integrating both textual and functional similarity matching to enhance the quality and relevance of retrieved cross-file contexts. Experimental results on the CrossCodeEval benchmark demonstrate that our fused retrieval method achieves significant performance improvements over existing models.