Stage 2 · Teens · Working with LLMs

Search in Production: Hybrid Retrieval

When meaning-only search fails, and why production systems mix vectors with keywords.

You already have the geometry: passage embeddings put related meaning nearby, which is why "car servicing" can match "automobile maintenance intervals." This lesson is the production half — when that geometry is the wrong tool, and what to add.

The embeddings in your vector database are almost never the LLM's internal token vectors. They come from a dedicated embedding model trained so that queries and relevant passages land close together. That model can go stale relative to your domain (legal jargon, internal codenames, SKUs) even if the chat model is excellent.

Nearest Neighbors in Vector Space
queryM-1042M-1040show-to
The query sits near "how-to" and "nearby SKUs." M-1042 is in the index but outside the tightest semantic neighborhood.

The star is the query. Vector search lights up a neighborhood; keyword search lights up the exact SKU.

All lessons in Stage 2: How AI works