Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Embeddings

Embeddings are numerical representations of data, such as text, images, audio, or video, expressed as vectors of floating-point numbers in a high-dimensional space.

Embeddings are produced by a model, usually a neural network, trained so that data with similar meaning ends up close together in that space, while unrelated data ends up far apart. This makes it possible to compare pieces of data by measuring the distance, or the cosine similarity, between their vectors, instead of comparing the raw data itself.

In applications, embeddings are typically generated by calling an external API, such as an LLM provider, or a local model, then stored and searched in a vector database. They are a core building block of semantic search, recommendation systems, and Retrieval Augmented Generation, RAG.

Documentation

See Also