An embedding is a numerical representation produced by a machine learning model. It commonly takes the form of a fixed-length vector: an ordered sequence of numbers that represents learned characteristics of an input. Depending on the model, that input might be a token, a passage of text, an image, or another supported data type. The individual numbers usually do not have simple, human-readable meanings; useful information is encoded across the representation.
For a semantic text embedding model, passages with similar meanings should have similar vectors. For example, a search for “recover access to my account” can retrieve a document titled “Resetting a forgotten password” even when the wording differs. Applications compare vectors using measures such as cosine similarity, dot product, or Euclidean distance. The appropriate measure depends on the model and index configuration. A similarity score indicates a mathematical relationship, not a probability that a document is correct or relevant.
Tokens, chunks, vectors, and embeddings are related but distinct concepts. Tokens are units used by a model to process text. Chunking divides a larger document into smaller passages. An embedding model can convert each passage into a vector. A vector is the mathematical structure that holds the numbers; an embedding is a learned representation expressed using that structure. Token embeddings used inside a transformer are also distinct from passage embeddings designed for document retrieval.
In a typical cloud retrieval workflow, an application extracts text from source documents, divides it into chunks, and submits those chunks to an embedding model. It stores the resulting vectors with document identifiers, source text or references, and metadata in a searchable index. When a user asks a question, the application embeds the query using the same model or a compatible query encoder and retrieves nearby document vectors. Matching vector dimensions alone does not make outputs from unrelated models compatible.
Retrieval-augmented generation, or RAG, adds the retrieved passages to a generative model's prompt. For example, a support assistant might retrieve relevant troubleshooting instructions before generating an answer. The embedding model supports retrieval; the generative model writes the response. Indexing documents this way does not retrain the generative model or update its weights. Retrieval can improve grounding, but it does not guarantee factual answers or eliminate hallucinations.
Engineering choices affect both quality and cost. Small chunks can improve precision but lose surrounding context, while large chunks can mix unrelated topics. Overlap can preserve context while increasing processing and storage. Higher-dimensional vectors require more storage and computation and do not automatically provide better results. Approximate nearest-neighbor indexes improve search speed at scale but may miss some relevant matches. Hybrid retrieval combines vector search with keyword search to handle both meaning-based queries and exact identifiers.
Evaluate embedding models against representative queries, including domain terminology and supported languages. Track the model version and preprocessing configuration, and plan to regenerate stored embeddings when changing to an incompatible model. Multimodal models can place supported input types into a shared space, but unrelated text and image models cannot automatically be compared. Finally, embeddings are not encryption or anonymization: protect them and their source content with access controls, and enforce document authorization during retrieval rather than relying on the generative model to hide restricted information.