A list of "20 RAG techniques every AI engineer should master" made the rounds on LinkedIn. It's a good list, and its closing line is the best part: start with the basics, measure what fails and improve one stage at a time. What the list doesn't show is where each technique comes from, what it costs and which stage of the pipeline it belongs to.
This article does that, with more than 25 techniques, each one linked to its original paper or documentation. I run two RAGs in production with Postgres and pgvector, one for studying my MBA lectures and another for an agency's website, and I'll tell you where some of these techniques showed up in practice. If the concept of RAG is still new to you, start with RAG vs CAG, which covers the basics and when it isn't even worth building one.
Naive, Advanced and Modular RAG
The survey by Yunfan Gao and colleagues organized the evolution of RAG into three paradigms: "the Naive RAG, the Advanced RAG, and the Modular RAG" (Gao et al., 2023).
- Naive RAG is the one from the original 2020 paper: index, retrieve the most similar passages and generate (Lewis et al.).
- Advanced RAG adds stages before retrieval (improving the query) and after it (reordering and filtering what came back).
- Modular RAG treats each stage as a swappable part, with routes and loops, like retrieving again when the first attempt wasn't enough.
1. Indexing: How to Split and Store
It's the stage that matters most and the one that shows up least in demos. Chroma compared chunking strategies and found differences of "up to 9% in recall" between them, with a warning: "default settings for certain popular chunking strategies can lead to relatively poor performance" (Chroma, 2024).
Fixed and recursive chunking. Split by size, ideally respecting paragraphs and sentences. LangChain's recursive splitter, according to the same research, "often perform well in practice when parametrized appropriately". It's the right starting point.
Semantic chunking. Split where the topic changes. Greg Kamradt's idea generates embeddingsList of numbers that represents the meaning of a text. Similar texts produce nearby lists, which lets you search by meaning, not just matching words. for groups of sentences and splits where the distance between them jumps; it was later added to LangChain. The author himself presents his list of levels as "for fun and educational purposes", so measure before adopting it.
Late chunking. First generate the embedding of every token in the long text, and only then split, "just before mean pooling". That way each chunk carries the document's context, with no extra training, as long as the embedding model accepts long context (Günther et al., Jina AI, 2024).
Parent-child (parent document retriever). Retrieve small chunks, which produce precise embeddings, and return the larger parent, which preserves context: "Retrieve small chunks then retrieve their parent documents" (LangChain). LlamaIndex's sentence-window does something similar: it indexes sentence by sentence and keeps a window of neighboring sentences to hand to the model.
RAPTOR. Clusters and summarizes chunks recursively, building a tree of summaries. With GPT-4, it improved accuracy on the QuALITY benchmark by 20 absolute points (Sarthi et al., 2024). It's meant for questions that need a view of the whole document.
Contextual Retrieval. Before generating the embedding, an LLMAI model trained on large amounts of text to predict the next word, which lets it chat, summarize, translate and write code. writes a sentence placing each chunk within the document. In Anthropic's tests, top-20 retrieval failures dropped 35% with contextual embeddings, 49% when adding contextual BM25 and 67% with reranking. The cost is paid once: "$1.02 per million document tokens", using prompt cachingModel provider feature that stores the repeated start of an already processed prompt, charging less and answering faster on later calls. (Anthropic, 2024).
Metadata. Store the source, date, category and owner alongside each chunk. It costs almost nothing at indexing time and it's what lets you filter during retrieval. In the MBA RAG, each passage carries the subject, the tags and the lecture date, and I filter by those before asking.
2. The Query: Transform Before Retrieving
People asking questions rarely write the sentence that best matches the document.
Query rewriting. A model rewrites the query before retrieval: "Rewrite-Retrieve-Read instead of the previous retrieve-then-read" (Ma et al., 2023). It helps a lot in chat, where the question depends on the history ("and what's its deadline?").
Multi-query and RAG-Fusion. Generate several versions of the question, retrieve with all of them and merge the results. RAG-Fusion adds RRF fusion on top. A study applied at Infineon recorded the risk: some answers "strayed off topic" when the generated questions drifted away from the original (Rackauckas, 2024).
HyDE. Ask the LLM for a hypothetical answer and retrieve with it, because an answer looks more like the document than the question does. The paper itself warns that this document "is unreal and may contain false details", which is why it's only for retrieval, never for answering (Gao et al., 2022).
Step-back prompting. Before the specific question, ask a more general one ("which physics principles apply here?") and retrieve with both. With PaLM-2L, it gained 7 points in physics and 11 in chemistry on MMLU, and 27 on TimeQA (Zheng et al., 2023).
Query decomposition. Break a complex question into sub-questions. IRCoT interleaves retrieval and step-by-step reasoning and improved retrieval by up to 21 points and answers by up to 15 on multi-hop questions, like those in HotpotQA (Trivedi et al., 2022).
3. Routing: Where to Retrieve, and Whether to
Query routing. A classifier or an LLM picks the right source: the manuals index, the orders database, web search, or none. LlamaIndex defines routers as modules that take the query and a set of choices and return the most suitable one (LlamaIndex). It's also where the decision not to retrieve anything comes in, when the question is just conversation.
4. Retrieval: Words, Meaning and Filters
Vector search. Compares the query's embedding with the chunks' embeddings. It catches synonyms and paraphrases; it misses proper names, codes and acronyms.
Hybrid search. Combines vector searchDatabase that stores embeddings and quickly finds those closest to a query, the basis of meaning-based search. Examples: pgvector in Postgres, Qdrant, Pinecone. with keyword search (BM25 or Postgres full-text). The pgvector documentation recommends exactly that, "Use together with Postgres full-text search for hybrid search", and mentions two ways to combine them: RRF or a cross-encoder (pgvector).
Reciprocal Rank Fusion (RRF). For each document, sum 1 divided by (60 + its position in each list). The 60 came from a pilot test by the authors. It's simple, it doesn't require calibrating scores from different systems and it "consistently yields better results than any individual system" (Cormack, Clarke and Büttcher, SIGIR 2009).
In SQL, with pgvector and full-text, the fusion fits in one query:
WITH vetor AS (
SELECT id, row_number() OVER (ORDER BY embedding <=> $1) AS pos
FROM trechos ORDER BY embedding <=> $1 LIMIT 20
), palavra AS (
SELECT id, row_number() OVER (ORDER BY ts_rank(busca, q) DESC) AS pos
FROM trechos, websearch_to_tsquery('english', $2) q
WHERE busca @@ q ORDER BY ts_rank(busca, q) DESC LIMIT 20
)
SELECT id, sum(1.0 / (60 + pos)) AS rrf
FROM (SELECT * FROM vetor UNION ALL SELECT * FROM palavra) t
GROUP BY id ORDER BY rrf DESC LIMIT 5;Metadata filtering. Restricts retrieval by user, date or category. There's a serious trap in pgvector: with an approximate index, the filter is applied after the index. "If a condition matches 10% of rows, with HNSW and the default hnsw.ef_search of 40, only 4 rows will match on average." Since version 0.8.0 you can turn on iterative index scans (SET hnsw.iterative_scan = strict_order), which keep scanning until enough results are found. If you filter by user, the way I filter by subject in the MBA RAG, it's worth checking this today.
GraphRAG. Microsoft started from a clear limitation: "RAG fails on global questions directed at an entire text corpus". GraphRAG uses the LLM to build a graph of entities and per-community summaries, and it answers "what are the main themes?" well (Edge et al., 2024). The project's README warns that indexing "can be an expensive operation" and suggests starting small. LightRAG proposes a lighter version, with two-level retrieval and incremental updates (Guo et al., 2024).
5. Reordering: The Best at the Top

Reranking with a cross-encoder. A model reads the query and each candidate together and gives a relevance score. That's how BERT reached the top of MS MARCO in 2019, 27% above the previous state of the art in MRR@10 (Nogueira and Cho, 2019). The cost is why retrieval comes first: cross-encoders "do not scale well for large datasets", so you retrieve 50 or 100 candidates quickly and only those go through the reranker (Sentence Transformers). Anthropic notes that it "inevitably adds a small amount of latency".
ColBERT. A middle ground: it encodes query and document separately but compares them token by token at query time, the so-called late interaction. It's competitive with full BERT models while being two orders of magnitude faster (Khattab and Zaharia, 2020).
6. Context: What Goes Into the Prompt
Context compression. Cuts from the retrieved text whatever doesn't help answer. Microsoft's LLMLingua reached "up to 20x compression with little performance loss" (Jiang et al., 2023); LongLLMLingua improved performance by up to 21.4% using about 4 times fewer tokens on NaturalQuestions (Jiang et al., 2023).
Reordering against "lost in the middle". Models do better when the information is at the beginning or end of the context (Liu et al., 2023). LangChain's LongContextReorder puts the most relevant passages at the edges and the least relevant in the middle.
Less is more. Before any technique, test k. Sending 20 passages "just in case" raises cost, latency and the chance of the model leaning on the wrong passage. Context is a finite resource, as I explained in context engineering vs harness.
7. Generation: RAG That Corrects Itself
Self-RAG. The model learns to emit "reflection tokens" that decide when to retrieve and assess whether the passage and the answer hold up. It was an oral at ICLR 2024 and beat ChatGPT and Llama 2 with RAG on several tasks (Asai et al., 2023). The cost is training the model.
Corrective RAG (CRAG). A lightweight evaluator gives a confidence score to what was retrieved; if the score is low, the system discards it, refines it or goes to the web (Yan et al., 2024). It works without training the main model.
Adaptive-RAG. A small classifier estimates the complexity of the question and chooses between not retrieving, retrieving once or retrieving in several steps (Jeong et al., NAACL 2024). It saves money on the easy questions.
FLARE. Retrieves mid-generation: when the predicted next sentence has low-confidence tokens, the system retrieves before writing it (Jiang et al., 2023).
Speculative RAG. A small model writes several drafts in parallel, each with part of the passages, and a large model picks one. On PubHealth, it gained 12.97% in accuracy and cut latency by 50.83% (Wang et al., 2024).
Agentic RAG. Retrieval becomes a tool for an agent, which decides when to retrieve, from which source, with which terms and whether it needs to retrieve again. The survey by Singh and colleagues lists reflection, planning, tool use and multi-agent collaboration as the patterns, and evaluation and coordination as the open challenges (Singh et al., 2025). The concepts of agent, loop and tools are in the map of agentic AI.
8. Multimodal and Evaluation
Multimodal RAG. A PDF with tables, charts and layout loses a lot when it becomes text. ColPali embeds the image of each page directly, with late interaction, and "largely outperforms modern document retrieval pipelines while being drastically simpler" (Faysse et al., 2024). In the MBA RAG I solved it another way: images go through a vision model that describes them and extracts the text before indexing.
Evaluation. RAGAS proposed evaluating without relying on human annotation for everything (Es et al., 2023), and its documentation defines the most used metrics (Ragas):
| Metric | Measures | Points to a problem in |
|---|---|---|
| Context precision | whether the relevant passages come at the top | retrieval and reranking |
| Context recall | whether everything needed was retrieved | chunking and retrieval |
| Faithfulness | whether the answer is grounded in the context | generation (hallucination) |
| Answer relevancy | whether the answer addresses the question | generation and prompt |
ARES trains lightweight judges on synthetic data and needs "only a few hundred human annotations" to calibrate (Saad-Falcon et al., 2023).
Extras That Save Money
- Matryoshka embeddings: vectors that can be truncated with little loss, up to 14 times smaller at the same accuracy in the paper's experiment (Kusupati et al., 2022).
- Binary quantization: stores each dimension as 1 bit, 32 times less memory, keeping about 96% of retrieval performance with rescoring (Hugging Face, 2024). pgvector supports it with
binary_quantize.
Where to Start
- Evaluation set: 30 to 50 real questions with the expected answer and passage.
- Tuned recursive chunking and metadata on every chunk. Test two or three sizes.
- Hybrid search with RRF. If you use Postgres, it fits in one query.
- Reranking on the top 50 candidates.
- Contextual Retrieval if retrieval still fails because chunks lack context.
- Query transformation if the problem is the way people ask.
- Only then GraphRAG, CRAG, Self-RAG or agentic RAG, for the kind of failure that's left.
The message of the LinkedIn post bears repeating: what separates a demo from a production system isn't the number of techniques, it's how well it retrieves, checks and uses the information. To see where RAG fits among the specialties of people working in AI, read the types of AI engineering.
Tools to Try
- Hugging Face, to pick embedding and reranking models and compare them on the public leaderboards.
- Ollama, to run embeddings and a local LLM and test techniques with no per-token cost.
- Crunchy Postgres Playground, to practice SQL and full-text in the browser before building hybrid search.
Quick check
Frequently Asked Questions
Which RAG techniques should I use first?
Well-tuned chunking, hybrid search and reranking. They improve retrieval the most with the least complexity. Before them, build a set of test questions to measure the effect of each change.
What is hybrid search in RAG?
It's combining vector search, which understands meaning, with keyword search, like BM25 or Postgres full-text, which gets names, codes and acronyms right. The two lists are merged, usually with Reciprocal Rank Fusion.
What's the difference between reranking and vector search?
Vector search compares vectors computed separately and is fast across millions of passages. Reranking reads the query and each candidate together and is more accurate, but slow, so it only reorders the top results from retrieval.
What is HyDE?
It's generating a hypothetical answer with the LLM and using that answer to retrieve, because it looks more like the documents than the short question does. The generated text may contain errors, so it's only for retrieval.
Is GraphRAG worth it?
When the questions are about the whole corpus, like themes and relationships between entities, yes. For specific questions, a regular, well-tuned RAG is usually enough, and GraphRAG indexing is expensive.
What is agentic RAG?
It's giving retrieval as a tool to an agent, which decides when, where and how many times to retrieve. It handles complex questions better, at the cost of more calls and behavior that's harder to predict and evaluate.
How do you evaluate a RAG system?
By separating retrieval from generation. For retrieval, context precision and context recall; for the answer, faithfulness and answer relevancy. Tools like RAGAS compute these metrics from a set of questions.
What's the best chunk size?
There's no universal number. Chroma's research showed differences of up to 9% in recall between strategies and warned against default values. Test two or three sizes on your corpus with your questions.
References
- Yunfan Gao et al., Retrieval-Augmented Generation for Large Language Models: A Survey, 2023.
- Patrick Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, NeurIPS 2020.
- Chroma, Evaluating Chunking Strategies for Retrieval, 2024.
- Michael Günther et al., Late Chunking, 2024; Parth Sarthi et al., RAPTOR, 2024.
- Anthropic, Introducing Contextual Retrieval, 2024.
- Xinbei Ma et al., Query Rewriting for Retrieval-Augmented LLMs, 2023; Zackary Rackauckas, RAG-Fusion, 2024; Luyu Gao et al., HyDE, 2022.
- Huaixiu Steven Zheng et al., Step-Back Prompting, 2023; Harsh Trivedi et al., IRCoT, 2022.
- Gordon Cormack, Charles Clarke and Stefan Büttcher, Reciprocal Rank Fusion, SIGIR 2009.
- pgvector, documentation on hybrid search, filtering and iterative index scans, accessed in 2026.
- Rodrigo Nogueira and Kyunghyun Cho, Passage Re-ranking with BERT, 2019; Omar Khattab and Matei Zaharia, ColBERT, 2020.
- Darren Edge et al., GraphRAG, 2024; Zirui Guo et al., LightRAG, 2024.
- Huiqiang Jiang et al., LLMLingua and LongLLMLingua, 2023; Nelson F. Liu et al., Lost in the Middle, 2023.
- Akari Asai et al., Self-RAG, 2023; Shi-Qi Yan et al., Corrective RAG, 2024; Soyeong Jeong et al., Adaptive-RAG, 2024.
- Zhengbao Jiang et al., FLARE, 2023; Zilong Wang et al., Speculative RAG, 2024; Aditi Singh et al., Agentic RAG survey, 2025.
- Manuel Faysse et al., ColPali, 2024.
- Shahul Es et al., RAGAS, 2023; Jon Saad-Falcon et al., ARES, 2023.
- Aditya Kusupati et al., Matryoshka Representation Learning, 2022; Hugging Face, Embedding quantization, 2024.
- Book: Chip Huyen, AI Engineering: Building Applications with Foundation Models, O'Reilly, 2025. Chapter 6 covers RAG and agents, with a large part on retrieval and evaluation.