Embedding Explorer.
How to read word vectors, compute similarity, and build semantic search — with production Python code.
After this lesson you'll know
- How to read word vectors and their coordinates
- What cosine similarity measures and why it matters
- How vector analogy calculations work
- Why embeddings power search, recommendations, and RAG
Every word lives at a specific address in meaning-space.
Imagine a massive warehouse where every word in the English language has its own shelf. Synonyms are on the same shelf. Related words are in the same aisle. Unrelated words are in different buildings. That warehouse is embedding space — and the shelf number is the word's vector.
When you search "affordable dining" and the system returns "budget-friendly restaurants" — that's embeddings at work. The two phrases have zero words in common, but they live on the same shelf.
How embeddings are created.
Embeddings are not hand-crafted — they are learned from data. An embedding model reads billions of sentences and discovers that words appearing in similar contexts tend to mean similar things. "The cat sat on the mat" and "the dog sat on the mat" teach the model that "cat" and "dog" are interchangeable in some contexts — so their vectors end up nearby.
The input text gets split into tokens — subword chunks like "un" + "believ" + "able." Each token is initially assigned a random vector. These random starting points will be refined through training.
The model reads sentences and tries to predict which words appear near each other. If "bank" frequently appears near "money," "account," and "deposit," its vector moves toward that financial cluster. If it also appears near "river," "water," and "fishing," it develops a separate sense captured in different dimensions.
After training on billions of sentences, the vectors settle into stable positions. Words with similar meanings end up in similar regions. The resulting embedding model can convert any new text into a vector that captures its meaning — even text it has never seen before.
Different embedding models produce different numbers of dimensions. More dimensions capture more nuance, but cost more compute:
POPULAR EMBEDDING MODELS
Model Dimensions Use Case
────────────────── ────────── ────────────────────
all-MiniLM-L6-v2 384 Fast, lightweight, free
BGE-small-en 384 Fast RAG, free via HuggingFace
text-embedding-3-small 1536 OpenAI API, good accuracy
text-embedding-3-large 3072 OpenAI API, best accuracy
voyage-3 1024 Anthropic-recommended
Rule of thumb: 384 dims = good for most use cases
1024+ dims = when you need maximum precision
All models: higher dims = more nuance, more compute
This lesson is for Pro members
Unlock all 520+ lessons across 52 courses with Academy Pro.
Already a member? Sign in to access your lessons.