RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Huo, Yu, Zeng, Kun, Zhang, Siyu, Lu, Yuquan, Yang, Cheng, Guo, Yifu, Tang, Xiaoying
Natura: Preprint
Pubblicazione: 2026
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866910139973369856
author Huo, Yu
Zeng, Kun
Zhang, Siyu
Lu, Yuquan
Yang, Cheng
Guo, Yifu
Tang, Xiaoying
author_facet Huo, Yu
Zeng, Kun
Zhang, Siyu
Lu, Yuquan
Yang, Cheng
Guo, Yifu
Tang, Xiaoying
contents Repository-level code completion benefits from retrieval-augmented generation (RAG). However, controlling cross-file evidence is difficult because chunk utility is often interaction-dependent: some snippets help only when paired with complementary context, while others harm decoding when they conflict. We propose RepoShapley, a coalition-aware context filtering framework supervised by Shapley-style marginal contributions. Our offline labeling module, ChunkShapley, estimates signed per-chunk effects via teacher-forced probing, feeds them into a lightweight surrogate game that captures saturation and interference, computes exact Shapley values for small retrieval sets, and selects a decoding-optimal coalition through bounded post-verification with the frozen generator. The verified keep/drop decisions and retrieval triggers are then distilled into a single model via discrete control tokens. Experiments across benchmarks and backbones show that RepoShapley improves completion quality while reducing harmful context and unnecessary retrieval.
format Preprint
id arxiv_https___arxiv_org_abs_2601_03378
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion
Huo, Yu
Zeng, Kun
Zhang, Siyu
Lu, Yuquan
Yang, Cheng
Guo, Yifu
Tang, Xiaoying
Software Engineering
Repository-level code completion benefits from retrieval-augmented generation (RAG). However, controlling cross-file evidence is difficult because chunk utility is often interaction-dependent: some snippets help only when paired with complementary context, while others harm decoding when they conflict. We propose RepoShapley, a coalition-aware context filtering framework supervised by Shapley-style marginal contributions. Our offline labeling module, ChunkShapley, estimates signed per-chunk effects via teacher-forced probing, feeds them into a lightweight surrogate game that captures saturation and interference, computes exact Shapley values for small retrieval sets, and selects a decoding-optimal coalition through bounded post-verification with the frozen generator. The verified keep/drop decisions and retrieval triggers are then distilled into a single model via discrete control tokens. Experiments across benchmarks and backbones show that RepoShapley improves completion quality while reducing harmful context and unnecessary retrieval.
title RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion
topic Software Engineering
url https://arxiv.org/abs/2601.03378