MODELCATALOG

Deploy & inference

Deploy & inference

ModelBuilder

Central V3 abstraction for creating a deployable model configuration.

Inputs

trained model/resource/package + serving schema/image

Outputs

SageMaker Model resource and deployable Endpoint

Core explanation

I think ModelTrainer on the training side and ModelBuilder on the deployment side.

01

Mental model

What this means before worrying about syntax.

ModelBuilder can take a framework model, inference specification or registered model package, build serving artifacts/configuration and deploy it.

  • ModelBuilder is the V3 serving-side abstraction that turns a model/inference specification into deployable serving resources.
  • Training artifact and inference contract meet here.
  • Request/response schema and preprocessing are part of production design.
Lifecycle position
trained or registered model -> ModelBuilder.build() -> deployable model -> deploy() -> endpoint
02

Implementation anatomy

The sequence you would actually build or configure.

  1. 1

    Identify model source.

  2. 2

    Define schema/serialization as needed.

  3. 3

    Select serving image and compute.

  4. 4

    Build serving configuration.

  5. 5

    Deploy.

  6. 6

    Smoke-test representative requests and capture endpoint/version identity.

Objects / terms worth remembering
sagemaker.serve.ModelBuilderSchemaBuilderbuild()deploy()
03

Concrete example

A real model-development or production flow.

1

Input JSON contains complaint text

↓
2

Inference loads vectorizer + classifier

↓
3

Transforms text then predict_proba

↓
4

Response returns category, probability, model_version

↓
5

Application applies 0.75 routing threshold

04

Implementation lab

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

01

Build and deploy from a trained object/resource

python

Current V3 ModelBuilder returns core Model/Endpoint resources rather than the old Predictor abstraction.

from sagemaker.serve.model_builder import ModelBuilder

builder = ModelBuilder(
    model=trained_model_or_model_package,
    role_arn=SAGEMAKER_ROLE_ARN,
    sagemaker_session=session,
    instance_type="ml.m5.xlarge",
)

model_resource = builder.build(
    model_name="complaint-classifier-v17"
)

endpoint = builder.deploy(
    endpoint_name="complaint-classifier-prod",
    initial_instance_count=2,
)
02

Invoke the returned Endpoint resource

python
payload = {
    "text": "I do not recognize this debit card purchase"
}

result = endpoint.invoke(data=payload)
print(result)

Design decisions that matter

  • Serving mode and compute.
  • Explicit request/output contract.
  • Dependency packaging.
  • Where feature retrieval/business rules live.

Common failure modes

  • Local load success does not guarantee serving-image dependency compatibility.
  • Opaque feature retrieval inside model code creates coupling.
  • A model package still needs a valid serving contract.

Production readiness check

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

✓ model source✓ serving image✓ schema✓ dependencies✓ instance type✓ smoke test✓ version traceability