Dense Passage Retrieval (DPR) is a bi-encoder architecture that independently encodes queries and documents into dense, fixed-length vector representations using dual BERT models. Unlike sparse lexical methods such as BM25, DPR captures semantic meaning beyond exact keyword overlap by training on question-passage pairs with in-batch negative sampling, enabling retrieval of relevant documents even when they share no common terminology with the query.
Glossary
Dense Passage Retrieval (DPR)

What is Dense Passage Retrieval (DPR)?
Dense Passage Retrieval (DPR) is a neural retrieval architecture that uses two independent BERT-based encoders to map queries and text passages into a shared dense vector space, where semantic similarity is computed via dot product for efficient open-domain question answering.
During inference, all passages in a corpus are pre-encoded offline into a dense index. At query time, only the query encoder runs, and the resulting vector is compared against the index using approximate nearest neighbor (ANN) search—typically via FAISS—to retrieve the top-k most semantically similar passages. This decoupled architecture makes DPR highly scalable for open-domain question answering, though it sacrifices the fine-grained token-level interactions that cross-encoder reranking stages later recover.
Key Features of Dense Passage Retrieval
Dense Passage Retrieval (DPR) is a bi-encoder architecture that independently encodes queries and passages into dense vector representations, enabling efficient semantic similarity search via approximate nearest neighbor (ANN) lookup. The following cards break down its core mechanisms and design principles.
Dual-Tower Bi-Encoder Architecture
DPR uses two independent BERT-based encoders: a query encoder and a passage encoder. This separation allows all passages in the corpus to be encoded offline into a static vector index. At query time, only the query is encoded, and its vector is used to search the pre-computed index via cosine similarity or inner product. This is fundamentally different from cross-encoders, which require processing the concatenated query-passage pair for every candidate, making them computationally prohibitive for first-pass retrieval over millions of documents.
Contrastive In-Batch Negative Training
DPR is trained using a contrastive loss with in-batch negatives. For each relevant query-passage pair in a training batch, all other passages in that same batch are treated as negative examples. This is computationally efficient because it reuses the passage embeddings already computed for the batch. The model is optimized to maximize the similarity between the query and its positive passage while minimizing similarity with all negatives. Hard negative mining—adding high-BM25-scoring but irrelevant passages—is critical for teaching the model fine-grained semantic distinctions.
ANN Indexing with FAISS
Once all passages are encoded into dense vectors, they are indexed using Facebook AI Similarity Search (FAISS) for efficient approximate nearest neighbor search. DPR typically uses Hierarchical Navigable Small World (HNSW) graphs or Inverted File with Product Quantization (IVFPQ) to compress vectors and accelerate retrieval. This enables sub-linear search time over billion-scale corpora, trading a small amount of accuracy for massive speed gains. The index can be stored entirely in memory or on disk with memory-mapped files.
Complementarity with Sparse Retrieval
DPR excels at semantic matching—finding passages that answer a question using different vocabulary than the query. However, it can struggle with precise lexical matches like rare entity names or numbers. This is why DPR is most powerful when combined with BM25 or learned sparse retrieval in a hybrid system. The two methods retrieve different result sets with high complementarity, and their outputs are fused using Reciprocal Rank Fusion (RRF) or weighted sum fusion to maximize overall recall.
Asymmetric Dataset Design
DPR training requires a specific dataset structure: natural questions paired with positive passages containing the answer span. The original DPR paper used datasets like Natural Questions, TriviaQA, and SQuAD. Critically, the positive passage is the one actually containing the answer, not just a top-ranked BM25 result. This ensures the model learns to retrieve passages that genuinely answer the question, not just those that are topically related. Negative passages are sampled from top BM25 results that do not contain the answer.
Dot Product vs. Cosine Similarity Scoring
During inference, similarity between the query vector and passage vectors is computed using either dot product or cosine similarity. DPR is typically trained with dot product, which is faster to compute and works well when vectors are L2-normalized. Cosine similarity is equivalent to dot product on normalized vectors. The choice affects ANN index configuration: FAISS supports both inner product search and L2 distance search, with inner product being the direct implementation of dot product scoring.
DPR vs. Sparse Retrieval vs. Cross-Encoder
A technical comparison of three core retrieval and scoring paradigms for answer engine pipelines.
| Feature | Dense Passage Retrieval (DPR) | Sparse Retrieval (BM25) | Cross-Encoder |
|---|---|---|---|
Architecture | Bi-Encoder (Dual-Tower) | Bag-of-Words / Inverted Index | Cross-Encoder (Single-Tower) |
Query-Document Interaction | Late Interaction (Cosine Similarity) | Exact Term Matching | Early/Full Interaction (Concatenated Input) |
Indexing Speed | Slow (Requires Neural Encoding) | Fast (Tokenization & Postings) | N/A (No Pre-indexing) |
Online Retrieval Speed | Fast (ANN Search) | Very Fast (Inverted Index Lookup) | Very Slow (Re-encodes Query-Doc Pairs) |
Semantic Understanding | |||
Handles Vocabulary Mismatch | |||
Handles Exact Term/Rare Entity Match | |||
Score Calibration | Uncalibrated Dot Product | Probabilistic (TF-IDF Derived) | Calibrated Relevance Score |
Frequently Asked Questions
Clear, technical answers to the most common questions about the bi-encoder architecture powering modern semantic search and open-domain question answering.
Dense Passage Retrieval (DPR) is a bi-encoder neural architecture that independently encodes queries and text passages into dense, low-dimensional vector representations, enabling efficient semantic similarity search via approximate nearest neighbor (ANN) lookup. Unlike sparse lexical methods like BM25 that rely on exact term matching, DPR captures deep semantic relationships. The architecture uses two separate BERT-based encoders: a query encoder and a passage encoder. During training, the model is optimized using a contrastive loss function with in-batch negatives, maximizing the dot-product similarity between a question and its relevant passage while minimizing it for all other passages in the batch. At inference time, all passages in the corpus are pre-encoded offline into a vector index. A user query is then encoded on-the-fly, and the top-k passages with the highest cosine similarity are retrieved, typically using an algorithm like Hierarchical Navigable Small World (HNSW) for sub-linear search speed. This decoupling of encoding from search is what makes DPR scalable to millions of documents while maintaining sub-100ms latency.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Dense Passage Retrieval operates within a broader ecosystem of retrieval and ranking technologies. Understanding these adjacent concepts is critical for building a production-grade hybrid search architecture.
Bi-Encoder Architecture
The foundational neural architecture powering DPR. A dual-tower model encodes queries and documents into independent dense vectors. This separation allows for offline document indexing, where millions of passages can be pre-encoded and stored, enabling sub-linear search times via ANN lookup during online querying. Contrasts with cross-encoders, which process query-document pairs jointly.
BM25 (Sparse Retrieval)
The standard lexical baseline that DPR is often fused with. BM25 is a probabilistic, bag-of-words retrieval function that excels at exact term matching and handling rare keywords. DPR complements BM25 by capturing semantic similarity, making their combination in a hybrid system highly robust. BM25 uses an inverted index for fast lookup.
Approximate Nearest Neighbor (ANN)
The class of algorithms that makes DPR scalable. Finding the exact nearest vectors in a high-dimensional space is computationally prohibitive. ANN algorithms like Hierarchical Navigable Small World (HNSW) trade a small amount of accuracy for massive speed gains, enabling sub-10ms search over billion-scale vector indexes. This is the engine behind the vector similarity search in DPR.
Cross-Encoder Reranking
A precision-focused re-ranking stage often placed after DPR. While DPR encodes passages independently for speed, a cross-encoder processes the concatenated query and candidate passage simultaneously through a transformer. This joint attention mechanism yields a fine-grained relevance score, significantly improving precision at the cost of higher latency. It is the standard second stage in a multi-stage retrieval pipeline.
Hard Negative Mining
A critical training strategy for DPR. Standard negative sampling uses random passages, which are too easy for the model to discriminate. Hard negative mining selects passages that are top-ranked by a baseline system (like BM25) but are actually irrelevant. Training with these challenging examples forces the dense encoder to learn fine-grained semantic distinctions, dramatically improving top-k retrieval accuracy.
Knowledge Distillation
A technique to build efficient DPR encoders. A powerful but slow cross-encoder teacher model scores query-passage pairs. A lightweight bi-encoder student model is then trained to mimic the teacher's relevance distribution. This distills the joint-attention precision of a cross-encoder into the fast, independent encoding architecture of DPR, yielding a high-quality yet deployable retriever.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us