Context and knowledge

Semantic search

stable definition
Machine-readable Download Markdown

Definition

Semantic search embeds a query and candidate items into a vector space, then retrieves candidates whose vectors are close under a chosen similarity or distance measure. It can match related wording even when query and document share few exact terms.

The embedding model determines what "related" means. A model trained for question-passage retrieval may produce a different geometry from one trained for topic similarity or code. Similarity scores also depend on normalization and metric, so a threshold calibrated for one model cannot be copied safely to another.

Vladimir Karpukhin and colleagues' 2020 Dense Passage Retrieval paper trained separate question and passage encoders and showed that dense retrieval could compete with a strong BM25 system on its open-domain question-answering tasks. It is an influential dense-retrieval result, not the origin of semantic search.

Lexical search remains useful for identifiers, error messages, exact quotations, and rare names. Hybrid retrieval combines lexical and dense candidates, then may rerank them. Metadata filters should enforce dates, tenants, document types, or access rules before similarity is treated as relevance.

Distinguish it from nearby terms

An embedding is the representation. A vector index searches representations. Semantic search is the retrieval behavior. Reranking applies another scoring step to candidates. None of these establishes factual agreement, authority, recency, or permission.

Check your understanding

A search for error code E11000 returns conceptually related database articles but misses the exact incident runbook. Why might lexical search outperform dense similarity, and how should a hybrid system combine the candidate sets?