If you've heard the words "vector database," "semantic search," or "RAG" and nodded along while quietly panicking β this one's for you. All three sit on top of one idea: embeddings. And the idea is genuinely simple.
This is Day 3 of AIFromZero, my concept-a-day series that explains how AI actually works, in plain language, no math degree required.
Computers are great with numbers and clueless about meaning. To a raw program, "happy" and "joyful" are just different strings of letters β no more related than "happy" and "stapler."
Embeddings fix that by turning each word (or sentence, or image) into a list of numbers β a point in space β arranged so that things with similar meaning land close together.
Think of it as GPS coordinates for meaning. "Dog" and "puppy" get nearby coordinates. "Dog" and "democracy" get far-apart ones.
A vector is just an ordered list of numbers:
"king" β [0.21, -0.44, 0.88, ... ]
"queen" β [0.19, -0.41, 0.85, ... ]
Real embedding models use hundreds or thousands of numbers (dimensions) per word β far too many to picture. But you don't have to picture all of them. You only care about one thing: how close are two vectors?
The standard measure is cosine similarity β how much two vectors point in the same direction. You don't need the formula to get the intuition:
So "find me things similar to X" becomes "find the vectors closest to X's vector." That's the entire trick behind semantic search.
Because meaning becomes geometry, you can do arithmetic on it:
vector("king") - vector("man") + vector("woman") β vector("queen")
Subtract "man-ness," add "woman-ness," and you land near "queen." The model was never told this β it fell out of learning from billions of sentences. That's the moment embeddings click for most people.
In the interactive demo I built, you get a 2-D "meaning map": click any word and watch its nearest neighbors light up, and see the king β man + woman example play out as arrows.
You don't compute embeddings by hand. You send text to an embedding model and get the vector back β one call:
const vector = await embed("a fluffy golden retriever puppy");
// β [0.03, -0.51, 0.27, ...] (hundreds of numbers)
Then you store those vectors in a vector database and search by closeness.
Embeddings turn meaning into coordinates, so "is this similar to that?" becomes "are these two points close?"
Once that lands, half of modern AI β search, recommendations, RAG, clustering β stops being mysterious and starts being geometry.
π Try the Meaning Map (click a word, see its neighbors, watch king β man + woman): https://dev48v.infy.uk/ai/days/day3-embeddings.html
π All concepts: https://dev48v.infy.uk/aifromzero.php
Tomorrow: what a neural net does β the intuition, no math.