RAG foundations · about 20 minutes of study

Vector search

Vector search retrieves stored representations near a query vector under a similarity metric. Approximate indexes trade some recall for speed and memory.

Before you start: Review Chunking first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Query vector

Encode with the compatible query model.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

A map can send you to nearby places. Whether the nearest place is the exact business you need still depends on its identity and relevance.

See a concrete example

A query about POL-42 may retrieve a semantically similar POL-43. An exact metadata lookup should protect the required identifier.

A claim to question

The nearest vector is not necessarily the correct record.

Try before revealing the answer

Explain why increasing top-k can improve candidate recall while making context worse.

Show the worked answer

More candidates may include the answer but also add distractors and token cost. Rerank and select a smaller evidence set, then measure final answer quality.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Dense Passage Retrieval

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.