When More Retrieval Hurts: Retrieval-Augmented Code Review Generation
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Code review generation can reduce developer effort by producing concise, reviewer-style feedback for a given code snippet or code change. However, generation-only models often produce generic or off-point reviews, while retrieval-only methods struggle to adapt well to new contexts. In this paper, we view retrieval augmentation for code review as retrieval-augmented in-context learning, where retrieved historical reviews are placed in the input context as examples that guide the model's output. Based on this view, we propose RARe (Retrieval-Augmented Code Reviewer), a framework that retrieves relevant historical reviews from a corpus and conditions a large language model on the retrieved in-context examples. Experiments on two public benchmarks show that RARe outperforms strong baselines and reaches BLEU-4 scores of 12.32 and 12.96. A key finding is that more retrieval can hurt: using only the top-1 retrieved example works best, while adding more retrieved items can degrade performance due to redundancy and conflicting cues under limited context budgets. Human evaluation and interpretability analysis further support that retrieval-augmented generation reduces generic outputs and improves review focus.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 26 of its 36 references that are in the map. First posted on arXiv 7 Nov 2025.
Builds on
26 of 36 references.
Closest ancestors · 3
Same direction, newest first
- 2025Retrieval-Augmented Code Review Comment Generation13 Jun
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
Other references · 23
- 2017Attention Is All You Needcited by 59,932
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,185
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2023Unified Demonstration Retriever for In-Context Learningcited by 141
- 2023Lift Yourself Up: Retrieval-augmented Text Generation with Self Memorycited by 103
- 2022Automating Code Review Activities by Large-Scale Pre-trainingcited by 98
- 2023Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learningcited by 71
- 2022Using Pre-Trained Models to Boost Code Review Automationcited by 63
- 2020Augmenting Transformers with KNN-Based Composite Memory for Dialoguecited by 53
11 more
- 2023LLaMA-Reviewer: Advancing Code Review Automation with Large Language Models through Parameter-Efficient Fine-Tuningcited by 47
- 2020Template-Based Question Generation from Retrieved Sentences for Improved Unsupervised Question Answeringcited by 39
- 2022AUGER: Automatically Generating Review Comments with Pre-training Modelscited by 23
- 2025PISCO: Pretty Simple Compression for Retrieval-Augmented Generationcited by 20
- 2024EXIT: Context-Aware Extractive Compression for Enhancing Retrieval-Augmented Generationcited by 17
- 2019CORE: Automating Review Recommendation for Code Changescited by 14
- 2023Diverse Retrieval-Augmented In-Context Learning for Dialogue State Trackingcited by 10
- 2025SARA: Selective and Adaptive Retrieval-augmented Generation with Context Compressioncited by 9
- 2024RAG-Enhanced Commit Message Generationcited by 6
- 2023Suggestion Bot: Analyzing the Impact of Automated Suggested Changes on Code Reviewscited by 3
- 2024Retrieval-Augmented Semantic Parsing: Improving Generalization with Lexical Knowledgecited by 1
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025LAURA: Enhancing Code Review Generation with Context-Enriched Retrieval-Augmented LLM
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
- 2024Improving Retrieval-Augmented Code Comment Generation by Retrieving for Generation
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
- 2025When Retriever Meets Generator: A Joint Model for Code Comment Generation ↗
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches