Mental model
Module 08: Combine exact words with meaning- Learn when lexical search and semantic search complement each other, and combine rankings without assuming one retriever is always best.
Learn when lexical search and semantic search complement each other, and combine rankings without assuming one retriever is always best.
Engineering focus: Combine exact words with meaning
Learn when lexical search and semantic search complement each other, and combine rankings without assuming one retriever is always best.
You are not expected to know the engineering vocabulary before using the idea. Formal terminology comes after the mental model.
Carry one evidence-grounded knowledge assistant through all 18 modules. Preserve source IDs, retrieval evidence, evaluation cases, authority decisions and security assumptions so every improvement is measurable.
Hybrid search uses two senses: exact-word hearing and semantic hearing. Fusion combines both candidate lists so each covers the other’s blind spots.
Hybrid retrieval is useful only when measured against representative queries.
Error codes, product IDs, command names and legal phrases often benefit from keyword-oriented ranking.
Semantic retrieval can find related text even when the query and document use different words.
Combining lexical and dense candidates often improves robustness across mixed query types.
Reciprocal rank fusion and weighted scoring are useful patterns, but tune them against representative queries.
Module 08: Combine exact words with meaningquery: "ERR-104 token reset"
LEXICAL: A(ERR-104), C, B
DENSE: B(reset credentials), A, D
RRF: A, B, C, DExact identifiers work but paraphrases fail—or vice versa.
Hybrid search should address measured complementary failure modes.
Goal: Fuse two ranked lists with reciprocal rank fusion.
python3 - <<'PY2'
lex=['docA','docC','docB']; dense=['docB','docA','docD']; scores={}
for ranking in (lex,dense):
for r,d in enumerate(ranking,1): scores[d]=scores.get(d,0)+1/(60+r)
print(sorted(scores.items(),key=lambda x:x[1],reverse=True))
PY2Record the intermediate source IDs, ranks, metadata or state produced by the baseline. Explain which pipeline layer this evidence belongs to.
Test one exact identifier query and one paraphrase query. Record which retriever wins each case before fusion.
Hybrid search should address measured complementary failure modes. State the failing layer, change only that layer, then repeat the verification checks.
Record: hypothesis → evidence → change → observed result → remaining limitation. Keep this note with the running Evidence Desk project.
Production RAG improves when every change can be traced to evidence at a specific pipeline layer. In production, retain the before/after evidence so the same failure can become a regression test.
Lexical and dense rankings traceable
Fusion evaluated by query cohort
Deduplication stable
Exact identifiers, names, commands and rare terms.
Finding semantically related text despite wording differences.
To combine complementary retrieval signals.
Using a labelled evaluation set, not intuition alone.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.