Agentic Research

Semantic vs keyword search

Also: 語義搜尋 · 語義檢索 · semantic search · 語義 vs 關鍵字 · 混合式檢索

The core trade-off between two retrieval styles: keyword matches on whether wording is identical, semantic on whether meaning is close. The former is precise but rigid; the latter is flexible but can miss the point.

When you will meet it

This is the first fork when designing any retrieval/RAG system. Pick the wrong side and every later tweak is uphill: semantic search misfires on product model numbers, keyword search misses meaning-questions like "how do I return this". Understanding the trade-off is why the answer is usually "use both".

An analogy

Keyword search is a dictionary: you must spell it right, and a typo or synonym finds nothing — but when you spell it right it is exact. Semantic search is asking someone who understands you: say "I'm hungry" and they know you want food even though you never said the word — but they may also overthink and bring you something you did not want.

Minimal example

查詢                          關鍵字檢索        語義檢索
─────────────────────────────────────────────────────────
"ERR-4032"                   ✓ 精準命中        ✗ 可能當成別的錯誤碼
"怎麼把圖片變小"              ✗ 沒有「壓縮」字  ✓ 懂你在說壓縮
"iPhone 15 Pro Max 256GB"    ✓ 一字不差        ✗ 可能混進 128GB/14
"我心情不好想找點輕鬆的"      ✗ 全落空          ✓ 懂你要抒壓內容

結論:沒有誰永遠贏 → 混合式(兩者都跑)+ rerank 收束

The pattern in this table: the more a query is about proper nouns, codes and exact models, the more keyword wins; the more it is about colloquial phrasing, synonyms and intent, the more semantic wins. Real queries are both, so mature systems do not pick one — they run both, merge the results, then rerank to push the most relevant to the top.

What people get wrong

  • Assuming semantic search is "more advanced" and fully replaces keyword. Semantic loses precision: it may treat "128GB" and "256GB" as alike, while keyword will not. Exact identifiers always need the keyword half.
  • Assuming hybrid is just "concatenate the two result lists". Concatenating causes duplicates and mismatched scoring scales; the correct approach needs a merge-and-rerank step, or the order is still a mess.

Related terms

Next