Embeddings: meaning as maps
How AI turns words, images and songs into points in space where closeness means similarity.
Computers only understand numbers. So how does a model know that "puppy" is close to "dog" but far from "spreadsheet"? It gives every word a list of numbers, an embedding, so that similar meanings land near each other.
๐ Words as coordinates
Each token becomes a vector, e.g. 768 numbers long.
These numbers are learned during training. Nobody hand-picks them; they emerge from which words appear in similar contexts.
๐งฎ Maths on meaning
Famous result from word2vec: king โ man + woman โ queen.
Directions in the space can capture concepts like gender, tense, or country โ capital.
In a good embedding space, "cat" and "kitten" should beโฆ
๐ Measuring closeness
Cosine similarity compares the angle between two vectors: 1 = same direction, 0 = unrelated.
It's how semantic search finds documents that mean the same thing even with different words.
๐ Embeddings everywhere
Not just words: sentences, images (CLIP puts images and captions in the same space), products, songs, users.
Recommendation systems, search engines and RAG (Advanced level) all run on embeddings.
Where do embedding values come from?
โจ Before you drift off
- Embeddings turn things into vectors where closeness = similarity.
- They're learned, not hand-written.
- Cosine similarity measures how close two embeddings are.
- They power search, recommendations and RAG.
๐ Go deeper (free & open)
- The Illustrated Word2vec โ ยท Jay Alammar
- Hugging Face LLM Course: Semantic search with embeddings โ ยท Hugging Face ยท Apache 2.0
- Embedding Projector (interactive) โ ยท TensorFlow / Google