Lesson 1 of 4 Model Deployment and Inference

Choosing a SageMaker AI Inference Option

This lesson explains how latency requirements, payload size, processing time and traffic pattern decide between SageMaker AI's four inference options, one of the most frequently tested decisions on the exam.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish real-time and serverless inference.
  • Distinguish asynchronous inference and batch transform.
  • Follow the decision flow to choose an option.

Real-time and serverless inference

Real-time inference hosts a model on persistent instances behind an HTTPS endpoint for low-latency, synchronous requests. It supports payloads up to 25 MB and processing up to 60 seconds (8 minutes for streaming responses), GPUs, auto scaling, multiple variants and data capture. You pay for instances while they run.

Serverless inference runs models without instances to manage and scales to zero when idle, so you pay per request duration. It suits intermittent or unpredictable traffic that tolerates cold starts, with payloads up to 4 MB, processing up to 60 seconds, memory up to 6 GB and no GPU support. Provisioned concurrency keeps capacity warm for predictable bursts.

25MB

Real-time inference payload

60s

Real-time and serverless processing time

4MB

Serverless inference payload

6GB

Serverless inference memory

Sort into groups

Real-time or serverless?

Exam skills 3.1.3

Choose between a real-time endpoint and serverless inference for each workload.

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

Asynchronous inference and batch transform

Asynchronous inference queues requests: the client uploads the input to S3 and calls InvokeEndpointAsync, and the result is written to S3 with an optional SNS notification. It supports payloads up to 1 GB and processing up to one hour, and it can scale to zero when the queue is empty. It suits large inputs such as documents, audio and video, or slow models.

Batch transform processes an entire dataset in S3 with no persistent endpoint: SageMaker AI starts instances, splits the input, runs inference, writes results and stops. It suits scheduled scoring of large datasets. Bedrock batch inference is the equivalent for FMs.

The following table summarises the options.

OptionPayload / timeScales to zeroBest for
Real-time25 MB / 60 s (8 min streaming)No (except inference components)Low-latency, steady traffic
Serverless4 MB / 60 s, no GPUYesIntermittent traffic, cold starts acceptable
Asynchronous1 GB / 1 hourYesLarge payloads, long processing, queued requests
Batch transformWhole datasetsNo endpointOffline scoring of datasets

1GB

Asynchronous inference payload

1hour

Asynchronous inference processing time

Scenario questions

Asynchronous or batch?

Exam skills 3.1.3

Choose between asynchronous inference and batch transform.

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

Decision flow

SageMaker AI offers four inference options, and a short sequence of questions chooses between them. First, does the caller need an immediate response? If not, and the input is a whole dataset, such as all customers to score overnight, batch transform processes it without a persistent endpoint. If requests arrive one at a time but can wait, for example large documents taking minutes to process, asynchronous inference queues them and can scale to zero.

If an immediate response is needed, the next question is whether the model needs a GPU or consistently low latency; if so, real-time inference on provisioned instances is the answer. If traffic is sporadic and occasional cold-start latency is acceptable, serverless inference charges only for requests and scales to zero.

The following diagram shows the decision flow for choosing between the SageMaker AI inference options.

The decision flow for SageMaker AI inference options. Without a need for an immediate response, a whole dataset goes to batch transform and individual slow or large requests to asynchronous inference. With an immediate response needed, a GPU or consistently low latency calls for real-time inference, while sporadic traffic that accepts cold starts suits serverless inference.
Limits are those given in the lesson.
Worked example

Four workloads

A company has four inference workloads.

WorkloadOptionReason
Score 40 million customers for a monthly campaignBatch transformOffline dataset, no endpoint needed
Transcribe-and-classify 200 MB call recordings, results within an hourAsynchronous inferenceLarge payload, long processing
Fraud check during checkout, 3,000 requests per secondReal-time with auto scalingLow latency, steady traffic
Internal tool used a few times a dayServerless inferenceIdle most of the time; cold starts acceptable

Serving the internal tool from a real-time endpoint would pay for an instance 24 hours a day for a few minutes of use.

Check yourself

Which inference option suits offline scoring of a whole dataset?

Show answer

Batch transform.

Exam Tips

Remember for the exam

  • Large payloads or long processing: asynchronous inference (1 GB, 1 hour).
  • Offline datasets: batch transform.
  • Intermittent traffic, no GPU, cold starts acceptable: serverless inference.
  • Steady low-latency traffic or GPUs: real-time endpoints.
  • Asynchronous endpoints can scale to zero when the queue is empty.