Hybrid Retrieval Strategies — Embeddings and Vector Search

← Back to Dashboard
1. Embedding Fundamentals2. Hybrid Retrieval Strategies

Hybrid Retrieval Strategies

📚 Embeddings and Vector Search⏱ 10 min⭐ 75 XP⌨ Hands-on lab

Dense + Keyword Works Better in Production

Hybrid retrieval combines semantic vector search with lexical (keyword/BM25) matching. Dense vectors understand meaning; lexical search nails exact tokens. Production corpora need both.

Where Each Approach Wins

QueryDense-onlyLexical-onlyHybrid
"how do I revoke a leaver's access"✓ finds "offboarding IAM checklist"� - no keyword overlap✓
"error INC-4402 in payment-svc"� - IDs embed poorly✓ exact match on INC-4402✓
"policy SEC-17 exceptions"� - may return SEC-12, SEC-19✓ exact identifier✓

Bedrock Knowledge Bases supports hybrid search natively - you can set retrieval type to HYBRID (or let it default per store capability) when calling Retrieve/RetrieveAndGenerate.

The Two-Stage Pattern: Retrieve Wide, Rerank Narrow

  1. Stage 1 - candidate retrieval: pull a generous top-k (e.g. 25-50) using hybrid search. Optimised for recall.
  2. Stage 2 - reranking: score each candidate against the query with a dedicated reranker (e.g. Cohere Rerank or Amazon Rerank on Bedrock) and keep the best 3-8. Optimised for precision.

Rerankers are cross-encoders - they read query and passage together, so they judge relevance far better than raw vector distance, at a per-pair compute cost you only pay for candidates.

Tuning heuristic: if answers miss obviously relevant documents → raise stage-1 k or fix chunking (recall problem). If answers cite plausible-but-wrong passages → add or strengthen reranking (precision problem).
⌨ HANDS-ON LABQuery Knowledge Base using Hybrid Search and Reranker
⭐ +150 XP

Execute a hybrid retrieval combining dense vector similarity with sparse BM25 keyword matching.

1Retrieve top-k chunks with HYBRID search override.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
🧪 Knowledge Check
Press 1-4 to select1 of 2
Why use hybrid retrieval instead of dense-only?
To increase IAM permissions
To capture both semantic meaning and exact lexical signals
To disable reranking
To remove metadata