Sitemap
AIbizX

Applied AI and data: findings you can trust, methods you can use.

Embeddings

How AI Turns Meaning Into Numbers

4 min readOct 26, 2026

--

Press enter or click to view image in full size
Photo by Joshua Hoehne on Unsplash

How can software tell that “cheap flights” and “low-cost airfare” mean the same thing, even though they share no words? This is the idea behind it.

In the last article we saw that models break text into tokens. Tokens are just pieces, though. To do anything useful with them, a model needs a way to capture what those pieces mean, and to tell whether two pieces of text are about the same thing.

The answer is embeddings. They quietly power search, recommendations, and the “chat with your documents” tools you’ve probably seen. And the core idea is much friendlier than the name.

The idea in one sentence

An embedding is a list of numbers that represents the meaning of a piece of text, arranged so that similar meanings get similar numbers.

A map of meaning

Picture a map. Cities that are close together on the map are close together in real life. Paris and Brussels sit near each other, and Paris and Sydney are far apart.

Now imagine a map where the places are ideas instead of cities. “Cat” and “kitten” sit right next to each other. “Dog” is nearby, since it’s another pet. “Car” is far off in a different region, near “truck” and “bicycle.”

That’s what an embedding does. It gives each piece of text a position on a map of meaning. The position is written as a list of numbers, the way a point on an ordinary map is written as latitude and longitude.

The difference is size. A real map needs two numbers to place a point. A real embedding uses hundreds or thousands, because meaning has a lot more dimensions than geography. We can’t draw that, but the principle is the same: close together means similar.

Where do the numbers come from?

They come from a model trained for the job, usually called an embedding model. During training it learns that words and sentences showing up in similar contexts tend to mean similar things, so it places them near each other.

You don’t need to do any of that yourself. You send text to an embedding model and get back a list of numbers. That’s it.

How do you measure “close”?

The most common method compares the direction two lists of numbers point in. It’s called cosine similarity, and it gives a score where a higher number means more alike. Scores near 1 mean the texts are very similar. Scores near 0 mean they’re unrelated. For a full review of Trigonometry and related functions like cosine, please read this: Trigonometry, the golden key of optimization in deep learning

Get Saman Siadati’s stories in your inbox

Join Medium for free to get updates from this writer.

Here’s a toy example you can run. The numbers are made up and tiny, just three per word, to show the idea. Real embeddings are far longer.

import math

def cosine(a, b):
dot = sum(x * y for x, y in zip(a, b))
norm_a = math.sqrt(sum(x * x for x in a))
norm_b = math.sqrt(sum(y * y for y in b))
return dot / (norm_a * norm_b)

cat = [0.9, 0.8, 0.1]
kitten = [0.85, 0.75, 0.15]
car = [0.1, 0.2, 0.95]

print(round(cosine(cat, kitten), 2)) # 1.0, very similar
print(round(cosine(cat, car), 2)) # 0.29, not similar

“Cat” and “kitten” score close to 1, and “cat” and “car” score much lower. That’s all semantic similarity is: a number that says how near two meanings are.

What embeddings are used for

Search by meaning. Instead of matching exact words, you embed the question and your documents, then return the documents closest to the question. That’s how a search for “how do I get my money back” can find a page titled “Refund policy.”

Recommendations. Items with nearby embeddings get suggested together, whether they’re articles, products or songs.

Grouping and sorting. Embed a pile of customer comments and cluster the ones that sit close together, and you’ll often find the themes without reading each one.

Finding duplicates. Two support tickets worded differently but about the same problem end up close together.

Feeding “chat with your documents.” This is the big one. Tools that answer questions about your own files embed those files, find the pieces closest to your question, and hand them to a language model to write the answer. We’ll cover that approach, called retrieval-augmented generation, later in the series.

Things worth knowing

  • Embeddings from different models don’t mix. Each model has its own map. If you change models, you need to re-embed everything.
  • They capture meaning, not truth. Two sentences can be close in meaning and one can still be wrong.
  • Length matters. Very long text gets squeezed into one point, so the detail can blur. That’s why documents are usually split into smaller pieces before embedding.
  • They carry the biases of their training data, just like the models that make them.

The takeaway

Embeddings turn meaning into numbers so software can compare ideas the way it compares prices or dates. Once you see them as points on a map of meaning, search, recommendations and document chat all start to make sense.

Where we go next

Now that you have the building blocks, it’s time to use them. In the next article we’ll look at prompts: seven habits that get you better answers from any model.

This series is part of the AIBizX publication, where we share research and practical guides on AI and data.

--

--