Skip to content

Skill 1.1.6: Validate AI training data integrity (for example, prompt-response pair validation, content safety screening)


Question Answer & Explanation
### Question 1 - Structural Validation of Prompt-Response Pairs

An ML engineering team is preparing a JSONL dataset for fine-tuning a large language model (LLM) in Amazon Bedrock. The dataset consists of prompt-response pairs, and compliance rules dictate that every record must contain both a "prompt" and a "completion" field, neither of which can be empty. The team needs to enforce these structural rules with the least operational overhead before the data is used for training.

Which solution meets these requirements? (Select ONE)

- A) Use Amazon Macie to scan the S3 bucket for empty fields in JSONL files.
- B) Use AWS Glue Data Quality with a Data Quality Definition Language (DQDL) ruleset to check for column presence and non-empty values.
- C) Use Amazon Bedrock Guardrails to set up content filters that block empty prompts.
- D) Write a custom AWS Lambda function to parse the JSONL file and log missing fields to CloudWatch.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: AWS Glue Data Quality allows engineers to declare explicit, repeatable rules (e.g., Completeness "prompt" = 1.0 and ColumnLength "prompt" > 0) in DQDL, evaluating the dataset automatically with minimal operational overhead.

Distractor Analysis:
- A is Incorrect: Amazon Macie is designed for sensitive data (PII) discovery and security classification, not structural schema validation of JSONL fields.
- C is Incorrect: Amazon Bedrock Guardrails screens model inputs/outputs at inference time for safety, toxicity, and denied topics, not structural completeness of training datasets.
- D is Incorrect: Writing and maintaining custom Lambda code to parse JSON and log errors introduces unnecessary operational overhead compared to a declarative Glue Data Quality ruleset.

> Exam Tip: Use AWS Glue Data Quality (DQDL) for declarative structural and schema validation of datasets, and reserve Bedrock Guardrails for content safety screening.
### Question 2 - Content Safety Screening with Bedrock Guardrails

A generative AI team is collecting customer service chat transcripts to use as a prompt-response training dataset for a custom model. Before ingesting this data into the training pipeline, the team must ensure that no prompts or responses contain hate speech, explicit content, or request forbidden topics. The organization mandates using a fully managed AWS service to screen the text without maintaining custom moderation models.

Which AWS service fulfills this requirement natively? (Select ONE)

- A) Amazon Rekognition
- B) AWS Glue DataBrew
- C) Amazon Bedrock Guardrails
- D) Amazon SageMaker Ground Truth
Correct Answer: C

Correct Answer Analysis:
- C is Correct: Amazon Bedrock Guardrails provides configurable filters (content filters, denied topics, word filters) specifically designed to screen prompts and model responses, which can be applied during the data preparation phase to filter harmful content.

Distractor Analysis:
- A is Incorrect: Amazon Rekognition provides image and video moderation, not text-based prompt-response content screening.
- B is Incorrect: AWS Glue DataBrew is used for data profiling and cleaning (e.g., missing values, outliers), not for semantic content safety or toxicity moderation.
- D is Incorrect: Amazon SageMaker Ground Truth is a data labeling service for human annotation, not an automated content safety screening tool.

> Exam Tip: Bedrock Guardrails is the go-to service for screening text for safety, toxicity, and denied topics in generative AI workflows.
### Question 3 - PII Detection in Text Training Data

An enterprise is preparing a large text corpus of email interactions for fine-tuning a foundation model. Compliance policies require that all personally identifiable information (PII), such as social security numbers and credit card numbers, be identified and redacted from the prompt-response pairs before training begins. The solution must use an AWS native service optimized for text analysis.

Which service should the team use? (Select ONE)

- A) Amazon Macie
- B) Amazon Comprehend
- C) Amazon SageMaker Data Wrangler
- D) AWS Glue Data Quality
Correct Answer: B

Correct Answer Analysis:
- B is Correct: Amazon Comprehend natively detects PII entities (such as SSNs, credit card numbers, names) in English and Spanish text, supporting both cleaning and safety screening for training data integrity.

Distractor Analysis:
- A is Incorrect: Amazon Macie is a data security service that discovers and protects sensitive data in Amazon S3 buckets; it is not an inline text analysis API for prompt-response pairs.
- C is Incorrect: Amazon SageMaker Data Wrangler is used for interactive data transformations and imbalance correction, not pre-trained PII entity extraction.
- D is Incorrect: AWS Glue Data Quality evaluates dataset rules (e.g., schema, ranges), but it cannot perform natural language processing (NLP) to semantically identify PII.

> Exam Tip: Use Amazon Comprehend for extracting PII from text datasets, and Amazon Macie for securing the S3 buckets that store those datasets.
### Question 4 - Enforcing Denied Topics in Training Data

A financial services company is preparing a dataset to fine-tune an LLM for internal Q&A. The compliance team has defined a strict list of prohibited topics, such as "investment advice" and "stock predictions," which must not be present in any of the prompt-response pairs. The AI engineer needs to screen the dataset and filter out any records containing these denied topics with the least custom code.

Which AWS service provides the required capability natively? (Select ONE)

- A) Amazon Bedrock Guardrails
- B) AWS Glue Data Quality
- C) Amazon Comprehend Medical
- D) Amazon Rekognition
Correct Answer: A

Correct Answer Analysis:
- A is Correct: Amazon Bedrock Guardrails features "Denied Topics" filters, allowing administrators to define specific topics to block. Running the dataset through Guardrails screens the prompts and responses for these prohibited subjects.

Distractor Analysis:
- B is Incorrect: AWS Glue Data Quality uses DQDL for structural and statistical rules (e.g., completeness, ranges) but cannot understand semantic topics in natural language.
- C is Incorrect: Amazon Comprehend Medical is tailored for medical and clinical text entity extraction, not financial compliance denied topics.
- D is Incorrect: Amazon Rekognition handles image and video analysis, not text-based topic filtering.

> Exam Tip: When the requirement involves semantic understanding of text (like prohibited topics or harmful intent), look to Bedrock Guardrails or Comprehend, not Glue Data Quality.
### Question 5 - Validating Response Length Constraints

An AI engineering team is setting up a continuous ingestion pipeline to validate prompt-response pairs stored in Amazon S3. The pipeline must first verify that every JSON record has a response field with a maximum length of 500 characters. The team wants to use the most cost-effective and operationally efficient method for the structural length check.

Which approach should they use for the structural validation step? (Select ONE)

- A) Use Amazon Comprehend to analyze the text length and toxicity.
- B) Use AWS Glue Data Quality to enforce a DQDL rule such as ColumnLength "response" <= 500.
- C) Use Amazon Bedrock Guardrails to enforce a word limit on the model's response.
- D) Deploy a custom Amazon SageMaker Processing job with a Python script to count characters.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: AWS Glue Data Quality allows you to write declarative rules in DQDL, such as ColumnLength, to validate structural constraints on datasets cost-effectively without writing custom code.

Distractor Analysis:
- A is Incorrect: Amazon Comprehend is an NLP service for entity detection and sentiment analysis, not structural field validation like character length.
- C is Incorrect: Amazon Bedrock Guardrails is used for safety and content filtering at inference time, not for validating the character length of files in an S3 training dataset.
- D is Incorrect: A custom SageMaker Processing job requires writing and maintaining code, which introduces higher operational overhead compared to a declarative Glue ruleset.

> Exam Tip: For simple structural validations like string lengths, null counts, or value ranges, AWS Glue Data Quality is the most efficient choice.
### Question 6 - Healthcare PHI Redaction

A healthcare startup is building a medical chatbot and needs to validate the training data integrity of its prompt-response pairs. The data consists of raw clinical notes. The team must ensure that Protected Health Information (PHI) is redacted from the text before it is used to fine-tune a model.

Which AWS service is best suited to identify and redact PHI in text? (Select ONE)

- A) Amazon Comprehend Medical
- B) Amazon Macie
- C) AWS Glue DataBrew
- D) Amazon Bedrock Guardrails
Correct Answer: A

Correct Answer Analysis:
- A is Correct: Amazon Comprehend Medical is specifically designed to identify and extract Protected Health Information (PHI) and medical entities from unstructured text, making it ideal for sanitizing clinical notes.

Distractor Analysis:
- B is Incorrect: Amazon Macie scans S3 buckets for sensitive data but does not provide a text API to identify and redact PHI inline within application pipelines.
- C is Incorrect: AWS Glue DataBrew is a visual data preparation tool for cleaning and profiling; it lacks pre-trained medical NLP models.
- D is Incorrect: While Bedrock Guardrails has sensitive information filters, Comprehend Medical is the specialized AWS service for healthcare text and PHI.

> Exam Tip: For healthcare text and PHI, use Amazon Comprehend Medical. For general text and standard PII, use Amazon Comprehend.
### Question 7 - Dropping Missing Prompts in Data Wrangler

An ML team is using Amazon SageMaker Data Wrangler to prepare a dataset of prompt-response pairs for training. During the data preparation phase, they discover that some prompts contain missing values or are completely empty. The team needs to handle this with the least manual intervention while ensuring the resulting dataset is structurally sound.

Which Data Wrangler transformation should the engineer apply? (Select ONE)

- A) Convert the prompt column to a categorical feature.
- B) Use the "Drop missing" transformation on the prompt column.
- C) Apply mean imputation to the prompt text column.
- D) Use Amazon Bedrock Guardrails to filter out empty prompts.
Correct Answer: B

Correct Answer Analysis:
- B is Correct: The "Drop missing" transformation in SageMaker Data Wrangler removes rows with null or empty values, cleanly addressing the structural defect and ensuring only valid pairs remain.

Distractor Analysis:
- A is Incorrect: Converting text to a categorical feature is a modeling transformation, not a cleaning step for missing text data.
- C is Incorrect: Mean imputation applies to numeric columns; you cannot calculate the "mean" of a text prompt.
- D is Incorrect: Bedrock Guardrails is used for content safety, not for fixing missing values inside a SageMaker Data Wrangler data flow.

> Exam Tip: Missing numeric values might be imputed, but missing text prompts or categorical labels should typically be dropped to avoid teaching the model incorrect associations.
### Question 8 - Orchestrating the Validation Pipeline

A generative AI team needs to orchestrate a validation pipeline for prompt-response pairs. The pipeline must execute three sequential steps: checking the JSONL schema using AWS Glue, screening for toxic content using Amazon Comprehend, and finally moving the validated data to a secure S3 bucket. The solution must minimize the code required to manage the state and retries of these steps.

Which AWS service is best suited for this orchestration? (Select ONE)

- A) AWS Step Functions
- B) Amazon EventBridge
- C) Amazon SageMaker Pipelines
- D) AWS Glue Workflows
Correct Answer: A

Correct Answer Analysis:
- A is Correct: AWS Step Functions is a serverless orchestration service that allows you to sequence AWS services (like Glue and Comprehend) while handling state management, retries, and error handling with minimal custom code.

Distractor Analysis:
- B is Incorrect: Amazon EventBridge is used for event routing and scheduling, not for managing complex multi-step workflow states and sequential dependencies.
- C is Incorrect: Amazon SageMaker Pipelines is optimized for ML training and deployment workflows, whereas this is a data validation ETL pipeline mixing non-SageMaker services.
- D is Incorrect: AWS Glue Workflows is restricted to orchestrating Glue components (jobs, crawlers, triggers) and cannot natively orchestrate Amazon Comprehend jobs.

> Exam Tip: For mixed-service orchestration (e.g., Glue + Comprehend + S3) requiring state management and retries, use AWS Step Functions.
### Question 9 - Toxicity Detection in Text Data

A retail company is collecting customer reviews to use as prompts for fine-tuning a text generation model. The data preparation team needs to screen the text for profanity and offensive language before training. They want to use a pre-trained AWS service that requires no custom model training to flag toxic content.

Which AWS service natively supports toxicity detection for text? (Select ONE)

- A) Amazon Comprehend
- B) Amazon Rekognition
- C) Amazon SageMaker Ground Truth
- D) AWS Glue Data Quality
Correct Answer: A

Correct Answer Analysis:
- A is Correct: Amazon Comprehend includes pre-trained toxicity detection capabilities that can identify and flag offensive, profane, or toxic text without requiring custom model training.

Distractor Analysis:
- B is Incorrect: Amazon Rekognition provides image and video moderation, not text-based toxicity detection.
- C is Incorrect: Amazon SageMaker Ground Truth is used for human labeling workflows, not for automated pre-trained toxicity screening.
- D is Incorrect: AWS Glue Data Quality checks structural rules; it has no NLP capabilities to understand semantic toxicity.

> Exam Tip: Amazon Comprehend is the go-to for pre-trained NLP tasks like toxicity detection, sentiment analysis, and PII extraction on text data.
### Question 10 - Visual Profiling of JSONL Data

An AI engineer is validating a large JSONL file containing prompt-response pairs for Bedrock fine-tuning. The engineer notices that some records are malformed JSON due to truncation during the collection process. To ensure data integrity, the engineer needs to profile the dataset to identify formatting issues, missing values, and statistical anomalies before proceeding.

Which AWS service provides a visual profiling job that requires no code to surface these data quality issues? (Select ONE)

- A) Amazon Bedrock Guardrails
- B) AWS Glue DataBrew
- C) Amazon Comprehend
- D) Amazon Macie
Correct Answer: B

Correct Answer Analysis:
- B is Correct: AWS Glue DataBrew provides a visual, no-code interface to run profile jobs on datasets, surfacing missing values, structural anomalies, and statistical summaries to help engineers understand data quality before cleaning.

Distractor Analysis:
- A is Incorrect: Amazon Bedrock Guardrails is an inference-time filter for safety, not a data profiling tool for JSONL datasets.
- C is Incorrect: Amazon Comprehend analyzes the semantic meaning of text (PII, sentiment) but does not profile structural anomalies or missing values in a dataset.
- D is Incorrect: Amazon Macie is a security service for S3 bucket data classification, not an interactive data profiling tool for ML data prep.

> Exam Tip: Profiling comes before cleaning. Use AWS Glue DataBrew for visual, no-code data profiling to spot anomalies, and Data Quality for declarative rule enforcement.