DEV Community

Devanshu Biswas
Devanshu Biswas

Posted on

Embeddings: Turning Meaning Into Numbers

Yesterday we turned text into tokens. Today: how those tokens become meaning a computer can work with — embeddings. This one concept quietly powers search, RAG, recommendations, and clustering. Here's an interactive demo with a real "meaning map."

🧭 Explore the meaning map + do vector math: https://dev48v.infy.uk/ai/days/day13-embeddings.html

Meaning becomes distance

An embedding turns a word (or sentence, or image) into a list of numbers — a vector. They're learned so that similar things sit close together. On the demo's map, dog/puppy/cat/kitten cluster in one corner; car/truck in another.

You can do arithmetic on meaning

The famous one: king − man + woman ≈ queen. Because relationships are encoded as directions in the space, you can add and subtract concepts. The demo runs it and lands on "queen."

Measuring closeness

Cosine similarity scores how aligned two vectors are (1 = same direction, 0 = unrelated). "dog ↔ puppy" scores high; "dog ↔ car" near zero. That single number is what powers semantic search.

Where it shows up

Embeddings + a vector database (nearest-neighbour search) = the retrieval half of RAG, "related items," dedup, and clustering.

🔨 Build it (text → vectors → cosine similarity → nearest-neighbour search) on the page: https://dev48v.infy.uk/ai/days/day13-embeddings.html

Part of AIFromZero. 🌐 https://dev48v.infy.uk

Top comments (0)