# What Are Embeddings and What They Do for a Store

> What embeddings are, how they measure similarity between texts with vectors, what OpenAI and Gemini use and what they do and do not say about your products.

URL: https://clione.ai/glossary/embeddings/
Lang: en

A shopper types "kettle that doesn't taste like plastic" and the system returns your kettle with a stainless steel interior, even though your [product page](/glossary/product-page/) contains neither "taste" nor "plastic". That is what embeddings make possible: **finding content by what it means and not by the words it shares**. It is a technical piece you will not configure in your store, but it is worth understanding what it measures, because it is increasingly used to decide which product page fits which question, and because it measures less than it seems.

## How it works

OpenAI defines it in its documentation in one sentence: an embedding is **a vector, a list of floating-point numbers, and the distance between two vectors measures their relatedness**. Small distances suggest high relatedness; large distances, low. They are used for search, clustering, recommendations, classification or detecting what does not fit.[^openai-embeddings]

Google's machine learning course explains it with food. If you place dishes along a line by how much they resemble a sandwich, the hot dog and the shawarma end up close; if you add a second dimension, "how much of a dessert it is", the apple strudel pulls away from both. **Each added dimension captures one more nuance**, and the distance between two points is read as their relative similarity within that representation.[^mlcc-embedding-space] The difference from real life is one of scale and clarity: real spaces have many more dimensions (in word spaces, often 256, 512 or 1024) and **their dimensions are almost never as understandable** as "dessert" or "[liquid](/glossary/shopify-liquid/)". Also, each embedding depends on the task it was created for.[^mlcc-embedding-space]

Current models work with even more dimensions. OpenAI's return vectors of 1536 numbers by default (`text-embedding-3-small`) or 3072 (`text-embedding-3-large`).[^openai-embeddings] [Gemini](/glossary/gemini/)'s return 3072 by default, and Google recommends 768, 1536 or 3072. Its newest model, `gemini-embedding-2`, places text, images, video, audio and documents in a single space, in more than a hundred languages.[^gemini-embeddings]

To compare two vectors, cosine similarity is used almost always. The Gemini documentation explains why: **it measures direction, not size**, which better reflects closeness between concepts, and it runs from -1 (opposite) to 1 (most similar).[^gemini-embeddings] OpenAI recommends it too.[^openai-embeddings]

There is a nuance that matters in a store with ambiguous vocabulary. Static embeddings, like those of the classic word2vec, give each word a single point covering all its meanings, and that is a limitation in some cases.[^mlcc-embedding-space] Think of "bat": the animal, the baseball kind or the cricket kind. Today's text embedding models calculate the vector for the whole text, which is what they measure when they compare a question with a product page.[^openai-embeddings]

Google's guide to its ranking systems does not detail which technique each one uses, but it does describe two that work with concepts and not only words: RankBrain, which helps it understand how words relate to concepts and return relevant content even if it does not contain every word in the search, and _neural matching_, which understands representations of concepts in queries and pages and matches them.[^google-ranking-systems] And Google cites [RAG (retrieval-augmented generation)](/glossary/rag/), the technique an assistant uses to retrieve documents before answering, as one of the common uses of embeddings.[^gemini-embeddings]

## In a store

A **fictitious example**, with a toy space of three made-up dimensions: how much a text has to do with boiling water, with metal and with plastic. The coordinates do not come from any model; they are set by hand so you can see the math.

| Text                                                    | Boiling water | Metal | Plastic |
| ------------------------------------------------------- | ------------- | ----- | ------- |
| Search: "stainless steel kettle"                        | 0.8           | 0.6   | 0.0     |
| Page A: "Electric kettle with stainless steel interior" | 0.9           | 0.7   | 0.1     |
| Page B: "Stainless steel frying pan"                    | 0.1           | 0.9   | 0.0     |
| Page C: "BPA-free plastic electric kettle"              | 0.9           | 0.0   | 0.8     |

The cosine similarity of the search with each page, with page A's math worked out:

```text
A: (0.8 × 0.9) + (0.6 × 0.7) + (0.0 × 0.1) = 1.14
   length of the search = 1.000   length of A = 1.145
   similarity = 1.14 / (1.000 × 1.145) = 0.996

B: similarity = 0.685
C: similarity = 0.598
```

Page A wins, and that makes sense. Now imagine someone copies A's description onto page C by mistake, though C is plastic: **page C would have exactly the same vector as A and would sit just as close to the search**. The embedding is calculated from the text, not the product, so it does not know whether what the text says is true. That is why a well-written fact on the product page matters: it is the only thing the vector can represent. Clione, for example, calculates a 1536-dimension vector for each product, category, collection and content page for [semantic search](/glossary/semantic-search/) inside the catalog.


That a high similarity means the system "understands" the product or that the product page answers the question well. Google's course puts it carefully: distance is interpreted as relative similarity within the model's representation, and its dimensions can almost never be read.[^mlcc-embedding-space] OpenAI speaks of relatedness between texts, not truth.[^openai-embeddings] A false text that resembles the question ends up as close as a true one.


## How to check it

For anyone who wants to see it with their own product pages, with a few lines of code or a Python notebook:

1. **Write three real searches from your customers**, taken from your store's search or from [Search Console](/glossary/google-search-console/), and copy the descriptions of the products that should come up.
2. **Calculate the embeddings with an API**: the OpenAI and Gemini documentation include a sample call, with the model name and the text as input.[^openai-embeddings][^gemini-embeddings]
3. **Compare each search with each description** using cosine similarity, which runs from -1 to 1.[^gemini-embeddings] With OpenAI's models, which return normalized vectors, the dot product is enough.[^openai-embeddings]
4. **Always compare within the same model and the same task**: embeddings depend on the task they were created for.[^mlcc-embedding-space]
5. **Review the top results by hand** against each product's real data. The number says which text is most similar, not which is true.

## Related concept: semantic search

[Semantic search](/glossary/semantic-search/) is the use; embeddings are the representation that makes it possible in most current systems. Google presents its embeddings for exactly that: searching, ranking and clustering with results that are more precise and more context-aware than those of keyword searches.[^gemini-embeddings] [Vector search](/glossary/vector-search/) is the mechanical part: storing millions of vectors and quickly finding the ones closest to a given one. **An embedding without search finds nothing, and a semantic search without embeddings needs another way to represent meaning.**

To keep going, the entry on [AI search](/glossary/ai-search/) explains how an assistant retrieves pages before answering, and the [reading path](/learn/ai-search/) orders the rest of the terms.
