Reproduce “RLCoder: Reinforcement Learning for Repository-Level Code Completion” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Yanlin Wang, Yanli Wang, Daya Guo, Jiachi Chen, Ruikai Zhang, Yuchi Ma, Zibin Zheng

RLCoder presents a reinforcement learning framework for repository-level code completion that trains a retriever using perplexity-based rewards, thereby eliminating the need for labeled data. The system achieved up to 12.2% Exact Match improvement over state-of-the-art baselines on Python code completion benchmarks while enhancing context understanding through natural candidate construction and a stop signal mechanism.

Key insights

  • Reinforcement learning with generative model feedback (perplexity) provides an effective method for training retrievers in code completion, eliminating the need for extensive human-labeled data.
  • Careful design of code candidate construction, such as the 'Split-Aggregate' strategy, significantly improves the semantic coherence and utility of retrieved context.
  • Intelligently deciding when to use external context and filtering irrelevant retrieved snippets (via a 'stop signal') is crucial for preventing hallucinations and enhancing code generation accuracy.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.