ladderlore
  • 输入服务名称,例如 S3 或 IAM。

概念 · 基于 AIF-C01

Asynchronous and batch inference

Queue big or slow requests, or score a whole dataset with no endpoint at all.

本课尚未翻译,暂以英文显示。

你在AI Practitioner中已学过

  • Asynchronous inference queues large requests or long jobs and returns the result later.
  • Batch inference runs a whole dataset in one go, with no one waiting.
阅读AI Practitioner课程
Application
Request queue
Async endpoint
Input in S3
Result in S3 and SNS notice
  1. 1The application puts the input in S3.
  2. 2It calls invoke_endpoint_async with the S3 location. SageMaker AI queues the request.
  3. 3The endpoint takes the request from the queue and runs the model.
  4. 4The result goes to S3, and an SNS message reports success or error.
An async request goes through S3 and a queue.

分步说明

  1. 1The application puts the input in S3.
  2. 2It calls invoke_endpoint_async with the S3 location. SageMaker AI queues the request.
  3. 3The endpoint takes the request from the queue and runs the model.
  4. 4The result goes to S3, and an SNS message reports success or error.
  • Asynchronous inference

    What runs it
    Endpoint with a queue, can scale to zero
    Pick it when
    Payloads up to 1 GB, jobs up to 1 hour
  • Batch transform

    What runs it
    Temporary instances for one job
    Pick it when
    Score a whole S3 dataset and join results
  • Bedrock batch inference

    What runs it
    A Bedrock job reading JSON lines
    Pick it when
    Many prompts that can wait
Three ways to run work that can wait.

是什么

Asynchronous inference is a SageMaker AI endpoint that queues requests. The caller puts the payload in Amazon S3 (up to 1 GB) and calls invoke_endpoint_async. SageMaker AI replies at once with an output location, processes the request when capacity is free (up to one hour per request) and writes the result to S3. An Amazon SNS topic can announce success or failure. With auto scaling set to a minimum of zero, the endpoint scales to zero instances when the queue is empty.

是什么

Batch transform has no endpoint. A transform job starts instances, reads every object under an S3 prefix, runs the model, writes the results to S3 and stops the instances. The settings that matter are the instance count, MaxPayloadInMB and the batch strategy (one record or many records per request). To keep each prediction next to its input, set JoinSource to Input. InputFilter and OutputFilter pass only the columns you need.

是什么

Amazon Bedrock has its own batch inference. You upload prompts as JSON lines to S3, create a model invocation job, and Bedrock writes the responses to S3 at a lower price than on-demand. It does not work with models that run on Provisioned Throughput. Use it for jobs such as summarizing a million documents overnight.

要记住

  • Async: queue, payload up to 1 GB, up to 1 hour, scale to zero, SNS notice, result in S3.
  • The caller uploads the input to S3 first, then calls invoke_endpoint_async.
  • Batch transform: no persistent endpoint. The instances stop when the job ends.
  • JoinSource set to Input writes each prediction beside its input record.

要记住

  • Bedrock batch inference: JSON lines in S3, a model invocation job, lower price, not for Provisioned Throughput.
  • Need an answer in milliseconds? None of these. Use a real-time endpoint.

考试中

  • “Large payload and long processing, but the caller can wait for the result” points to asynchronous inference.
  • “Score a whole S3 dataset, with no endpoint left running” points to batch transform.
  • “Add the prediction beside every input row” points to a batch transform join with JoinSource set to Input.
  • “Many Bedrock prompts that can wait, at lower cost” points to Bedrock batch inference.