Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
While Retrieval-Augmented Generation (RAG) is increasingly adopted to ground Large Language Models (LLMs) in software artifacts, the optimal configuration of its components remains an open question for software engineering (SE) tasks. The lack of systematic guidance forces practitioners into costly, ad-hoc experimentation. This paper presents a comprehensive, component-wise empirical study that dissects the RAG pipeline, evaluating over 21 distinct models and methods. Our study systematically isolates and evaluates 4 query processing techniques, 7 retrieval models spanning sparse, dense, and hybrid paradigms, 4 context refinement methods, and 6 distinct generators. We test these components on a suite of 3 core SE tasks: code generation, summarization, and repair. Our empirical findings reveal a crucial insight: the retriever-side components, particularly the choice of the retrieval algorithm, often exert a more significant influence on final system performance than the selection of the generator model. Strikingly, the classic lexical retriever BM25 demonstrates exceptionally robust performance across diverse tasks. Our analysis provides a practical, data-driven roadmap for researchers and practitioners, offering clear guidance on prioritizing optimization efforts when constructing effective RAG systems for software engineering contexts.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 40 of its 54 references that are in the map. First posted on arXiv 14 May 2026.
Builds on
40 of 54 references.
Closest ancestors · 4
Same direction, newest first
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond26 Mar
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities23 Jan
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
Other references · 36
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2024Qwen2.5 Technical Reportcited by 4,713
- 2019Unsupervised Cross-lingual Representation Learning at Scalecited by 3,907
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2017Billion-scale similarity search with GPUscited by 2,477
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,883
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2022Text Embeddings by Weakly-Supervised Contrastive Pre-trainingcited by 1,216
24 more
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2025Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Modelscited by 1,175
- 2024M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillationcited by 1,050
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023Towards General Text Embeddings with Multi-stage Contrastive Learningcited by 705
- 2019Passage Re-ranking with BERTcited by 629
- 2022Precise Zero-Shot Dense Retrieval without Relevance Labelscited by 508
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 443
- 2023Is ChatGPT Good at Search? Investigating Large Language Models as Re-Ranking Agentscited by 356
- 2023Improving Text Embeddings with Large Language Modelscited by 295
- 2023RECOMP: Improving Retrieval-Augmented LMs with Compression and Selective Augmentationcited by 253
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 151
- 2024Granite Code Models: A Family of Open Foundation Models for Code Intelligencecited by 116
- 2023Jina Embeddings 2: 8192-Token General-Purpose Text Embeddings for Long Documentscited by 103
- 2024Searching for Best Practices in Retrieval-Augmented Generationcited by 83
- 2024DebugBench: Evaluating Debugging Capability of Large Language Modelscited by 74
- 2022No More Fine-Tuning? An Experimental Evaluation of Prompt Tuning in Code Intelligencecited by 41
- 2024Do Large Language Models Rank Fairly? An Empirical Study on the Fairness of LLMs as Rankerscited by 17
- 2023Understanding Difficulty-based Sample Weighting with a Universal Difficulty Measurecited by 9
- 2024Retrieval-Augmented Test Generation: How Far Are We?cited by 7
- 2025Knowledge Graph Based Repository-Level Code Generationcited by 4
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
- 2024A Methodology for Evaluating RAG Systems: A Case Study On Configuration Dependency Validation
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
- 2024Understanding the Fundamental Design Decisions of Retrieval-Augmented Generation Systems
- 2024Seven Failure Points When Engineering a Retrieval Augmented Generation System
- 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Tasks
- 2026Mapping the RAG Landscape: A Four Axis Taxonomy of Efficiency, Defense, Interactivity, and Reasoning