Generative AI

Word embeddings, visualized

An embedding turns a word (or an image, or a document) into a list of numbers — a vector — positioned so that things with similar meaning sit close together. 'King' lands near 'queen' and 'throne', far from 'banana'. Meaning becomes geometry.

This is the quiet engine behind semantic search, recommendations, and retrieval-augmented generation (RAG). When an AI 'finds relevant information', it is usually comparing embedding vectors by distance.

Click a word to find its nearest meanings

kingqueenprincedogcathorseapplebananamango

Closest to "king"

queen, prince

cosine similarity 1 & 1 — nearly 1 means same direction = same kind of thing.

Real embeddings do this in hundreds of dimensions, but the rule is identical: to find related text, compare vector directions.

Free · runs entirely in your browser · nothing to install

How to use it

  1. Click a word to make it the query point.
  2. Watch the other words re-rank by how close their meaning is.
  3. Try an ambiguous word and see which neighbours it pulls in.

What you'll take away

  • Why 'similarity' can be measured as distance between vectors.
  • How embeddings power semantic search and RAG.
  • The bridge from raw text to something a model can compute with.

Want to actually build this?

This demo is one moment inside a full Math to Machine lesson — predict, build, and explain the concept, with an AI tutor that gives hints, not answers. The first five lessons are free.

FAQ

What is a word embedding?
It's a numeric vector that represents a word's meaning, arranged so that words used in similar ways have vectors that are close together. Models learn these vectors from large amounts of text.
How are embeddings used in search?
Your query and every document are converted to embedding vectors. The system returns the documents whose vectors are nearest to the query's vector, so results match by meaning rather than exact keywords.

More Generative AI tools