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. Unlike sparse lexical methods like BM25, DPR captures semantic similarity by training on question-passage pairs, learning to pull relevant pairs together and push irrelevant ones apart via contrastive learning. The system retrieves the top-k passages by computing the maximum inner product search (MIPS) between the query embedding and all passage embeddings, typically using approximate nearest neighbor (ANN) indexes for scalability.
Glossary
Dense Passage Retrieval (DPR)

What is Dense Passage Retrieval (DPR)?
Dense Passage Retrieval (DPR) is a dual-encoder neural framework that retrieves relevant documents by maximizing the inner product between dense vector representations of queries and text passages.
The framework is trained with in-batch negatives, where other passages in the same mini-batch serve as negative examples, dramatically improving computational efficiency. DPR forms the foundational retrieval component in Retrieval-Augmented Generation (RAG) pipelines and open-domain question answering systems, providing factual grounding for language models. Its dense representations enable robust matching across lexical gaps—retrieving relevant content even when query and passage share no overlapping keywords—making it essential for clinical entity linking and semantic search over unstructured knowledge bases.
Key Features of DPR
Dense Passage Retrieval (DPR) is a dual-encoder framework that retrieves relevant passages by maximizing the inner product of dense query and context embeddings, offering superior semantic matching over sparse lexical methods like BM25.
Dual-Encoder Architecture
DPR uses two independent BERT-based encoders: one for queries and one for passages. This separation allows passages to be pre-encoded and indexed offline, enabling sub-linear retrieval latency at query time. The query encoder maps a natural language question to a dense vector, while the passage encoder maps every document chunk to a fixed-size embedding in the same vector space.
Inner Product Similarity Scoring
Relevance is computed as the dot product between the query embedding and each passage embedding. This operation is highly optimized for GPU acceleration and Approximate Nearest Neighbor (ANN) search. Unlike cross-encoders that process query-passage pairs jointly, the inner product allows for maximum inner product search (MIPS) over millions of pre-computed passage vectors in milliseconds.
In-Batch Negative Training
DPR is trained using a contrastive loss with hard negatives. For each relevant query-passage pair in a batch, all other passages in the same batch serve as negatives. This technique dramatically increases training efficiency by reusing computed embeddings. Additional hard negative mining—selecting high-BM25-score but irrelevant passages—further sharpens the model's disambiguation capability.
Dense vs. Sparse Retrieval
DPR overcomes the lexical gap that plagues sparse retrievers like BM25. Where BM25 relies on exact term overlap, DPR captures semantic similarity:
- Synonym handling: 'physician' matches 'doctor' without explicit mapping
- Paraphrase robustness: reworded queries retrieve the same relevant passages
- Cross-lingual potential: embeddings can align semantically across languages This makes DPR ideal for clinical text where the same concept may be expressed with highly variable terminology.
Indexing with FAISS
Pre-computed passage embeddings are indexed using Facebook AI Similarity Search (FAISS) for efficient retrieval. FAISS supports multiple index types:
- Flat Index: exact search, suitable for small corpora
- IVF (Inverted File): clusters embeddings for faster approximate search
- HNSW (Hierarchical Navigable Small World): graph-based indexing for high recall For biomedical knowledge bases with millions of entities, FAISS enables sub-10ms retrieval on commodity hardware.
Application in Clinical Entity Linking
In clinical entity linking pipelines, DPR serves as the candidate generation stage. A clinical mention (e.g., 'MI') is encoded by the query tower, and the top-k most similar UMLS concept descriptions are retrieved from a pre-indexed knowledge base. This dense retrieval step is often followed by a cross-encoder reranker for precise candidate scoring. DPR's semantic understanding is critical for resolving ambiguous abbreviations like 'MI' (myocardial infarction vs. mitral insufficiency) based on surrounding context.
Frequently Asked Questions
Explore the core mechanics and architectural decisions behind Dense Passage Retrieval, the dual-encoder framework that powers high-accuracy clinical entity linking and semantic search in modern AI systems.
Dense Passage Retrieval (DPR) is a dual-encoder neural framework designed to retrieve relevant text passages from a large knowledge base by maximizing the inner product of a query vector and a context vector. Unlike sparse lexical methods like BM25, DPR encodes both the input query and all candidate passages into dense, low-dimensional vector embeddings using two independent BERT-based transformers. During inference, the system uses Approximate Nearest Neighbor Search (ANN) to rapidly identify the passages with the highest semantic similarity to the query. The framework is trained via a contrastive learning objective, where positive pairs (query, relevant passage) are pulled together in the vector space, and negative pairs (query, irrelevant passage) are pushed apart. This allows DPR to capture deep semantic relationships, making it exceptionally effective for tasks like open-domain question answering and clinical entity linking, where a mention like 'heart attack' must be matched to the correct UMLS Concept Unique Identifier (CUI) based on contextual meaning rather than keyword overlap.
DPR vs. Sparse Retrieval (BM25)
Contrasting dense dual-encoder retrieval with traditional sparse lexical retrieval for candidate generation in clinical entity linking pipelines.
| Feature | Dense Passage Retrieval (DPR) | Sparse Retrieval (BM25) |
|---|---|---|
Core Mechanism | Learned dense embeddings via dual-encoder neural networks; relevance scored by inner product of query and passage vectors | Lexical term frequency-inverse document frequency (TF-IDF) weighting with exact token matching |
Semantic Understanding | ||
Handles Lexical Mismatch | ||
Handles Exact Term Match | ||
Zero-Shot Generalization | ||
Training Data Required | Large corpus of labeled query-passage pairs for contrastive learning | |
Inference Latency | ~10-50 ms per query (GPU-accelerated ANN search) | < 5 ms per query (CPU-based inverted index) |
Infrastructure Complexity | Requires GPU inference and vector database for approximate nearest neighbor search | Standard CPU-based inverted index (Lucene, Elasticsearch) |
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 relies on a specific architectural stack and training methodology. These related concepts define the dual-encoder framework and its optimization for high-recall semantic search.
Bi-Encoder Architecture
The foundational dual-tower neural network that defines DPR. A query encoder and a context encoder independently map text into a shared dense vector space. Unlike cross-encoders, this separation allows for offline pre-indexing of millions of passages. At inference, only the query needs to be encoded, enabling sub-linear search times via Approximate Nearest Neighbor (ANN) indexes.
Contrastive Learning
The self-supervised training paradigm used to optimize DPR. The model is trained to maximize the inner product between a query and its positive passage while minimizing it for negative passages. Key sampling strategies include:
- In-batch negatives: Other passages in the same mini-batch serve as negatives.
- Hard negative mining: Selecting high-BM25-score but incorrect passages to sharpen decision boundaries. This forces the encoder to learn fine-grained semantic distinctions.
Candidate Generation & Ranking
DPR typically serves as the first-stage retriever in a two-stage pipeline. It efficiently fetches a small subset of candidates (e.g., top-100) from a large corpus. A more computationally expensive Cross-Encoder Reranker then processes the query and each candidate jointly to produce a high-fidelity relevance score. This hybrid approach balances the speed of dense retrieval with the precision of joint encoding.
Approximate Nearest Neighbor Search (ANN)
The indexing algorithm that makes DPR viable at scale. Exhaustive vector comparison is computationally prohibitive. ANN libraries like FAISS or ScaNN cluster and compress embeddings, trading a small amount of recall for a massive gain in speed. This allows DPR to search billions of passages in milliseconds by focusing the search on the most promising regions of the vector space.
Hard Negative Mining
A critical data curation strategy for DPR training. Random negatives are too easy for the model to dismiss. Hard negatives are passages that share high lexical overlap with the query but are semantically irrelevant. Mining these using a sparse retriever like BM25 forces the dual-encoder to move beyond keyword matching and learn true semantic similarity, significantly boosting top-k retrieval accuracy.
Cross-Encoder Reranker
The high-precision second-stage model paired with DPR. While DPR encodes the query and passage independently, a cross-encoder concatenates them and processes the pair through a full transformer. This allows for deep token-level attention but is too slow for full-corpus search. It re-ranks the DPR candidates, often using a BERT-based architecture, to push the most relevant passage to the top position.

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