Nestor G Pestelos Jr · ELI5

Phase 2: The User Interaction

Vector Search

How computers retrieve the right information by measuring conceptual closeness instead of matching exact spelling.

01 / Concept vs Keyword

Finding meaning even when zero words overlap.

Old search engines look for exact letter matches. Vector search looks for concept proximity in embedding space.

✗ KEYWORD SEARCH Query: "feline clinic" Document: "cat hospital" Result: 0 Matches Found (No overlapping words, search fails) ✓ VECTOR SEARCH Query vector: [0.82, -0.41, 0.19] Doc vector: [0.80, -0.39, 0.22] Result: 96% Semantic Match Recognizes feline = cat, clinic = hospital
How queries turn into vectors

When you type a search question, an embedding model converts your sentence into a list of numbers. The search engine calculates the cosine angle between your query vector and millions of stored document vectors in fractions of a millisecond.

02 / Nearest Neighbors

Dropping a pin and finding the closest neighbors.

Vector search acts like dropping a GPS pin on a map and scooping up the three closest landmarks.

Doc: "Cooking pasta" Doc: "Rocket engines" YOUR QUERY PIN Match #1 Match #2 Match #3
What is top-k retrieval?

In production search, k represents the number of documents retrieved (typically \(k = 3\) or \(k = 5\)). The database ranks all candidates by distance and returns only the top-k highest-scoring snippets to pass into the model's context window.

03 / Highway Shortcuts (HNSW)

Highway express lanes make searching instant.

Comparing your query against a billion documents takes too long. Algorithms like HNSW use express highways to zoom in rapidly.

LAYER 2 (EXPRESS HIGHWAY) Giant regional jumps LAYER 0 (LOCAL STREETS) Fine-grained target neighborhood reached
What does HNSW stand for?

HNSW stands for Hierarchical Navigable Small World. It is an index graph inspired by the "six degrees of separation" rule. Instead of evaluating 10,000,000 items, the search hops across only 20 to 50 nodes to pinpoint the exact closest answer.

04 / Hybrid Search

Combining vectors with keywords gives the best results.

Vector search understands broad ideas, but keyword search is unbeatable for exact serial numbers and proper names. Mixing both is called hybrid search.

Vector Search (Concepts) Keyword Search (BM25) HYBRID FUSED RESULTS Understands concepts AND matches exact IDs This combined pipeline powers modern Retrieval-Augmented Generation (RAG).
What is Reciprocal Rank Fusion?

Reciprocal Rank Fusion (RRF) is an algorithm that combines rankings from both search methods. An item ranked highly by both keyword search and vector search automatically rises to the very top of the list.