← My notebook

05 · Search

Embeddings

An embedding turns text into a list of numbers, a point in space. Similar meanings land near each other, so closeness becomes something you can measure.

Text cannot be measured

You cannot subtract "diesel" from "petrol". Strings have no distance. An embedding model fixes that by mapping each piece of text to a vector, usually hundreds of numbers long.

Neighbours share meaning

The model learns the mapping from how words are used. Words that appear in similar places, like diesel, petrol and fuel, end up in the same region. Cost, price and spend form another. The picture flattens this to two dimensions so you can see the clusters.

A new word finds its place

"gasoline" was never in the list. Embed it the same way and it lands next to the fuel cluster. Its nearest neighbours, by distance, are its closest meanings. That is the whole trick behind semantic search.

What to watch for

Use the same embedding model for stored text and queries; points from different models do not share a space. And remember close is not identical: "refund" and "no refund" can sit uncomfortably near each other.