Skip to content

RAG techniques: 25+ every AI engineer should know

Chunking, hybrid search, RRF, reranking, HyDE, Contextual Retrieval, GraphRAG, Self-RAG, CRAG and evaluation: where each technique fits in the pipeline, its source, its cost and where to start.

Ramon Gomes 18 min read Level: Advanced

Also available in: Español, Français, Português

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.

Animated flow with the eight stages of a RAG in sequence, indexing, query, routing, retrieval, reordering, context, generation and evaluation, each with the techniques that belong to it
Each technique touches one stage. When the RAG gets it wrong, the first question is: which 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).

Diagram with three levels in sequence: naive RAG, which indexes, retrieves the k most similar and generates; advanced RAG, which adds stages before retrieval, like rewriting, and after it, like reranking; and modular RAG, with swappable stages, routes and retrieval loops
Nobody needs to jump straight to modular. Most good systems are a well-measured advanced RAG.
  • 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).

Hybrid search diagram: one list ranked by BM25 and another by vector, with documents A and C ranked well in both, combined into a final ranking where A and C rise to the top, with the formula score equals the sum of 1 over 60 plus the position
Whoever ranks well in both lists rises. Whoever only one search found still gets in, but lower down.

In SQL, with pgvector and full-text, the fusion fits in one query:

sql
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

Gold panner seen from behind, crouched at the edge of a shallow river, shaking a dented metal pan full of gravel, with a few golden specks showing between the stones
Retrieval brings the gravel; reranking is the pan. Shake it hard, little is left, and the little that's left is what counts.

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

  1. Evaluation set: 30 to 50 real questions with the expected answer and passage.
  2. Tuned recursive chunking and metadata on every chunk. Test two or three sizes.
  3. Hybrid search with RRF. If you use Postgres, it fits in one query.
  4. Reranking on the top 50 candidates.
  5. Contextual Retrieval if retrieval still fails because chunks lack context.
  6. Query transformation if the problem is the way people ask.
  7. 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

1. Why does the article organize the techniques by pipeline stage?
Show answer

Answer: Because knowing which stage the error is in tells you which technique to test

Each technique changes one stage. Finding where the RAG fails points to the right technique, instead of adopting all of them at once.

2. What does hybrid search fix that vector search alone gets wrong?
Show answer

Answer: Proper names, codes and acronyms, which keyword search matches better

Vectors catch synonyms and paraphrases but mix up exact terms. Combining them with BM25 or full-text, via RRF, covers both sides.

3. With HyDE, what should you do with the hypothetical answer the LLM writes?
Show answer

Answer: Use it only to search, never as an answer, because it may contain false details

It helps because it looks more like the document than the question does. But it's made up on purpose.

4. Why does a cross-encoder reranker come after a fast search instead of replacing it?
Show answer

Answer: Because it reads query and passage together and doesn't scale to the whole corpus

It's precise and expensive. So the search quickly brings 50 or 100 candidates, and only those go through it.

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

Source: https://ramongomessilva.com.br/blog/rag-techniques-for-ai-engineers · Accessed on December 02, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. RAG techniques: 25+ every AI engineer should know. Ramon Gomes, 20 nov. 2026. Disponível em: https://ramongomessilva.com.br/blog/rag-techniques-for-ai-engineers. Acesso em: 2 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, November 20). RAG techniques: 25+ every AI engineer should know. Ramon Gomes. https://ramongomessilva.com.br/blog/rag-techniques-for-ai-engineers

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026ragtechniquesfor,
  author = {Gomes, Ramon},
  title = {{RAG techniques: 25+ every AI engineer should know}},
  organization = {Ramon Gomes},
  year = {2026},
  month = nov,
  date = {2026-11-20},
  url = {https://ramongomessilva.com.br/blog/rag-techniques-for-ai-engineers},
  urldate = {2026-12-02}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles