Embeddings

Turn text into vectors so similar meaning sits close in vector space.

What is an embedding?

An embedding model maps text to numeric vectors. Similar meaning → nearby vectors. Embeddings power semantic search and clustering.

Cosine similarity measures alignment between vectors (1 = identical direction).

Embedding space visualizer

Search:
Drag points or search to explore semantic neighbors. Points are color-coded by topic.
Nearest: (none)
Open embeddings lab notebook

In RAG

  1. Embed every chunk at index time
  2. Embed user question at query time
  3. Nearest neighbors = best context

Models

OpenAI, Cohere, sentence-transformers, local models (e.g. all-MiniLM). Trade off quality, speed, and cost.