The embedding contract
An embedding model is a neural network that takes a string and returns a fixed-length list of floats called a vector. The model is trained so that texts with similar meaning produce vectors that are close together. You don't choose what each dimension means — the model learned that during pretraining on billions of documents.
Two things matter from day one:
- The same model encodes both queries and documents. Mixing models breaks similarity completely — the vectors live in different spaces.
- Vectors have a dimension. Common sizes are 384 (small, fast), 768 (workhorse), 1024–1536 (production sweet spot), and 3072 (top-tier OpenAI / Voyage). More dimensions can capture more nuance but cost more storage and slower comparisons.
Run an embedding locally
The easiest first step is sentence-transformers with a small model. It runs on CPU, downloads weights once, and returns NumPy arrays you can inspect. Once you can print a vector and see that two related sentences land closer than two unrelated ones, the rest of the course is just engineering.