RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
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.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 34 of its 54 references that are in the map. First posted on arXiv 6 Jan 2026.
Builds on
34 of 54 references.
Closest ancestors · 5
Same direction, newest first
- 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion19 Sep
- 2025Impact-driven Context Filtering For Cross-file Code Completion8 Aug
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
Other references · 29
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2017A Unified Approach to Interpreting Model Predictionscited by 6,488
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2017Axiomatic Attribution for Deep Networkscited by 3,350
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,800
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,103
- 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 820
17 more
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
- 2019Data Shapley: Equitable Valuation of Data for Machine Learningcited by 617
- 2025GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Modelscited by 446
- 2023Making Retrieval-Augmented Language Models Robust to Irrelevant Contextcited by 364
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2023CodePlan: Repository-level Coding using LLMs and Planningcited by 139
- 2024In-Context Learning with Long-Context Models: An In-Depth Explorationcited by 126
- 2024InstructRAG: Instructing Retrieval-Augmented Generation via Self-Synthesized Rationalescited by 100
- 2022CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Contextcited by 64
- 2024Dataflow-Guided Retrieval Augmentation for Repository-Level Code Completioncited by 40
- 2024C-RAG: Certified Generation Risks for Retrieval-Augmented Language Modelscited by 27
- 2025TokenShapley: Token Level Context Attribution with Shapley Valuecited by 14
- 2025Fair Document Valuation in LLM Summaries via Shapley Valuescited by 6
Built on by
Citing papers per year: 2026: 3.
3 papers.
- 2026Group of Skills: Group-Structured Skill Retrieval for Agent Skill Librariescited by 9
- 2026Decision-Aware Memory Cards: Counterfactual-Inspired Context Selection and Compression for Tool-Using LLM Agentscited by 1
- 2026CodeNib: A Multi-View Data System for Serving Repository Context to Coding Agentscited by 0
- 2026CodeNib: A Multi-View Data System for Serving Repository Context to Coding Agents28 Jul 2026
- 2026Decision-Aware Memory Cards: Counterfactual-Inspired Context Selection and Compression for Tool-Using LLM Agents6 Jun 2026
- 2026Group of Skills: Group-Structured Skill Retrieval for Agent Skill Libraries7 May 2026
Similar, not cited
Close in wording, no citation either way
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
- 2025SaraCoder: Orchestrating Semantic and Structural Cues for Resource-Optimized Repository-Level Code Completion
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model
- 2025Completion by Comprehension: Guiding Code Generation with Multi-Granularity Understanding
- 2024RepoGenReflex: Enhancing Repository-Level Code Completion with Verbal Reinforcement and Retrieval-Augmented Generation
- 2026Better Call Grep: Evaluating and Improving Grep-Like Lexical Retrieval for Repository-Level Code Completion
- 2024RLCoder: Reinforcement Learning for Repository-Level Code Completion
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion