A question and the passage that answers it may use different words. Embedding-based retrieval searches for passages by comparing vector representations rather than requiring an exact keyword match. That helps with questions such as “What causes rainfall?”, but a dense match can still miss a passage containing a crucial exact part number. section 4.1.1
A bi-encoder encodes the query and each document independently, then compares their embeddings, often with a dot product. Document vectors can be computed offline and stored in an index; a live query needs only its own embedding and a vector search. Unlike a cross-encoder, it does not run the full model on every query–document pair. That speed comes at the cost of comparing separate summaries rather than reading each pair together. section 2.3.1 section 8.6
Choose the encoder for the relationship being searched:
- For paraphrases or duplicate questions, Sentence-BERT uses shared BERT weights and training that brings similar sentences together in vector space. section 2.3.1 section 3.1
- For a short question seeking a longer answer passage, DPR uses specialized question and passage encoders trained on correct and incorrect passages. A model trained to find sentence twins may fail at this asymmetric task. section 3.1
- When an embedding model specifies different query and document formats, follow them before indexing. For example, omitting BGE’s query prefix can silently worsen retrieval. section 3.1
Table 3.1 Symmetric search vs asymmetric search
|
Feature
|
Symmetric
Search
|
Asymmetric
Search
|
|
Goal
|
Find similar text
(twins)
|
Find answers to
questions
|
|
Input
|
Similar
length/structure
|
Short query vs.
Long doc
|
|
Model
|
SBERT
|
DPR
|
|
Use Case
|
Paraphrase
detection
|
Open Domain QA
|
The symmetric-versus-asymmetric comparison helps distinguish sentence similarity from question-to-answer-passage retrieval. section 3.1
Scoring candidates
Given a batch of query embeddings and candidate-document embeddings, `tf.einsum("BD,BND->BN", query_emb, unflattened_candidate_emb)` produces one dot-product relevance score per candidate. The scores express vector alignment; they do not establish that a passage actually contains a usable answer. section 3.3 section 3.2
Retrieval-augmented systems can use these scores to select context for a reader or generator. REALM trains retrieval toward documents that help predict masked text, but needs a warm start because a random retriever supplies no useful learning signal. A modular RAG setup instead starts with pretrained DPR, keeps its document index fixed, and fine-tunes the query encoder. For higher precision, retrieve a small candidate set first and let a cross-encoder rerank it; combine keyword search when exact terms matter. section 3.2 section 4.1 section 8.6 section 4.1.1



