Lesson 4 of 4 Monitoring Models in Production

Monitoring ML Jobs and Endpoints for Errors and Anomalies

This lesson explains how to monitor the jobs and endpoints around a model, which can crash, stop, return errors or slow down, to detect anomalies and errors as the exam guide asks.

Learning outcomes

After completing this lesson, you will be able to:

  • Interpret endpoint metrics such as 4XX and 5XX errors.
  • Alert on job and pipeline failures with EventBridge.
  • Use CloudWatch anomaly detection.

Endpoint metrics

SageMaker AI endpoints publish CloudWatch metrics per variant. Invocations counts requests; Invocation4XXErrors indicate bad requests from clients, such as malformed payloads; Invocation5XXErrors indicate failures in the model or container; ModelLatency is the time the container takes; OverheadLatency is time added by SageMaker AI; and CPUUtilization, MemoryUtilization and GPU metrics show resource pressure. Container logs go to CloudWatch Logs under /aws/sagemaker/Endpoints/.

Match the pairs

Endpoint metrics

Exam skills 4.1.2

Match each SageMaker AI endpoint metric with what it shows.

Log in to try this activity Interactive activities are free with an account.

Job and pipeline events

Training and processing jobs run without anyone watching, so failures must be reported automatically. SageMaker AI emits Amazon EventBridge events for state changes of training, processing and transform jobs, pipeline executions and steps, endpoints and model package approvals. AWS Glue, Step Functions and Bedrock batch jobs emit similar events.

EventBridge rules that match Failed states send notifications through Amazon SNS or start remediation with Lambda, such as retrying a job. CloudWatch Logs Insights queries then search the job logs for the cause, such as out-of-memory errors or missing input files.

The following diagram shows the alerts that catch a failing batch transform job, and the fix.

Catching the failing batch transform job. An EventBridge rule matches transform job state changes with status Failed and alerts the on-call team through SNS within minutes; a CloudWatch alarm on the age of the latest output file also catches a schedule that never ran; and more memory, a smaller MaxPayloadInMB and SplitType=Line fix the out-of-memory error.
The scenario is illustrative.
Scenario questions

Catch failed jobs

Exam skills 4.1.2

Choose how to detect failures and anomalies in ML jobs.

Log in to try this activity Interactive activities are free with an account.

Anomaly detection

Fixed thresholds miss unusual patterns in metrics that vary by time of day. CloudWatch anomaly detection learns a metric's expected band and alarms when values leave it, which suits invocations, latency and data volumes. Metric filters turn log patterns, such as "ValidationError", into metrics. Amazon DevOps Guru also detects operational anomalies, but it is not open to new customers from 29 October 2026 and reaches end of support on 30 September 2027, so AWS recommends CloudWatch anomaly detection instead. The following table summarises the signals.

SignalIndicatesResponse
Invocation4XXErrors risingClient sending bad requestsCheck client payload changes
Invocation5XXErrors risingModel or container failuresCheck container logs, roll back
ModelLatency highSlow model or saturated instancesScale, optimise, check utilisation
OverheadLatency highPlatform overhead, often payload sizeReduce payload or review configuration
Job state Failed eventPipeline or job failureSNS alert, Lambda remediation
Metric outside anomaly bandUnusual behaviourInvestigate
Worked example

Silent failure

A nightly batch transform job that scores customers failed for three nights in a row with an out-of-memory error. Nobody noticed until marketing used stale scores.

  • Create an EventBridge rule matching SageMaker transform job state changes with status Failed, targeting an SNS topic for the on-call team.
  • Add a CloudWatch alarm on the age of the latest output file, catching jobs that never ran.
  • Increase the instance memory or reduce MaxPayloadInMB and use SplitType=Line to fix the out-of-memory error.

Event-based alerting catches failures within minutes, and the freshness alarm also catches the case where the schedule itself stops.

Check yourself

Rising 5XX errors on an endpoint point to what?

Show answer

The model or its container. 4XX errors point to the clients.

Exam Tips

Remember for the exam

  • 4XX errors point to clients; 5XX errors point to the model or container.
  • ModelLatency is the container's time; OverheadLatency is SageMaker AI's.
  • Alert on failed jobs and pipelines with EventBridge rules and SNS.
  • Metrics with daily patterns: CloudWatch anomaly detection.
  • DevOps Guru is not open to new customers from 29 October 2026; prefer CloudWatch anomaly detection.