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

Yu Huo, Kun Zeng, Siyu Zhang, Yuquan LU, Cheng Yang, Yifu Guo, Xiaoying Tang


Abstract
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.
Anthology ID:
2026.findings-acl.505
Volume:
Findings of the Association for Computational Linguistics: ACL 2026
Month:
July
Year:
2026
Address:
San Diego, California, United States
Editors:
Maria Liakata, Viviane P. Moreira, Jiajun Zhang, David Jurgens
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
10390–10412
Language:
URL:
https://preview.aclanthology.org/ingest-acl/2026.findings-acl.505/
DOI:
Bibkey:
Cite (ACL):
Yu Huo, Kun Zeng, Siyu Zhang, Yuquan LU, Cheng Yang, Yifu Guo, and Xiaoying Tang. 2026. RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion. In Findings of the Association for Computational Linguistics: ACL 2026, pages 10390–10412, San Diego, California, United States. Association for Computational Linguistics.
Cite (Informal):
RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion (Huo et al., Findings 2026)
Copy Citation:
PDF:
https://preview.aclanthology.org/ingest-acl/2026.findings-acl.505.pdf
Checklist:
 2026.findings-acl.505.checklist.pdf