CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Types of Inference

Once a model is trained, it earns its keep through inference: making predictions on new data. Amazon SageMaker AI offers four ways to run inference: real-time, serverless, asynchronous and batch. This lesson shows how to pick one from three clues in a scenario: how fast an answer is needed, how…

10 cards
Study this deck

Types of Inference

Once a model is trained, it earns its keep through inference: making predictions on new data. Amazon SageMaker AI offers four ways to run inference: real-time, serverless, asynchronous and batch. This lesson shows how to pick one from three clues in a scenario: how fast an answer is needed, how big each request is, and how steady the traffic is.

Training and inference

Training is when a model learns from historical data. It happens occasionally and can take hours. Inference is when the trained model is used, for example scoring a payment for fraud or tagging a photo. Inference happens far more often than training, so how you run it has a big effect on cost and user experience. The four options below differ in whether a server is always running, how long a request can take, and how results come back.

Real-time and serverless inference

Real-time inference keeps a model on a persistent endpoint, which is always running and ready to answer. Each request gets a response within milliseconds to seconds. It suits steady traffic where a person or system is waiting, such as checking a payment at checkout. You pay for the instances while they run, even when quiet.

Serverless inference also answers requests as they arrive, but SageMaker AI manages capacity for you and scales it down when there's no traffic, so you don't pay for idle time. The trade-off is a possible delay, called a cold start, when a request arrives after a quiet spell. It suits light, intermittent or unpredictable traffic with small requests.

Asynchronous and batch inference

Asynchronous inference puts requests in a queue and processes them in the background. The result is written to storage, and the caller can be notified when it's ready. It handles large inputs, such as long audio or video files, and jobs that take minutes rather than seconds. It can scale down to zero instances between bursts.

Batch inference, called batch transform in SageMaker AI, scores a whole dataset in one go, with no endpoint left running afterwards. It suits offline work where all the data is available up front and nobody is waiting on any single answer, such as scoring every customer once a month.

Choosing an option

If the scenario says...Choose
Someone is waiting; traffic is steady; low latency mattersReal-time
Traffic is light or unpredictable; pay nothing when idle; small requestsServerless
Large files or long processing; requests arrive over time; queue themAsynchronous
A whole dataset at once; results not needed immediately; no endpointBatch transform

On the exam

The trap is usually between two options that both sound reasonable. Serverless and asynchronous can both scale to zero, but serverless is for small, quick requests, and asynchronous is for big payloads or long jobs. Batch and asynchronous both run in the background, but batch processes a dataset you already have all at once, while asynchronous handles individual requests as they trickle in.

Quiz me on this
An online store must check each card payment for fraud before confirming the order. Shoppers are waiting, the answer must come back in well under a second, and traffic is steady throughout the day. Which SageMaker AI inference option fits BEST?
  1. Batch transform
  2. ✓ Real-time inference
  3. Asynchronous inference
  4. Serverless inference
An insurer wants to score all of its several million policies once a month to set renewal prices. Nobody needs results for a single policy straight away, and the company does not want any endpoint running between monthly runs. Which inference option should it use?
  1. Real-time inference
  2. Serverless inference
  3. ✓ Batch transform
  4. Asynchronous inference
A media company lets editors upload long video files throughout the day for automated analysis that takes 10-20 minutes per file. Uploads come in bursts with quiet hours in between. Each editor needs results within an hour of uploading and should be notified when their file is done, and the company wants to pay for no instances when nothing is queued. Which option meets these requirements?
  1. ✓ Asynchronous inference
  2. Batch transform run once every night
  3. Real-time inference
  4. Serverless inference
A startup's internal tool makes a few dozen small predictions a day at unpredictable times. Users accept that the first request after a quiet period may take a little longer. The team wants to pay nothing while the tool is idle and does not want to manage instances or scaling. Which option is MOST cost-effective?
  1. Real-time inference on a small instance
  2. Asynchronous inference with a request queue
  3. Batch transform scheduled every hour
  4. ✓ Serverless inference
Inference
Using a trained model to make predictions on new data. It happens far more often than training.
Real-time inference
A persistent endpoint that answers each request within milliseconds to seconds. Best for steady, latency-sensitive traffic.
Serverless inference
Managed capacity that scales down when idle, so you pay only for use. Suits small, intermittent requests; may have cold starts.
Asynchronous inference
Queues requests and processes them in the background. Suits large payloads and long jobs, and can scale to zero.
Batch transform
Scores a whole dataset in one offline job with no persistent endpoint. Suits data available up front with no one waiting.
Serverless vs asynchronous inference
Both can avoid charges when idle. Serverless is for small, quick requests; asynchronous is for large payloads or long processing.