MODELCATALOG

Deploy & inference

Deploy & inference

Serverless, async & batch inference

Inference architecture should match latency, payload size and traffic pattern.

Inputs

workload SLA + payload + traffic profile

Outputs

right-sized inference execution mode

Core explanation

I select serving mode from workload characteristics rather than assuming every model needs a real-time endpoint.

01

Mental model

What this means before worrying about syntax.

Serverless suits intermittent request/response workloads; async suits longer-running or larger requests; batch transform suits offline bulk scoring.

  • Serving mode follows workload shape, not model type alone.
  • Latency, traffic regularity, payload size, processing duration and idle cost drive the choice.
  • Batch scoring avoids persistent endpoint infrastructure.
Lifecycle position
workload pattern -> choose serving mode -> inference
02

Implementation anatomy

The sequence you would actually build or configure.

  1. 1

    Serverless for intermittent request/response where cold-start tradeoff is acceptable.

  2. 2

    Async for queued longer-running/larger requests.

  3. 3

    Batch Transform for finite offline scoring datasets.

Objects / terms worth remembering
Serverless InferenceAsynchronous InferenceBatch Transform
03

Concrete example

A real model-development or production flow.

1

Occasional internal complaint API -> serverless candidate

↓
2

Large document taking tens of seconds -> async candidate

↓
3

Nightly score 20M accounts -> batch candidate

04

Implementation lab

Concrete code, data manipulation and configuration for this lifecycle step.

01

Decision table in code

python
def choose_inference_mode(
    latency_required: bool,
    bursty_or_infrequent: bool,
    long_running: bool,
    offline_bulk: bool,
):
    if offline_bulk:
        return "batch-transform"
    if long_running:
        return "asynchronous"
    if bursty_or_infrequent and latency_required:
        return "serverless"
    return "real-time-endpoint"
02

Batch scoring contract

text
# Input S3:
# s3://bank-ml/scoring/2026-08-17/accounts.csv
#
# Batch job:
#   read records
#   score records
#   write result records
#
# Output S3:
# s3://bank-ml/scoring/2026-08-17/output/
#
# Always include a stable record ID in input and output so
# predictions can be reconciled back to the source population.

Design decisions that matter

  • Latency SLA.
  • Traffic shape.
  • Payload/processing duration.
  • Idle cost vs provisioned capacity.

Common failure modes

  • Serverless is not zero-latency or unlimited-concurrency.
  • Batch results must map cleanly back to source record IDs.
  • Async changes application workflow because result is not immediate.

Production readiness check

Items to close before treating this step as production-ready.

✓ latency✓ traffic shape✓ payload size✓ processing time✓ concurrency✓ cost model✓ result correlation