RepoFusion: Training Code Models to Understand Your Repository
Not on the map. Why?
Abstract (arXiv)
Despite the huge success of Large Language Models (LLMs) in coding assistants like GitHub Copilot, these models struggle to understand the context present in the repository (e.g., imports, parent classes, files with similar names, etc.), thereby producing inaccurate code completions. This effect is more pronounced when using these assistants for repositories that the model has not seen during training, such as proprietary software or work-in-progress code projects. Recent work has shown the promise of using context from the repository during inference. In this work, we extend this idea and propose RepoFusion, a framework to train models to incorporate relevant repository context. Experiments on single-line code completion show that our models trained with repository context significantly outperform much larger code models as CodeGen-16B-multi (~73× larger) and closely match the performance of the ~ 70× larger StarCoderBase model that was trained with the Fill-in-the-Middle objective. We find these results to be a novel and compelling demonstration of the gains that training with repository context can bring. We carry out extensive ablation studies to investigate the impact of design choices such as context type, number of contexts, context length, and initialization within our framework. Lastly, we release Stack-Repo, a dataset of 200 Java repositories with permissive licenses and near-deduplicated files that are augmented with three types of repository contexts. Additionally, we are making available the code and trained checkpoints for our work. Our released resources can be found at urlhttps://huggingface.co/RepoFusion.
Key facts. Cited by 40 papers in the map (data through 14 Oct 2026). Builds on 31 of its 42 references that are in the map. First posted on arXiv 19 Jun 2023.
Builds on
31 of 42 references.
References · 31
- 2014Adam: A Method for Stochastic Optimizationcited by 37,240
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,210
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
- 2023StarCoder: may the source be with you!cited by 799
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
19 more
- 2022The Stack: 3 TB of permissively licensed source codecited by 359
- 2022Efficient Training of Language Models to Fill in the Middlecited by 255
- 2020IntelliCode Compose: Code Generation Using Transformercited by 227
- 2022Grounded Copilot: How Programmers Interact with Code-Generating Modelscited by 218
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
- 2023SantaCoder: don't reach for the stars!cited by 170
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
- 2021Retrieval Augmented Code Generation and Summarizationcited by 149
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
- 2022Reading Between the Lines: Modeling User Behavior and Costs in AI-Assisted Programmingcited by 91
- 2022CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Contextcited by 65
- 2022When Language Model Meets Private Librarycited by 54
- 2022FiDO: Fusion-in-Decoder optimized for stronger performance and faster inferencecited by 31
- 2022How Readable is Model-generated Code? Examining Readability and Visual Inspection of GitHub Copilotcited by 14
- 2021Capturing Structural Locality in Non-parametric Language Modelscited by 8
- 2021Learning to Generate Code Comments from Class Hierarchiescited by 5
- 2021Embedding API Dependency Graph for Neural Code Generationcited by 5
- 2020On-the-Fly Adaptation of Source Code Models using Meta-Learningcited by 4
Built on by
Citing papers per year: 2023: 3; 2024: 14; 2025: 13; 2026: 10.
40 papers.
Sort:
By area:
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 354
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completioncited by 55
- 2024AgileCoder: Dynamic Collaborative Agents for Software Development based on Agile Methodologycited by 46
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Modelcited by 40
- 2025SWE-QA: Can Language Models Answer Repository-level Code Questions?cited by 38
- 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Contextcited by 32
- 2026SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolvingcited by 31
28 more
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 25
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2024M2rc-Eval: Massively Multilingual Repository-level Code Completion Evaluationcited by 21
- 2026In Line with Context: Repository-Level Code Generation via Context Inliningcited by 18
- 2024RepoHyper: Search-Expand-Refine on Semantic Graphs for Repository-Level Code Completioncited by 15
- 2024Enhancing LLM-Based Coding Tools through Native Integration of IDE-Derived Static Contextcited by 10
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loopscited by 10
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2024R2C2-Coder: Enhancing and Benchmarking Real-world Repository-level Code Completion Abilities of Code Large Language Modelscited by 9
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentationcited by 7
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2025CodeVisionary: An Agent-based Framework for Evaluating Large Language Models in Code Generationcited by 6
- 2025Agentic Software Issue Resolution with Large Language Models: A Surveycited by 6
- 2026Multi-agent Collaboration with State Managementcited by 6
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Modelcited by 5
- 2025YABLoCo: Yet Another Benchmark for Long Context Code Generationcited by 5
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Informationcited by 5
- 2025Impact-driven Context Filtering For Cross-file Code Completioncited by 5
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivitycited by 5
- 2025Knowledge Graph Based Repository-Level Code Generationcited by 4
- 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generationcited by 4
- 2025Gistify! Codebase-Level Understanding via Runtime Executioncited by 4
- 2026Repository Intelligence Graph: Deterministic Architectural Map for LLM Code Assistantscited by 4
- 2026REAgent: Requirement-Driven LLM Agents for Software Issue Resolutioncited by 4
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Trainingcited by 1
- 2026Hierarchical Embedding Fusion for Retrieval-Augmented Code Generationcited by 0
- 2026Benchmarking LLM-Based Static Analysis for Secure Smart Contract Development: Reliability, Limitations, and Potential Hybrid Solutionscited by 0
- 2026PaperCompiler: Faithful Paper-to-Code Generation via Repository-Level Specification Compilationcited by 0
- 2026PaperCompiler: Faithful Paper-to-Code Generation via Repository-Level Specification Compilation2 Sep 2026
- 2026Multi-agent Collaboration with State Management19 May 2026
- 2026Benchmarking LLM-Based Static Analysis for Secure Smart Contract Development: Reliability, Limitations, and Potential Hybrid Solutions11 May 2026
- 2026REAgent: Requirement-Driven LLM Agents for Software Issue Resolution8 Apr 2026
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Training9 Mar 2026
- 2026Hierarchical Embedding Fusion for Retrieval-Augmented Code Generation4 Feb 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2026Repository Intelligence Graph: Deterministic Architectural Map for LLM Code Assistants15 Jan 2026
- 2026SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolving4 Jan 2026
- 2026In Line with Context: Repository-Level Code Generation via Context Inlining1 Jan 2026
- 2025Agentic Software Issue Resolution with Large Language Models: A Survey24 Dec 2025
- 2025Gistify! Codebase-Level Understanding via Runtime Execution30 Oct 2025
28 more
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivity24 Sep 2025
- 2025SWE-QA: Can Language Models Answer Repository-level Code Questions?18 Sep 2025
- 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generation11 Aug 2025
- 2025Impact-driven Context Filtering For Cross-file Code Completion8 Aug 2025
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Information28 Jul 2025
- 2025Knowledge Graph Based Repository-Level Code Generation20 May 2025
- 2025YABLoCo: Yet Another Benchmark for Long Context Code Generation7 May 2025
- 2025CodeVisionary: An Agent-based Framework for Evaluating Large Language Models in Code Generation18 Apr 2025
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentation11 Apr 2025
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2024M2rc-Eval: Massively Multilingual Repository-level Code Completion Evaluation28 Oct 2024
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Model21 Oct 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databases7 Aug 2024
- 2024AgileCoder: Dynamic Collaborative Agents for Software Development based on Agile Methodology16 Jun 2024
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model11 Jun 2024
- 2024R2C2-Coder: Enhancing and Benchmarking Real-world Repository-level Code Completion Abilities of Code Large Language Models3 Jun 2024
- 2024A Survey on Large Language Models for Code Generation1 Jun 2024
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion15 Mar 2024
- 2024RepoHyper: Search-Expand-Refine on Semantic Graphs for Repository-Level Code Completion10 Mar 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024
- 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Context22 Feb 2024
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loops7 Feb 2024
- 2024Enhancing LLM-Based Coding Tools through Native Integration of IDE-Derived Static Context6 Feb 2024
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Code14 Nov 2023
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Models31 Aug 2023
- 2023OctoPack: Instruction Tuning Code Large Language Models14 Aug 2023
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2025CodeVisionary: An Agent-based Framework for Evaluating Large Language Models in Code Generationcited by 6
- 2025Agentic Software Issue Resolution with Large Language Models: A Surveycited by 6
- 2026Multi-agent Collaboration with State Managementcited by 6
- 2025Gistify! Codebase-Level Understanding via Runtime Executioncited by 4
- 2026Repository Intelligence Graph: Deterministic Architectural Map for LLM Code Assistantscited by 4
- 2026REAgent: Requirement-Driven LLM Agents for Software Issue Resolutioncited by 4
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Trainingcited by 1
- 2026Multi-agent Collaboration with State Management19 May 2026
- 2026REAgent: Requirement-Driven LLM Agents for Software Issue Resolution8 Apr 2026
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Training9 Mar 2026
- 2026Repository Intelligence Graph: Deterministic Architectural Map for LLM Code Assistants15 Jan 2026
- 2025Agentic Software Issue Resolution with Large Language Models: A Survey24 Dec 2025
- 2025Gistify! Codebase-Level Understanding via Runtime Execution30 Oct 2025
- 2025CodeVisionary: An Agent-based Framework for Evaluating Large Language Models in Code Generation18 Apr 2025
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 354
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completioncited by 55
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Modelcited by 40
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentationcited by 7
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Modelcited by 5
- 2025Impact-driven Context Filtering For Cross-file Code Completioncited by 5
- 2026Hierarchical Embedding Fusion for Retrieval-Augmented Code Generationcited by 0
- 2026Hierarchical Embedding Fusion for Retrieval-Augmented Code Generation4 Feb 2026
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Impact-driven Context Filtering For Cross-file Code Completion8 Aug 2025
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentation11 Apr 2025
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Model21 Oct 2024
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model11 Jun 2024
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion15 Mar 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024AgileCoder: Dynamic Collaborative Agents for Software Development based on Agile Methodologycited by 46
- 2025SWE-QA: Can Language Models Answer Repository-level Code Questions?cited by 38
- 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Contextcited by 32
- 2026SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolvingcited by 31
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 25
- 2024M2rc-Eval: Massively Multilingual Repository-level Code Completion Evaluationcited by 21
- 2026In Line with Context: Repository-Level Code Generation via Context Inliningcited by 18
- 2024RepoHyper: Search-Expand-Refine on Semantic Graphs for Repository-Level Code Completioncited by 15
12 most cited of 23 All 23 (JSON)
- 2026PaperCompiler: Faithful Paper-to-Code Generation via Repository-Level Specification Compilation2 Sep 2026
- 2026Benchmarking LLM-Based Static Analysis for Secure Smart Contract Development: Reliability, Limitations, and Potential Hybrid Solutions11 May 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2026SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolving4 Jan 2026
- 2026In Line with Context: Repository-Level Code Generation via Context Inlining1 Jan 2026
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivity24 Sep 2025
- 2025SWE-QA: Can Language Models Answer Repository-level Code Questions?18 Sep 2025
- 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generation11 Aug 2025
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Information28 Jul 2025
- 2025Knowledge Graph Based Repository-Level Code Generation20 May 2025
- 2025YABLoCo: Yet Another Benchmark for Long Context Code Generation7 May 2025
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
12 newest of 23 All 23 (JSON)