Embedding
Embedding is a concept that allows LLMs to process and represent the relationships between different pieces of data. This enables models to find similar items in the data.
What is an embedding?
An embedding is a numerical representation of complex data, such as words or images, into a vector in high-dimensional space. Embedding data allows models to capture semantic meaning and relevant characteristics.
Embeddings are usually created by deep learning models that learn to map data points in such a way that similar items are closer together in the vector space and dissimilar items are positioned farther apart.
The resulting vector, called an embedding, is a dense array of numbers that encodes the data’s features and context, making it efficient for algorithms to analyse and compare.
Embedding vs. semantic embedding
While the standard embedding representation does contain some semantic meaning, semantic embeddings have been optimised to find semantic relationships between two inputs (for example, between text and image).
This optimisation is achieved by training additional layers using datasets curated for this task and a contrastive loss. An optional dimensionality-reduction layer reduces the embedding dimension to a 128-dimensional vector, making it more efficient to compare two vectors.
Cases in which the semantic meaning of a text matters, such as semantic search systems or Chat applications, can benefit from the semantic embedding endpoint.