Interactive Lab · Word Embeddings
word2vec gives every word a location in space, arranged so that directions carry meaning. The step from man to woman is the same step as king to queen, so you can literally do algebra on words: king − man + woman lands right on top of queen. Pick any three words below and watch the analogy solve itself.
▶ The playground, do algebra on words
Embeddings turn words, and images, users, products, into vectors so a model can do math on meaning. They're the foundation under semantic search, recommendations, RAG, and the input layer of every LLM. Any time you need “find things similar to this,” you're using this idea.
The code that's actually running
Try tokyo − japan + france. Before you look, which word should it land on? The model never saw the phrase "capital of France"; it only ever saw words sitting near other words in sentences. Yet the country → capital direction is baked into the space, so the arithmetic just works. Now try a relation the vocabulary doesn't share a clean direction for and watch the top match get fuzzier, that's the limit of the trick.
The takeaway