ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generation
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Recent advances in large language models (LLMs) have demonstrated impressive capabilities in code-related tasks, such as code generation and automated program repair. Despite their promising performance, most existing approaches for code repair suffer from high training costs or computationally expensive inference. Retrieval-augmented generation (RAG), with its efficient in-context learning paradigm, offers a more scalable alternative. However, conventional retrieval strategies, which are often based on holistic code-text embeddings, fail to capture the structural intricacies of code, resulting in suboptimal retrieval quality. To address the above limitations, we propose ReCode, a fine-grained retrieval-augmented in-context learning framework designed for accurate and efficient code repair. Specifically, ReCode introduces two key innovations: (1) an algorithm-aware retrieval strategy that narrows the search space using preliminary algorithm type predictions; and (2) a modular dual-encoder architecture that separately processes code and textual inputs, enabling fine-grained semantic matching between input and retrieved contexts. Furthermore, we propose RACodeBench, a new benchmark constructed from real-world user-submitted buggy code, which addresses the limitations of synthetic benchmarks and supports realistic evaluation. Experimental results on RACodeBench and competitive programming datasets demonstrate that ReCode achieves higher repair accuracy with significantly reduced inference cost, highlighting its practical value for real-world code repair scenarios.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 31 of its 49 references that are in the map. First posted on arXiv 2 Sep 2025.
Builds on
31 of 49 references.
References · 31
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,135
- 2023Teaching Large Language Models to Self-Debugcited by 988
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2023An Empirical Study of Catastrophic Forgetting in Large Language Models During Continual Fine-tuningcited by 639
19 more
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 358
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2024Many-Shot In-Context Learningcited by 206
- 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 197
- 2024The Effect of Sampling Temperature on Problem Solving in Large Language Modelscited by 170
- 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-stepcited by 127
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 111
- 2023Improving Code Generation by Training with Natural Language Feedbackcited by 76
- 2023A Survey of Learning-based Automated Program Repaircited by 55
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2018CODIT: Code Editing with Tree-Based Neural Modelscited by 40
- 2020Synthesize, Execute and Debug: Learning to Repair for Neural Program Synthesiscited by 39
- 2024ThinkRepair: Self-Directed Automated Program Repaircited by 23
- 2023Domain Knowledge Matters: Improving Prompts with Fix Templates for Repairing Python Type Errorscited by 22
- 2018Practical Program Repair via Bytecode Mutationcited by 19
- 2025AuPair: Golden Example Pairs for Code Repaircited by 3
- 2022Neural Program Repair: Systems, Challenges and Solutionscited by 2
- 2025OASIS: Order-Augmented Strategy for Improved Code Searchcited by 2
Built on by
Citing papers per year: 2025: 2; 2026: 4.
6 papers.
- 2025VeriGuard: Enhancing LLM Agent Safety via Verified Code Generationcited by 49
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2026TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generationcited by 5
- 2026SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generationcited by 0
- 2026MemRepair: Hierarchical Memory for Agentic Repository-Level Vulnerability Repaircited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localization18 May 2026
- 2026MemRepair: Hierarchical Memory for Agentic Repository-Level Vulnerability Repair17 May 2026
- 2026SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation18 Feb 2026
- 2026TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generation11 Feb 2026
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025VeriGuard: Enhancing LLM Agent Safety via Verified Code Generation3 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
- 2024Retrieval-augmented code completion for local projects using large language models
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Models
- 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2026Improving LLM-Assisted Secure Code Generation through Retrieval-Augmented-Generation and Multi-Tool Feedback