Embeddings
Embeddings are sequences of numbers that represent the meaning of a text. They make content comparable without the words having to match.
What embeddings are
Embeddings are sequences of numbers that represent the meaning of a text. A paragraph is converted into a fixed number of values, often several hundred. Individually those numbers mean nothing, but their position relative to each other does: texts with similar content sit close together, texts with different content far apart.
The benefit lies exactly there. Two sentences can mean the same without sharing a word. Shipping costs and delivery charge share no syllable and still sit close together as embeddings. A full text search does not find that connection, a vector search does.
How similarity is calculated
To check how close two embeddings sit, the angle between them is calculated. A small angle means high similarity. The length of the sequence does not matter, only the direction. That is why a short sentence and a long paragraph on the same topic can still be recognised as similar.
The quality of the outcome depends on the model doing the conversion. A model trained on general text recognises technical terms less well than one that has worked on your own vocabulary. Choosing the model is therefore a decision with consequences, not a detail.
What they are used for in retail
- Search in the shop: a search over embeddings finds items whose description does not contain the query literally. That lifts the hit rate for colloquial queries.
- Similar items: recommendations can be built on content closeness rather than on shared categories.
- Duplicate items: two entries with different titles and the same content stand out through embeddings.
- Knowledge retrieval: in a RAG setup embeddings are the route by which matching passages are found.
- Sorting enquiries: customer enquiries can be grouped by topic without writing rules for every topic.
Where the limits lie
The first limit is numbers, codes and proper names. Two similar item numbers often sit close together as embeddings although they denote different products. For exact identifiers a second search for character strings is needed.
The second limit is currency. An embedding is created at the moment of conversion and does not change. When an item is renamed or rewritten, the embedding has to be recalculated, otherwise it describes the old state. The third point is language: a single language model does not recognise German and English texts as similar. Bilingual shops need a multilingual model.
The fourth limit is traceability. An embedding does not explain why two pieces of content count as similar. For decisions that have to be justified that is a problem, because the similarity is calculated rather than demonstrated.
Frequent questions
- Can I store and reuse embeddings? Yes, that is the normal case. They are calculated once and then stored.
- How long is an embedding? Somewhere between a few hundred and a few thousand numbers, depending on the model.
- Do I have to be able to change the model? Yes, otherwise all stored values become useless on a change.