Skip to content

Skill 4.1.2: Monitor workflows to detect anomalies or errors in data processing or model inference


Question 1 - Monitoring Data Pipeline Output Quality

A financial services company runs a nightly AWS Glue job that prepares transaction data for fraud detection models hosted on SageMaker endpoints. The Glue job reports "SUCCEEDED" status, but the following morning, fraud detection endpoints begin returning a high rate of invocation errors. Investigation reveals the Glue job's output Parquet files were written with a changed schema that no longer matches the inference container's expected input format.

The ML engineering team must implement monitoring that detects this issue within minutes of the Glue job completing, with minimal operational overhead.

Which solution should the team implement?

  • A) Create a CloudWatch alarm on the glue.driver.aggregate.numSucceededTasks metric with a threshold of 0 to detect job failures.
  • B) Configure AWS Glue Data Quality rules to validate row count, schema completeness, and non-null constraints on critical columns, then publish results to CloudWatch and trigger an SNS alert when data quality scores fall below threshold.
  • C) Enable CloudWatch anomaly detection on the SageMaker endpoint's Invocations metric to detect the spike in HTTP 4XX errors.
  • D) Place an AWS Lambda function inside the Glue job script to manually parse output files and check for schema drift using pandas.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: AWS Glue Data Quality rules run automatically after job completion, validate output against predefined expectations (row counts, schema, null constraints), and integrate with CloudWatch and SNS for immediate alerting. This detects "successful" jobs that wrote unusable data.

Distractor Analysis

  • A is Incorrect: Monitoring numSucceededTasks only confirms that Glue tasks ran to completion. A job can succeed while writing corrupted or malformed output, so this misses the actual failure mode described.
  • C is Incorrect: Endpoint error rate spikes are already observable (as stated), but the goal is to detect the root cause upstream, closer to when data is written. Also, CloudWatch anomaly detection on invocation counts would not explain why errors spiked.
  • D is Incorrect: This introduces unnecessary custom code (Lambda + pandas) with heavy operational overhead, which violates the "minimal operational overhead" constraint.

Key Takeaway: In production ML pipelines, monitoring job completion status alone is insufficient; always validate the output quality of upstream data processing jobs to catch "false success" patterns.


Question 2 - Drift Detection Pipeline Architecture

A retail recommendation team operates a SageMaker endpoint serving a product recommendation model trained on customer browsing behavior. They want to detect whether the distribution of user features (e.g., browsing duration, categories viewed, device type) arriving at the endpoint deviates from the training distribution, because such deviation could silently degrade relevance scores.

The team must build a drift detection pipeline with minimal manual intervention and automated alerting when drift crosses an agreed-upon threshold. Which architecture satisfies these requirements? (Select TWO)

  • A) Schedule a SageMaker Processing job weekly that captures current traffic features from S3, computes a distribution distance metric (e.g., total variation distance or KS statistic) against a stored baseline dataset, and publishes the drift score to CloudWatch.
  • B) Use Amazon SageMaker Model Monitor with a pre-built data drift monitor (DataQualityMonitor) that emits a CloudWatch alarm when the statistical distance metric exceeds a threshold.
  • C) Build a custom Python script using scipy.stats on a local laptop to manually compare feature distributions every week and email results.
  • D) Enable X-Ray tracing on the SageMaker endpoint to visualize feature-level data distributions over time.
  • E) Configure Amazon Bedrock Guardrails to block incoming requests whose embeddings are too far from the average embedding.
Click to reveal Answer & Explanation

Correct Answers: A and B

Correct Options Analysis

  • A is Correct: A scheduled SageMaker Processing job with a defined drift statistic (e.g., KS statistic on numeric features) automated against a stored baseline and publishing to CloudWatch provides repeatable, unattended drift detection with alerting.
  • B is Correct: Amazon SageMaker Model Monitor's built-in DataQualityMonitor automatically captures live traffic data, computes statistical distances against a baseline, and integrates with CloudWatch alarms. This is the AWS-native, low-overhead solution.

Distractor Analysis

  • C is Incorrect: Manual comparison on a laptop is not scalable, not automatable, and introduces high operational overhead and risk of human error.
  • D is Incorrect: X-Ray provides distributed tracing for request latency and error attribution, not statistical distribution of feature values over time.
  • E is Incorrect: Bedrock Guardrails is for content filtering and safety policies on foundation model inference, not numerical feature drift detection on a SageMaker endpoint.

Key Takeaway: Amazon SageMaker Model Monitor is the recommended AWS-native service for automated drift detection; if a custom statistic is needed, schedule SageMaker Processing jobs and publish to CloudWatch.


Question 3 - Flatlining Invocation Count Metric

A healthcare diagnostics platform uses an event-driven architecture where a Bedrock-based LLM inference pipeline processes uploaded medical imaging metadata via S3 event notifications. After a recent IAM policy change, all inference invocations suddenly stop. The CloudWatch dashboard shows the Invocations metric for the Bedrock model invocation dropped to zero and remained flat for over an hour.

The monitoring setup currently only has an alarm when invocation latency is greater than 5 seconds. What is the most effective monitoring improvement to detect this failure mode?

  • A) Add a CloudWatch alarm that triggers when the Invocations metric is <= 0 for a sustained period (e.g., 15 minutes), using the AWS/Usage namespace.
  • B) Set up AWS CloudTrail to log all API calls and alert on Deny events in IAM.
  • C) Increase the alert threshold on invocation latency to 15 seconds so that long-running failed requests are captured.
  • D) Use a synthetic canary (CloudWatch Synthetics) that invokes the Bedrock pipeline every 5 minutes and alerts if the canary fails.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: A missing metric or flatline at zero is a critical anomaly for event-driven pipelines. CloudWatch alarms can trigger when Invocations = 0 for a sustained period (e.g., 15 minutes), catching pipeline breakage that a latency threshold alone cannot detect.

Distractor Analysis

  • B is Incorrect: CloudTrail logs API calls, but detecting a zero-invocation condition from IAM Deny logs requires additional parsing and correlation. It's also after-the-fact and does not proactively alert on absence of traffic.
  • C is Incorrect: Raising the latency threshold does not address zero invocations; if no requests are occurring, latency metrics are not emitted at all, so the alarm never fires.
  • D is Incorrect: CloudWatch Synthetics canaries can verify availability, but they introduce active traffic (not appropriate for zero-traffic pipelines) and add operational overhead.

Key Takeaway: Alarms on absence of traffic (flatline at zero) are as important as alarms on spikes; use sustained-zero thresholds on Invocations to catch broken event pipelines.


Question 4 - Agentic Workflow Monitoring (Tool Failures)

A software company has deployed an Amazon Bedrock AgentCore agent that coordinates multiple tool calls (e.g., billing database queries, CRM lookups, ticket creation) in a customer support chatbot. The team notices that some conversations end with the agent repeatedly attempting to call a failing tool, causing high token usage and poor user experience.

The team wants to detect coordination failures like tool call failures, truncated streaming responses, and agent retry loops, with end-to-end trace visibility across tool interactions.

Which AWS service or feature provides this capability?

  • A) Amazon CloudWatch generative AI observability
  • B) AWS Step Functions Express Workflows
  • C) Amazon Forecast
  • D) Amazon OpenSearch Serverless with vector embeddings
Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: Amazon CloudWatch generative AI observability provides pre-built views for Bedrock AgentCore agents, including tool call tracking, token usage, latency, error rates, throttling, and distributed X-Ray prompt traces for multi-step agent execution (model calls, tool calls, memory operations).

Distractor Analysis

  • B is Incorrect: Step Functions orchestrates workflows but does not natively capture token-level, tool-level, and prompt-trace telemetry for LLM agents without custom instrumentation.
  • C is Incorrect: Amazon Forecast is a time-series forecasting service, completely unrelated to agent monitoring.
  • D is Incorrect: OpenSearch Serverless is a search/analytics engine for vector and text search, not real-time agent telemetry or tracing.

Key Takeaway: Amazon CloudWatch generative AI observability is the default, low-overhead way to monitor agentic Bedrock workloads with tool-call traces and error attribution.


Question 5 - Concept Drift Detection vs Data Drift

A streaming news recommendation service uses a SageMaker-hosted transformer model. Users' reading habits have shifted dramatically: the types of articles they engage with have changed (e.g., from long-form analysis to short video summaries), but the raw input features (device type, time-of-day, click count) remain statistically stable. The model's click-through rate (CTR) is declining, and the team wants to detect this change automatically.

Which of the following metrics or signals would best detect this condition? (Select TWO)

  • A) Data Quality Monitor on input feature distributions (KS statistic vs baseline)
  • B) Business outcome metrics (CTR, user engagement score) tracked over time and alerted when declining beyond expected variance
  • C) Token usage per request from the SageMaker endpoint
  • D) User feedback signals (thumbs down, "not interested" clicks) aggregated and monitored for trend deviation
  • E) Invocation count per minute on the SageMaker endpoint
Click to reveal Answer & Explanation

Correct Answers: B and D

Correct Options Analysis

  • B is Correct: Concept drift manifests as a change in the relationship between inputs and expected outputs (P(Y|X)). Monitoring business outcome metrics like CTR catches this directly, because input features may remain stable while user behavior shifts.
  • D is Correct: Explicit user feedback (negative signals, engagement drops) provides a direct signal of concept drift, especially when data drift monitors show stable input distributions.

Distractor Analysis

  • A is Incorrect: Data Quality Monitor detects changes in input distribution (P(X)), not concept drift. In this scenario, the input features are stable, so data drift monitoring will not fire.
  • C is Incorrect: Token usage tracks request payload size, not whether the output meets evolving user expectations.
  • E is Incorrect: Invocation count is a traffic health metric, not a signal of model relevance or concept drift.

Key Takeaway: Data drift monitors catch input distribution changes; concept drift requires monitoring downstream outcomes (e.g., CTR, engagement, feedback) because the mapping from input to expected output has changed.


Question 6 - Shadow Variant Testing

A large e-commerce platform is deploying a new recommendation model that uses a novel two-tower architecture. Before serving any live traffic to the new model, the team wants to validate that the serving stack and model initialization work correctly under production traffic loads, without any user-visible impact.

The team also wants to compare the new model's latency and throughput against the current production model over the same traffic window.

Which SageMaker endpoint configuration supports this requirement?

  • A) Create a new SageMaker endpoint for the new variant and route 5% of CloudFront traffic to it using weighted routing.
  • B) Add the new model as a production variant with a small weight (e.g., 2%) on the existing endpoint.
  • C) Add the new model as a shadow variant on the existing endpoint, so it receives a copy of live traffic but its responses are not returned to users.
  • D) Use AWS Step Functions to manually replay a day's worth of historical user requests against the new model.
Click to reveal Answer & Explanation

Correct Answer: C

Correct Option Analysis

  • C is Correct: SageMaker shadow variants receive a copy of live traffic and execute inference, but their responses are recorded for analysis rather than served to end users. This validates serving stack performance and model behavior under real production load without user impact.

Distractor Analysis

  • A is Incorrect: Routing 5% of live traffic exposes real users to the new model, contradicting the "no user-visible impact" requirement.
  • B is Incorrect: A small production weight also exposes live users to the new variant, which is not allowed under this constraint.
  • D is Incorrect: Replaying historical data is not real-time traffic and does not test under actual production load, concurrency, or request patterns.

Key Takeaway: Shadow variants validate infrastructure and behavior under live traffic loads without exposing users to candidate models, while A/B testing (production variants with weights) requires live user exposure.


Question 7 - Anomaly Detection on Feature Processing Job Duration

An insurance company has a multi-stage ML pipeline:

  1. AWS Glue job performs feature engineering on claims data (usually takes 45 minutes).
  2. SageMaker batch transform generates risk scores.
  3. Results are written to S3 and pushed to a downstream underwriting API.

Recently, the Glue job's runtime has been increasing by 10 minutes every week (now at 95 minutes) due to growing data volume, and the batch transform is timing out because downstream users need results by 90 minutes after job start.

The team wants to detect such progressive runtime creep before it causes timeouts, with minimal operational overhead.

Which CloudWatch feature is most appropriate?

  • A) CloudWatch Logs Insights query to manually audit Glue job runtime every week.
  • B) CloudWatch Anomaly Detection with a band around the glue.driver.aggregate.elapsedTime metric, which automatically learns expected duration patterns and alerts on progressive deviations.
  • C) A static threshold alarm on glue.driver.aggregate.elapsedTime set to 90 minutes.
  • D) Use AWS Config rules to enforce that Glue jobs never run longer than 90 minutes.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: CloudWatch Anomaly Detection uses machine learning to learn expected patterns of a metric (e.g., job duration) and automatically creates a band of normal behavior. When durations creep beyond this learned band, it triggers an alarm. This is low-overhead and adapts to legitimate growth.

Distractor Analysis

  • A is Incorrect: Manual weekly Logs Insights queries are labor-intensive and do not provide proactive alerting.
  • C is Incorrect: A static threshold at 90 minutes would only fire after the duration already exceeds the SLA, not before the timeout. It also does not learn legitimate patterns.
  • D is Incorrect: AWS Config is for resource compliance configuration, not runtime metric monitoring. It cannot enforce Glue job duration constraints at runtime.

Key Takeaway: CloudWatch Anomaly Detection automatically learns metric patterns and detects deviations (including slow drift) without manual threshold tuning; static thresholds only detect after-the-fact violations.


Question 8 - Detecting Truncated Streaming Responses

An AI-assisted coding platform uses Amazon Bedrock to stream LLM-generated code completions to users in real time. Users occasionally report incomplete code suggestions, but the team cannot easily reproduce the issue.

They need to detect truncated streaming responses and alert when the completion stream ends before the model finish reason is emitted, with minimal added complexity to the inference endpoint.

Which solution best addresses this?

  • A) Increase the max_tokens parameter to a large number to reduce truncation frequency.
  • B) Instrument the streaming client to log the finishReason field from the Bedrock response and set a CloudWatch alarm when finishReason = "length" exceeds a threshold rate.
  • C) Enable AWS X-Ray tracing and look for missing subsegments in the trace map.
  • D) Deploy the model on a SageMaker real-time endpoint instead of using Bedrock.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: Amazon Bedrock streaming responses include a finishReason field indicating why generation stopped (e.g., length, stop, content_filtered). Monitoring for finishReason = "length" rate above a threshold directly detects truncation with minimal client-side instrumentation.

Distractor Analysis

  • A is Incorrect: Increasing max_tokens may reduce truncation but does not detect it when it still occurs due to content filters, tool call errors, or connection issues.
  • C is Incorrect: X-Ray traces request flow; it does not capture LLM-specific finish reasons or semantic truncation patterns.
  • D is Incorrect: Moving to SageMaker endpoints introduces significant operational overhead and does not inherently solve detection of truncated streaming.

Key Takeaway: For Bedrock streaming workloads, monitor the finishReason field; elevated "length" counts are a direct, low-complexity signal that responses are being truncated.


Question 9 - Multi-Component Failure Attribution with X-Ray

A media streaming company's recommendation API invokes a chain of services:

  1. Amazon API Gateway receives the request.
  2. A Lambda function fetches user profile data from DynamoDB.
  3. The function calls a SageMaker endpoint for personalized scores.
  4. Results are cached in Amazon ElastiCache and returned.

Users are reporting intermittent slow responses (p95 latency > 3 seconds). The team needs to determine which component is causing the slowdown, with minimal additional code instrumentation.

Which solution is most appropriate?

  • A) Add structured logging to each Lambda function and manually correlate timestamps in CloudWatch Logs.
  • B) Enable AWS X-Ray tracing on API Gateway, Lambda, and the SageMaker endpoint, then use the service map and trace timelines to identify the bottleneck.
  • C) Create individual CloudWatch alarms on each component's p95 latency metric and investigate when any fire.
  • D) Enable VPC Flow Logs to analyze network latency between components.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: AWS X-Ray provides end-to-end distributed tracing with minimal code changes (per-service instrumentation via SDK/console). The trace map visualizes service relationships, and individual trace timelines show per-component latency attribution.

Distractor Analysis

  • A is Incorrect: Manual log correlation is time-consuming, error-prone, and not scalable for intermittent latency issues.
  • C is Incorrect: Per-component alarms confirm that a component is slow, but don't correlate a single user request's performance across all services; for intermittent issues, aggregate alarms don't pinpoint the bottleneck.
  • D is Incorrect: VPC Flow Logs capture IP-level network traffic metadata, not application-level invocation latency or per-component timing within a service chain.

Key Takeaway: AWS X-Ray is the primary AWS-native tool for distributed tracing and component-level latency attribution in microservices-based ML inference flows.


Question 10 - Data Validation in Bedrock Knowledge Base Ingestion

A legal tech startup ingests contracts (PDFs) into an Amazon Bedrock Knowledge Base for RAG-powered clause retrieval. The ingestion pipeline uses S3 event notifications to trigger a Bedrock ingestion job. Recently, the retrieved context has become unreliable—the vector database contains documents that are partially parsed, with missing text chunks and corrupted embeddings.

The monitoring setup currently only checks that the S3 event notification was delivered and that the ingestion job ran.

What is the most effective addition to detect document parsing failures and incomplete embedding generation?

  • A) Enable Amazon Bedrock model evaluation with a judge model to score the retrieval quality.
  • B) Configure the Bedrock Knowledge Base ingestion job to write operational metrics to CloudWatch, and alarm on the number of successfully indexed chunks per document falling below an expected floor.
  • C) Add an S3 bucket policy that prevents partial file uploads to the source bucket.
  • D) Encrypt the vector collection at rest using KMS to prevent data corruption.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: Monitoring the actual output of the ingestion pipeline (e.g., number of text chunks successfully indexed per document) catches parsing or embedding failures even when the job "completed successfully." CloudWatch alarms on chunk count below a threshold provide proactive detection.

Distractor Analysis

  • A is Incorrect: Model evaluation with judge models assesses output quality at inference time, not data ingestion pipeline health or document parsing completeness.
  • C is Incorrect: S3 bucket policies prevent unauthorized access, not partial uploads. Multi-part uploads and lifecycle events are managed differently, and this does not detect parsing failures.
  • D is Incorrect: KMS encryption protects data at rest but does not detect or prevent parsing/embedding corruption.

Key Takeaway: For RAG ingestion pipelines, monitor the output (chunks indexed, documents successfully embedded) rather than only job execution status to catch silent ingestion failures.


Summary Quick Reference

Monitoring Scenario Recommended AWS Service/Feature
Bedrock/Agent metric dashboard Amazon CloudWatch generative AI observability
Drift detection (input features) SageMaker Model Monitor (DataQualityMonitor)
Concept drift (output expectations) Business outcome metrics + user feedback monitoring
Job completion vs job output validation AWS Glue Data Quality rules + CloudWatch alarms
Flatline / zero invocation detection CloudWatch alarm on Invocations ≤ 0 for sustained period
Progressive metric drift (duration creep) CloudWatch Anomaly Detection
Tool call failures, truncated streaming, agent loops CloudWatch generative AI observability + finishReason
Distributed tracing / component-level latency AWS X-Ray
Shadow validation (no live user impact) SageMaker shadow variants
A/B testing on live traffic SageMaker production variants with traffic weights