MODELCATALOG

Deploy & inference

Deploy & inference

Real-time endpoint

For low-latency request/response inference.

Inputs

validated request payload + optional retrieved features

Outputs

low-latency model response + operational metrics

Core explanation

I use real-time hosting when request latency matters and traffic justifies continuously available endpoint capacity.

01

Mental model

What this means before worrying about syntax.

Deploy the model behind a persistent SageMaker endpoint sized for required latency and throughput.

  • Real-time endpoint is persistent managed infrastructure for low-latency request/response scoring.
  • End-to-end latency includes feature retrieval, network, serialization and model execution.
  • Capacity planning matters as much as model correctness.
Lifecycle position
application -> endpoint -> inference container -> prediction
02

Implementation anatomy

The sequence you would actually build or configure.

  1. 1

    Deploy model/variant.

  2. 2

    Application invokes endpoint.

  3. 3

    Container deserializes/preprocesses/predicts/serializes.

  4. 4

    Track latency/errors/throttles/utilization.

  5. 5

    Configure autoscaling and safe deployment/rollback.

Objects / terms worth remembering
Endpointinstance typeautoscalinginvoke
03

Concrete example

A real model-development or production flow.

1

Card authorization arrives

↓
2

Retrieve online card/merchant features

↓
3

Invoke fraud endpoint

↓
4

Return probability within latency budget

↓
5

Decision service combines score with policy

04

Implementation lab

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

01

Application-side inference flow

python

This makes the boundary explicit: orchestration/feature retrieval sits around the endpoint; the endpoint scores a well-defined payload.

def score_transaction(request, feature_client, endpoint):
    customer = feature_client.get_customer(request["customer_id"])
    card = feature_client.get_card(request["card_id"])

    vector = {
        "amount": request["amount"],
        "tx_count_5m": card["tx_count_5m"],
        "avg_amount_30d": card["avg_amount_30d"],
        "merchant_risk": request["merchant_risk"],
        "customer_tenure_days": customer["tenure_days"],
    }

    result = endpoint.invoke(data=vector)

    return {
        "transaction_id": request["transaction_id"],
        "fraud_probability": result["fraud_probability"],
        "model_version": result["model_version"],
    }
02

Measure end-to-end latency, not only model latency

python
from time import perf_counter

t0 = perf_counter()
features = load_online_features(card_id)
t1 = perf_counter()

prediction = endpoint.invoke(data=features)
t2 = perf_counter()

print({
    "feature_lookup_ms": (t1 - t0) * 1000,
    "endpoint_ms": (t2 - t1) * 1000,
    "end_to_end_ms": (t2 - t0) * 1000,
})

Design decisions that matter

  • Latency SLO.
  • Minimum capacity/autoscaling.
  • Availability and rollout strategy.
  • Model score vs final business decision separation.

Common failure modes

  • Autoscaling is not instantaneous.
  • Feature-store/network hops can dominate latency.
  • Large models may violate SLO even if endpoint is technically healthy.

Production readiness check

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

✓ p50/p95/p99 latency✓ TPS/concurrency✓ errors/throttles✓ autoscaling✓ payload✓ logging/data capture✓ rollback