Skip to content

Skill 1.2.5: Configure and use embedding models to transform text and image data into numerical representations


Question Answer & Explanation
### Question 1 - Amazon Bedrock Embedding Model Selection

A retail company is building a visual search application where users upload an image of a product (e.g., a dress or a chair) to find visually similar items in their product catalog. The team plans to use Amazon Bedrock to generate vector representations of the product images.

Constraint: The solution must use the least operational overhead and natively support image-to-image similarity searches without requiring a custom model training pipeline.

Which AWS service or feature should the ML engineer use?

Select ONE that applies:

- A) Use Amazon Titan Text Embeddings (v2) and convert images to text descriptions using a separate LLM before embedding.
- B) Use Amazon Titan Multimodal Embeddings (G1) to generate embeddings directly from the image data.
- C) Train a custom ResNet model using Amazon SageMaker to output feature vectors for the images.
- D) Use Amazon Comprehend to extract key phrases from the image metadata and embed the text.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: Amazon Titan Multimodal Embeddings (G1) is a foundation model available in Amazon Bedrock specifically designed to convert both text and images into numerical vector representations. It natively supports image embeddings for visual similarity search without requiring custom model training or a secondary LLM to translate images to text.

Distractor Analysis:
- A is Incorrect: Converting images to text first introduces a two-step pipeline with higher latency, potential information loss in the image-to-text translation, and unnecessary operational overhead.
- C is Incorrect: Training a custom ResNet model in SageMaker violates the "least operational overhead" constraint, as it requires managing training data, compute resources, and model deployment.
- D is Incorrect: Amazon Comprehend is an NLP service for extracting insights from text, not for processing raw image data into image embeddings.

> Key Takeaway: For visual search and multimodal retrieval, use Amazon Titan Multimodal Embeddings in Amazon Bedrock to directly convert images into vector representations.
### Question 2 - RAG Chunking Strategies for Embeddings

A legal firm is building a Retrieval-Augmented Generation (RAG) application using Amazon Bedrock Knowledge Bases. The source data consists of large, complex PDF contracts where clauses and definitions are heavily interdependent.

Constraint: The retrieval step must return coherent, contextually complete passages rather than arbitrary fragments of sentences. The team wants to use an automated chunking method that breaks documents based on natural structural boundaries.

Which chunking strategy should the ML engineer configure in the Bedrock Knowledge Base to meet this requirement?

Select ONE that applies:

- A) Fixed-size chunking with a small chunk size and high overlap percentage.
- B) Semantic chunking.
- C) No chunking (treat each PDF as a single chunk).
- D) Document-based hierarchical chunking.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: Semantic chunking groups content into chunks based on natural divisions in the text, such as paragraphs, topics, or sentences, rather than an arbitrary character count. This ensures that related sentences and context remain together, producing more coherent embeddings and better retrieval results for complex legal documents.

Distractor Analysis:
- A is Incorrect: Fixed-size chunking breaks text at arbitrary character limits, which often splits sentences or clauses mid-way, destroying the contextual integrity required for legal definitions.
- C is Incorrect: No chunking would mean embedding the entire contract as one massive vector. This dilutes the semantic meaning of specific clauses and exceeds typical token limits for embedding models.
- D is Incorrect: While hierarchical chunking maintains parent-child relationships, semantic chunking is specifically designed to break on natural structural boundaries (meaning) to ensure coherent, standalone passages.

> Key Takeaway: Use semantic chunking in Amazon Bedrock Knowledge Bases when documents require context to be preserved across naturally related text blocks rather than arbitrary character counts.
### Question 3 - Embeddings vs. Categorical Encoding

A data science team is preparing a dataset for a hybrid machine learning system. The dataset is a structured table containing two key fields: customer_region (e.g., "North", "South", "East") and support_ticket_text (a free-text field containing a paragraph describing the customer's issue).

Constraint: The transformation step must correctly represent both categorical labels and semantic meaning for downstream ML models.

Which combination of transformations should the engineer apply?

Select ONE that applies:

- A) Apply One-Hot Encoding to customer_region and One-Hot Encoding to support_ticket_text.
- B) Apply Amazon Titan Text Embeddings to customer_region and One-Hot Encoding to support_ticket_text.
- C) Apply One-Hot Encoding to customer_region and Amazon Titan Text Embeddings to support_ticket_text.
- D) Apply Amazon Titan Text Embeddings to both customer_region and support_ticket_text.
Correct Answer: C

Correct Answer Analysis:
- C is Correct: Categorical variables (customer_region) should be encoded using methods like One-Hot Encoding because they act as label substitutes without inherent semantic relationships. Free-text fields (support_ticket_text) contain semantic meaning and context, which should be captured using an embedding model like Amazon Titan Text Embeddings.

Distractor Analysis:
- A is Incorrect: Applying One-Hot Encoding to free text would result in an incredibly sparse and meaningless matrix where every unique word or sentence becomes a category, destroying semantic similarity.
- B is Incorrect: Embedding a simple categorical label like "North" or "South" is unnecessary overhead; categorical encoding handles this efficiently without needing an embedding model.
- D is Incorrect: Using an embedding model for customer_region is computationally wasteful and does not improve the representation of discrete, unrelated labels.

> Key Takeaway: Categories get encoded (e.g., One-Hot Encoding), and meaning gets embedded (e.g., Amazon Titan Embeddings).
### Question 4 - Frequent Knowledge Updates: RAG vs. Fine-Tuning

An AI engineering team is developing an internal HR assistant using a foundation model. The assistant answers employee questions based on the company's employee handbook, which undergoes revisions and updates on a monthly basis.

Constraint: The solution must require the least rework and lowest compute overhead when the source documents change.

Which data preparation approach should the team use?

Select ONE that applies:

- A) Split the handbook into chunks, generate embeddings, and store them in a vector store for RAG.
- B) Build prompt and response pairs from the handbook and fine-tune the foundation model.
- C) Assemble the handbook as unlabeled text for continued pre-training.
- D) Assemble a prompt set covering the handbook and distill a smaller model from a larger one.
Correct Answer: A

Correct Answer Analysis:
- A is Correct: RAG preparation makes knowledge retrievable. By storing chunked document embeddings in a vector store, the model can access the latest information. When the handbook changes monthly, the team only needs to re-index the updated chunks, requiring minimal compute overhead and no model weight updates.

Distractor Analysis:
- B is Incorrect: Fine-tuning bakes knowledge directly into the model weights. Every monthly handbook revision would require recreating prompt-response pairs and running expensive GPU training pipelines.
- C is Incorrect: Continued pre-training is highly compute-intensive and designed to teach a model a domain's vocabulary/patterns, not to update factual policies dynamically.
- D is Incorrect: Distillation transfers capabilities from a teacher to a student model. Re-running this process monthly for document updates is cost-prohibitive and operationally heavy.

> Key Takeaway: Frequently changing knowledge belongs in a vector store (RAG); static behavior and tone belong in fine-tuning data.
### Question 5 - Low-Code Ingestion for Embeddings

An enterprise needs to ingest 10,000 unstructured PDF documents into an Amazon OpenSearch Serverless vector collection. The pipeline must parse the PDFs, extract text, split the text into chunks, generate vector embeddings, and store them in OpenSearch.

Constraint: The solution must use the lowest operational overhead and avoid writing custom parsing and embedding pipeline code.

Which AWS service should the engineer use to orchestrate this entire workflow?

Select ONE that applies:

- A) Deploy an AWS Lambda function triggered by S3 Event Notifications to parse PDFs and invoke the Bedrock API.
- B) Create an AWS Glue ETL job using Apache Spark to process the PDFs and call the Bedrock API.
- C) Create an Amazon Bedrock Knowledge Base pointing to the S3 bucket and run the StartIngestionJob API.
- D) Use an Amazon SageMaker Processing job with a custom PyPDF and LangChain script.
Correct Answer: C

Correct Answer Analysis:
- C is Correct: Amazon Bedrock Knowledge Bases natively manages the entire ingestion path for RAG: parsing documents, applying chunking strategies, calling the embedding models, and writing the vectors to a configured vector store (like OpenSearch Serverless) without requiring custom code.

Distractor Analysis:
- A is Incorrect: Using Lambda requires writing custom code for PDF parsing, chunking, and API calls, introducing high operational overhead and potential timeout issues for 10,000 documents.
- B is Incorrect: AWS Glue is a serverless ETL service, but it requires writing Spark scripts to handle PDF parsing and Bedrock API integration, violating the "no custom code" constraint.
- D is Incorrect: SageMaker Processing requires managing container environments and writing custom scripts, which is much higher operational overhead than Bedrock Knowledge Bases.

> Key Takeaway: Bedrock Knowledge Bases provides a fully managed, no-code ingestion path for document parsing, chunking, embedding, and vector indexing.
### Question 6 - OpenSearch Serverless Configuration for Embeddings

A team is configuring a vector database to store text embeddings generated by Amazon Titan Text Embeddings (v2). They have chosen Amazon OpenSearch Serverless as their vector store. The application will query the database to find passages with similar semantic meaning to a user's question.

Constraint: The infrastructure must automatically scale based on the application's read and write demands without manual cluster management.

Which OpenSearch collection type and configuration should the engineer select?

Select ONE that applies:

- A) Create a Search Collection and define a knn_vector field type in the index mapping.
- B) Create a Time-Series Collection and define a text field type in the index mapping.
- C) Create a Search Collection and define a keyword field type in the index mapping.
- D) Create a Managed Cluster (non-serverless) and configure a knn_vector field type.
Correct Answer: A

Correct Answer Analysis:
- A is Correct: OpenSearch Serverless Search Collections are designed for search and vector workloads. The knn_vector field type is specifically required to store the dense numerical vectors (embeddings) and enable k-nearest neighbor (k-NN) similarity search for semantic retrieval.

Distractor Analysis:
- B is Incorrect: Time-series collections are optimized for time-based log and metric data, not vector similarity search. Additionally, text fields do not support vector mathematical distance calculations.
- C is Incorrect: keyword fields are used for exact match filtering, not for storing dense float arrays (embeddings) used in semantic similarity search.
- D is Incorrect: A managed cluster (non-serverless) requires manual node provisioning and cluster management, violating the "no manual cluster management" constraint.

> Key Takeaway: In OpenSearch Serverless, use a Search Collection with a knn_vector field type to enable automatic scaling for semantic similarity queries.
### Question 7 - Multilingual Embedding Models

A global enterprise is building a semantic search application for its customer support portal. The support articles are written in multiple languages, including English, Spanish, and Japanese. Users must be able to search for an article in Spanish and retrieve semantically similar articles written in English or Japanese.

Constraint: The solution must use a single embedding model to handle cross-lingual semantic search natively without requiring translation.

Which embedding model available in Amazon Bedrock is best suited for this task?

Select ONE that applies:

- A) Amazon Titan Text Embeddings (v2)
- B) Amazon Titan Multimodal Embeddings (G1)
- C) Claude 3 Haiku
- D) Amazon Titan Image Generator
Correct Answer: A

Correct Answer Analysis:
- A is Correct: Amazon Titan Text Embeddings (v2) supports multilingual text (over 100 languages) and creates a unified semantic vector space. This means text with similar meanings in different languages will map to vectors that are close to each other, enabling cross-lingual semantic search without a separate translation step.

Distractor Analysis:
- B is Incorrect: Titan Multimodal Embeddings (G1) is designed for image and text-to-image matching, not specifically optimized for cross-lingual text-to-text search across 100+ languages.
- C is Incorrect: Claude 3 Haiku is a Large Language Model (LLM) used for text generation and reasoning, not an embedding model designed to output vector representations for semantic search.
- D is Incorrect: Titan Image Generator is a diffusion model for creating images from text prompts, not for generating text embeddings.

> Key Takeaway: Amazon Titan Text Embeddings (v2) natively supports multilingual text inputs, allowing cross-lingual semantic search by mapping different languages into the same vector space.
### Question 8 - Metadata Filtering in Vector Stores

A financial services company is using a RAG pipeline with Amazon Bedrock Knowledge Bases and OpenSearch Serverless. They have ingested quarterly earnings reports from the last 10 years. When users ask about "2023 revenue," the vector store retrieves chunks from 2018 and 2023 because the word "revenue" appears in both, leading to conflicting answers.

Constraint: The solution must strictly limit the semantic similarity search to the correct document subset before performing the k-NN search, without requiring a smaller embedding model.

Which technique should the ML engineer implement?

Select ONE that applies:

- A) Decrease the chunk size to reduce the chance of retrieving irrelevant years.
- B) Extract the year as metadata from the documents and attach it to the embeddings, then use pre-filtering in OpenSearch.
- C) Increase the overlap size during chunking to capture more context about the year.
- D) Use an LLM to post-process the retrieved chunks and filter out older years.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: Extracting the year as metadata and attaching it to the vector chunks allows OpenSearch to perform pre-filtering. Pre-filtering restricts the search space to only chunks where year=2023 before calculating vector distances, ensuring accurate retrieval and saving compute resources.

Distractor Analysis:
- A is Incorrect: Decreasing chunk size does not solve the fundamental issue that the vector store contains multiple years of data with similar vocabulary.
- C is Incorrect: Increasing overlap helps maintain context within a single document but does not prevent the retrieval of chunks from entirely different documents (years).
- D is Incorrect: Using an LLM to post-process retrieved chunks adds latency and compute cost, and the LLM might not even see the correct chunk if it wasn't retrieved in the first place due to vector limits.

> Key Takeaway: Extracting metadata during ingestion and using pre-filtering in the vector store narrows retrieval to the right subset before similarity is even considered.
### Question 9 - Batch Processing Embeddings via API

An application is processing a large batch of product reviews. The developer is using the Amazon Bedrock InvokeModel API with an embedding model to generate vectors for each review. The developer currently loops through 500 reviews, making a separate API call for each one.

Constraint: The solution must optimize for API rate limits and reduce overall latency for the batch while using Amazon Bedrock.

What architectural change should the engineer implement?

Select ONE that applies:

- A) Migrate the code to an AWS Glue ETL job to handle the looping natively in Spark.
- B) Switch to using Amazon SageMaker Data Wrangler to generate embeddings instead of Bedrock.
- C) Batch the text snippets into a single payload (up to the model's maximum token limit) and make a single API call for the array.
- D) Deploy the API calls across multiple AWS Lambda functions concurrently using Step Functions.
Correct Answer: C

Correct Answer Analysis:
- C is Correct: Amazon Bedrock embedding models (like Titan Text Embeddings) support batched inputs. By passing an array of texts in a single API call, the application reduces the number of HTTP requests, stays well within API rate limits, and significantly reduces network latency overhead.

Distractor Analysis:
- A is Incorrect: Migrating to Glue introduces a heavy data engineering tool for a simple API batching problem and doesn't inherently solve the API rate limit issue if it still loops single calls.
- B is Incorrect: Data Wrangler is a visual data prep tool; it doesn't natively call Bedrock embedding APIs better than a direct batched API call.
- D is Incorrect: Parallelizing single API calls with Lambda and Step Functions will actually trigger Bedrock API throttling (rate limits) much faster than sequential calls.

> Key Takeaway: When generating embeddings for multiple texts, always batch them into a single API request payload to optimize for latency and API rate limits.
### Question 10 - Modality-Specific Vector Storage

An e-commerce platform uses Amazon Titan Multimodal Embeddings (G1) to generate vector representations of both product images and product text descriptions. They are storing these vectors in an Amazon OpenSearch Service cluster.

Constraint: The index must be configured to correctly store the 1024-dimensional vectors generated by the Titan Multimodal Embeddings model to support k-NN search.

Which index mapping configuration is required?

Select ONE that applies:

- A) Define the field as "type": "text" and use a custom analyzer.
- B) Define the field as "type": "knn_vector" and set "dimension": 1024.
- C) Define the field as "type": "binary" to store the compressed image data.
- D) Define the field as "type": "keyword" to allow exact matching of vector arrays.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: OpenSearch uses the knn_vector field type to store dense floating-point arrays for vector similarity search. The dimension parameter must exactly match the output dimensions of the embedding model. Titan Multimodal Embeddings (G1) outputs 1024-dimensional vectors by default.

Distractor Analysis:
- A is Incorrect: The text type is used for full-text search (e.g., BM25), not for storing numerical vector arrays required for semantic similarity.
- C is Incorrect: binary fields are used for storing binary data encoded in Base64, not for float arrays representing semantic embeddings.
- D is Incorrect: keyword fields are for exact string matching and cannot perform mathematical distance calculations (like cosine similarity) required for k-NN search.

> Key Takeaway: When storing embeddings in OpenSearch, always map the field as knn_vector and explicitly specify the dimension to match the chosen embedding model's output vector size.