Cloud concept · Updated

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

In short

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.

Cloud Concepts Hub →

6 key aspects of Embeddings

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

01
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.

02
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.

03
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.

04
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.

05
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.

06
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.

Amazon OpenSearch ServiceAmazon 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.

Amazon AuroraAmazon 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.

Amazon SageMakerAmazon 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.

Embeddings exam questions

Real practice exam questions on Embeddings, with the correct answer and its explanation. Answer them with every option in the exam simulator.

AIB-C01 (beta)

A furniture retailer is building an Amazon Bedrock assistant that accepts a customer's photograph of a chair, finds visually similar chairs in the retailer's approved catalog, and drafts a comparison using those products' specifications. Catalog photographs have automatically generated filenames and no descriptive captions. Many chairs share the same category but differ significantly in shape and style. The retailer must keep the response-generation model unchanged. Which approach BEST supports the required product retrieval?

Show answerCORRECT ANSWER

Use an image-capable embedding model to represent both customer and catalog photographs in the same vector space, retrieve similar catalog images, and supply their product specifications to the response-generation model.

Compatible image embeddings allow the application to compare learned visual characteristics and retrieve similar products. Supplying the associated specifications then grounds the generated comparison in approved catalog information without changing the generation model.

MLA-C02 (beta)

A company is evaluating a compressed vector index for a semantic-search application on Amazon OpenSearch Service. The existing index contains 20 million embeddings, each with 1,024 float32 coordinates. A pilot replaces each embedding's full-precision in-memory search representation with a 128-byte code. The new index persists all these codes on disk and also retains every original float32 embedding on disk for full-precision rescoring.

Document metadata and all other index structures require a combined 16 GB of disk storage in either configuration. Codebook storage is negligible for this estimate. Use decimal GB, exclude replicas, and assume no other storage compression. The pilot meets the retrieval-quality target, but production-scale latency testing is not complete.

Which conclusion should an ML engineer use when forecasting infrastructure costs?

Show answerCORRECT ANSWER

Forecast approximately 100.48 GB of disk storage. Evaluate lower-memory node configurations, but benchmark rescoring I/O and end-to-end latency before projecting node-cost savings.

The original embeddings occupy 20 million × 1,024 × 4 bytes = 81.92 GB. The persisted codes add 20 million × 128 bytes = 2.56 GB. Adding 16 GB of other index data gives 100.48 GB. Quantization can reduce the in-memory search footprint even though total disk storage increases. Rescoring adds I/O and computation that must be tested before downsizing.

AIP-C01

A manufacturer uses Amazon OpenSearch Service to retrieve evidence for a generative AI maintenance assistant. Each equipment manual contains hundreds of passages. With one OpenSearch document per passage, the 10 nearest-neighbor hits frequently come from a single manual, excluding other useful manuals.

The retrieval contract must return up to 10 distinct manuals, ranked by the similarity of each manual's best-matching passage, and include that passage's text and source reference. Passage embeddings must remain individually searchable because averaging them loses narrowly focused procedures. The application cannot retrieve an oversized flat passage result set and group it afterward. Approximate nearest-neighbor retrieval is acceptable.

The company can rebuild the index. Its OpenSearch version supports nested k-NN search with Lucene HNSW and inner hits.

Which design BEST meets these requirements?

Show answerCORRECT ANSWER

Create one parent document per manual with passages represented as nested objects containing text, source references, and knn_vector fields. Use a nested k-NN query with maximum-score aggregation to retrieve 10 parent manuals, and request the highest-scoring matching passage through inner_hits.

Nested k-NN search can search individual passage vectors while diversifying results at the parent-document level. Maximum-score aggregation ranks each manual using its best-matching passage, and inner_hits returns the matching nested passage with its text and source reference. This avoids a flat candidate list being consumed by passages from one manual.

Practice Embeddings in a full exam

Questions on Embeddings in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Embeddings

3 min read

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.

Learn Embeddings in lessons

12 short lessons on Embeddings in 5 certification courses.

and 6 more lessons

Open the lessons