Embedding
Transformation of text into a vector of numbers that reflects its meaning. Semantically similar objects receive close vectors.
What is it
A special embedding model converts a word, sentence, or document into a list of coordinates of the form:
[0.23, -0.81, 0.45, ...]
The length of such a list — from hundreds to thousands of numbers. This is called the vector dimension.
How the 'space of meaning' works
In multidimensional space:
- 'king' and 'monarch' are close;
- 'apple' is far;
- 'cat' is close to 'kitten', although the letters are different.
Therefore, searching by embeddings is called semantic — by meaning, not by letters.
Why is it needed
Embeddings are the foundation of RAG. Each fragment of the knowledge base is converted into a vector, and during a query, the system searches for the nearest vectors.
Who can do embeddings
- OpenAI (text-embedding-3);
- Cohere Embed;
- open models BGE, E5;
- Sentence Transformers locally.