Inferensys

Glossary

Dense Passage Retrieval (DPR)

A bi-encoder neural architecture that uses dense vector representations to retrieve relevant knowledge base passages or entity descriptions for candidate generation in open-domain entity linking.
Knowledge engineer constructing knowledge base on laptop, document hierarchy visible, casual office setup.
NEURAL RETRIEVAL ARCHITECTURE

What is Dense Passage Retrieval (DPR)?

Dense Passage Retrieval (DPR) is a bi-encoder neural architecture that uses dense vector representations to retrieve relevant knowledge base passages for candidate generation in open-domain entity linking and question answering.

Dense Passage Retrieval (DPR) is a retrieval architecture employing a dual-encoder framework where separate BERT-based encoders independently map questions and text passages into a shared, low-dimensional dense vector space. Relevance is computed via maximum inner product search (MIPS) between the resulting embeddings, enabling efficient semantic matching beyond lexical keyword overlap.

The model is trained using a contrastive loss with in-batch negatives, where the correct passage forms a positive pair and all other passages in the batch serve as negatives. This training regime teaches the encoder to distinguish relevant from irrelevant passages, making DPR a foundational component for retrieval-augmented generation (RAG) and open-domain entity linking pipelines.

ARCHITECTURE

Key Features of DPR

Dense Passage Retrieval (DPR) is a bi-encoder neural architecture that uses dense vector representations to retrieve relevant knowledge base passages or entity descriptions for candidate generation in open-domain entity linking. Its core innovation is the independent encoding of questions and passages into a shared dense space where relevance is computed via dot product similarity.

01

Dual-BERT Bi-Encoder Architecture

DPR employs two independent BERT-based encoders—one for questions and one for passages—that map text into dense, fixed-size vectors. Unlike cross-encoders that process question-passage pairs jointly, bi-encoders allow offline pre-computation of all passage embeddings, enabling sub-linear retrieval via approximate nearest neighbor search. The question encoder and passage encoder are trained simultaneously using a contrastive loss that maximizes the similarity between relevant pairs while minimizing it for in-batch negatives.

02

Contrastive In-Batch Negative Training

DPR is trained using a contrastive learning objective with in-batch negatives. For each relevant question-passage pair in a training batch, all other passages in the same batch serve as negative examples. This approach is computationally efficient because it reuses passage embeddings already computed for the batch. The loss function is a negative log-likelihood over the softmax of similarity scores, forcing the model to distinguish the true passage from a large pool of distractors without requiring explicit hard-negative mining.

04

Dense vs. Sparse Retrieval Paradigm

DPR represents a fundamental shift from traditional sparse retrieval methods like BM25 and TF-IDF. Where sparse methods rely on exact lexical overlap and bag-of-words representations, DPR captures semantic similarity in a learned continuous space. Key advantages include:

  • Synonym handling: 'automobile' and 'car' map to similar vectors
  • Cross-lingual potential: multilingual encoders can align semantically equivalent passages across languages
  • Paraphrase robustness: reworded queries retrieve the same relevant passages This semantic capability is critical for entity linking where surface forms vary widely.
05

Candidate Generation for Entity Linking

In entity linking pipelines, DPR serves as the candidate generation module that retrieves a shortlist of potential knowledge base entries for a given entity mention. The mention and its surrounding context are encoded as the query, while entity descriptions from Wikidata or a proprietary knowledge base form the passage index. DPR typically achieves recall@100 > 90% on standard benchmarks, dramatically reducing the search space for downstream disambiguation models while maintaining high coverage of the correct entity.

06

Index Refresh and Incremental Updates

Production DPR deployments require strategies for maintaining index freshness as knowledge bases evolve. Common approaches include:

  • Full re-indexing: periodic batch recomputation of all passage embeddings when the underlying BERT model is fine-tuned
  • Incremental indexing: computing embeddings only for newly added or modified passages and inserting them into the FAISS index
  • Versioned indices: maintaining multiple index snapshots to support A/B testing of different encoder checkpoints Efficient index management is essential for entity linking systems that must reflect real-time knowledge base updates.
DENSE PASSAGE RETRIEVAL EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about Dense Passage Retrieval (DPR), the bi-encoder architecture that revolutionized open-domain question answering and entity linking candidate generation.

Dense Passage Retrieval (DPR) is a bi-encoder neural architecture that uses dense vector representations to retrieve relevant passages from a large corpus for open-domain question answering and entity linking. It works by independently encoding both the query and each candidate passage into fixed-size dense vectors using two separate BERT-based encoders, then computing relevance via maximum inner product search (MIPS) between the query vector and all passage vectors. Unlike sparse retrieval methods like BM25 that rely on exact term matching, DPR captures semantic similarity in a continuous latent space, allowing it to retrieve passages that answer a question even when they share no overlapping keywords. The system is trained using a contrastive loss function with in-batch negatives, where positive pairs (question, relevant passage) are pulled together in the embedding space while negative pairs are pushed apart. At inference time, passage embeddings are pre-computed and indexed using FAISS for efficient approximate nearest neighbor search, enabling sub-second retrieval across millions of documents.

RETRIEVAL PARADIGM COMPARISON

DPR vs. Sparse Retrieval Methods

A technical comparison of dense vector retrieval against traditional sparse lexical methods for candidate generation in entity linking and open-domain QA.

FeatureDense Passage Retrieval (DPR)BM25 (Sparse Lexical)TF-IDF (Sparse Lexical)

Representation Basis

Dense vectors in latent semantic space (768-dim BERT embeddings)

Sparse bag-of-words vectors with term saturation curves

Sparse bag-of-words vectors with inverse document frequency weighting

Vocabulary Mismatch Handling

Exact Term Matching

Training Data Required

Large-scale question-passage pairs for fine-tuning

Top-20 Retrieval Accuracy (Natural Questions)

78.4%

59.1%

52.3%

Indexing Speed

Slower (GPU-accelerated encoding required)

Fast (inverted index construction)

Fast (inverted index construction)

Query Latency (per query)

< 50 ms (with FAISS approximate nearest neighbor)

< 10 ms

< 10 ms

Semantic Synonym Awareness

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.