Dense Passage Retrieval (DPR) is a neural retrieval method that uses dual-encoder models to encode questions and text passages into dense vector representations. Unlike traditional sparse retrieval (BM25), DPR captures semantic meaning, allowing it to match questions with relevant passages even when there is no keyword overlap between them.
DPR uses two separate BERT-based encoders: one for questions and one for passages. Both encoders produce single dense vector embeddings. During indexing, all passages in the corpus are encoded and stored in a vector index. At query time, the question is encoded into a vector, and the most similar passage vectors are retrieved using approximate nearest neighbor search. The training uses in-batch negatives and hard negatives to teach the model to distinguish relevant passages from similar but irrelevant ones.
The original DPR model uses separate BERT-base encoders for questions and passages, each producing 768-dimensional CLS token embeddings. Training uses contrastive loss (NLL) with in-batch negatives and BM25-mined hard negatives. The passage index is built with FAISS (typically IVF-PQ for large corpora). At query time, top-k passages are retrieved in milliseconds even over millions of passages. DPR was originally designed for open-domain question answering and showed significant improvements over BM25 on datasets like Natural Questions and TriviaQA.