What is dense retrieval?
Dense retrieval is an information retrieval method that turns queries and documents into dense vectors with learned embedding models and finds the most relevant documents by similarity between vectors.
It differs from sparse retrieval in how it matches: sparse methods such as BM25 rely on exact word overlap, while dense retrieval also catches the same meaning in different words. For searches needing exact matches, such as product codes or clause numbers, sparse methods are more reliable, so the two are often combined in hybrid search.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Vector-based retrieval, semantic retrieval
How dense retrieval works
- Documents are split into chunks, each turned into a vector by an embedding model.
- Vectors are written to an approximate nearest neighbour index such as Hierarchical Navigable Small World.
- The query is embedded with the same or a paired model; the nearest chunks are retrieved by cosine similarity or inner product.
- Retrieved chunks are reranked if needed and passed to the model as context in RAG.
In more detail
Bi-encoder architecture and how it differs from a cross-encoder
Dense retrieval relies on a bi-encoder architecture: document embeddings are computed offline and indexed once, while only the query is embedded at search time. This decouples document encoding from query latency, unlike cross-encoder rerankers that must score every query-document pair jointly.
Contrastive training and hard negatives
Dense retrievers are typically trained with contrastive learning (such as InfoNCE loss), pulling relevant query-passage pairs together while pushing away in-batch negatives and mined "hard negatives", passages that share keywords with the query but do not answer it.
The single-vector bottleneck, multi-vector retrieval and Matryoshka embeddings
Compressing a multi-paragraph chunk into a single vector creates an information bottleneck for long or multi-topic passages. Multi-vector late-interaction models (such as ColBERT) and Matryoshka Representation Learning address this trade-off between retrieval granularity and storage footprint.
Vector dimension, quantisation and HNSW memory cost
Vector dimensionality (e.g., 768 to 3,072 floats) directly drives RAM usage in HNSW indexes and search latency. Techniques such as scalar (int8) or binary quantisation and Product Quantisation (PQ) can cut memory footprints by 4x to 32x with minimal recall loss when paired with rescoring.
Why dense retrieval matters for on-premises AI
Dense retrieval is a cornerstone of in-house RAG: relevant content is found even when staff do not know the words used in documents. The embedding model and vector index run in-house, so document content stays inside. Success depends on how well the embedding model fits the language and domain; one untested on Turkish and the organisation's terms may return irrelevant chunks. As documents are updated, their vectors must be regenerated.
A telecom operator's support team uses dense retrieval on its internal knowledge base; a staff member searching “number porting” also finds instructions written as “operator change”.
Common questions
How does dense retrieval differ from keyword search?
Keyword search looks for exact word overlap. Dense retrieval looks at meaning, finding synonyms but can be weak on exact codes and numbers.
Does dense retrieval replace keyword search?
Not fully. The two make different mistakes; in-house search often combines them in hybrid search.
Related terms
- Sparse retrieval
- Embedding model
- Vector search
- Approximate nearest neighbour search
- Hybrid search
- Reranking
- BM25
- Retrieval-Augmented Generation
- Bi-encoder
Sources
- Karpukhin et al., Dense Passage Retrieval for Open-Domain Question Answering, 2020
- Reimers and Gurevych, Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks, 2019
In the glossary: Glossary, A to D