{
  "id": "dense-retrieval",
  "title": "Dense retrieval",
  "lang": "en",
  "source_lang": "en",
  "summary": "Dense retrieval ranks documents or other items by comparing learned vector representations of queries and candidates, enabling search beyond exact term overlap.",
  "category": "computer-science",
  "subcategory": "artificial-intelligence",
  "type": "concept",
  "aliases": [
    "Dense vector retrieval",
    "Dense embedding retrieval"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/dense-retrieval/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/dense-retrieval/",
      "json": "https://aiwiki.page/zh/dense-retrieval.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Dense retrieval is an approach to information retrieval in which queries and candidate items are represented as vectors of numerical features, and candidates are ranked by a similarity score between those representations. The vectors are usually learned by neural networks and contain many nonzero components, distinguishing them from sparse representations organized around vocabulary terms. Dense retrieval can identify relevant material even when it shares few words with a query, but its effectiveness depends on the model, training objective, corpus, and search procedure."
    },
    {
      "heading": "Representations and scoring",
      "text": "A dense retriever maps a query \\(q\\) and a candidate document \\(d\\) into a common vector space. In a typical single-vector architecture,\n\n\\[\\mathbf{q}=f_\\theta(q), \\qquad \\mathbf{d}=g_\\phi(d),\\]\n\nwhere \\(f_\\theta\\) and \\(g_\\phi\\) are encoders with learned parameters. They may share parameters or be trained separately. A document can be a complete text, a passage, a product description, or another retrievable unit.\n\nThe components of these vectors are learned features rather than explicit vocabulary entries. A coordinate generally does not have a simple interpretation such as “the frequency of the word river.” Through representation learning, the encoders instead learn combinations of features useful for the retrieval task.\n\nCommon scoring functions include the inner product,\n\n\\[s(q,d)=\\mathbf{q}^{\\mathsf T}\\mathbf{d},\\]\n\nand cosine similarity,\n\n\\[s(q,d)= \\frac{\\mathbf{q}^{\\mathsf T}\\mathbf{d}} {\\|\\mathbf{q}\\|_2\\|\\mathbf{d}\\|_2}.\\]\n\nFor unit-normalized vectors, these two scores coincide, and ranking by increasing Euclidean distance gives the same ordering. Without normalization, inner-product scores also depend on vector magnitudes.\n\nThe desired geometry is task-dependent. A model trained to retrieve answers should place a question near passages that answer it, not merely near passages discussing the same subject. Consequently, a model that performs well at measuring sentence similarity is not automatically an effective search model."
    },
    {
      "heading": "Relationship to sparse and semantic retrieval",
      "text": "Traditional text retrieval often represents documents through vocabulary-based features, such as TF–IDF, and uses ranking functions such as BM25. An inverted index efficiently identifies documents containing query terms. These approaches are particularly effective when relevant documents contain distinctive words, names, identifiers, or phrases from the query.\n\nDense retrieval can bridge vocabulary differences. For example, a query about “reducing electricity consumption” may retrieve a passage about “improving energy efficiency” without requiring explicit expansion of the query into synonyms.\n\nThe distinction is not simply “keywords versus meaning”:\n\n- Sparse systems can incorporate linguistic processing, query expansion, and learned relevance models.\n- Learned sparse retrievers can assign weights to vocabulary terms absent from the original text.\n- Dense retrievers can learn strong lexical associations and remain sensitive to wording.\n- A semantically similar document may not answer the query or satisfy its constraints.\n\nSemantic search is therefore a broader description of search behavior, whereas dense retrieval identifies a representation and retrieval approach. Dense retrieval also need not be limited to text."
    },
    {
      "heading": "Model architectures",
      "text": "Dual encoders\n\nThe most common architecture is a dual encoder, also called a bi-encoder. Queries and documents are encoded independently, allowing document vectors to be computed before queries arrive.\n\nText encoders often use the transformer architecture, including models derived from BERT. Token-level outputs are combined into a fixed-size vector through pooling or a designated output token. The choice of pooling, input formatting, and training procedure affects retrieval quality.\n\nIndependent encoding makes search over large collections practical: a new query requires one query-encoding operation rather than a separate neural-network evaluation for every query–document pair.\n\nIts principal limitation is that the model must compress each document into a representation that supports many possible future queries. A single vector may not preserve every detail relevant to a long or complex document.\n\nCross-encoders and reranking\n\nA cross-encoder processes a query and a candidate together, allowing interactions between their tokens before producing a relevance score. This richer interaction often improves ranking quality, but document computation cannot be fully reused across queries.\n\nA common pipeline therefore uses a dense retriever to select a relatively small candidate set and a cross-encoder to rerank it. This separates efficient candidate generation from more expensive relevance assessment. Reranking cannot recover a relevant document that the first-stage retriever did not select.\n\nMulti-vector and late-interaction models\n\nSome retrievers represent a document with multiple vectors, often corresponding to tokens or passages. Late-interaction models encode queries and documents independently but compare their constituent vectors during scoring.\n\nColBERT is a prominent example: its scoring aggregates, for each query token, a maximum similarity over document-token representations. This preserves finer-grained matching than a single-vector representation, at the cost of larger indexes and more complex search.\n\nMulti-vector systems complicate a strict division between dense and sparse retrieval. They use dense token representations but may rely on specialized indexing and pruning rather than one nearest-neighbor lookup per document."
    },
    {
      "heading": "Training",
      "text": "Dense retrieval is commonly trained using relevant query–document pairs. Supervision can come from human relevance judgments, question-answer pairs, interaction logs, or generated examples. Each source defines relevance differently and may introduce selection biases or noisy labels.\n\nA typical objective uses contrastive learning. Given a relevant document \\(d^+\\) and a set of negative candidates \\(D^-\\), one possible loss function is\n\n\\[\\mathcal{L}(q)= -\\log \\frac{\\exp(s(q,d^+)/\\tau)} {\\exp(s(q,d^+)/\\tau)+ \\sum_{d^-\\in D^-}\\exp(s(q,d^-)/\\tau)},\\]\n\nwhere \\(\\tau>0\\) is a temperature parameter. The objective increases the relevant document’s score relative to the sampled negatives; it does not directly compare the query with every document in the corpus.\n\nNegative selection\n\nNegative selection strongly affects the task learned by the model.\n\n- Random negatives are sampled without considering similarity and are often easy to distinguish.\n- In-batch negatives reuse documents associated with other queries in the same training batch.\n- Hard negatives are high-scoring but nonrelevant candidates retrieved by an existing system.\n- Mined negatives may be refreshed as the retriever changes.\n\nHard negatives can improve discrimination between closely related documents. However, a high-scoring document without a relevance label may actually be relevant. Treating such false negatives as incorrect can damage training, particularly when relevance judgments are incomplete.\n\nOther techniques include knowledge distillation from a stronger ranking model and fine-tuning on domain-specific examples. Training on multiple tasks or languages can improve coverage, although gains do not necessarily transfer uniformly across settings."
    },
    {
      "heading": "Indexing and query execution",
      "text": "A typical deployment has an offline indexing stage and an online retrieval stage.\n\nDuring indexing, the system divides source material into retrievable units, encodes those units, and stores their vectors together with document identifiers and associated metadata. At query time, it encodes the query, searches the vector collection, and returns high-scoring candidates. Filtering, reranking, or downstream processing may follow.\n\nExact and approximate search\n\nExact retrieval can compute the query’s score against every stored vector. For \\(N\\) vectors of dimension \\(m\\), a straightforward scan requires work proportional to \\(Nm\\) per query. Batched matrix operations on a graphics processing unit can make exact search practical for some workloads.\n\nLarge collections often use approximate nearest-neighbor search. Graph-based indexes, partitioning methods, and vector compression reduce search cost by avoiding exhaustive comparison or using approximate scores.\n\nApproximation introduces a separate source of error: the search procedure may fail to return the highest-scoring vectors even when the encoder has ranked them correctly. This differs from a relevance error, in which the model itself gives an irrelevant item a high score.\n\nFor unnormalized vectors, maximum-inner-product search is not identical to Euclidean nearest-neighbor search. Index configuration must match the intended scoring function.\n\nStorage and updates\n\nRaw vector storage requires approximately\n\n\\[Nmb\\]\n\nbytes, where \\(b\\) is the number of bytes per component. Index structures, metadata, identifiers, and source text add further overhead. Quantization and other forms of data compression can reduce memory and bandwidth requirements, sometimes at a cost in retrieval accuracy.\n\nA change to the document encoder generally requires re-encoding the corpus unless compatibility with the existing vector space is explicitly maintained. Updating source content also requires updating its representations. Operational quality therefore depends on index freshness and version consistency as well as model quality.\n\nChunking and filtering\n\nLong documents are often split into passages because encoders have finite input limits and a single vector may obscure local details. Chunk size and overlap affect the balance between contextual completeness, retrieval specificity, duplication, and storage cost.\n\nMetadata filters can constrain results by language, date, document type, or access permissions. Restrictive filters may interact with approximate search, and filtering only after candidate selection can leave too few usable results."
    },
    {
      "heading": "Hybrid retrieval",
      "text": "Hybrid retrieval combines dense retrieval with lexical or sparse retrieval. The systems may search independently and merge their rankings, or one component may supply candidates for another.\n\nCommon combination methods include weighted score fusion and reciprocal-rank fusion. Raw scores from different retrievers are not necessarily comparable, so direct score addition requires appropriate normalization or calibration.\n\nHybrid retrieval can combine the strengths of both approaches. Lexical matching is useful for exact identifiers, rare names, and specialized terminology; dense matching can recover relevant paraphrases and conceptually related expressions. The combination nevertheless adds indexing, tuning, and operational complexity, and is not guaranteed to improve every query class."
    },
    {
      "heading": "Historical development",
      "text": "Dense retrieval builds on earlier vector-space models and latent representations used in information retrieval. Word embeddings and neural matching models helped establish learned representations as practical tools for comparing text.\n\nIn the early 2010s, models such as the Deep Structured Semantic Model learned compact representations for web-search matching. Later, pretrained contextual encoders provided stronger starting points for query and document representations.\n\nThe 2020 Dense Passage Retrieval work demonstrated the effectiveness of supervised dual encoders for passage retrieval in open-domain question answering. Also in 2020, ColBERT developed a prominent late-interaction approach. Subsequent research expanded training data, negative mining, cross-domain evaluation, multilingual retrieval, and the use of larger pretrained encoders.\n\nDense retrieval later became a common component of retrieval-augmented generation, in which retrieved material supplies context to a large language model. Retrieval remains a separate task: finding related material does not ensure that generated output is supported by it."
    },
    {
      "heading": "Applications",
      "text": "Dense retrieval is used in document search, open-domain question answering, enterprise knowledge search, product discovery, and code search. It can support candidate generation in recommender systems, although those systems may optimize for preferences or interaction outcomes rather than textual relevance.\n\nIn multimodal learning, encoders can map different modalities into compatible vector spaces. Models such as CLIP enable text-to-image retrieval by comparing text and image representations. Cross-lingual retrievers similarly seek compatible representations across languages, allowing queries in one language to retrieve content in another.\n\nThe common requirement is a representation space whose similarity function aligns with the intended relevance relationship."
    },
    {
      "heading": "Evaluation and limitations",
      "text": "Evaluation must distinguish relevance quality, search approximation, and operational performance.\n\nCommon ranking measures include recall at a cutoff, mean reciprocal rank, normalized discounted cumulative gain, and average precision. Different measures emphasize different goals: finding any useful answer, retrieving most relevant items, or ordering candidates correctly. For approximate indexes, nearest-neighbor recall measures agreement with exact vector search, not agreement with human relevance judgments.\n\nOperational evaluation includes latency, throughput, memory consumption, index-building time, update cost, and performance under filtering. End-to-end evaluation may also examine whether a downstream system uses retrieved evidence correctly.\n\nImportant limitations include:\n\n- Domain sensitivity. A model trained on one corpus or query style may degrade under distribution shift.\n- Exact-detail failures. Similar vectors may not adequately distinguish negation, dates, numerical constraints, or near-identical identifiers.\n- Compression of meaning. Fixed-size representations can lose details in long or multifaceted documents.\n- Incomplete relevance labels. Evaluation may penalize useful results that were never judged.\n- Limited interpretability. Individual vector dimensions rarely provide a direct explanation of a relevance decision.\n- Security and privacy constraints. Vector similarity does not enforce authorization, remove sensitive information, or establish that retrieved content is trustworthy.\n\nDense retrieval performance is therefore a property of the complete pipeline—including corpus preparation, supervision, encoders, scoring, indexing, filtering, and evaluation—not merely of embedding dimensionality or model size."
    }
  ],
  "links": [
    "information-retrieval",
    "artificial-neural-network",
    "vector-space",
    "representation-learning",
    "tf-idf",
    "bm25",
    "inverted-index",
    "transformer-architecture",
    "bert",
    "contrastive-learning",
    "loss-function",
    "knowledge-distillation",
    "fine-tuning",
    "metadata",
    "graphics-processing-unit",
    "data-compression",
    "access-control",
    "word-embedding",
    "retrieval-augmented-generation",
    "large-language-model",
    "recommender-system",
    "multimodal-learning",
    "clip-model",
    "average-precision",
    "distribution-shift"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}