Phase 05 · Embeddings & vector search Core

Embedding models

Dedicated models (not chat LLMs) that produce embeddings - you choose by quality-per-dollar, dimension size, and language support.

In plain terms

Embedding models are the mapmakers: better ones place meanings more accurately. OpenAI/Cohere/Google sell mapmaking by API; free open models (from Hugging Face) let you make maps on your laptop. The map's accuracy caps your whole search system's quality.

Why it matters

Your retrieval can never be smarter than your embeddings. And because switching later means re-embedding your entire corpus, this choice deserves 30 minutes of thought instead of grabbing whatever the tutorial used.

How it works

API options: OpenAI text-embedding-3-small/large, Cohere embed-v4, Google, Voyage. Open-source: sentence-transformers models, bge, gte, nomic-embed - run locally, data never leaves. Compare on the MTEB leaderboard, but weigh: dimension count (bigger = better + costlier storage), max input length, multilingual quality, price per million tokens. Small API models are shockingly good and cheap; they're the right default.

When you use it

Chosen once per project at index-build time. Revisit only when retrieval quality - measured, not vibed - is your bottleneck.

Common mistakes

  • Optimizing embedding model choice before fixing chunking (chunking dominates).
  • Ignoring input-length limits - long chunks silently truncate and you lose the tail.
  • Choosing a top-heavy 3072-dim model for a 500-document hobby project (waste).

Best practices

  • Default: a cheap API model (text-embedding-3-small tier) or bge-small locally; upgrade only with eval evidence.
  • Record model name + version in your index metadata - future-you must know how vectors were made.
  • For queries and documents, use the model's prescribed prefixes/instructions if it has them (many open models need them).

Try it yourself

Embed the same 20 sentences with an API model and a local sentence-transformers model. Compare nearest-neighbor rankings - where do the maps disagree?

Resources