Skill 1.1.1: Extract data from data sources
Question 1 - SageMaker Feature Store for Training-Serving Consistency
A financial services company is building a fraud detection model that processes real-time credit card transactions. The data science team has engineered features including transaction velocity (transactions in the last 24 hours), merchant category embeddings, and customer spending z-scores. During development, they discover that the features computed during experimentation differ from those being computed in production, causing model performance degradation. The team needs a solution that ensures training and inference use identical feature definitions with minimal operational overhead.
Which approach should the ML engineer implement to resolve this training-serving skew?
A) Store all engineered features in Amazon SageMaker Feature Store, using the same feature groups for both training queries and online inference lookups.
B) Refactor the feature engineering codebase into a shared Python library and deploy it as a Lambda layer for both training jobs and inference endpoints.
C) Use AWS Glue DataBrew recipes to document the feature transformations, then manually reimplement them in the production inference pipeline.
D) Create feature lookup tables in Amazon DynamoDB that store pre-computed aggregates, and use AWS Lambda functions to compute features on-the-fly during inference.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: Amazon SageMaker Feature Store provides a centralized repository for feature definitions, ensuring that features are computed once and reused consistently across both model training and real-time inference. This eliminates training-serving skew by design, with the feature store handling the storage, retrieval, and serving infrastructure.
Distractor Analysis
- B is Incorrect: While a shared code library reduces drift, it still requires the team to maintain deployment infrastructure and ensure the library version is synchronized across training and production environments. This introduces more operational overhead than using the managed Feature Store.
- C is Incorrect: Manually reimplementing transformations in production is exactly the practice that introduces training-serving skew. DataBrew recipes document the steps but don't automatically enforce consistency at inference time.
- D is Incorrect: DynamoDB with Lambda functions is a custom implementation that requires the team to build, maintain, and scale the feature serving infrastructure themselves. This is higher operational overhead compared to SageMaker Feature Store's managed online and offline serving.
Key Takeaway: Use SageMaker Feature Store when the same feature definitions must serve both training and inference workloads, eliminating training-serving skew with minimal operational overhead.
Question 2 - Streaming Data Transformation with Sliding Windows
A logistics company ingests GPS telemetry data from their delivery fleet through Amazon Kinesis Data Streams. The ML team needs to compute rolling average delivery speeds over the last 15 minutes for each vehicle to feed into a delay prediction model. The transformation must support continuously updating windows that slide with each new record, and the solution must maintain state across events while providing exactly-once processing guarantees.
Which AWS service should the team use to implement this streaming transformation?
A) AWS Lambda functions configured with a Kinesis event source mapping and a batch window of 15 minutes.
B) Amazon Managed Service for Apache Flink with a sliding window operator over the telemetry stream.
C) AWS Glue streaming ETL job running on Apache Spark Structured Streaming.
D) Amazon Kinesis Data Analytics with SQL-based sliding window queries.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Amazon Managed Service for Apache Flink is purpose-built for stateful stream processing with sliding windows. It maintains continuous state across events, supports exactly-once processing semantics, and can compute rolling aggregates (like a 15-minute sliding average) that update as each new record arrives.
Distractor Analysis
- A is Incorrect: AWS Lambda is fundamentally stateless. While Lambda event source mappings can aggregate records into fixed non-overlapping windows, they cannot maintain the continuous sliding window state required for this use case.
- C is Incorrect: AWS Glue streaming ETL with Spark Structured Streaming can process streaming data, but it is primarily designed for batch-oriented ETL workloads. Configuring and managing Spark for stateful sliding windows introduces more operational overhead than the dedicated stream processing of Managed Flink.
- D is Incorrect: Kinesis Data Analytics with SQL (the legacy SQL engine) supports sliding windows but has been superseded by the Flink-based engine in Amazon Managed Service for Apache Flink. The newer service offers better state management, fault tolerance, and exactly-once guarantees.
Key Takeaway: Amazon Managed Service for Apache Flink is the right choice for stateful stream processing with continuously sliding windows, while Lambda only supports fixed non-overlapping windows.
Question 3 - Semantic Chunking for RAG Document Preparation
A healthcare organization is building a Retrieval-Augmented Generation (RAG) application on Amazon Bedrock to answer physician queries from medical research papers. The current implementation uses fixed-size chunking of 2000 characters, but doctors report that answers often include irrelevant information from adjacent but unrelated sections of the papers. The team needs to improve retrieval precision by ensuring chunks align with natural topic boundaries within each document.
Which chunking strategy should the team implement in Amazon Bedrock Knowledge Bases to address this issue?
A) Increase the fixed chunk size to 4000 characters to include more surrounding context.
B) Configure semantic chunking that splits documents based on meaning and topic shifts rather than uniform length.
C) Disable chunking entirely and treat each entire research paper as a single retrieval unit.
D) Apply hierarchical chunking with a parent-child structure and larger parent chunks.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Semantic chunking in Amazon Bedrock Knowledge Bases uses embedding-based algorithms to identify natural topic boundaries and linguistic shifts within documents. This ensures each chunk contains coherent, topically-related content, improving retrieval precision by preventing irrelevant adjacent sections from being included alongside relevant information.
Distractor Analysis
- A is Incorrect: Increasing fixed chunk size would worsen the problem by retrieving even more irrelevant surrounding text along with the relevant passage, diluting the semantic signal in the vector embedding.
- C is Incorrect: Using entire papers as chunks would cause retrieval to return massive documents containing substantial irrelevant content, flooding the LLM context window and reducing answer quality.
- D is Incorrect: Hierarchical chunking with larger parent chunks would preserve context through parent-child relationships, but the larger parent chunks would still contain irrelevant sections if the fixed-size splits don't align with topical boundaries.
Key Takeaway: Semantic chunking improves retrieval precision by splitting documents at natural topic boundaries, unlike fixed-size chunking that may include irrelevant adjacent content.
Question 4 - Embedding Models for Multimodal Search
An e-commerce company wants to build a visual search feature that allows customers to upload product photos and find visually similar items in their catalog. The solution must generate embeddings for both product images and their textual descriptions (titles, categories, and attributes) and enable searching across modalities—image-to-image, text-to-image, and image-to-text retrieval.
Which AWS service should the company use to generate these embeddings?
A) Amazon SageMaker with a custom-trained image classification model.
B) Amazon Bedrock with multimodal embedding models that generate vector representations for both images and text.
C) Amazon Rekognition to extract labels from images and use those labels as text embeddings.
D) Amazon Comprehend with custom entity recognition for product attributes.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Amazon Bedrock provides access to multimodal embedding models (such as Amazon Titan Multimodal Embeddings) that can generate embeddings for both images and text in a shared vector space. This enables cross-modal search—where an image query can retrieve text descriptions and vice versa—without building custom model infrastructure.
Distractor Analysis
- A is Incorrect: A custom-trained image classification model outputs discrete class labels, not continuous vector embeddings suitable for similarity search. Building and maintaining a custom embedding model also introduces significant operational overhead compared to using Bedrock's managed multimodal models.
- C is Incorrect: Amazon Rekognition extracts descriptive labels from images, but this approach only enables image-to-text search indirectly and loses the richness of visual embedding representations. It does not support direct image-to-image similarity search.
- D is Incorrect: Amazon Comprehend is designed for natural language processing tasks like entity recognition and sentiment analysis, not for generating multimodal embeddings that span both visual and textual modalities.
Key Takeaway: Amazon Bedrock's multimodal embedding models generate unified vector representations for both images and text, enabling cross-modal similarity search without custom model development.
Question 5 - Feature Engineering Techniques for Skewed Data
A retail analytics team is building a customer lifetime value prediction model. They analyze the raw features and find that the total_spend variable has a right-skewed distribution with a long tail: most customers spend between \(50–\)500, while a small number of VIP customers spend $50,000+. The team plans to use a linear regression model, which assumes normally distributed features for optimal performance.
Which transformation should the ML engineer apply to the total_spend feature before model training?
A) Min-max scaling to normalize the values to a [0, 1] range.
B) Log transformation to compress the long tail and reduce skewness.
C) One-hot encoding to convert the continuous values into categories.
D) Z-score standardization to center the distribution at zero.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Log transformation (typically log1p for values that may include zero) is specifically designed to handle heavily skewed distributions. By applying a logarithmic function, extreme values in the long tail are compressed relative to the smaller values, bringing the distribution closer to normal. This helps linear models learn more stable coefficients and improves model performance.
Distractor Analysis
- A is Incorrect: Min-max scaling only rescales values to a fixed range without changing the underlying distribution shape. The skew and long tail would remain, meaning extreme values would still dominate the scaling range.
- C is Incorrect: One-hot encoding is designed for categorical variables, not continuous features. Converting continuous spend values to categories would lose the ordinal information and significantly increase dimensionality without addressing the skewness.
- D is Incorrect: Z-score standardization centers data at zero with unit variance but does not reduce skewness. The long tail of extreme values would still distort the distribution and affect model performance.
Key Takeaway: Log transformations compress long tails in skewed distributions, while scaling techniques (min-max, z-score) only rescale the range without changing the underlying shape.
Question 6 - Fine-tuning vs. Continued Pre-training Data Preparation
A legal technology company wants to customize a foundation model for contract analysis. They have two sets of training data available:
- Dataset 1: 500,000 unlabeled legal contracts, court opinions, and regulatory filings (approximately 2 billion tokens).
- Dataset 2: 10,000 labeled examples of contract clauses paired with their plain-language interpretations.
The team wants the model to first develop fluency in legal terminology and document structures, then learn the specific task of clause interpretation.
Which approach should the ML engineer use to prepare this data for model customization?
A) Combine both datasets into a single JSONL file for supervised fine-tuning.
B) Use Dataset 1 as unlabeled text for continued pre-training, then fine-tune the resulting model using Dataset 2 as prompt-response pairs.
C) Use both datasets for continued pre-training since the model will learn everything from the unlabeled data.
D) Convert Dataset 1 into embeddings for a RAG system and use Dataset 2 for distillation from a larger model.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Continued pre-training with Dataset 1 (unlabeled domain text) allows the model to absorb legal vocabulary, document structures, and stylistic patterns. This is followed by supervised fine-tuning with Dataset 2 (labeled prompt-response pairs) to teach the specific task of clause interpretation. This sequential approach is the correct architectural pattern for domain adaptation followed by task specialization.
Distractor Analysis
- A is Incorrect: Supervised fine-tuning requires labeled prompt-response pairs. Dataset 1 contains unlabeled text that cannot be formatted for fine-tuning, so combining both datasets into a single fine-tuning file would not work.
- C is Incorrect: Continued pre-training uses unlabeled text with self-supervised learning and does not use labeled data to teach specific tasks. The labeled Dataset 2 would be wasted in this pipeline, and the model would not learn the specific clause interpretation task.
- D is Incorrect: Converting Dataset 1 into embeddings sets up a RAG system, but the goal here is to customize the model's weights to understand legal language, not to retrieve external knowledge. Distillation with Dataset 2 would not leverage the unlabeled domain data for domain adaptation.
Key Takeaway: Continued pre-training uses unlabeled text for domain adaptation, followed by supervised fine-tuning with labeled JSONL prompt-response pairs for task-specific behavior.
Question 7 - Data Anonymization Techniques for Compliance
A healthcare startup is preparing a dataset of electronic health records for ML model training in Amazon SageMaker. The dataset contains personally identifiable information (PII) including patient names, social security numbers, and dates of birth. Compliance regulations require that the data be anonymized so that no individual can be identified, while preserving as much analytical value as possible for the ML model.
Which combination of techniques should the ML engineer apply to meet compliance requirements?
A) Mask PII fields by replacing characters with asterisks while preserving the format structure.
B) Apply data anonymization techniques such as k-anonymity or differential privacy, and remove direct identifiers.
C) Encrypt the PII fields using AWS KMS before storing in S3.
D) Use Amazon Macie to detect PII and apply client-side redaction in the training script.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Data anonymization requires techniques that make it impossible to identify individuals from the data. Removing direct identifiers (names, SSNs) and applying techniques like k-anonymity or differential privacy ensures that even indirect identifiers (zip code, age, condition) cannot be combined to re-identify individuals. This is fundamentally different from masking or redaction, which only hide values without guaranteeing anonymity.
Distractor Analysis
- A is Incorrect: Masking hides values but still preserves individual records by keeping same-format placeholders. This may be sufficient for display purposes but does not guarantee data anonymization, as individuals could still be identified through remaining information.
- C is Incorrect: Encryption protects data at rest but does not anonymize it. Once decrypted for model training, the PII becomes visible, and encryption does not prevent an individual from being identified in the dataset.
- D is Incorrect: Amazon Macie detects and reports PII locations but does not perform anonymization. Client-side redaction in the training script adds complexity and does not guarantee anonymization if the original data remains in S3.
Key Takeaway: Anonymization requires applying techniques like k-anonymity or differential privacy and removing direct identifiers, which is fundamentally different from masking (preserves shape) or encryption (protects at rest).
Question 8 - Data Balancing with SageMaker Data Wrangler
A fraud detection team is preparing transaction data for model training. The dataset contains 2% fraudulent transactions and 98% legitimate transactions. Initial model training shows the model is biased toward predicting "not fraud" due to the extreme class imbalance. The team wants to rebalance the dataset during the interactive data preparation phase before finalizing the feature engineering pipeline.
Which option should the team use to address the class imbalance?
A) Use Amazon SageMaker Data Wrangler to apply SMOTE (Synthetic Minority Over-sampling Technique) or other balancing transforms during data preparation.
B) Manually implement random undersampling in Python custom code within a Jupyter notebook.
C) Apply log transformation to the target variable to reduce the imbalance.
D) Use Amazon SageMaker Feature Store to store separate balanced and unbalanced versions of the dataset.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: Amazon SageMaker Data Wrangler provides built-in transforms for handling imbalanced datasets, including SMOTE, random oversampling, and undersampling. These can be applied interactively during data preparation before exporting the processing flow to a pipeline, eliminating the need for custom code.
Distractor Analysis
- B is Incorrect: While manually implementing undersampling in Python would work, it introduces unnecessary development overhead compared to Data Wrangler's built-in balancing transforms. The question emphasizes interactive data preparation, where Data Wrangler's visual interface is more appropriate.
- C is Incorrect: Log transformations are applied to continuous features to reduce skewness, not to the target variable for class imbalance. Applying log to binary labels (0/1) would be meaningless.
- D is Incorrect: SageMaker Feature Store manages feature storage and serving, but it does not perform class balancing or data transformation. Storing two versions in the Feature Store would also introduce data management complexity without addressing the imbalance problem.
Key Takeaway: SageMaker Data Wrangler provides built-in transforms like SMOTE, oversampling, and undersampling for handling imbalanced classes during interactive data preparation.
Question 9 - Metadata Extraction for RAG Attribution
A customer support team is building a RAG application using Amazon Bedrock Knowledge Bases to answer inquiries from their product documentation. The documentation includes user guides, API references, and troubleshooting guides for over 100 products. The application must provide source citations (document title, product name, and section heading) in every response and enable filtering of retrieved chunks by product.
Which configuration should the ML engineer implement in the Bedrock Knowledge Base to meet these requirements?
A) Enable metadata extraction from the source documents, including custom fields for product name and document type, and configure filtering on these metadata fields.
B) Store all chunks without metadata and rely on the embedding similarity to ensure only relevant products are retrieved.
C) Add product names and titles directly into the chunk text before embedding to enable semantic search by product.
D) Create separate knowledge bases for each product and route queries to the appropriate one using Amazon Lex.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: Amazon Bedrock Knowledge Bases supports metadata extraction and custom metadata fields. By extracting product name, document title, and section heading as metadata for each chunk, the application can filter retrieval results by product and provide source citations. This is the native approach that meets both attribution and filtering requirements.
Distractor Analysis
- B is Incorrect: Without metadata, the system cannot provide source citations or filter by product. Embedding similarity alone may retrieve chunks from unrelated products if text is semantically similar.
- C is Incorrect: Embedding product names directly into chunk text would disrupt the semantic embeddings and does not provide reliable structured filtering or attribution capabilities compared to proper metadata fields.
- D is Incorrect: Creating 100 separate knowledge bases introduces significant operational overhead with 100 vector stores to manage. Using metadata filtering within a single knowledge base is more scalable and cost-effective.
Key Takeaway: Metadata extraction in Bedrock Knowledge Bases enables both filtering (by product, document type) and source attribution (title, section heading) without needing separate vector stores.
Question 10 - Data Distribution Analysis Before Transformation
A machine learning team at a manufacturing company has loaded sensor data into Amazon SageMaker Canvas for anomaly detection. They notice that the temperature feature has values ranging from 15°C to 900°C, while vibration ranges from 0.01 to 0.5, and pressure ranges from 100 to 150. The team wants to understand data quality issues, outliers, and distribution patterns for each column before applying any transformations.
Which AWS tool should the team use for this initial data exploration step?
A) Amazon SageMaker Feature Store to store the raw sensor data and query it for analysis.
B) AWS Glue DataBrew to run a data profiling job that generates column-level statistics, identifies missing values, and detects outliers.
C) Amazon Bedrock to generate embeddings of the sensor data for pattern detection.
D) AWS Glue to run an ETL job that performs data quality checks and writes results to S3.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: AWS Glue DataBrew's data profiling feature automatically generates column-level statistical reports, including data distributions, missing value counts, outlier detection, and data quality scores. This provides exactly the information needed to decide which transformations to apply (scaling, outlier handling, or log transformation) before writing any code.
Distractor Analysis
- A is Incorrect: SageMaker Feature Store is designed for storing and serving engineered features for model training and inference, not for exploratory data analysis or data profiling of raw data before transformation.
- C is Incorrect: Embedding models convert text or images into vector representations for semantic similarity. They are not appropriate for profiling numerical sensor data to understand distributions, outliers, and data quality.
- D is Incorrect: While AWS Glue ETL jobs can run data quality checks, this requires writing code or configuring rules. DataBrew's profiling job is the purpose-built, code-free approach for initial data exploration and profiling.
Key Takeaway: Use AWS Glue DataBrew's profile job for automated, code-free data profiling that reveals column distributions, missing values, and outliers before transformation.
Question 11 - Feature Store for Realtime Feature Reuse
A ride-sharing company has built a demand prediction model that uses features including driver_supply_index, rider_demand_score, and surge_multiplier. These features are computed by separate streaming jobs that aggregate data over the past 30 minutes. Several different ML models (demand forecasting, pricing optimization, and driver allocation) need to consume the same features in real-time with sub-100ms latency.
Which architecture should the company implement to serve these features to multiple models with minimal operational overhead?
A) Each model receives raw events from Kinesis and computes its own features in real-time using Lambda.
B) Store the features in Amazon SageMaker Feature Store online store and have all models retrieve them via the GetRecord API.
C) Store the features in a shared Redis cluster on Amazon ElastiCache and have models query Redis directly.
D) Write the features to DynamoDB tables and use DynamoDB Streams to trigger model-specific Lambda functions.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: SageMaker Feature Store's online store provides low-latency (single-digit millisecond) feature retrieval through the GetRecord API. Multiple models can share the same feature groups, ensuring that all models consume identical feature definitions and values. This avoids duplicated feature computation across models and provides a centralized repository for feature management.
Distractor Analysis
- A is Incorrect: Having each model compute its own features leads to duplicated processing logic and increased development overhead. This can also introduce inconsistencies between models if feature definitions diverge over time.
- C is Incorrect: Using Redis on ElastiCache requires managing the infrastructure, configuring replication, and implementing data serialization. It is a viable option but introduces more operational overhead compared to the managed SageMaker Feature Store online store.
- D is Incorrect: Using DynamoDB tables requires designing the table schema, managing read/write capacity, and implementing change data capture with DynamoDB Streams. This introduces more complexity than using the Feature Store's built-in online serving capabilities.
Key Takeaway: SageMaker Feature Store's online store serves as a centralized feature repository for multiple models, providing consistent feature definitions and single-digit millisecond retrieval latency.
Question 12 - Tokenization for Domain-Specific Vocabulary
A pharmaceutical company is preparing drug discovery research papers for a foundation model fine-tuning task. The base model's tokenizer frequently breaks domain-specific terms like "pembrolizumab" and "CRISPR-Cas9" into multiple subword tokens, causing the model to produce incorrect scientific terminology. The team needs to improve the model's handling of specialized pharmaceutical vocabulary.
Which approach should the ML engineer implement to address this tokenization issue?
A) Apply text normalization to convert all domain-specific terms to their common abbreviations before tokenization.
B) Include domain-specific terms during continued pre-training so the model's tokenizer can adapt to the specialized vocabulary.
C) Remove all domain-specific terms from the training data and replace them with generic substitutes.
D) Simply increase the context window to fit more tokens for the domain-specific terms.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Continued pre-training on domain-specific text allows the model to adapt its tokenizer (or model vocabulary) to handle specialized pharmaceutical terms more effectively. As the model processes more domain text, it learns to recognize these terms as single tokens or more meaningful subword units, improving the model's ability to generate correct scientific terminology.
Distractor Analysis
- A is Incorrect: Normalizing domain-specific terms to abbreviations would still not solve the tokenization problem if the abbreviations are also not in the model's vocabulary. It also loses specificity, since different abbreviations might have multiple meanings depending on context.
- C is Incorrect: Removing domain-specific terms defeats the purpose of domain adaptation. The model would never learn to handle specialized pharmaceutical vocabulary and would produce generic or incorrect terminology.
- D is Incorrect: Increasing context window size allows the model to process more tokens but does not improve tokenization quality. Domain-specific terms would still be broken into multiple subword tokens regardless of context window size.
Key Takeaway: Continued pre-training on domain-specific text is the recommended approach for improving a model's tokenization and vocabulary handling of specialized terminology.
Question 13 - Real-time Feature Aggregation with Sliding Windows
A cybersecurity company ingests network traffic logs through Amazon Kinesis Data Streams and needs to compute moving average packet sizes per IP address over a sliding 5-minute window. The transformation must update continuously as new traffic arrives, maintain state per IP address, and handle out-of-order events with watermarks. The company wants to minimize infrastructure management.
Which option best satisfies these requirements?
A) Use AWS Lambda with a Kinesis event source mapping configured with a 5-minute batch window.
B) Use Amazon Managed Service for Apache Flink with a keyed sliding window and event-time processing.
C) Use AWS Glue with a Python shell job triggered every 5 minutes to process the accumulated stream data.
D) Use Amazon Kinesis Data Firehose to buffer records for 5 minutes and then process them with a Lambda function.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Amazon Managed Service for Apache Flink supports keyed (per-IP-address) sliding windows, maintains state per key, and handles out-of-order events using event-time processing with watermarks. The managed service minimizes infrastructure management compared to self-managed Flink clusters.
Distractor Analysis
- A is Incorrect: Lambda is stateless and cannot maintain the continuous per-IP sliding window state. While Lambda supports batch windows for fixed non-overlapping intervals, it cannot implement a continuously sliding 5-minute window that updates with each new event.
- C is Incorrect: AWS Glue Python shell jobs are designed for batch processing, not continuous streaming. Running the job every 5 minutes would introduce latency and potentially miss the moving average semantics required for a continuously updating window.
- D is Incorrect: Kinesis Data Firehose buffers data for delivery to destinations like S3 or OpenSearch, not for stateful stream processing with per-key aggregation and sliding windows. It does not support out-of-order event handling or watermarks.
Key Takeaway: Use Amazon Managed Service for Apache Flink for keyed sliding windows on streaming data, especially when you need stateful per-key aggregation and event-time processing.
Question 14 - PII Detection and Redaction Before Model Training
A financial services company is preparing customer service transcripts for a foundation model fine-tuning task. The transcripts contain sensitive information including credit card numbers, social security numbers, and account balances. Compliance requirements mandate that no PII be stored in the training dataset, and the team wants to minimize manual review efforts.
Which AWS solution should the ML engineer implement for automated PII detection and removal?
A) Amazon Comprehend to detect PII entities in the transcripts, then apply redaction before storing in S3 for fine-tuning.
B) Amazon Macie to discover sensitive data in the S3 bucket and automatically encrypt the files with customer-managed KMS keys.
C) Use Amazon SageMaker Clarify to detect sensitive data in the training dataset.
D) Use AWS Secrets Manager to store PII separately from the training data.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: Amazon Comprehend provides PII detection capabilities that identify sensitive entities (credit card numbers, SSNs, bank account numbers) in text. The identified PII can then be redacted from the transcripts before the data is stored in S3 for fine-tuning. This provides automated, scalable PII removal without manual review.
Distractor Analysis
- B is Incorrect: Amazon Macie discovers and reports sensitive data locations in S3 but does not perform redaction. Encryption with KMS protects data at rest but does not remove PII from the training dataset—the PII would still be visible once decrypted for model training.
- C is Incorrect: Amazon SageMaker Clarify is designed for detecting model bias and explaining model predictions, not for detecting PII in training data. It is an inappropriate tool for this use case.
- D is Incorrect: AWS Secrets Manager stores credentials and secrets (API keys, passwords), not PII from training data. It does not provide any mechanism for removing PII from text transcripts.
Key Takeaway: Amazon Comprehend provides automated PII detection for text data, while Amazon Macie only discovers and reports sensitive data locations in S3.
Question 15 - Classification vs. Embedding for Text Features
A machine learning team is building a product recommendation model. The dataset includes a product_category column with 5 possible values (Electronics, Clothing, Home, Sports, and Beauty) and a product_description column containing free-text descriptions of each item. The team needs to transform both features for use in a neural network model.
Which transformation approach should the team apply to each feature?
A) Apply one-hot encoding to product_category and use an embedding model from Amazon Bedrock for product_description.
B) Apply one-hot encoding to both product_category and product_description.
C) Use an embedding model for both features since both are textual.
D) Assign numeric codes (1-5) to product_category and use TF-IDF for product_description.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: This follows the fundamental principle: categories get encoded, while meaning gets embedded. product_category is a categorical feature with no inherent semantic relationship among values, so one-hot encoding (or label encoding with proper model architecture) is appropriate. product_description contains free-text with semantic meaning (products described as "wireless" and "Bluetooth" should be recognized as similar), so using an embedding model from Amazon Bedrock is appropriate.
Distractor Analysis
- B is Incorrect: One-hot encoding for
product_descriptionwould create an extremely high-dimensional feature vector where each unique word becomes a binary column. This approach loses semantic relationships between similar texts and creates prohibitively high-dimensional input for the neural network (e.g., 20,000+ unique words in descriptions). - C is Incorrect: Using embeddings for
product_categoryis unnecessary and potentially counterproductive. Categorical features like product category should be encoded, not embedded for semantic similarity. Embedding a 5-category column would create unnecessary complexity and reduce interpretability. - D is Incorrect: Assigning numeric codes (1-5) to
product_categorycreates an artificial ordinal relationship where Home (3) would appear "greater than" Clothing (2), which may mislead the model. While TF-IDF is a valid text representation, it does not capture contextual meaning with the same effectiveness as modern transformer-based embedding models.
Key Takeaway: Use encoding (one-hot or label encoding) for categorical features with no semantic relationship, and use embedding models for free-text features where capturing semantic meaning is important.
Question 16 - Scaling Transform Fit and Transform Consistency
A data science team has built a churn prediction model using scikit-learn. During training, they standardized the age feature using StandardScaler fitted on the training dataset. The training pipeline saves the scaler parameters (mean=45, std=12) and uses these parameters during model evaluation on test data. Six months later, when the team deploys a batch inference job on new customer data, a junior data scientist re-fits the StandardScaler on the new batch before transforming the data.
What is the consequence of this approach?
A) The model's performance will improve because the scaler is now fitted on the most recent data.
B) The model will receive standardized features that are consistent with what it was trained on.
C) Training-serving skew will be introduced because the same age value will map to different standardized values than during training.
D) Nothing will change, because StandardScaler always produces the same output regardless of the data it is fitted on.
Click to reveal Answer & Explanation
Correct Answer: C
Correct Answer Analysis
C is Correct: StandardScaler computes z-scores using parameters learned during .fit(). If the scaler is re-fitted on a new batch of data with different mean and standard deviation, the same raw age value will map to a different standardized value than it did during training. This introduces training-serving skew because the model receives input values that were not represented in its training distribution.
Distractor Analysis
- A is Incorrect: Re-fitting the scaler on new data does not improve model performance; it introduces inconsistency in the feature transformation. The model expects inputs standardized using the original training data parameters, regardless of how the data distribution may have shifted.
- B is Incorrect: The features would be standardized relative to the new batch's mean and standard deviation, not the values used during training. This inconsistency violates the principle of maintaining identical transformations between training and inference.
- D is Incorrect: While the standardization formula is deterministic, the output depends entirely on the parameters (mean, standard deviation) learned during fitting. Different fitting datasets produce different parameters, resulting in different outputs for the same input value.
Key Takeaway: Always save scaler/transformer parameters learned during training and apply them unchanged during inference; never re-fit transformations on inference data.
Question 17 - Hierarchical Chunking for Document Context
A technical documentation team is building a RAG application for API documentation. Their content is organized hierarchically: an API reference page contains an overview section, endpoint sections, parameter descriptions, and code examples. When retrieving chunks for a query like "How do I authenticate with the Orders API?", the current fixed-size chunking returns the endpoint description but misses the related authentication overview and code example from the parent section.
Which chunking strategy should the team implement to preserve the document hierarchy during retrieval?
A) Reduce the chunk size to create more focused chunks that match individual sections.
B) Use hierarchical chunking in Amazon Bedrock that creates parent-child relationships between larger sections and smaller subsections.
C) Disable chunking to treat each full API reference page as a single chunk.
D) Apply semantic chunking to split content based on meaning rather than structural hierarchy.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
B is Correct: Hierarchical chunking in Amazon Bedrock Knowledge Bases creates larger parent chunks (e.g., the full API reference page) and smaller child chunks (e.g., individual endpoint sections). When retrieval finds a child chunk that matches the query, the parent chunk provides surrounding context from related sections. This preserves the document hierarchy and enables the system to return both the specific endpoint details and the related overview information.
Distractor Analysis
- A is Incorrect: Reducing chunk size would make each chunk even more isolated and would further lose the contextual relationship between the endpoint description and related overview sections in the parent document.
- C is Incorrect: Treating the full page as one chunk would return the entire document including all unrelated endpoints, flooding the context with irrelevant information and reducing retrieval precision.
- D is Incorrect: Semantic chunking splits based on topic shifts, which may not align with the structural hierarchy (overview, endpoints, parameters, examples). It would not necessarily preserve the parent-child relationship between sections that share the same topic.
Key Takeaway: Hierarchical chunking preserves document structure by creating parent-child relationships during retrieval, where parents provide context for matched child chunks.
Question 18 - Labeled Data for Fine-tuning vs. Distillation
A company wants to customize a foundation model for their internal IT support chatbot. They have gathered 5,000 examples of support ticket questions paired with the correct resolution responses from their IT team. They also want to reduce model inference costs by using a smaller model that matches the performance of a larger model on IT support tasks.
Which two preparation techniques should the company use with their data? (Select TWO)
A) Format the 5,000 support ticket pairs as JSONL prompt-response examples for supervised fine-tuning.
B) Use the 5,000 ticket examples as unlabeled text for continued pre-training.
C) Create a separate prompt set covering the IT support use cases for model distillation from a larger teacher model.
D) Convert the 5,000 examples to embeddings for a RAG vector store.
E) Store the 5,000 examples in Amazon SageMaker Feature Store for retrieval during inference.
Click to reveal Answer & Explanation
Correct Answer: A and C
Correct Answer Analysis
- A is Correct: The 5,000 support ticket pairs (question + resolution response) are labeled data perfectly suited for supervised fine-tuning. They should be formatted as JSONL with prompt-response pairs for the fine-tuning process.
- C is Correct: Model distillation requires a set of prompts covering the use case. The larger teacher model generates responses to these prompts, and the smaller student model is fine-tuned on those responses to match the teacher's performance at a lower inference cost.
Distractor Analysis
- B is Incorrect: Continued pre-training expects large volumes of unlabeled domain text (millions of documents), not labeled prompt-response pairs. Using labeled data for continued pre-training would waste the valuable response labels.
- D is Incorrect: Converting the examples to embeddings sets up a RAG system, which retrieves knowledge at inference time without updating model weights. This is different from fine-tuning, which updates the model's weights to learn to generate the responses.
- E is Incorrect: SageMaker Feature Store is designed for storing engineered features for ML models, not for storing training examples for foundation model customization. The feature store is not used to prepare data for fine-tuning.
Key Takeaway: Fine-tuning wants labeled JSONL prompt-response pairs, while distillation wants a prompt set covering the use case for the teacher model to generate responses.
Question 19 - Batch vs. Streaming Transformation Tool Selection
A marketing analytics company needs to process daily data from their data warehouse that includes customer demographics, purchase history, and campaign response data. The data arrives as nightly CSV files from multiple sources and requires complex joins, data cleaning, and feature engineering before being used to train recommendation models. The company wants a cost-effective, serverless solution with minimal operational overhead.
Which AWS service should the company use for this batch transformation pipeline?
A) AWS Glue ETL jobs running on serverless Apache Spark.
B) Amazon Managed Service for Apache Flink with continuous streaming.
C) AWS Lambda functions triggered by S3 events for each incoming CSV file.
D) Amazon EMR clusters with custom Spark jobs deployed on EC2.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: AWS Glue is a serverless ETL service that runs Apache Spark jobs on demand or on a schedule. It is purpose-built for batch transformations like nightly data processing, handling complex joins, data cleaning, and feature engineering without requiring infrastructure management. The serverless model provides cost-effective processing since you pay only for job duration.
Distractor Analysis
- B is Incorrect: Amazon Managed Service for Apache Flink is designed for continuous streaming data processing, not batch processing of nightly CSV files. Using a streaming service for batch workloads adds unnecessary complexity and cost.
- C is Incorrect: While Lambda can process CSV files when triggered by S3 events, Lambda functions are limited to 15-minute execution time and 10GB memory. Complex joins across multiple large files requiring data shuffling would exceed these limits. Lambda is better suited for simple per-record transformations, not distributed batch processing.
- D is Incorrect: Amazon EMR on EC2 requires provisioning and managing clusters, which introduces significant operational overhead compared to AWS Glue's serverless model. The question specifies cost-effective, serverless, and minimal operational overhead, which Glue satisfies better than self-managed EMR clusters.
Key Takeaway: AWS Glue is the serverless choice for batch ETL with complex joins and transformations, while Lambda suits simple per-record processing and Managed Flink handles continuous streaming.
Question 20 - Outlier Detection During Data Profiling
A retail company has loaded customer transaction data into AWS Glue DataBrew for initial inspection. The data contains transaction amounts, customer tenure, and store location. Before applying transformations, the team wants to identify columns with anomalies, missing values, and unusual distributions that might require outlier handling.
Which feature of DataBrew should the team use to gather this information?
A) DataBrew's data profiling capability that generates column-level statistics and anomaly detection reports.
B) DataBrew's recipe steps that clean and transform the data.
C) DataBrew's data lineage tracking that shows data provenance.
D) DataBrew's job scheduling that automates transformation runs.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
A is Correct: AWS Glue DataBrew's data profiling feature automatically analyzes datasets and generates statistical summaries for each column, including data quality scores, missing value percentages, distribution patterns, and outlier detection. This provides exactly the information needed to decide which transformations (such as outlier removal or log transformation) are needed before building the data preparation recipe.
Distractor Analysis
- B is Incorrect: Recipe steps are the transformation actions themselves (e.g., removing outliers, encoding categories), not the exploration tool used to discover which transformations are needed. The team needs profiling first to decide what recipe steps to create.
- C is Incorrect: Data lineage tracking shows where data came from and how it has been transformed, but does not provide statistical insights about column values, missing data, or outliers.
- D is Incorrect: Job scheduling automates running a recipe at defined intervals, but does not produce the exploratory statistical analysis the team needs to determine what transformations to apply.
Key Takeaway: DataBrew's data profiling generates column-level statistics, missing value counts, and outlier detection to guide transformation decisions before creating any recipe steps.