Skip to content
anythingai.space
AI Foundationsintermediate12 min · 9 steps

Retrieval: Keyword, Semantic, Hybrid and HyDE

The R in RAG: how to find the right passages — by words, by meaning, by both, or by first imagining the answer.

questionsearchtop-kquestion + passagesUserRetrieverKnowledge basehelp-centre articlesLLM
requestdatatoken
metrics are illustrative
1 / 9
ProblemStep 1 of 9

The model can only use what you retrieve

Retrieval is step one of RAG: given a question, fetch the k most relevant passages (top-k) from a knowledge base and put them in the prompt.

If the right passage isn't in the top-k, even the best LLM will answer from the wrong evidence. Retrieval quality is measured with recall (did we find the relevant passages?) and precision (how much of what we returned is relevant?).

InsightMost bad RAG answers are retrieval failures. Measure retrieval on its own before tuning prompts.

Lesson 27 of 34 in AI Foundations