Impact-driven Context Filtering For Cross-file Code Completion
Retrieval-augmented generation (RAG) has recently demonstrated considerable potential for repository-level code completion, as it integrates cross-file knowledge with in-file preceding code to provide comprehensive contexts for generation. To better understand the contribution of the retrieved cross-file contexts, we introduce a likelihood-based metric to evaluate the impact of each retrieved code chunk on the completion. Our analysis reveals that, despite retrieving numerous chunks, only a small subset positively contributes to the completion, while some chunks even degrade performance. To address this issue, we leverage this metric to construct a repository-level dataset where each retrieved chunk is labeled as positive, neutral, or negative based on its relevance to the target completion. We then propose an adaptive retrieval context filtering framework, CODEFILTER, trained on this dataset to mitigate the harmful effects of negative retrieved contexts in code completion. Extensive evaluation on the RepoEval and CrossCodeLongEval benchmarks demonstrates that CODEFILTER consistently improves completion accuracy compared to approaches without filtering operations across various tasks. Additionally, CODEFILTER significantly reduces the length of the input prompt, enhancing computational efficiency while exhibiting strong generalizability across different models. These results underscore the potential of CODEFILTER to enhance the accuracy, efficiency, and attributability of repository-level code completion.
Code (0)
등록된 구현이 없습니다.
Tasks
Computational EfficiencyCode CompletionSimilar Papers 제목 키워드 기반
Correctness-Aware Repository Filtering Under Maximum Effective Context Window Constraints
Context window efficiency is a practical constraint in large language model (LLM)-based developer tools. Paulsen [12] shows that all tested models degrade in accuracy well before their advertised context limits the Maxim…
Semantic RetrievalFiltering Discomforting Recommendations with Large Language Models
Personalized algorithms can inadvertently expose users to discomforting recommendations, potentially triggering negative consequences. The subjectivity of discomfort and the black-box nature of these algorithms make it c…
Language ModelingLanguage ModellingLarge Language ModelNon-average price impact in order-driven markets
We present a measurement of price impact in order-driven markets that does not require averages across executions or scenarios. Given the order book data associated with one single execution of a sell metaorder, we measu…
ClusteringAttention Mechanism and Heuristic Approach: Context-Aware File Ranking Using Multi-Head Self-Attention
The identification and ranking of impacted files within software reposi-tories is a key challenge in change impact analysis. Existing deterministic approaches that combine heuristic signals, semantic similarity measures,…
Semantic SimilarityActive Inference with Reusable State-Dependent Value Profiles
Adaptive behavior in volatile environments requires agents to switch among value-control regimes across latent contexts, but maintaining separate preferences, policy biases, and action-confidence parameters for every sit…