Create and explore imaginative 3D worlds with our new product Dreamfield (opens in a new tab)
Papers
Topics
Authors
Recent
Search
2000 character limit reached

Dense Retrieval

Updated 19 November 2026
  • Dense retrieval is a semantic search method that independently maps queries and documents into a shared vector space, enabling approximate-nearest-neighbor ranking that can overcome vocabulary mismatch.
  • Its effectiveness depends on training objectives, negative mining, representation granularity, and index design, with approaches such as multi-vector retrieval, lexical–dense hybrids, quantization, and tree-based search addressing different accuracy and efficiency trade-offs.
  • Dense retrieval supports applications including question answering, conversational search, recommendation, and retrieval-augmented generation, but production systems must evaluate latency, memory, updates, robustness, domain generalization, privacy, and operational cost.

Dense retrieval (DR) is an information-retrieval paradigm in which queries and documents are independently mapped into a shared low-dimensional vector space and ranked by vector similarity, typically an inner product. Given query encoder φ\varphi and document encoder ψ\psi, the representations are φ(q)∈Rk\varphi(q)\in\mathbb{R}^{k} and ψ(d)∈Rk\psi(d)\in\mathbb{R}^{k}, with relevance score r(q,d)=φ(q)⊤ψ(d)r(q,d)=\varphi(q)^\top\psi(d). Documents can be encoded offline and stored in maximum-inner-product-search or approximate-nearest-neighbor (ANN) indexes, while a query is encoded online and matched against the corpus. DR addresses vocabulary mismatch and supports semantic matching, but introduces challenges involving training objectives, representation granularity, index construction, memory, latency, robustness, generalization, and operational cost. Its development includes full-corpus training procedures, multi-vector document representations, lexical–dense hybrids, quantized and tree-based indexes, reasoning-aware retrieval, and privacy-preserving protocols.

1. Foundations and retrieval architecture

The standard DR architecture is a dual encoder, also called a bi-encoder. A query encoder and a document encoder independently produce representations:

q=φθ(q),d=ψϕ(d),\mathbf{q}=\varphi_\theta(q),\qquad \mathbf{d}=\psi_\phi(d),

and rank documents using an inner product,

f(q,d)=q⊤d.f(q,d)=\mathbf{q}^{\top}\mathbf{d}.

At inference time, the document encoder processes the corpus offline, an index is constructed over the resulting vectors, and the query encoder processes a new query. Retrieval is then expressed as:

Retrieve⁡(q,n)=TopN⁡d∈D[φ(q)⊤ψ(d)].\operatorname{Retrieve}(q,n)= \operatorname{TopN}_{d\in D}\left[\varphi(q)^\top\psi(d)\right].

This architecture contrasts with lexical retrieval systems such as BM25, which rely on term overlap, term frequency, inverse document frequency, and document-length normalization. Lexical retrieval is efficient and robust for rare names, entities, identifiers, and distinctive terms, but can fail under vocabulary mismatch. DR can match semantically related queries and documents with limited word overlap, while preserving the computational advantage of offline document encoding.

A cross-encoder jointly encodes a query–document pair using full self-attention. It is generally more expressive but must process every candidate pair at query time, making it unsuitable for direct search over millions of documents. DR therefore occupies the first-stage retrieval role, although lightweight interaction layers can be applied after dense candidate generation. In dialogue response selection, DR-BERT combines offline response embeddings and maximum-inner-product search with a candidate-level interaction layer that models both context–response and response–response interactions (Lan et al., 2021).

The primary computational costs of ordinary DR are corpus representation, vector storage, and nearest-neighbor search. Exhaustive search over NN documents of dimension kk requires approximately O(Nk)O(Nk) work for one query and stores approximately O(Nk)O(Nk) embedding values. Approximate indexes reduce practical search cost but introduce retrieval-quality trade-offs. The deployment decision therefore depends on more than ranking effectiveness: query latency, indexing throughput, storage, hardware requirements, update behavior, and robustness must also be evaluated (Hofstätter et al., 2022).

2. Training objectives and the training–inference mismatch

Conventional DR training typically uses a positive document and a selected set of negative documents. For query qiq_i, relevant document di+d_i^+, and negatives di,1−,…,di,m−d_{i,1}^-,\ldots,d_{i,m}^-, training encourages:

r(qi,di+)>r(qi,di,j−).r(q_i,d_i^+) > r(q_i,d_{i,j}^-).

The corresponding contrastive or sampled-softmax objective is:

L=−log⁡exp⁡r(qi,di+)exp⁡r(qi,di+)+∑jexp⁡r(qi,di,j−).\mathcal{L} = -\log \frac{\exp r(q_i,d_i^+)} {\exp r(q_i,d_i^+)+ \sum_j\exp r(q_i,d_{i,j}^-)}.

Negative documents may be randomly sampled, retrieved by BM25, drawn from the same minibatch, obtained by noise-contrastive estimation, or mined using asynchronously refreshed ANN indexes, as in ANCE. In-batch negatives are computationally efficient: the positive passage associated with one query becomes a negative for other queries in the batch. Their effectiveness is nevertheless constrained by batch size and by the possibility of false negatives.

A central criticism of sampled-negative training is the mismatch between the training candidate set and the deployment candidate set. Training generally reranks a selected subset, whereas inference retrieves from the entire corpus. Weak random negatives produce little pressure for top-ranking discrimination. BM25 negatives can cause a model to suppress lexical overlap, even though lexical overlap may identify relevant documents. Stale ANN negatives are generated with an old index and may cease to resemble the model’s current top-ranked documents. In-batch negatives remain a selected sample rather than the actual current retrieval result.

The Learning To Retrieve (LTRe) method addresses this mismatch by constructing a document index before training and performing full retrieval at every iteration. It encodes the corpus once with a pretrained document encoder, builds a dense index, retrieves the top nn documents for each current query batch, and applies a ranking loss to those actual retrieval results. The document embeddings remain fixed, while the query encoder is updated. Candidates are therefore selected by the same index and similarity function used at inference (Zhan et al., 2020).

LTRe uses RankNet or LambdaRank over dynamically retrieved candidates. The approach is not a full softmax over every corpus document: the loss is computed over the top retrieved documents, but those documents are obtained by searching the full corpus rather than by independently sampling negatives. If all retrieved documents are irrelevant, a known relevant document is inserted to ensure a positive comparison. With a fixed document index, gradients flow through the scores of retrieved documents but not through the discrete top-nn selection.

The results reported for LTRe include more than 170×170\times training acceleration over ANCE, arising from avoiding repeated corpus encoding and index rebuilding and from convergence in roughly 60,00060{,}000 rather than 600,000600{,}000 steps. On MS MARCO passage development, LTRe(ANCE) obtains MRR@10 =0.341=0.341 and Recall@1k =0.962=0.962, compared with ANCE’s $0.338$ and $0.960$. The method also improves the candidate pool supplied to second-stage BERT rankers.

Other training strategies target different weaknesses. LED uses a lexicon-aware SPLADE teacher to mine lexical hard negatives and impose pairwise rank-consistent regularization, transferring phrase and entity sensitivity into a single dense retriever (Zhang et al., 2022). DensePhrases uses in-passage phrase negatives, forcing the model to distinguish an answer-bearing span from neighboring spans in the same passage (Lee et al., 2021). Typo-robust dense retrieval applies dual self-teaching: misspelled queries are aligned with pristine queries while the query-retrieval direction separates each query from neighboring queries associated with different passages (Tasawong et al., 2023).

3. Representation granularity and multi-vector retrieval

A single document vector compresses all document semantics into one point. This is efficient, but a long document may contain several unrelated topics or answerable regions. Query-agnostic pooling can suppress or mix these regions. Multi-vector methods retain several document representations and allow the query to select among them.

One approach generates document-specific pseudo-query embeddings by clustering document-token representations. For document token vectors {di}i=1m\{d_i\}_{i=1}^{m}, kk-means produces centroids {cj}j=1k\{c_j\}_{j=1}^{k}. Query-dependent aggregation computes:

aj=softmax⁡(eq⊤cj),ed=∑j=1kajcj,a_j=\operatorname{softmax}(e_q^\top c_j), \qquad e_d=\sum_{j=1}^{k}a_jc_j,

followed by the document score y=eq⊤edy=e_q^\top e_d. The same document can therefore produce different effective representations for different queries. The method uses k=8k=8 for MS MARCO document ranking and k=4k=4 for other tasks in its main implementation; an ablation reports the best MRR@100 for k=16k=16, with a decline at k=32k=32 (Tang et al., 2021).

Because the exact multi-centroid score is inconvenient for standard ANN libraries, retrieval is performed in two stages. All centroids are indexed, ANN search retrieves centroid-level candidates, and the original softmax aggregation is computed only for candidate documents. The implementation retrieves R=1000kR=1000k centroid-level candidates, deduplicates them into documents, and applies exact multi-centroid rescoring. The interaction complexity is approximately O(kn)O(kn), compared with O(mn)O(mn) for token-level late interaction when documents have mm tokens and queries have nn tokens.

DensePhrases represents each passage with many phrase vectors. A phrase is any contiguous span of at most 20 words, and passage relevance is defined by the highest-scoring phrase:

f~(p,q)=max⁡s∈S(p)Es(s)⊤Eq(q).\widetilde f(p,q) = \max_{s\in\mathcal{S}(p)} E_s(s)^\top E_q(q).

Retrieved phrases are grouped by source passage or document, and the maximum phrase score becomes the score of the larger unit. Phrase retrieval can therefore support phrase, passage, and document retrieval without retraining or modifying the phrase model. On the reported QA benchmarks, DensePhrases improves early passage ranking, including NQ Top-1 from 46.0 for dataset-specific DPR to 50.1 and multi-dataset NQ Top-1 from 44.2 to 51.1. Its advantage is particularly relevant when only a small number of passages can be passed to a reader.

Fine-grained indexing also includes proposition retrieval. Propositions are atomic, contextualized, self-contained expressions of distinct facts. The FACTOIDWIKI corpus contains approximately 41 million 100-word passages, 114 million sentences, and 257 million propositions. With the same retrievers applied to different segmentation schemes, proposition indexing improves average passage Recall@5 and downstream QA under fixed word budgets. For example, across six retrievers, proposition indexing improves EM@100 over passage indexing by 5.9 points for SimCSE, 7.8 for Contriever, 5.8 for DPR, 4.9 for ANCE, 5.9 for TAS-B, and 6.9 for GTR (Chen et al., 2023).

Fine granularity has costs and limitations. Proposition generation can omit or incorrectly split information, and atomic units can lose relations required for multi-hop reasoning. Phrase and proposition indexes contain many more vectors than single-vector passage indexes. The optimal retrieval unit therefore balances semantic atomicity against contextual completeness.

Quantization and discrete representations

Product Quantization (PQ) divides a document vector into MM sub-vectors and assigns each sub-vector to one of KK centroids. With K=256K=256, each assignment can be stored in one byte. The reconstructed vector is:

d^=[c1,φ1(d),…,cM,φM(d)].\widehat{\mathbf d} = [ \mathbf c_{1,\varphi_1(d)}, \ldots, \mathbf c_{M,\varphi_M(d)} ].

RepCONC jointly trains the dual encoders and PQ representations. Its objective combines retrieval loss over quantized document vectors with reconstruction loss:

L=Lr+λLm,Lm=∥d−d^∥2.L=L_r+\lambda L_m, \qquad L_m=\|\mathbf d-\widehat{\mathbf d}\|^2.

It imposes a uniform clustering constraint so that each centroid receives approximately the same fraction of assignments. The assignment problem is relaxed to mini-batch optimal transport and solved using Sinkhorn–Knopp iterations. This prevents centroid collapse and improves code distinguishability. RepCONC also uses an IVF index to avoid scanning every compressed code (Zhan et al., 2021).

At 64-fold compression, corresponding to 48 bytes per item, RepCONC reports passage MRR@10 =0.340=0.340 on MS MARCO, compared with $0.332$ for JPQ and $0.305$ for DPQ. Its ablations show that clustering loss, uniform constraints, and dynamic hard negatives each contribute to effectiveness. More aggressive compression reduces storage and scoring cost but increases quantization error.

LTRe also examines compressed indexes using optimized product quantization. The uncompressed passage index occupies approximately 26 GB in the reported comparison. An OPQ96,IVF1,PQ96\mathrm{OPQ96,IVF1,PQ96} index uses about 0.9 GB and produces only a small effectiveness reduction when training and inference use matching index geometries. Extremely aggressive compression can make retrieved candidates resemble random negatives: broad recall may remain reasonable while top-ranking precision deteriorates.

Tree and graph indexes

JTR jointly optimizes query encoding and a tree-based index. Documents are recursively partitioned by kk-means, cluster-node embeddings are trained with a unified contrastive objective, and sibling nodes serve as hard negatives. Positive ancestors are trained along the path to a relevant leaf, encouraging a maximum-heap-like property so that beam search is less likely to prune the relevant branch. JTR additionally permits overlapping document assignments, allowing a multi-topic document to occur in multiple leaves (Li et al., 2023).

At inference, beam search traverses high-scoring tree nodes, selects leaves, and computes exact document scores only within the selected leaves. The reported complexity is:

O(βblog⁡K)+O(bNK),O(\beta b\log K)+O\left(\frac{bN}{K}\right),

where β\beta is the branching factor, bb the beam size, KK the number of leaves, and NN the number of documents. On MS MARCO passage retrieval, JTR reports MRR@100 =0.318=0.318 at 30 ms average query processing time, while JPQ reports MRR@100 =0.306=0.306 at 152 ms. On document retrieval, JTR reports MRR@100 =0.364=0.364 at 18 ms, compared with JPQ’s $0.347$ at 55 ms.

LADR uses lexical retrieval to seed a dense document-proximity graph. BM25 retrieves an initial set, neighboring documents are expanded through a precomputed graph, and dense scores determine the final ranking. Proactive LADR expands all seed neighborhoods once; Adaptive LADR iteratively expands neighbors of the currently highest-scoring dense candidates. At approximately 8 ms per query on the reported hardware, Adaptive LADR obtains strong TREC DL performance, including TAS-B nDCG =0.738=0.738 and Recall@1000 =0.872=0.872 on TREC DL 2019 and nDCG =0.739=0.739 and Recall@1000 =0.900=0.900 on TREC DL 2020 (Kulkarni et al., 2023).

Lucene HNSW integration provides dense and sparse retrieval in a single Lucene-centered software stack. On MS MARCO passage development, Lucene HNSW achieves MRR@10 =0.389=0.389, close to exact cosine search at $0.390$, while Recall@1k is $0.974$ versus $0.980$. Its main trade-off is substantially slower index construction than Faiss, although Lucene provides unified indexing and stronger reported inter-query scaling in the tested configuration (Ma et al., 2023).

5. Robustness, generalization, and specialized retrieval

Dense retrieval does not generalize uniformly across domains. A DPR model trained on NQ obtains R@20 =80.1=80.1 on NQ but $70.4$ on TriviaQA, $68.9$ on Web Questions, and $48.9$ on SQuAD. On the entity-rich T-REx QA benchmark, dense models trained on ordinary QA data can underperform BM25. Dense retrievers generalize better to unseen entities than to unseen relations: after mixed NQ/T-REx training, performance is $79.5$ for seen entities and seen relations, $75.9$ for unseen entities and seen relations, but only $52.6$ for seen entities and unseen relations (Sciavolino, 2021).

Broader training data such as PAQ, single-encoder training, and query-side fine-tuning improve out-of-domain behavior. Query-side fine-tuning freezes the passage encoder and index, retrieves actual corpus candidates, and trains only the query encoder on those candidates. It therefore aligns the query representation with the fixed passage space and reduces the mismatch between sampled training negatives and full-corpus inference. Even after these improvements, BM25 remains stronger on T-REx in the reported experiments.

Lexical and dense retrieval can be combined sequentially. In multi-hop QA, Rerank+DPR2_2 uses BM25 and BERT reranking for the first hop and a dense retriever specialized for second-hop queries. On HotpotQA full-Wiki, it obtains EM@2 =0.599=0.599, EM@10 =0.732=0.732, and EM@20 =0.762=0.762, outperforming ordinary resource-constrained MDR but remaining below the fully resourced MDR configuration (Sidiropoulos et al., 2021). The method illustrates a division of labor: lexical retrieval exploits exact entities and phrases in the first hop, while dense retrieval follows a semantic bridge in the second.

Conversation search introduces another representation problem: the current turn may be elliptical or omit the relevant entity. GPT2QR+DPR rewrites conversational queries and then applies dense retrieval. On the CAsT benchmark, Raw+DPR obtains NDCG@3 =0.145=0.145, GPT2QR+DPR =0.212=0.212, and GPT2QR+DPR with the preceding utterance =0.229=0.229. Manual rewriting reaches $0.263$, showing that query reformulation remains a substantial error source (Salamah et al., 21 Mar 2025).

Dense retrieval can also be specialized for reasoning. RaDeR constructs training data from retrieval-augmented mathematical reasoning trajectories, self-reflective relevance judgments, and rejected theorems as hard negatives. It trains on complete questions, partial chain-of-thought contexts, concise reasoning queries, and lexical queries. On BRIGHT, its best reported average nDCG@10 is 25.5 for original questions and 29.2 for GPT-4 chain-of-thought queries, compared with BM25’s 14.5 and 27.0, respectively (Das et al., 23 May 2025).

AdaQR learns a Dense Reasoner that maps an original query embedding toward the embedding of an LLM-generated reasoning rewrite. A Reasoner Router sends predictable queries through the inexpensive embedding-space mapper and difficult queries to an LLM. Across the tested BRIGHT configurations, the paper reports a 28.12% reduction in reasoning cost and a 7.24% average retrieval improvement relative to full LLM reasoning. The method’s central limitation is that its Dense Reasoner is reliable only when reasoning-induced embedding transformations are geometrically structured (Zhang et al., 27 Sep 2025).

Robustness can be improved for corrupted queries. The DST method generates misspellings through insertion, deletion, substitution, and character swaps, and applies consistency training in both query-to-passage and passage-to-query directions. With a BERT encoder, it improves misspelled-query MS MARCO MRR@10 to $0.260$, compared with $0.237$ for self-teaching; with CharacterBERT, it reaches $0.288$, compared with $0.274$. The model is deployed as an ordinary dual encoder, so the robustness mechanism affects training rather than inference architecture (Tasawong et al., 2023).

6. Deployment, privacy, and open research problems

A replacement decision between DR and term-based retrieval should consider average effectiveness together with operational constraints. In a Web-ranking case study, dense retrieval can produce higher effectiveness with competitive query latency, but vectorization and ANN-index construction are substantially more expensive. Reported document-index sizes include 2.3 GB for BM25, 5 GB for exhaustive dense FirstP, 10 GB for exhaustive dense MaxP, 8 GB for HNSW FirstP, and 18 GB for HNSW MaxP (Hofstätter et al., 2022).

Guardrails are necessary because average metrics can conceal systematic failures. Relevant tests include query length, rare-term frequency, lexical overlap, out-of-distribution generalization, long documents, minority-query regression, and semantically related but non-relevant results. In the reported MS MARCO analysis, TAS-Balanced has 0.01% zero-overlap queries and 2.64% one-overlap queries; manual judgments show P@1 =0.622=0.622 and $0.715$ for those groups. In the most stringent regression comparison, TAS-Balanced has 472 queries, or 0.97%, where BM25 is correct at rank one and dense retrieval is not.

Privacy-preserving DR treats retrieval as an encrypted matrix–vector computation. Let quantized corpus embeddings form A∈Zm×nA\in\mathbb{Z}^{m\times n} and a quantized query be x∈Znx\in\mathbb{Z}^{n}. Scoring is:

s=Ax,i∗=arg⁡max⁡isi.s=Ax, \qquad i^*=\arg\max_i s_i.

A two-round protocol encrypts the query vector, has the server compute a verifiable matrix–ciphertext product, decrypts and selects the winning index locally, and then privately fetches the selected document using an encrypted one-hot vector. The server commits to the corpus matrices and proves that returned ciphertexts correspond to the committed computation. Three-bit clipped quantization largely preserves retrieval and downstream RAG quality in the reported experiments, while private verified retrieval over moderately sized corpora requires minute-scale server time (Thibault et al., 28 Sep 2026).

The privacy protocol protects query confidentiality and retrieval integrity, not corpus completeness, model quality, answer confidentiality, or the entire RAG pipeline. Its main computational cost is proof generation, and at PubMed scale the reported throughput would imply approximately four to six hours of server computation and roughly 1 GB of communication.

Other open issues concern the semantics and limits of retrieval itself. Mechanistic analysis of DPR indicates that fine-tuning decentralizes access to knowledge already present in BERT: DPR-BERT activates more intermediate-layer neurons, while probing shows that pretrained BERT already contains substantial query–passage discrimination. Model-editing experiments report that only 37–44% of successfully inserted facts are detected after DPR training, whereas 81–100% of successfully overwritten facts remain unavailable or incorrectly matched. This suggests that dense retrieval can reorganize access to knowledge without reliably creating arbitrary missing knowledge (Reichman et al., 2024).

Future directions include broader and more diverse training data, corpus-scale and dynamically retrieved negatives, query-side alignment, lexical–dense integration, multi-vector and proposition representations, reasoning-aware supervision, uncertainty estimation, explainable retrieval, dynamic indexes, quantization-aware encoders, and methods that map internal model knowledge directly to external documents. Dense retrieval is therefore not a single algorithm but a family of representation, training, indexing, and deployment choices whose suitability depends on the target workload, corpus dynamics, latency budget, and required robustness.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (19)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Dense Retrieval.