Enhancing Repository-Level Code Completion with Reinforcement Learning in Real-World Scenarios
cs.CL
Submitted: 2026-11-05
Updated: 2026-11-05
Comments: Accepted by EMNLP 2026 Main
Code: https://github.com/zhenlongDai/RepoCompletion
License: http://creativecommons.org/licenses/by/4.0/
The gist: The rapid development of large language models (LLMs) for code, which closely aligns with the practical needs of real-world software development…
Terminology
Abstract
The rapid development of large language models (LLMs) for code, which closely aligns with the practical needs of real-world software development, has sparked growing attention in repository-level code completion. However, existing Code LLMs present challenges in focusing on suitable contexts from the repository and in deeply reasoning about cross-file dependencies. To address these challenges, we propose a novel reinforcement learning framework for repository-level code completion. To better understand both in-file and cross-file contexts, we employ identifier-driven intent recognition to capture completion intent, thereby improving the model's performance in real-world scenarios. To enhance cross-file reasoning, we propose a reward-driven completion learning to effectively reward in complex repository completion scenarios. To guide LLMs in completing code that aligns with intended functionality and repository context, we introduce a selective-exploration strategy that directs the model to focus on low-confidence, high-reward tokens, promoting the exploration of valuable, underexplored completion patterns. Experimental results show that our approach significantly improves the performance of Code LLMs. The code and the dataset are available at https://github.com/zhenlongDai/RepoCompletion.
Sources
- Multi-lingual Evaluation of Code Generation Models
- Evaluating Large Language Models Trained on Code
- Dataflow-Guided Retrieval Augmentation for Repository-Level Code Completion
- PanGu-Coder: Program Synthesis with Function-Level Language Modeling
- CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Context
- De-Hallucinator: Mitigating LLM Hallucinations in Code Generation Tasks via Iterative Grounding
- InCoder: A Generative Model for Code Infilling and Synthesis
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
- Qwen2.5-Coder Technical Report
- A Survey on Large Language Models for Code Generation
- aiXcoder-7B-v2: Training LLMs to Fully Utilize the Long Context in Repository-level Code Completion
- REPOFUSE: Repository-Level Code Completion with Fused Dual Context
- RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems
- StarCoder 2 and The Stack v2: The Next Generation
- CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generation
- CodeElo: Benchmarking Competition-level Code Generation of LLMs with Human-comparable Elo Ratings
- Code Llama: Open Foundation Models for Code
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
- RLCoder: Reinforcement Learning for Repository-Level Code Completion
- CodeT5+: Open Code Large Language Models for Code Understanding and Generation
Related papers
- ALARM: Audio-Language Alignment for Reasoning Models
- ThinkSum: Probabilistic reasoning over sets using large language models
- Coherence boosting: When your pretrained language model is not paying enough attention
- From Facts to Insights: A Persona-Driven Dual Memory Framework and Dataset for Role-Playing Agents
- Improving General Role-Playing Agents via Psychology-Grounded Reasoning and Role-Aware Policy Optimization
- The Art of Asking: Multilingual Prompt Optimization for Synthetic Data