SageMaker AI inference: real-time, serverless, async or batch

When to use SageMaker AI real-time, serverless, asynchronous and batch inference: a comparison table, the limits that decide it, and the scenario cues for each.

· 3 min read · MLA-C02 · UpHopp team

Four ways to get predictions

Amazon SageMaker AI offers four main ways to run inference on a model you've trained. They differ in how fast an answer comes back, how big a request can be, and what you pay for while nothing is happening. Most deployment questions turn on those three things.

OptionBest forScaling and costWatch out for
Real-time inferenceInteractive requests that need low latencyInstances stay running; automatic scaling adjusts how manyYou pay for the instances even when traffic is low
Serverless InferenceTraffic with idle periods between burstsNo instances to manage; compute is assigned on demandCold starts; 1–6 GB of memory; no GPUs
Asynchronous inferenceLarge payloads (up to 1 GB) and long processing (up to an hour)Requests are queued; the instance count can scale to zeroInput and output go through Amazon S3, so it isn't instant
Batch transformPredictions for a whole dataset, offlineA job runs and stops; there's no persistent endpointNot for live requests

Real-time inference

A real-time endpoint is a fully managed, persistent endpoint for interactive, low-latency requests, such as scoring a transaction while the customer waits. It supports automatic scaling, so the number of instances follows the traffic.

  • Choose it when every request needs an answer straight away and traffic is steady enough to keep instances busy.
  • It supports features that Serverless Inference doesn't, such as GPUs, VPC configuration, data capture for Model Monitor and several production variants.
  • Use SageMaker AI Inference Recommender to load-test instance types and pick the one that meets your latency target at the lowest cost.

Serverless Inference

Serverless Inference runs your model without any instances to configure or manage. It suits workloads with idle periods between bursts of traffic that can tolerate cold starts, such as an internal tool used a few times an hour.

  • You choose a memory size from 1 GB to 6 GB, and SageMaker AI assigns compute in proportion to it.
  • Several real-time features aren't available, including GPUs, VPC configuration, network isolation, data capture, Model Monitor, multi-model endpoints and multiple production variants.
  • Provisioned Concurrency keeps capacity ready for predictable bursts, which reduces cold starts.

Asynchronous inference

An asynchronous endpoint queues each request and processes it in the background. It's built for large payloads of up to 1 GB, long processing times of up to one hour, and cases where an answer within minutes is fine, such as analyzing a long document or a high-resolution image.

  • You place the request payload in Amazon S3 and pass its location; the result is written back to S3.
  • Amazon SNS can notify you when each result succeeds or fails.
  • The endpoint can scale its instance count to zero when there's nothing to process, so you pay only while it works.

Batch transform

Batch transform runs inference over a large dataset in Amazon S3 as a job, then stops. Use it when you don't need a persistent endpoint, for example scoring every customer once a night, or preprocessing a dataset before training.

Choosing in a scenario

  1. Does each caller wait for the answer in an interactive flow? Real-time inference, unless traffic is sparse and cold starts are acceptable, in which case Serverless Inference.
  2. Does the model need a GPU, a VPC, data capture or Model Monitor? Real-time inference; Serverless Inference doesn't support them.
  3. Are payloads large, or does processing take minutes? Asynchronous inference, with the payload in S3.
  4. Is it a whole dataset with no endpoint needed? Batch transform.
  5. Must the cost drop to nothing when idle? Serverless Inference, or an asynchronous endpoint scaled to zero.

Official AWS references

Put it into practice

Try AWS MLA-C02 questions for free

Scenario questions with an explanation for every option, then timed mocks when you're ready.

Try free practice