CLOUD CONCEPT

Embeddings

Embeddings are learned numerical representations that encode characteristics of data as vectors so that meaningful relationships can be compared mathematically.

Cloud Concepts Hub →

What is Embeddings

An embedding model maps inputs such as text or images into a vector space where related inputs are intended to have similar representations. Embeddings support semantic search, recommendations, clustering, and retrieval-augmented generation by helping applications find relevant information beyond exact keyword matches.

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.

Key aspects of Embeddings

Effective embedding systems combine suitable learned representations, compatible similarity search, careful input preparation, and explicit quality and security controls.

Learned vector representations

An embedding model converts supported inputs into numerical vectors that capture characteristics learned during training. The representation is useful for computation even though individual dimensions usually lack an obvious human interpretation.

Similarity-based retrieval

Applications compare embeddings to find related content without requiring identical wording. Select a similarity measure supported by the model and validate retrieval quality rather than treating a high score as proof of correctness.

Compatible embedding spaces

Queries and indexed content must use the same embedding space, typically through the same model or explicitly compatible encoders. Equal vector lengths do not make different models interchangeable.

Chunking and input preparation

Chunk boundaries, text cleanup, and model input limits influence which information an embedding captures. Test chunk size and overlap against realistic questions, especially when answers span multiple passages.

Retrieval rather than generation

Embeddings help locate information; they do not themselves produce a natural-language answer. In RAG, retrieved source passages become prompt context for a separate generative step.

Operational and security trade-offs

Vector dimensions, index design, and update frequency affect storage, latency, and cost. Treat embeddings as potentially sensitive derived data, preserve source permissions, and version the embedding pipeline.

Cloud services for Embeddings

A cloud embedding pipeline separates model inference from vector storage and retrieval. Amazon Bedrock or Amazon SageMaker AI can generate embeddings, while Amazon OpenSearch Service or Amazon Aurora PostgreSQL-Compatible Edition can store and search them. The application retains source references and authorization metadata, embeds incoming queries with a compatible encoder, and retrieves relevant passages. For RAG, it supplies those passages to a generative model as prompt context. Knowledge Bases for Amazon Bedrock can manage supported parts of this workflow, but engineers still need to evaluate retrieval quality, permissions, update behavior, and cost.

Amazon Bedrock

Amazon Bedrock provides access to embedding models that convert supported inputs into vectors. Knowledge Bases for Amazon Bedrock can orchestrate document ingestion, embedding generation, and retrieval using a supported vector store for RAG.

Open Amazon Bedrock →
Amazon OpenSearch Service image Amazon OpenSearch Service

Amazon OpenSearch Service can index and search embedding vectors using vector search capabilities. Applications can combine vector similarity, keyword queries, and metadata filters to retrieve relevant content.

Open Amazon OpenSearch Service →
Amazon Aurora image Amazon Aurora

Amazon Aurora PostgreSQL-Compatible Edition supports the pgvector extension for storing and searching vectors alongside relational data. Applications can associate externally generated embeddings with business records and apply SQL predicates and joins during retrieval.

Open Amazon Aurora →
Amazon SageMaker image Amazon SageMaker

Amazon SageMaker AI can host compatible embedding models on inference endpoints or run batch inference jobs. This supports custom model selection and deployment when a team needs control over model artifacts, inference configuration, or domain-specific training.

Open Amazon SageMaker →