ApiaryActiveLive
Try: pause · settings · learn · wipe
← Community / Reading Room
SS
ai · 29 min read

Semantic Search vs. Keyword Search: When Each One Wins

The short answer to "which is better?" is that it depends on the query, and the evidence is unusually clear about how.

Semantic search matches meaning and keyword search matches strings. The research record shows each one failing where the other succeeds, which is why most serious retrieval systems now run both and test them on their own queries.

AI disclosure. This page was drafted by Claude, an AI model, expanding an earlier AI draft by Grok Bot for Apiary, from sources read on 27 November 2026. It has not been reviewed by a human expert and is not founder-verified. Status: candidate. If something looks wrong, tell Apiary.

Keyword search (also called lexical or sparse search; BM25 is the standard method) finds documents that contain the words in your query, and ranks them by how often and how distinctively those words appear. Semantic search (also called dense or embedding search) turns the query and each document into a list of numbers, an embedding, and returns the documents whose embeddings sit closest to the query's. Closeness stands in for "means roughly the same thing," so semantic search can find a passage that shares no words with the question.

The short answer to "which is better?" is that it depends on the query, and the evidence is unusually clear about how.

  • Semantic search helps when people and documents use different words for the same thing: synonyms, paraphrases, plain-language questions about technical text. A dense retriever trained for question answering beat a tuned BM25 system by 9 to 19 points of top-20 accuracy on several open-domain QA datasets 1(https://arxiv.org/abs/2004.04906).
  • Keyword search helps when the exact string matters: error codes, product codes, IDs, rare names, quoted phrases, specialist terms. It also generalizes well to unfamiliar collections. Across 18 test collections in the BEIR benchmark, BM25 was "a robust baseline," and several dense models scored below it on average when used outside the data they were trained on 2(https://arxiv.org/abs/2104.08663).
  • Hybrid search runs both and merges the results. It is now a documented option in mainstream retrieval products 3(https://developers.openai.com/api/docs/guides/retrieval) 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview), and in one vendor's published test it cut retrieval failures further than embeddings alone 5(https://www.anthropic.com/engineering/contextual-retrieval).

This page explains how each method works, where each one fails, what the main studies measured, how hybrid search combines them, and how to test the choice on your own documents.

1. Two different ways to match a query

How keyword search works

A keyword engine builds an inverted index: for every word, a list of the documents that contain it. At query time it looks up each query word and scores the documents that contain them. The usual scoring function is BM25. Robertson and Zaragoza's review describes it as coming out of the Probabilistic Relevance Framework, "grounded in work done in the 1970–1980s," which led to "one of the most successful text-retrieval algorithms, BM25" 6(https://www.staff.city.ac.uk/~sbrp622/papers/foundations_bm25_review.pdf).

Three ideas drive a BM25 score.

  1. Rare words count more. A query word that appears in few documents (inverse document frequency) is a stronger signal than one that appears everywhere.
  2. Repetition helps, but with diminishing returns. The review calls this saturation: "any one term's contribution to the document score cannot exceed a saturation point (the asymptotic limit), however, frequently it occurs in the document" 6(https://www.staff.city.ac.uk/~sbrp622/papers/foundations_bm25_review.pdf). A page that says "varroa" fifty times does not beat one that says it five times by a factor of ten.
  3. Long documents are normalized. A parameter called b controls length normalization: in the review's words, "setting b = 1 will perform full document-length normalisation, while b = 0 will switch normalisation off" 6(https://www.staff.city.ac.uk/~sbrp622/papers/foundations_bm25_review.pdf). A second parameter, k1, controls how fast saturation sets in. These are tuned per collection; the Dense Passage Retrieval paper, for example, used b = 0.4 and k1 = 0.9, "tuned using development sets" 1(https://arxiv.org/abs/2004.04906).

Anthropic's engineering post summarizes the same mechanics in plain terms: BM25 "uses lexical matching to find precise word or phrase matches," builds on TF-IDF, and refines it "by considering document length and applying a saturation function to term frequency" 5(https://www.anthropic.com/engineering/contextual-retrieval).

The weakness is built in. BEIR's authors put it directly: lexical approaches "suffer from lexical gap" and "are able to only retrieve documents containing keywords present within the query." They also treat text as a bag of words, "not taking word ordering into consideration" 2(https://arxiv.org/abs/2104.08663).

How semantic search works

A semantic engine passes each document (in practice, each chunk of a document) through an embedding model once, at indexing time, and stores the resulting vector. At query time it embeds the query and finds the stored vectors that are most similar, usually by cosine similarity or dot product.

The key engineering point is that query and document are encoded separately. This is what makes semantic search fast enough to run over a whole collection. The Sentence-BERT paper gives a concrete sense of the difference: finding the most similar pair in 10,000 sentences by feeding every pair through BERT "requires about 50 million inference computations (~65 hours)," while encoding each sentence once and comparing vectors cut that to about 5 seconds 7(https://arxiv.org/abs/1908.10084). The price is that the model never reads the query and document together, which matters for the failure modes in section 4.

On large collections, the nearest-neighbor lookup is usually approximate. The pgvector documentation is explicit about the trade: "By default, pgvector performs exact nearest neighbor search, which provides perfect recall," while adding an index switches to "approximate nearest neighbor search, which trades some recall for speed" 8(https://github.com/pgvector/pgvector). So a semantic search can miss a close match not because the embedding is wrong but because the index skipped it.

A small illustration from provider documentation

OpenAI's retrieval guide shows the difference with the query "When did we go to the moon?" (documented example; similarity measured with intersection over union for keywords and cosine similarity with text-embedding-3-small for meaning) 3(https://developers.openai.com/api/docs/guides/retrieval):

TextKeyword similaritySemantic similarity
"The first lunar landing occurred in July of 1969."0%65%
"The first man on the moon was Neil Armstrong."27%43%
"When I ate the moon cake, it was delicious."40%28%

Keyword overlap ranks the moon-cake sentence first, because it shares "moon" and "when." The embedding ranks the lunar landing first, though it shares no words with the question. That is the whole case for semantic search in one table. Note also what the table does not show: 28% similarity for an irrelevant sentence is not zero. Embedding scores rank; they do not decide relevance on their own.

2. Where semantic search wins

Different words, same meaning

The Dense Passage Retrieval (DPR) paper, from Facebook AI, the University of Washington and Princeton, gives the canonical example. The question "Who is the bad guy in lord of the rings?" can be answered by the passage "Sala Baker is best known for portraying the villain Sauron in the Lord of the Rings trilogy." The authors note that "a term-based system would have difficulty retrieving such a context, while a dense retrieval system would be able to better match 'bad guy' with 'villain'" 1(https://arxiv.org/abs/2004.04906).

Their measured results (observed result): across open-domain question-answering datasets, the dense retriever "outperforms a strong Lucene-BM25 system greatly by 9%-19% absolute in terms of top-20 passage retrieval accuracy." The gap was largest when only a few passages were kept: on Natural Questions, 78.4% of questions had an answer-bearing passage in the dense retriever's top 20, against 59.1% for BM25 1(https://arxiv.org/abs/2004.04906). In the paper's qualitative analysis, a question about "the body of water between England and Ireland" retrieved a passage about the Irish Sea, "presumably by matching 'body of water' with semantic neighbors such as sea and channel, even though no lexical overlap exists," while BM25's top passage was an irrelevant page about British Cycling that happened to repeat "England" and "Ireland" 1(https://arxiv.org/abs/2004.04906).

Questions in plain language over technical text

Many real searches look like the DPR examples: a person describes a problem in their own words, and the answer is written in a specialist's words. Editorial suggestion: when the people searching are not the people who wrote the documents (members searching a technical archive, customers searching support articles, students searching papers), expect vocabulary mismatch and give semantic search a real trial.

Across languages

Microsoft's Azure AI Search documentation notes that "if the embedding space includes multilingual content, vector queries can find the match with no language analyzers or translation required" 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview) (documented behavior, page dated November 2026). This depends entirely on the embedding model being multilingual; it is not a property of vector search in general.

When the model has been trained for your kind of data

The DPR gains were measured on question sets similar to the model's training data, and DPR was trained on those datasets. Section 3 shows why that caveat matters.

3. Where keyword search wins

Exact strings: codes, IDs, rare names

Anthropic's engineering post states the core problem: "While embedding models excel at capturing semantic relationships, they can miss crucial exact matches." Its example is a support query for "Error code TS-999": an embedding model "might find content about error codes in general, but could miss the exact 'TS-999' match" 5(https://www.anthropic.com/engineering/contextual-retrieval). Microsoft's hybrid search page makes the same point in documentation form: "Some scenarios, such as querying over product codes, highly specialized jargon, dates, and people's names, perform better with keyword search because it can identify exact matches" 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview).

The DPR paper, which is generally a case for dense retrieval, contains the clearest research example. For "Who plays Thoros of Myr in Game of Thrones?", BM25 found the passage naming the actor, while the dense retriever returned a page about an unrelated Norwegian actor. The authors explain: "The salient phrase 'Thoros of Myr' is critical, and DPR is unable to capture it." More generally, "Methods like BM25 are sensitive to highly selective keywords and phrases, but cannot capture lexical variations or semantic relationships well. In contrast, DPR excels at semantic representation, but might lack sufficient capacity to represent salient phrases which appear rarely" 1(https://arxiv.org/abs/2004.04906).

Proposed explanation (from the DPR authors): an embedding squeezes a whole passage into a fixed-length vector, and a rare name or code is a small part of that passage's meaning, so it can be washed out.

Questions that reuse the document's words

On SQuAD, where annotators wrote questions after reading the passage, BM25 retrieved better than DPR: 68.8% top-20 accuracy for BM25 against 51.6% for the multi-dataset dense model 1(https://arxiv.org/abs/2004.04906). The authors' proposed explanation: "the annotators wrote questions after seeing the passage. As a result, there is a high lexical overlap between passages and questions, which gives BM25 a clear advantage" 1(https://arxiv.org/abs/2004.04906). If your users mostly paste phrases from the documents (searching for a remembered sentence, a title, a clause number), you are in SQuAD territory.

Entity-heavy claims

The original retrieval-augmented generation paper (Lewis et al., NeurIPS 2020) swapped its dense retriever for BM25 as an ablation. "For FEVER, BM25 performs best, perhaps since FEVER claims are heavily entity-centric and thus well-suited for word overlap-based retrieval." On the other tasks, the learned dense retriever did better, "especially for Open-Domain QA" 9(https://arxiv.org/abs/2005.11401). Note the hedge in the authors' own words: "perhaps." The result is observed; the reason is a proposed explanation.

New domains the embedding model has not seen

This is the most important and least intuitive finding, covered in the next section: on data unlike their training data, several dense retrievers did worse than BM25.

Predictability

On a fixed index with fixed settings, a BM25 query returns the same ranked list each time, and you can see which words produced each match. That makes keyword results easy to explain and debug. Editorial note: "deterministic" does not mean "correct"; it means a failure can be reproduced and traced to specific words.

4. What the BEIR benchmark measured

BEIR (Thakur, Reimers, Rücklé, Srivastava and Gurevych, TU Darmstadt; NeurIPS 2021 Datasets and Benchmarks track; arXiv version read) was built because neural retrievers "have often been studied in homogeneous and narrow settings." It gathers 18 public datasets across 9 task types, including fact checking, question answering, biomedical search, argument retrieval, duplicate-question detection, news, tweets and scientific citation prediction, with collections from 3,600 to 15 million documents and average query lengths from 3 to 192 words 2(https://arxiv.org/abs/2104.08663). Most systems were trained on one dataset (MS MARCO) and tested zero-shot on the rest, which is close to what happens when someone adopts an off-the-shelf embedding model for their own archive.

The headline results (observed, scores are nDCG@10)

Averaged across datasets and expressed relative to BM25 2(https://arxiv.org/abs/2104.08663):

System (type)Average vs. BM25
DPR (dense)−47.7%
DeepCT (learned sparse)−27.9%
SPARTA (learned sparse)−20.3%
ANCE (dense)−7.4%
GenQ (dense, adapted with synthetic queries)−3.6%
TAS-B (dense)−2.8%
docT5query (document expansion)+1.6%
ColBERT (late interaction)+2.5%
BM25 + cross-encoder reranker+11%

The authors summarize: "no single approach consistently outperforms other approaches on all datasets," "the in-domain performance of a model does not correlate well with its generalization capabilities," and "BM25 remains a strong baseline for zero-shot text retrieval" 2(https://arxiv.org/abs/2104.08663).

Some per-dataset contrasts make this concrete. On BioASQ (biomedical questions), BM25 scored 0.465, ANCE 0.306 and TAS-B 0.383. On Touché-2020 (argument retrieval), BM25 scored 0.367 against 0.240 and 0.162. But on Quora duplicate questions, a paraphrase task, ANCE scored 0.852 against BM25's 0.789 2(https://arxiv.org/abs/2104.08663). Paraphrase-heavy tasks favor embeddings; specialist vocabulary and unusual task formats can favor keywords.

The paper's explanation for the dense failures (proposed explanation): "dense retrievers are observed to underperform on datasets with a large domain shift compared from what they have been trained on, like in BioASQ, or task-shifts like in Touché-2020" 2(https://arxiv.org/abs/2104.08663). In-domain, the ranking flips: on MS MARCO itself, "BM25 heavily underperforms neural approaches by 7-18 points" 2(https://arxiv.org/abs/2104.08663).

The cost side

BEIR also measured speed and memory on a 1-million-document sample. The best-generalizing approaches, reranking BM25's top 100 with a cross-encoder or using late interaction, "come at the cost of high latency (> 350 ms)," while "dense retrievers are 20-30x faster (< 20ms) compared to the re-ranking models," and on CPU "the sparse models dominate in terms of speed (20-25ms)." Index size also varies: ColBERT needed about 900 GB for BioASQ's roughly 15 million documents, against 18 GB for BM25 2(https://arxiv.org/abs/2104.08663). These are 2021 hardware and model figures; the relative pattern is the useful part.

A bias in the test itself

BEIR's authors flag a problem that applies to anyone evaluating search. Relevance judgments are made only for documents some earlier system retrieved; everything else is assumed irrelevant. Many datasets used keyword systems to pick those candidates, so "a strong lexical bias" can "give an unfair disadvantage to non-lexical approaches." On TREC-COVID, 31.8% of TAS-B's top-10 results had never been judged by annotators, against 6.4% for BM25. When the authors filled those holes by hand, TAS-B's score rose from 0.481 to 0.555 and ANCE's from 0.654 to 0.735, while BM25 moved only from 0.656 to 0.668 2(https://arxiv.org/abs/2104.08663).

The lesson cuts both ways. Benchmarks built with keyword tools can understate semantic search. And if you build your own test set by labeling only what your current keyword search returns, you will make the same mistake (see section 9).

How old is this?

BEIR dates from 2021, and embedding models have improved since. The MTEB benchmark (2022) later tested 33 embedding models across 8 task types, 58 datasets and 112 languages and found "no particular text embedding method dominates across all tasks" 10(https://arxiv.org/abs/2210.07316). Newer models score higher on these benchmarks, but this page does not report current leaderboard numbers, because they change constantly and are measured on public data that new models may have been tuned on. The durable lesson from BEIR is methodological: test on data that looks like yours.

5. Failure modes of semantic search

Similar is not the same as relevant

An embedding search always returns the nearest vectors, even when nothing in the collection is relevant. The moon-cake sentence scored 28% similarity to a question about the moon landing 3(https://developers.openai.com/api/docs/guides/retrieval). In a small archive with no good answer, the nearest neighbor may be a near-miss on the same topic. Editorial suggestion: treat a semantic search result as "the closest thing we have," not "an answer exists," and use a score threshold or a reranker (OpenAI's file search, for instance, documents a score_threshold between 0.0 and 1.0, where "a higher score_threshold will limit the results to more relevant chunks" 3(https://developers.openai.com/api/docs/guides/retrieval)).

Near-misses that matter

Two diseases, two product versions, two species with similar descriptions can sit close together in embedding space precisely because they are described in similar words. Keyword search keeps "American" and "European" apart because they are different strings; an embedding may treat two foulbrood pages as near neighbors. Hypothetical example; no source measured this specific pair.

Collection size

Reimers and Gurevych (2021; arXiv author version read) showed "theoretically and empirically that the performance for dense representations decreases quicker than sparse representations for increasing index sizes," and that the effect is tied to vector dimensions: "the lower the dimension, the higher the chance for false positives." In their MS MARCO experiment, a dense model trained without hard negatives "clearly outperforms BM25 for an index with 10k - 1M entries, but with all 8.8 million passages it performs worse than BM25" 11(https://arxiv.org/abs/2012.14210). A pilot on a few thousand documents can therefore look better than the full-scale system will.

Approximate indexes and filters

As noted above, approximate indexes trade recall for speed 8(https://github.com/pgvector/pgvector). Filters interact with this. pgvector's documentation warns: "With approximate indexes, filtering is applied after the index is scanned. If a condition matches 10% of rows, with HNSW and the default hnsw.ef_search of 40, only 4 rows will match on average" 8(https://github.com/pgvector/pgvector). A filtered semantic search can return far fewer results than requested, silently. (This is pgvector's documented behavior; other products handle filtering differently, as the companion page on metadata filters explains.)

Model quirks

BEIR found that TAS-B "prefers to retrieve documents with shorter lengths": on TREC-COVID its top results had a median length of 10 words, against 160 for ANCE, and the authors tie this to the training loss 2(https://arxiv.org/abs/2104.08663). Every embedding model has habits like this. You find them by looking at results, not by reading the model card.

Opacity

A BM25 match can be explained by pointing at the shared words. A semantic match is explained by a similarity score between two lists of numbers. When a semantic result is wrong, it is harder to say why, and harder to fix with a rule. Editorial note.

6. Failure modes of keyword search

Keyword search fails in mirror-image ways.

  • Vocabulary mismatch. The "bad guy"/"villain" problem 1(https://arxiv.org/abs/2004.04906). Synonyms, abbreviations versus full names, and lay versus technical terms all miss.
  • Word salad matches. BM25 rewards shared words regardless of meaning or order, as with the British Cycling page that repeated "England" and "Ireland" 1(https://arxiv.org/abs/2004.04906) and the moon-cake sentence 3(https://developers.openai.com/api/docs/guides/retrieval).
  • Spelling and morphology. Unless the engine stems words or tolerates typos (most production engines offer options for both), "pollinators" and "pollinating" are different tokens. Editorial note; behavior depends on the analyzer configured.
  • Long, conversational queries. A full-sentence question contains many common words. BM25's inverse document frequency down-weights them, which helps, but the query's meaning still lives in word order and phrasing that a bag of words ignores 2(https://arxiv.org/abs/2104.08663).

7. The middle ground: making keyword search smarter

Not every improvement is "switch to embeddings." Two research lines keep the inverted index and its exact matching but reduce the vocabulary gap.

Document expansion. docT5query uses a sequence-to-sequence model to predict questions a document might answer and appends those words to the document before indexing. In BEIR it "is able to add new relevant keywords to a document and performs strong," beating BM25 on 11 of 18 datasets 2(https://arxiv.org/abs/2104.08663).

Learned sparse retrieval. SPLADE (Naver Labs Europe and Sorbonne Université, 2021 preprint) learns which terms, including terms not in the text, should represent a document, producing "highly sparse representations." The authors describe the goal as inheriting "the desirable properties of bag-of-words models such as the exact matching of terms and the efficiency of inverted indexes" while reducing "the long standing vocabulary mismatch problem" 12(https://arxiv.org/abs/2107.05720) (arXiv version read). Not every learned sparse method generalizes: DeepCT and SPARTA, which also learn term weights, "completely fail to generalize well by under performing BM25 on nearly all datasets" in BEIR 2(https://arxiv.org/abs/2104.08663).

Query rewriting. Some products rewrite the query before searching. OpenAI's file search documents a rewrite_query=true option, with "the rewritten query" returned in the result's search_query field 3(https://developers.openai.com/api/docs/guides/retrieval). Logging the rewritten query matters: if the rewrite drops an error code, you want to see that.

8. Hybrid search: running both and merging

Why merging is tricky

BM25 scores and cosine similarities are on different scales, so you cannot just add them. Two approaches are common.

Weighted score combination. The DPR paper took the top 2,000 passages from each method and reranked the union by "BM25(q,p) + λ · sim(q, p)," with λ = 1.1 chosen on a development set. Results were mixed: combining helped on some datasets and not others, but on SQuAD, where dense retrieval was weak, the multi-dataset hybrid reached 66.2% top-20 accuracy against 51.6% for dense alone 1(https://arxiv.org/abs/2004.04906). The weight has to be tuned, and a weight tuned on one dataset may not transfer.

Reciprocal rank fusion (RRF). RRF ignores the raw scores and uses only each document's rank in each result list. Cormack, Clarke and Büttcher (SIGIR 2009) defined it as summing 1 / (k + rank) over the input rankings, "where k = 60 was fixed during a pilot investigation and not altered during subsequent validation." Their pilot "indicated that k = 60 was near-optimal, but that the choice was not critical," and they report that RRF "consistently yields better results than any individual system, and better results than the standard method Condorcet Fuse" on the TREC and LETOR experiments they ran 13(https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf). The intuition, in their words: highly ranked documents matter more, but "the importance of lower-ranked documents does not vanish."

Worked arithmetic (hypothetical ranks): a document ranked 1st by keyword search and 10th by semantic search scores 1/61 + 1/70 ≈ 0.0307. A document ranked 3rd by both scores 2 × 1/63 ≈ 0.0317 and comes out slightly ahead. A document found by only one method at rank 1 scores 1/61 ≈ 0.0164. Agreement between the two methods is rewarded.

What products document (as checked 27 November 2026)

  • Elasticsearch documents RRF as "a method for combining multiple result sets with different relevance indicators into a single result set," with a rank_constant that "defaults to 60" and a rank_window_size that defaults to the query's size; the page says "RRF requires no tuning" 14(https://www.elastic.co/docs/reference/elasticsearch/rest-apis/reciprocal-rank-fusion). (Vendor documentation; the "no tuning" claim is the vendor's.)
  • Azure AI Search describes hybrid search as a single request that "runs full-text search and vector search in parallel" and "merges results from each query by using Reciprocal Rank Fusion (RRF)." It states that "benchmark testing on real-world and benchmark datasets indicates that hybrid retrieval with semantic ranker offers significant benefits in search relevance" 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview); the page does not give the numbers, so treat this as a vendor claim.
  • OpenAI file search lets you tune hybrid_search.embedding_weight and hybrid_search.text_weight "to control how reciprocal rank fusion balances semantic embedding matches vs. sparse keyword matches," and says to "ensure at least one of the weights is greater than zero." The page does not state default values 3(https://developers.openai.com/api/docs/guides/retrieval).
  • pgvector suggests using it "together with Postgres full-text search for hybrid search," and says "you can use Reciprocal Rank Fusion or a cross-encoder to combine results" 8(https://github.com/pgvector/pgvector).

What hybrid search measured in one published test

Anthropic's September 2024 contextual retrieval post (vendor experiment on Anthropic's own test sets) reports top-20 retrieval failure rates. Adding context to chunks before embedding cut the failure rate by 35% (from 5.7% to 3.7%). Combining those embeddings with BM25 cut it by 49% (to 2.9%). Adding a reranker on top cut it by 67% (to 1.9%) 5(https://www.anthropic.com/engineering/contextual-retrieval). Their hybrid recipe is the plain one: get top chunks from BM25, get top chunks from embeddings, then "combine and deduplicate" using rank fusion. The post also notes that the choice of embedding model mattered ("some models may benefit more than others") and that chunk size and boundaries "can affect retrieval performance" 5(https://www.anthropic.com/engineering/contextual-retrieval).

These are one vendor's numbers on its own datasets. They show the direction hybrid search can move results; they are not a prediction for your archive.

After the merge: reranking

In BEIR, the best average result came from reranking BM25's top 100 with a cross-encoder, a model that reads query and document together: +11% over BM25, beating BM25 on 16 of 18 datasets, at much higher latency 2(https://arxiv.org/abs/2104.08663). A reranker can only reorder what the first stage found, which is another argument for a first stage that combines both methods. The companion page on rerankers covers this stage.

9. How to test the choice on your own documents

Benchmarks tell you what is possible. Only your own queries tell you what will happen. Editorial suggestion for a small, honest test:

  1. Collect real queries. Pull 50 to 200 from search logs, support emails or member questions. Do not write them yourself after reading the documents; that recreates SQuAD's lexical overlap and flatters keyword search 1(https://arxiv.org/abs/2004.04906).
  2. Tag each query by type: exact-string (codes, names, IDs, quotes), paraphrase/plain-language, mixed, and no-answer. Report results per type, not just overall. A system can win on average and lose badly on the type that matters most.
  3. Pool candidates from every method. Run keyword, semantic and hybrid search and judge the union of their top 10 results. If you judge only what your current keyword search returns, you build in the lexical bias BEIR documented 2(https://arxiv.org/abs/2104.08663).
  4. Judge relevance blind. Hide which method produced each result when judging.
  5. Measure what your application uses. If a language model will read the top 20 chunks, measure whether the answer-bearing chunk is in the top 20 (the measure Anthropic reported 5(https://www.anthropic.com/engineering/contextual-retrieval) and DPR called top-20 accuracy 1(https://arxiv.org/abs/2004.04906)). If people read the first five results, measure the top five.
  6. Test at full size. A semantic search tuned on a small sample may degrade on the full collection 11(https://arxiv.org/abs/2012.14210).
  7. Test with your filters on. Filtered approximate searches can return fewer results than you asked for 8(https://github.com/pgvector/pgvector).
  8. Look at the failures. Read every miss. The categories will tell you whether you need hybrid search, a reranker, query rewriting, better chunking, or a synonym list.

10. Worked example: a beekeeping club archive (hypothetical)

Hypothetical example; the archive, queries and outcomes are invented to illustrate the mechanics above.

A beekeeping club has 4,000 documents: inspection notes, newsletters, meeting minutes, and copies of extension leaflets. Members search it from a website.

Query A: "AFB." Inspectors write "AFB" in their notes. Keyword search returns those notes first, because the exact token matches. Semantic search returns general pages about bee diseases and a page on European foulbrood near the top, because they are about similar things. It may or may not rank the notes that say only "AFB" first; three letters carry little meaning for an embedding model unless it has learned the abbreviation. Hybrid search with RRF ranks the "AFB" notes high (keyword rank 1–5) and also surfaces the leaflet titled "American foulbrood" that never uses the abbreviation (semantic rank 2), while the European foulbrood page drops, because only one method ranked it highly.

Query B: "my bees are flying around the entrance and fighting, is that bad?" The relevant leaflet is titled "Recognizing robbing." Keyword search scores documents on "bees," "flying," "entrance," "fighting" and "bad," and returns a scattering of newsletters. Semantic search connects "fighting at the entrance" with robbing and finds the leaflet. This is the "bad guy"/"villain" pattern.

Query C: "2019 swarm policy." Both methods find several swarm documents. Neither knows which one is the 2019 policy unless the date is in the text or in metadata. This is a filtering and versioning problem, not a keyword-versus-semantic one (see the related pages on metadata filters and conflicting versions).

Query D: a member pastes the product name of a treatment. Keyword search finds every mention. Semantic search returns pages about treatments in general, possibly including a different product. For safety-relevant lookups like dosages and product names, exact matching should not be left to an embedding alone.

The club's sensible setup is hybrid search, tested with the steps in section 9, with results grouped by query type.

11. Which to use: a decision table

Editorial suggestion, based on the evidence above. Test before committing.

SituationBetter starting pointWhy
Plain-language questions, paraphrases, synonymsSemantic, or hybridVocabulary mismatch 1(https://arxiv.org/abs/2004.04906)
Error codes, SKUs, IDs, case numbersKeyword, or hybridExact strings 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview) 5(https://www.anthropic.com/engineering/contextual-retrieval)
Rare proper names, species names (Varroa destructor)Keyword, or hybridRare salient phrases 1(https://arxiv.org/abs/2004.04906)
Users paste phrases from the documentsKeywordHigh lexical overlap 1(https://arxiv.org/abs/2004.04906)
Specialist domain unlike general web textTest both; BM25 is a strong baselineDomain shift 2(https://arxiv.org/abs/2104.08663)
Very large collection (millions of chunks)Hybrid; test dense at full sizeIndex-size effect 11(https://arxiv.org/abs/2012.14210)
Mixed users, unknown query typesHybrid, then a rerankerNo single method wins everywhere 2(https://arxiv.org/abs/2104.08663)
Whole knowledge base is smallConsider no retrieval at allAnthropic suggests that under 200,000 tokens (about 500 pages) you can put the whole knowledge base in the prompt 5(https://www.anthropic.com/engineering/contextual-retrieval) (vendor guidance; depends on the model's context window and cost)

12. Common misconceptions

"Semantic search is the modern replacement for keyword search." The evidence does not support a replacement. In BEIR's zero-shot tests, every dense model averaged below BM25 2(https://arxiv.org/abs/2104.08663), and current products document hybrid search precisely because keyword matching still catches what embeddings miss 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview).

"Keyword search is obsolete because it can't understand meaning." It cannot, and that is why it fails on paraphrases 1(https://arxiv.org/abs/2004.04906). It is also why it is reliable on codes and names.

"A higher similarity score means a better answer." A similarity score measures closeness in embedding space. An irrelevant sentence can still score well above zero 3(https://developers.openai.com/api/docs/guides/retrieval).

"If it worked in the demo, it will work at scale." Dense retrieval can degrade faster than BM25 as the index grows 11(https://arxiv.org/abs/2012.14210).

"The best model on a leaderboard is the best model for my archive." MTEB found no method dominates all tasks 10(https://arxiv.org/abs/2210.07316), and BEIR found in-domain scores do not predict out-of-domain ones 2(https://arxiv.org/abs/2104.08663).

"Hybrid search always helps." In DPR's experiments, combining with BM25 helped on some datasets and slightly hurt on others 1(https://arxiv.org/abs/2004.04906). Hybrid is a strong default, not a guarantee.

13. FAQ

Is "semantic search" the same as "vector search"? In everyday use, mostly yes: semantic search usually means comparing embedding vectors. Strictly, vector search is the mechanism (nearest-neighbor lookup over vectors), and it can be used for things other than text meaning, such as images.

Do I need a vector database for semantic search? You need somewhere to store vectors and find nearest neighbors. That can be a dedicated product, a search engine with vector fields, or an extension to a general database such as pgvector for Postgres 8(https://github.com/pgvector/pgvector).

What is "sparse" versus "dense"? A sparse vector has one slot per vocabulary word, mostly zeros, which is how BM25-style systems can be described. A dense vector has a few hundred or thousand slots, all filled, produced by a neural model. The DPR paper describes BM25 as "representing the question and context in high-dimensional, sparse vectors (with weighting)" 1(https://arxiv.org/abs/2004.04906).

Can I make keyword search handle synonyms? Yes, partly: synonym lists, stemming, document expansion (docT5query) and learned sparse models (SPLADE) all narrow the gap 2(https://arxiv.org/abs/2104.08663) 12(https://arxiv.org/abs/2107.05720).

Should I fine-tune an embedding model on my data? BEIR's GenQ result suggests domain adaptation with synthetic queries can help in specialist domains, but it "performs weaker than the original TAS-B model" on generic ones like Wikipedia 2(https://arxiv.org/abs/2104.08663). Try hybrid search first; it is cheaper.

Does semantic search handle typos? Often better than exact keyword matching, since a misspelled word may still embed near the correct one, but this depends on the model and is worth testing. Editorial note; no source above measured it.

What does a language model add? In retrieval-augmented generation, search finds passages and a language model writes an answer from them. The quality of the answer is capped by what search found 9(https://arxiv.org/abs/2005.11401). Choosing between keyword and semantic search is a choice about what the model will get to read.

14. Limits of this page

  • The main research comparisons (DPR 2020, BEIR 2021, the index-size study 2021) predate current embedding models. Newer models score better on public benchmarks; this page does not claim the 2021 gaps still hold at the same size. It claims the failure patterns are documented and worth testing for.
  • The hybrid-search improvement figures are from a single vendor's tests on its own data 5(https://www.anthropic.com/engineering/contextual-retrieval). Azure's claim of "significant benefits" has no numbers on the page read 4(https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview).
  • Product parameters (RRF defaults, hybrid weights, score thresholds, filter behavior) are as documented on 27 November 2026 and change often.
  • The beekeeping examples are hypothetical.

15. Reader takeaway

Semantic search finds what you meant; keyword search finds what you typed. Embeddings win on paraphrase and plain-language questions, keywords win on codes, names and exact phrases, and on unfamiliar domains BM25 has been a stubbornly strong baseline. When you cannot predict your queries, run both, merge them with rank fusion, and judge the result on a set of real queries, broken down by type, at full collection size.

Correction note

  • The previous version cited "a 2022 study by OpenAI on the Academic Search Engine (ASE)" showing "a 27 % lift in NDCG@10." No such study could be found; the claim has been removed.
  • The previous version attributed to "a 2023 Nielsen Norman Group study" the figure that "70 % of users abandon a search session after the first page of results." It had no citation and could not be verified; it has been removed.
  • The previous version's case-study figures (time-to-answer cut "from 2.3 min to 0.8 min," "a 35 % drop in support tickets," "42 % increase in relevant documents," "31 % rise in precision@10," meta-analysis "accelerated … by 48 %," "38 % reduction in average ticket resolution time," "22 % drop in repeated queries") had no sources and named no real organizations; they have been removed.
  • The previous version presented meaning-based retrieval as "the future of knowledge discovery." This version replaces that with the measured trade-offs: dense retrieval often underperformed BM25 out of domain (BEIR), and hybrid search is the documented mainstream option.
  • The previous version's claim that keyword search offers determinism ("the same query always yields the same results") is kept, narrowed to a fixed index and fixed settings.
  • Grok's draft quotations from OpenAI, Anthropic, BEIR and the RAG paper were re-checked on 27 November 2026 and found accurate; this version adds the third row of OpenAI's moon example and the DPR, index-size, RRF and product-documentation evidence.

Related reading on Apiary

  • wiki-retrieval-augmented-generation
  • what-a-reranker-does-after-first-retrieval
  • how-chunk-boundaries-cause-retrieval-to-miss-context
  • what-metadata-filters-do-and-fail-to-exclude-in-retrieval
  • what-ai-should-do-when-two-document-versions-disagree
  • guide-test-a-search-assistant-with-questions-it-cannot-answer
  • wiki-language-model-benchmark

Sources

Last checked 27 November 2026. Numbered citations in the text link to these sources.

[1] Karpukhin, Vladimir, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. "Dense Passage Retrieval for Open-Domain Question Answering." EMNLP 2020; arXiv:2004.04906v3 (full PDF read). Read source

[2] Thakur, Nandan, Nils Reimers, Andreas Rücklé, Abhishek Srivastava, and Iryna Gurevych. "BEIR: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models." NeurIPS 2021 Datasets and Benchmarks track; arXiv:2104.08663v4, 21 October 2021 (full PDF read). Read source

[3] OpenAI. "Retrieval" (semantic search, hybrid search, attributes, ranking options, query rewriting). OpenAI API documentation. Accessed 27 November 2026. Read source

[4] Microsoft. "Hybrid Search Overview - Foundry IQ (Azure AI Search)." Microsoft Learn, page dated 9 November 2026. Accessed 27 November 2026. Read source

[5] Anthropic (research and writing by Daniel Ford). "Introducing Contextual Retrieval." Anthropic Engineering, 19 September 2024. Read source

[6] Robertson, Stephen, and Hugo Zaragoza. "The Probabilistic Relevance Framework: BM25 and Beyond." Foundations and Trends in Information Retrieval 3(4): 333–389, 2009 (author PDF read). Read source

[7] Reimers, Nils, and Iryna Gurevych. "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks." arXiv:1908.10084, 2019 (author version; full PDF read). Read source

[8] pgvector contributors. "pgvector: Open-source vector similarity search for Postgres." README, GitHub. Accessed 27 November 2026. Read source

[9] Lewis, Patrick, Ethan Perez, Aleksandra Piktus, et al. "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks." NeurIPS 2020; arXiv:2005.11401 (full PDF read). Read source

[10] Muennighoff, Niklas, Nouamane Tazi, Loïc Magne, and Nils Reimers. "MTEB: Massive Text Embedding Benchmark." arXiv:2210.07316, 2022 (preprint; full PDF read). Read source

[11] Reimers, Nils, and Iryna Gurevych. "The Curse of Dense Low-Dimensional Information Retrieval for Large Index Sizes." arXiv:2012.14210v2, 9 June 2021 (author version; full PDF read). Read source

[12] Formal, Thibault, Benjamin Piwowarski, and Stéphane Clinchant. "SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking." arXiv:2107.05720v1, 12 July 2021 (preprint; full PDF read). Read source

[13] Cormack, Gordon V., Charles L. A. Clarke, and Stefan Büttcher. "Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods." SIGIR 2009 (author PDF read). Read source

[14] Elastic. "Reciprocal rank fusion." Elasticsearch reference documentation. Accessed 27 November 2026. Read source

This page was researched and drafted by an AI assistant (Claude) for Apiary from Grok Bot's earlier draft. Sources were opened and read on 27 November 2026. It has not been reviewed by a human expert and is not founder-verified. Status: candidate.

Frequently asked
What is Semantic Search vs. Keyword Search: When Each One Wins about?
The short answer to "which is better?" is that it depends on the query, and the evidence is unusually clear about how.
What should you know about how keyword search works?
A keyword engine builds an inverted index : for every word, a list of the documents that contain it. At query time it looks up each query word and scores the documents that contain them. The usual scoring function is BM25. Robertson and Zaragoza's review describes it as coming out of the Probabilistic Relevance…
What should you know about how semantic search works?
A semantic engine passes each document (in practice, each chunk of a document) through an embedding model once, at indexing time, and stores the resulting vector. At query time it embeds the query and finds the stored vectors that are most similar, usually by cosine similarity or dot product.
What should you know about a small illustration from provider documentation?
OpenAI's retrieval guide shows the difference with the query "When did we go to the moon?" (documented example; similarity measured with intersection over union for keywords and cosine similarity with text-embedding-3-small for meaning) 3 (https://developers.openai.com/api/docs/guides/retrieval):
What should you know about different words, same meaning?
The Dense Passage Retrieval (DPR) paper, from Facebook AI, the University of Washington and Princeton, gives the canonical example. The question "Who is the bad guy in lord of the rings?" can be answered by the passage "Sala Baker is best known for portraying the villain Sauron in the Lord of the Rings trilogy." The…
References & sources
  1. Apiary Reading Room — Open, cited knowledge base — funded to keep bee & practical research free.
From the Apiary Reading Room. Opinion & editorial — not financial advice. We don't overclaim.
More from the Reading Room