RAG Retrieval Methods: Complete Guide
Retrieval is the backbone of any Retrieval-Augmented Generation (RAG) system. The quality of the documents you surface determines the ceiling of your answer quality—no amount of prompt engineering compensates for retrieving the wrong passages. This guide covers every major retrieval approach, their trade-offs, how they combine, and practical recommendations for deploying each method in a fully sovereign, on-premise environment where no data leaves your network.
Table of Contents
1. Dense Vector Retrieval
Dense vector retrieval is the standard approach in modern RAG. You embed the user’s query and all documents into a shared high-dimensional vector space using a transformer-based embedding model, then find the nearest neighbors by cosine similarity (or dot product, depending on whether the vectors are normalized). Documents that are semantically similar to the query land close together in the space, even when they share no surface-level words.
How It Works
Each document chunk is passed through an embedding model—typically a small transformer (100–400M parameters)—that outputs a fixed-length vector (384, 768, 1024, or 1536 dimensions are common). These vectors are stored in a vector index. At query time, the same model embeds the query, and an approximate nearest neighbor (ANN) algorithm finds the K stored vectors with the highest cosine similarity to the query vector.
Cosine similarity between the query vector q and document vector d is:
If vectors are L2-normalized (all embeddings have unit length), cosine similarity reduces to the dot product, which is faster to compute and is the default in most vector databases.
Sovereign-Compatible Tools
| Tool | Type | Sovereign? | Notes |
|---|---|---|---|
| Qdrant | Dedicated vector DB | Yes | Rust core, open-source (Apache 2.0). Runs in Docker on-prem. HNSW index, payload filtering, quantization support. |
| pgvector | PostgreSQL extension | Yes | Adds vector types and ANN search (HNSW, IVFFlat) to PostgreSQL. Reuses your existing DB. Best when you want relational + vector in one engine. |
| FAISS | Library (Meta) | Yes | C++ library with Python bindings. No server, no persistence layer—you build your own. Extremely fast, GPU-capable. Best for research and embedded use. |
| Milvus | Dedicated vector DB | Yes | Open-source, scales to billions of vectors. Heavier infrastructure footprint (etcd, MinIO, Pulsar). |
| Chroma | Embedded vector DB | Yes | Python-native, lightweight. Good for prototyping and small deployments. |
| Pinecone | Managed SaaS | No | Cloud-only. Avoid for sovereign deployments. Listed for comparison only. |
Dense Retrieval Summary
✓ Pros
- Semantic understanding: finds related concepts even with zero word overlap.
- Handles synonyms, paraphrasing, and natural language questions well.
- Language-agnostic with multilingual models (e.g.,
e5-mistral-multilingual,bge-m3). - Scales to millions of documents with ANN indexes (HNSW, IVF).
- Single model serves all queries—no per-domain tuning required for most cases.
✗ Cons
- Misses exact matches: a search for an ID like
ERR-47291or a function nameparseAuthToken()may not surface the exact passage because the embedding generalizes. - Requires an embedding model loaded into memory (200MB–2GB depending on model).
- Embedding quality depends on the model—domain-specific text (medical, legal, code) may need fine-tuned or domain-specific embeddings.
- Out-of-domain queries (text very different from training data) degrade performance.
- Re-embedding all documents when switching models is expensive at scale.
Recommended Embedding Models (Local)
| Model | Dimensions | Size | Best For |
|---|---|---|---|
bge-large-en-v1.5 | 1024 | 1.3GB | General English, strong MTEB scores |
bge-m3 | 1024 | 2.3GB | Multilingual, multi-granularity (dense + sparse + multi-vector in one) |
e5-large-v2 | 1024 | 1.3GB | General purpose, well-documented |
gte-large | 1024 | 1.3GB | Strong on reasoning-heavy benchmarks |
nomic-embed-text-v1.5 | 768 | 0.5GB | Lightweight, fully open weights, long context |
all-MiniLM-L6-v2 | 384 | 0.09GB | Fast prototyping, low resource |
2. Sparse Retrieval (BM25 / TF-IDF)
Sparse retrieval is the classic keyword-based approach that predates embeddings. It relies on exact term matching: if the query contains the word “indemnification,” it finds documents containing that exact word. The dominant algorithm is BM25 (Best Matching 25), an evolution of TF-IDF that incorporates term frequency saturation and document length normalization.
The BM25 Scoring Formula
Where f(t,d) is term frequency in the document, IDF(t) is inverse document frequency, |d| is document length, avgdl is average document length, and k1 (typically 1.2–2.0) and b (typically 0.75) are tuning parameters.
Sovereign-Compatible Tools
| Tool | Type | Sovereign? | Notes |
|---|---|---|---|
| Elasticsearch | Full-text search engine | Yes | Mature, battle-tested BM25. Self-hostable (note: Elastic license, not pure OSI—check current terms). Scales horizontally. |
| OpenSearch | Full-text search engine | Yes | Apache 2.0 licensed fork of Elasticsearch. Fully open-source. Recommended over Elasticsearch for new sovereign deployments. |
| PostgreSQL full-text search | Built-in PG feature | Yes | tsvector / tsquery with GIN or GiST indexes. No separate service needed. Surprisingly capable for small-to-medium sets. |
| Whoosh / Tantivy / Lucene | Library | Yes | Embed directly in your application. Tantivy (Rust) is fast and memory-efficient. No server overhead. |
| SPLADE | Neural sparse model | Yes | Neural network that produces sparse vectors—combines BM25-style exactness with learned term expansion. Runs locally. |
Sparse Retrieval Summary
✓ Pros
- Exact term matching: finds specific names, product IDs, error codes, function names, legal clause numbers with high precision.
- No embedding model needed—minimal infrastructure, low latency.
- Transparent and debuggable: you can see exactly which terms matched and why.
- Excellent for code, structured data, and identifier-heavy text.
- Works well on rare terms that dense models may not handle correctly.
- No GPU required.
✗ Cons
- No semantic understanding: a search for “car insurance” will not find a document about “auto coverage” unless you configure synonyms.
- Misses paraphrases and conceptual relationships.
- Vocabulary mismatch: users phrase queries differently than documents are written.
- Requires manual synonym lists or domain tuning for best results.
- Performs poorly on long, natural-language questions where exact keywords are absent.
- Language-specific: each language needs its own analyzer/stemmer.
3. Hybrid Search
Hybrid search combines dense and sparse retrieval to capture the strengths of both. It runs both retrieval pipelines in parallel, merges their results, and returns a unified ranking. This is the recommended default for production RAG—it costs slightly more compute but dramatically reduces the failure modes of either approach used alone.
How to Combine Dense + Sparse
Method 1: Reciprocal Rank Fusion (RRF) — Recommended
RRF is the simplest and most robust fusion method. Instead of trying to normalize incomparable score scales (cosine similarity is 0–1; BM25 is unbounded), RRF uses only the rank of each document in each result list. A document ranked #1 in dense results and #3 in sparse results gets a higher fused score than one ranked #5 and #2.
Where R is the set of retrieval systems, rankr(d) is the rank of document d in system r’s results, and k is a constant (typically 60) that dampens the influence of very high ranks. RRF is parameter-light, robust, and requires no score calibration—making it the default in production systems.
Method 2: Weighted Score Blending
Normalize each retriever’s scores to a 0–1 range, then take a weighted sum:
The weight α (typically 0.5–0.7) controls the balance. This method can outperform RRF when you have tuned the weights on your data, but it requires score normalization and is sensitive to the normalization method. Min-max and softmax normalization are common choices.
Method 3: Cascade (Two-Stage)
Use one retriever as a first-stage filter and the other as a refiner. For example, run sparse retrieval first to find all documents containing the exact key terms (high recall on identifiers), then run dense similarity only on that filtered set. Or invert it: use dense retrieval to find top-100 semantically relevant documents, then re-score those 100 with BM25 for exact-term precision. The cascade approach reduces the search space for the second stage, lowering latency at the cost of potentially missing documents the first stage filtered out.
Why Hybrid Is the Recommended Default
In production RAG systems, queries are unpredictable. Some users ask semantic questions (“What are the termination conditions?”), others search for exact identifiers (“Section 8.3”), and many do both in the same query. A pure-dense system fails on exact-match queries. A pure-sparse system fails on semantic queries. Hybrid search handles both cases with no additional engineering effort beyond running two retrievers and fusing results.
Empirically, hybrid search consistently outperforms either method alone on standard benchmarks (BEIR, MTEB) by 5–15% in nDCG. The compute overhead is modest—you run two lightweight retrievals in parallel instead of one—and the fusion step is trivially fast (sorting a few hundred items). For any deployment serving real users, the robustness gain is worth the cost.
4. Re-Ranking with Cross-Encoders
Re-ranking is a two-stage retrieval pattern. In stage one, a fast bi-encoder (the standard embedding model) retrieves a broad set of top-K candidates (e.g., 50–100 documents). In stage two, a more accurate but slower cross-encoder scores each query–document pair jointly and re-orders the candidates.
Bi-Encoder vs. Cross-Encoder
| Property | Bi-Encoder (Embedding Model) | Cross-Encoder (Re-Ranker) |
|---|---|---|
| Input | Query and document encoded separately | Query and document concatenated, encoded together |
| Output | Two vectors → similarity score | Single relevance score directly |
| Speed | Very fast (pre-computed doc vectors, one ANN lookup) | Slow (must encode each pair at query time) |
| Accuracy | Good (semantic recall) | Excellent (sees full query–document interaction) |
| Use Case | Stage 1: retrieve from millions of docs | Stage 2: re-rank top 50–100 candidates |
| Pre-computable? | Yes—document vectors stored in index | No—score depends on the specific query |
The cross-encoder sees both the query and document simultaneously in a single forward pass, allowing it to model fine-grained token-level interactions (attention between query tokens and document tokens). This makes it significantly more accurate than a bi-encoder, which must compress each into a single vector before comparison. The trade-off is that cross-encoders cannot pre-compute document representations—every query requires a fresh forward pass for every candidate document.
Recommended Cross-Encoder Models (Local / Sovereign)
| Model | Size | Notes | Sovereign? |
|---|---|---|---|
cross-encoder/ms-marco-MiniLM-L-6-v2 |
~80MB | Fast, lightweight, trained on MS MARCO. Good default. 384-dim backbone. | Yes |
cross-encoder/ms-marco-MiniLM-L-12-v2 |
~120MB | Slightly more accurate, still fast. Good middle ground. | Yes |
BAAI/bge-reranker-base |
~1.1GB | Strong general-purpose reranker. Supports multi-language. | Yes |
BAAI/bge-reranker-large |
~2.6GB | Higher accuracy, more memory. Recommended for high-value domains. | Yes |
BAAI/bge-reranker-v2-m3 |
~2.3GB | Multilingual, supports long documents. State of the art for open weights. | Yes |
jina-reranker-v2 |
~1.2GB | Strong on multilingual and code. Open weights available. | Yes |
| Cohere Rerank | Cloud API | Excellent accuracy, but cloud-hosted. Sends queries and documents to Cohere servers. | No |
bge-reranker or ms-marco-MiniLM) instead. The accuracy
gap is small (1–3% on most benchmarks) and shrinking as open models improve.
5. Query Transformation
Users are bad at writing search queries. They ask vague questions, use different vocabulary than the documents, combine multiple questions into one, or phrase things in ways no embedding model expects. Query transformation rewrites the user’s query before retrieval to improve what gets found. The LLM does the rewriting; the retrieval system runs on the improved query.
5.1 Sub-Query Decomposition
Complex multi-part questions are decomposed into simpler sub-queries. Each sub-query is run independently through the retriever, and results are merged. This dramatically improves recall for questions that span multiple documents or topics.
5.2 Query Expansion (Synonym Injection)
The LLM or a thesaurus adds synonyms and related terms to the query before retrieval. This is especially helpful for sparse retrieval, which depends on exact term matching. A query for “automobile insurance” can be expanded to include “car coverage,” “vehicle policy,” and “motor protection.”
5.3 Back-Translation (Paraphrasing)
Translate the query to another language (e.g., English → French → English) using the LLM or a translation model. The round-trip translation produces a paraphrase that uses different vocabulary, which may match documents the original query missed. This is a form of data augmentation that exploits the non-determinism of translation to generate alternative phrasings.
Query Transformation Summary
✓ Pros
- Improves recall on vague or multi-part questions.
- Bridges vocabulary gaps between users and documents.
- Can be combined with any retrieval method (dense, sparse, hybrid).
- Uses the LLM you already have—no additional models required.
- Sub-query decomposition is particularly effective for multi-hop reasoning.
✗ Cons
- Adds latency: each LLM call adds 200ms–2s before retrieval even begins.
- Sub-query decomposition multiplies retrieval calls (N sub-queries = N searches).
- LLM may generate poor or irrelevant expansions, degrading retrieval quality.
- Back-translation can introduce errors if the translation model is weak.
- Harder to debug—you must trace through the transformation to understand results.
6. Query Expansion with HyDE
HyDE (Hypothetical Document Embeddings) is a clever query expansion technique that leverages the fact that embedding models work better on document-length text than on short queries. Instead of embedding the user’s query directly, you ask the LLM to generate a hypothetical answer to the question, then embed that hypothetical answer and use it for retrieval.
Why HyDE Works
Embedding models are trained on document-length text. A short query like “What are the termination penalties?” produces a sparse, low-information vector. A hypothetical answer like “The contract specifies that early termination incurs a penalty of 30% of the remaining contract value, payable within 30 days…” is rich, document-like text whose embedding lands much closer in vector space to real documents about termination penalties. The retrieval is more precise because the embedding space is being used the way it was designed to be used.
HyDE Summary
✓ Pros
- Significantly improves retrieval for short or vague queries.
- No training or fine-tuning required—works with any embedding model.
- Bridges the query–document length mismatch in embedding space.
- Particularly effective for factoid questions with specific answers.
- Uses the LLM you already have deployed.
✗ Cons
- Adds one LLM generation step before retrieval (200ms–3s latency).
- If the LLM’s hypothetical answer is factually wrong, the embedding may retrieve irrelevant documents (the error compounds).
- Less effective for queries where the user already uses precise vocabulary matching the documents.
- Increases cost: each query now requires an LLM call before retrieval.
- Not useful for pure keyword/ID lookups where exact matching matters.
7. Step-Back Prompting
Step-back prompting is a retrieval strategy that first asks a broader, more general question to gather background context, then asks the specific question with that context in hand. It addresses the problem where a too-specific query retrieves narrow documents that lack the surrounding context needed to fully understand or answer the question.
How It Works
Given a specific user question, the LLM generates a “step-back” question—a more general version that retrieves foundational context. Both questions are run through the retriever, and their results are merged.
When Step-Back Helps
- Questions that need background: “Why did Q3 revenue drop?” benefits from first retrieving the broader “What happened in Q3?” context.
- Questions with implicit assumptions: “How fast is the new model?” benefits from first retrieving “What are the specifications of the new model?”
- Multi-hop reasoning: Questions that require connecting facts from different parts of a document set.
When Step-Back Doesn’t Help
- Simple factoid lookups where the specific question is already precise enough.
- Keyword/ID searches where broadening the query introduces noise.
- Time-sensitive questions where the broader context includes outdated information.
8. Multi-Vector Retrieval
Single-vector retrieval embeds each document chunk into one vector. Multi-vector retrieval stores multiple representations per document—for example, a summary embedding, a full-text embedding, and embeddings of key passages. At query time, the system retrieves from multiple indexes (or multiple vector fields in one index) and merges the results. This captures different aspects of relevance that a single embedding cannot.
Common Multi-Vector Strategies
| Representation | What It Captures | Best Query Type |
|---|---|---|
| Document summary | High-level topic, intent, scope | Broad conceptual questions |
| Full document text | All detail, specific facts | Detailed, specific questions |
| Key passages / sections | Important subsections, definitions | Targeted lookups within a long document |
| Document title + metadata | Document identity, type, category | Filtering, navigation, classification |
| Hypothetical questions (DPR-style) | Questions the document would answer | Natural language questions (inverts the embedding direction) |
The “Hypothetical Questions” Approach
An interesting multi-vector strategy: for each document, use the LLM to generate 3–5 questions that the document would answer. Embed those questions. At query time, compare the user’s query against these question embeddings. If the query is similar to a question the document answers, that document is likely relevant. This inverts the usual direction and can be very effective for Q&A corpora.
Multi-Vector Retrieval Summary
✓ Pros
- Captures multiple aspects of relevance per document.
- Broad conceptual queries match summaries; specific queries match full text.
- The hypothetical-questions variant is excellent for FAQ-style corpora.
- Can be combined with hybrid search and re-ranking.
- Each representation can use a different embedding model optimized for its purpose.
✗ Cons
- Storage cost multiplies: 3 representations = 3x the vectors.
- Ingestion is slower and more complex (generate summaries, extract key passages).
- Query latency increases: multiple ANN searches per query.
- Merge strategy (union, intersection, weighted) needs tuning.
- More moving parts = more failure modes.
9. Contextual Compression
Contextual compression sits between retrieval and generation. After the retriever returns top-K documents, a compression step filters and extracts only the relevant portions before sending context to the LLM. This reduces token consumption, removes irrelevant noise that could distract the LLM, and improves answer quality by focusing the generation on only what matters.
Compression Approaches
1. LLM-Based Extraction
Send each retrieved document to the LLM with the instruction: “Extract only the parts relevant to this question.” The LLM returns the relevant sentences or paragraphs. This is accurate but expensive—one LLM call per retrieved document, before the main generation call.
2. Embedding-Based Filtering
Split each retrieved document into smaller units (sentences or paragraphs). Compute the embedding similarity of each unit to the query. Keep only units above a similarity threshold. No LLM call needed—just additional embedding comparisons. Faster but less nuanced than LLM extraction.
3. Document-Level Filtering
Use a lightweight classifier or the cross-encoder re-ranker score to drop entire documents below a relevance threshold. Simple, fast, and effective when the retriever returns a mix of relevant and irrelevant documents.
Tools and Implementations
| Tool | Approach | Sovereign? | Notes |
|---|---|---|---|
| LangChain ContextualCompressionRetriever | Framework wrapper | Yes | Wraps any retriever with a compression step. Supports multiple compressor backends. Works with local LLMs (Ollama, vLLM). |
| LangChain LLMChainExtractor | LLM extraction | Yes | Sends each document to the LLM for relevant-part extraction. Configure with a local LLM endpoint for sovereignty. |
| LangChain EmbeddingsFilter | Embedding similarity filter | Yes | No LLM calls—filters by embedding similarity threshold. Fast and cheap. |
| Custom pipeline | Your own logic | Yes | Split, score, filter. Full control over the compression strategy. |
10. Citation and Source Tracking
In legal, medical, and business RAG, the answer is not enough—you must be able to trace every claim back to the specific document and passage it came from. Citation and source tracking is the practice of maintaining a chain of custody from retrieved documents through to every sentence in the generated answer.
Why Citation Matters
- Legal: An attorney citing a contract clause must point to the exact section, page, and paragraph. A vague “according to the agreement” is not actionable in court.
- Medical: A clinical decision support system must cite the specific guideline, study, or drug label its recommendation is based on. Without citations, the recommendation is unreviewable and potentially dangerous.
- Business: An analyst summarizing financial documents must cite the specific filing, page, and table. Auditors require traceability.
- Trust: Users verify answers by checking sources. Without citations, the system is a black box.
- Compliance: Regulatory frameworks (EU AI Act, sector-specific regulations) increasingly require explainability and source attribution for AI-generated content.
Citation Strategies
Strategy 1: Chunk ID Tagging (Recommended)
Assign a unique ID to every chunk at ingestion time. When the retriever returns chunks, include their IDs in the context sent to the LLM. Instruct the LLM to cite the chunk ID after each claim. This is the most reliable approach because the LLM is working with explicit, structured identifiers.
Strategy 2: Post-Hoc Sentence Matching
After the LLM generates the answer, match each sentence in the answer back to the retrieved chunks using embedding similarity. The closest chunk is the cited source. This does not require the LLM to cooperate with citation instructions, but it is less precise—the matching is heuristic and can be wrong for claims that synthesize multiple sources.
Strategy 3: Span-Level Highlighting
For maximum precision, track which character spans in the original document each claim maps to. This requires the LLM or a separate model to identify the exact text span, but it enables UI features like “click to see the highlighted passage.” This is the gold standard for legal and medical applications.
What to Store for Full Traceability
| Field | Purpose |
|---|---|
| chunk_id | Unique identifier for the chunk |
| source_doc | Original file name or document ID |
| page_number | Page in the source document (for PDFs) |
| section / heading | Section number or heading for structural context |
| char_start / char_end | Character offsets for span-level highlighting |
| retrieval_score | Score from the retriever (for debugging relevance) |
| rerank_score | Score from the cross-encoder (if re-ranking was used) |
| retrieval_method | Which method found this chunk (dense, sparse, hybrid) |
11. Comparison Table
The following table summarizes every retrieval method across the dimensions that matter for production deployment. “Sovereign-compatible” means the method can be fully deployed on-premise with no external API calls.
| Method | Accuracy | Latency | Complexity | Best For | Sovereign? |
|---|---|---|---|---|---|
| Dense Vector | High (semantic) | Low (10–50ms ANN) | Low–Medium | General-purpose semantic search, natural language Q&A | Yes |
| Sparse (BM25) | Medium (exact match) | Very Low (5–20ms) | Low | Exact term matching: IDs, names, code, legal clause numbers | Yes |
| Hybrid Search | Very High | Low (20–60ms parallel) | Medium | Production default: mixed query types, unknown user behavior | Yes |
| Cross-Encoder Re-Ranking | Very High (top-K precision) | Medium (50–200ms on CPU) | Medium | High-stakes domains: legal, medical, financial | Yes |
| Query Transformation | High (improves base retrieval) | Medium–High (adds LLM call) | Medium | Vague queries, multi-part questions, vocabulary gaps | Yes |
| HyDE | High (for short queries) | Medium–High (adds LLM call) | Medium | Factoid questions, short user queries, domain-specific corpora | Yes |
| Step-Back Prompting | High (adds context) | Medium (adds retrieval + optional LLM call) | Medium | Questions needing background context, multi-hop reasoning | Yes |
| Multi-Vector | Very High (multi-aspect) | Medium (multiple searches) | High | Long documents, diverse query types, high-value corpora | Yes |
| Contextual Compression | Improves precision of context | High (LLM-based) / Low (embedding-based) | Medium | Reducing token usage, removing noise, long retrieved documents | Yes |
| Citation Tracking | N/A (traceability, not retrieval) | Low (metadata passthrough) | Medium | Legal, medical, compliance, audit trail | Yes |
Latency Budget by Pipeline Stage
| Stage | Typical Latency | Bottleneck |
|---|---|---|
| Query embedding | 5–20ms | Embedding model forward pass |
| Dense ANN search | 5–30ms | Vector DB, index size |
| Sparse BM25 search | 5–20ms | Inverted index lookup |
| Hybrid fusion (RRF) | 1–5ms | Sorting a few hundred items |
| Cross-encoder re-ranking (50 docs) | 50–200ms (CPU), 10–50ms (GPU) | Cross-encoder forward passes |
| Query transformation (LLM) | 200ms–3s | LLM generation latency |
| HyDE (LLM generation) | 300ms–3s | LLM generation latency |
| Contextual compression (LLM, 10 docs) | 500ms–5s | N LLM calls for N documents |
| Final LLM generation | 1–10s | Output length, model size |
12. Practical Recommendations
The right retrieval method depends on your data, your users, your latency budget, and your accuracy requirements. Below are concrete recommendations for common scenarios, all assuming sovereign, on-premise deployment.
Small Document Set (<1,000 docs)
Recommended: Hybrid search with pgvector + PostgreSQL full-text search.
No separate services needed—PostgreSQL handles both vectors and keywords in one engine.
Add a lightweight cross-encoder (ms-marco-MiniLM-L-6-v2) for re-ranking if accuracy
matters.
pgvector PostgreSQL FTS RRF fusion MiniLM reranker
Large Scale (>1M documents)
Recommended: Qdrant (dense) + OpenSearch (sparse) with RRF fusion.
Dedicated engines scale better than overloaded PostgreSQL. Use HNSW indexes in Qdrant with quantization for memory efficiency. Deploy cross-encoder re-ranking only on top-50 candidates to keep latency manageable. Consider multi-vector if query diversity is high.
Qdrant OpenSearch bge-reranker-large HNSW + quantization
Medical RAG
Recommended: Hybrid search + cross-encoder re-ranking + citation tracking.
Accuracy is paramount. Use a domain-specific embedding model if available (or fine-tune a
general one on medical literature). Re-rank with bge-reranker-large. Implement
full citation tracking with chunk IDs, source document, page, and section. Use contextual
compression to extract only relevant clinical passages. Never use cloud APIs—patient data
must not leave the network.
Hybrid search bge-reranker-large Citation tracking Contextual compression
Legal RAG
Recommended: Hybrid search + cross-encoder re-ranking + HyDE + citation tracking.
Legal queries are often phrased as questions (good for HyDE). Exact clause numbers and section references need sparse retrieval. Long contracts benefit from multi-vector (summary + full text + key passages). Re-rank with cross-encoder. Full citation tracking with section numbers, page numbers, and character spans is non-negotiable.
Hybrid search HyDE Multi-vector Span-level citations
Code RAG
Recommended: Sparse-heavy hybrid + code-specific embeddings.
Code retrieval demands exact matching for function names, variable names, and API calls.
Weight sparse retrieval higher (α = 0.3 for dense, 0.7 for sparse). Use a code-aware
embedding model (jina-embeddings-v2-code or fine-tuned BGE). Consider chunking by
function/class rather than fixed-size tokens. Re-rank with a code-trained cross-encoder if
available.
BM25-weighted hybrid Code embeddings Function-level chunking
Multi-Lingual RAG
Recommended: Hybrid search with bge-m3 + cross-encoder re-ranking.
BGE-M3 supports 100+ languages and provides dense, sparse, and multi-vector outputs from a
single model—reducing infrastructure. Use bge-reranker-v2-m3 for multilingual
re-ranking. For query transformation, back-translation can help bridge cross-lingual vocabulary
gaps. Ensure your sparse retriever has appropriate analyzers/stemmers for each target language.
bge-m3 bge-reranker-v2-m3 Back-translation Language-specific analyzers
High-Throughput / Low-Latency
Recommended: Dense-only with HNSW + quantization, no LLM-based steps.
Skip query transformation, HyDE, and LLM-based contextual compression—they add LLM latency. Use dense retrieval with Qdrant HNSW + scalar quantization for sub-20ms retrieval. Optional lightweight cross-encoder on top-20 candidates if you can afford 50ms. Keep the pipeline short.
Qdrant HNSW Scalar quantization No LLM pre-processing
Maximum Accuracy (Cost Agnostic)
Recommended: Full pipeline: query transformation → hybrid search → multi-vector → cross-encoder re-ranking → contextual compression → citation tracking.
Every technique in this guide, stacked. Latency will be 3–10 seconds per query, but accuracy will be the highest achievable. Suitable for expert-system deployments where correctness matters more than speed (e.g., legal research, medical diagnosis support).
Full pipeline bge-reranker-large LLM compression Full citations
Default Production Architecture
If you are building a new RAG system today and want the best balance of accuracy, latency, and simplicity, here is the recommended default:
This pipeline delivers excellent accuracy with reasonable latency (total retrieval + re-ranking in under 300ms on commodity hardware), uses only sovereign-compatible components, and provides full citation traceability. Add query transformation or HyDE if your users tend to ask vague or short questions. Add multi-vector if your documents are long and structurally diverse.
Conclusion
Retrieval method selection is the most impactful architectural decision in a RAG system. Dense vector retrieval handles semantics; sparse retrieval handles exact matches; hybrid search combines both. Cross-encoder re-ranking sharpens precision. Query transformation, HyDE, and step-back prompting improve what gets retrieved. Multi-vector captures multiple aspects of relevance. Contextual compression cleans up what reaches the LLM. Citation tracking ensures accountability.
For sovereign, on-premise deployments, every technique described here has a fully local implementation. The only tools to avoid are cloud-hosted retrieval and re-ranking APIs (Pinecone, Cohere, Voyage) that require sending your data to external servers. The open-source ecosystem now matches or exceeds these cloud services in quality, making fully sovereign RAG not just possible but practical.
Start with hybrid search and cross-encoder re-ranking. Add stages as your accuracy requirements demand. Measure everything. Cite everything. Build for the users who will rely on these answers in high-stakes decisions.