🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

SageMaker vs Vertex AI: Picking a Cloud ML Platform

Module 15: Data Engineering and MLOpsđŸŸĸ Free Lesson
Module 15: Data Engineering and MLOps

A managed ML platform is a set of contracts, not a notebook

By the end of this lesson you will be able to map your workload onto SageMaker or Vertex AI, price an endpoint before you launch it, and defend the choice in a design review.

13 min read📘Intermediate

Prerequisites

  • !Cloud object storage basics: buckets, prefixes, and IAM roles
  • !A training script that already runs locally with scikit-learn or PyTorch
  • !What a model registry and a feature store are for

What You'll Learn

  • 1Describe the four jobs every managed ML platform performs and where the vendor-specific surface begins
  • 2Launch a SageMaker training job and a Vertex AI pipeline step from the SDK
  • 3Compare real-time, batch, and serverless inference options and their billing models
  • 4Estimate monthly spend from instance hours before committing to a platform
  • 5Decide when staying on plain containers is cheaper than managed ML

What the platform actually owns for you

A managed ML platform is not a prettier notebook. It is a set of contracts about where your data lives, who is allowed to start a GPU, how a trained artifact becomes a versioned, auditable object, and what happens when traffic arrives at three in the morning. SageMaker, Vertex AI, and Azure Machine Learning all cover the same four jobs: authoring, training, registry, and serving. Where they differ is how much plumbing you can still see, and how much of it you are charged for while it sits idle.

The teams that get burned pick a platform from IDE screenshots. A notebook environment costs twenty minutes of setup; the questions that actually decide the outcome are whether your training data already sits in that cloud's object store, whether your security team already issues credentials for it, and whether the inference shape you need is billed in a way that does not let idle hours dominate the invoice. Workloads that read petabyte-scale tables in BigQuery behave very differently from workloads that stream millions of small files from S3, and no amount of abstraction erases that difference.

There is also a personnel cost. Every platform-specific line you write becomes a line someone must migrate if the company changes clouds. The practical goal of this lesson is to keep the portable parts of your pipeline portable, and to know exactly which lines are not.

The shared lifecycle both platforms implement

Every serious ML deployment walks the same five stages. Understanding them as a fixed sequence makes the vendor feature lists much easier to read, because each product name maps onto one of these stages.

StageWhat must happenSageMaker nameVertex AI nameFailure if skipped
PrepareClean, join, and split raw data reproduciblyProcessing jobsDataflow / DataprocSilent train-serve skew
TrainFit weights on a tracked dataset versionTraining jobs, SpotCustom training, AutoMLIrreproducible metrics
EvaluateScore against a held-out set with fixed metricsModel MetricsModel evaluationCherry-picked accuracy
RegisterStore artifact plus lineage and approval stateModel RegistryModel RegistryNobody knows what shipped
ServeExpose the model behind a versioned contractEndpoints, Batch TransformEndpoints, Batch predictionNo rollback path

The column that matters most is the last one. A platform that registers models but gives you no rollback path has moved the risk rather than removed it. When you evaluate a vendor demo, ask what happens when you register version seven and version seven turns out to be wrong: how many seconds until the previous version is answering traffic again, and does that answer require a human at a keyboard.

Launching training on SageMaker

SageMaker's unit of work is the job. You point it at a script, an instance type, and an input channel in S3, and it provisions, runs, and tears down. Hyperparameter tuning is a wrapper around the same job. The SDK snippet below trains a gradient boosting model on tabular data and deploys the fitted artifact to a real-time endpoint, which is the shortest path from script to prediction in AWS.

python
import sagemaker
from sagemaker.sklearn.estimator import SKLearn
from sagemaker.tuner import IntegerParameter, HyperparameterTuner

role = sagemaker.get_execution_role()
sess = sagemaker.Session()

estimator = SKLearn(
    entry_point="train.py",
    role=role,
    instance_count=1,
    instance_type="ml.m5.xlarge",
    framework_version="1.2-1",
    hyperparameters={"max_depth": 8, "n_estimators": 300},
    output_path="s3://churn-ml/models",
    use_spot_instances=True,           # up to 70% cheaper for interruptible work
    max_wait=3600,
    max_run=1800,
)

estimator.fit({"train": "s3://churn-ml/train/", "test": "s3://churn-ml/test/"})

tuner = HyperparameterTuner(
    estimator=estimator,
    objective_metric_name="test:roc_auc",
    hyperparameters={"max_depth": IntegerParameter(4, 12)},
    max_jobs=20,
    max_parallel_jobs=4,
)
tuner.fit({"train": "s3://churn-ml/train/"})

predictor = estimator.deploy(
    initial_instance_count=1,
    instance_type="ml.m5.large",
    endpoint_name="churn-v3",
)

Two details in that code carry real money. Spot capacity lets AWS reclaim the instance, so the job must checkpoint or tolerate restart; SageMaker handles the retry, but your training script must be idempotent. And the endpoint you deploy at the end bills per instance-hour whether or not anyone calls it. A single idle ml.m5.large costs roughly a hundred dollars a month, which is why the serving decision deserves as much thought as the model architecture.

Running the same pipeline on Vertex AI

Vertex AI organizes work as pipelines: directed acyclic graphs of containerized steps whose outputs feed the next step. Each step runs in its own container, which is a discipline worth adopting even if you never touch GCP, because it forces you to declare inputs and outputs instead of relying on hidden state in a notebook kernel.

python
from google.cloud import aiplatform
from kfp import dsl
from google_cloud_pipeline.v1.artifact_types import Model
from google_cloud_pipeline.v1 import pipeline_jobs

aiplatform.init(project="acme-ml", location="us-central1")

@dsl.pipeline(
    name="churn-training-pipeline",
    pipeline_root="gs://acme-ml/pipeline-root",
)
def churn_pipeline(
    data_path: str = "gs://acme-ml/data/train.csv",
    n_estimators: int = 300,
    max_depth: int = 8,
):
    prepare = dsl.ContainerOp(
        name="prepare",
        image="us-central1-docker.pkg.dev/acme-ml/ml/prepare:1.4",
        arguments=["--input", data_path],
    )

    train = dsl.ContainerOp(
        name="train",
        image="us-central1-docker.pkg.dev/acme-ml/ml/train:1.4",
        arguments=[
            "--n-estimators", str(n_estimators),
            "--max-depth", str(max_depth),
        ],
    ).after(prepare)

    evaluate = dsl.ContainerOp(
        name="evaluate",
        image="us-central1-docker.pkg.dev/acme-ml/ml/evaluate:1.4",
        arguments=["--threshold", "0.85"],
    ).after(train)

job = aiplatform.PipelineJob(
    display_name="churn-training",
    template_path="pipeline.json",
    parameter_values={"n_estimators": 300},
    enable_caching=True,
)
job.run()

Notice the parameterized container arguments. That is what makes a rerun cheap: changing max_depth re-executes only the steps whose inputs changed, because caching is keyed on step inputs rather than on wall-clock time. The equivalent SageMaker construct is a Pipeline with step-level caching, and the equivalent in plain tooling is Make or Dagster. The discipline transfers; the SDK does not.

Feature stores, registries, and drift monitors

Both vendors ship a feature store, a model registry, and a drift monitor, and the marketing language is close enough to be confusing. The differences show up in refresh semantics and in who pays for reads.

CapabilitySageMaker Feature StoreVertex AI Feature StorePlain alternative
StorageOnline store plus offline S3 copiesOnline store plus BigQuery offlineParquet files, feature service
RefreshScheduled batch or on-demand writesStreaming writes or scheduled batchAny orchestrator
Serving pathPoint lookup from the online storePoint lookup from the online storeRedis or Postgres
Drift detectionSageMaker Model Monitor, hourly baselinesModel Monitoring, skew and anomaly alertsEvidently, custom jobs
Best fitAWS-centric shops with S3 lakesTeams whose features already live in BigQuerySmall teams, low read volume

The honest advice for a small team is that a feature store is often premature. If one service writes features and one model reads them, a versioned Parquet table plus a Redis cache reproduces ninety percent of the value for none of the per-read cost. Reach for the managed feature store when you have many trainers and many consumers, or when offline and online paths have drifted apart in production at least once.

Reading the bill before it reads you

Cloud ML spend clusters into three buckets: training hours, idle serving capacity, and storage plus data transfer. Training is the easiest to control because it is finite and interruptible. Serving is where bills surprise people, because a deployed endpoint is a lease, not a meter.

The table below prices a typical churn model at modest traffic. Numbers are indicative on-demand rates and shift by region, but the ratios are stable enough to plan with.

Line itemConfigurationUtilizationApproximate monthly cost
Training1 × ml.m5.xlarge, 2 hours per weekScheduledUnder 10 dollars
Hyperparameter search20 jobs × 1 hour on spotWeekly15 to 25 dollars
Real-time endpoint1 × ml.m5.large, always on4 percent at peakAround 100 dollars
Batch transform1 × ml.m5.xlarge, nightly 20 minutesScheduledUnder 5 dollars
Model and data storage40 GB across S3 and ECRConstantUnder 2 dollars

The endpoint line dwarfs everything else while contributing the least unique value, because predictions are a commodity operation. Three moves shrink it: right-size the instance after measuring actual p95 latency, enable autoscaling with a floor of one so you never pay for four replicas at 2 a.m., and move spiky or asynchronous workloads to serverless inference or batch prediction, which bill per request rather than per hour. When traffic is bursty and unpredictable, that single change often cuts the serving bill by an order of magnitude.

Choosing for your workload, not for a keynote

If your analytics already run in BigQuery, your features are columns in it, and your team writes SQL more fluently than Python, Vertex AI is the shorter path. The BigQuery ML integration lets you train a logistic regression without moving data, and the pipeline tooling reads naturally to anyone who has used Kubeflow. If your data lake is already in S3, your security posture is built around IAM roles and VPC endpoints, and you need the broadest catalog of instance types including inference accelerators, SageMaker will cost less friction on every subsequent project.

Portability is achievable if you draw the line deliberately. Keep three things vendor-neutral: the training script that reads a dataframe and writes an artifact, the evaluation code that prints metrics, and the serving contract expressed as request and response schemas. Wrap those in thin vendor adapters, and a migration becomes an adapter rewrite measured in days rather than a rewrite of the science. What you cannot make portable is the storage layout, the identity model, and the autoscaling policy, so document those decisions where the next engineer will find them.

Common Mistakes

Deploying a real-time endpoint to demo a model that receives a few hundred predictions a day

Fix: Measure requests per minute first; below roughly one per second, batch prediction or serverless inference is almost always cheaper and simpler

Leaving spot training enabled on a non-idempotent training script

Fix: Make initialization deterministic, seed every random source, and checkpoint mid-training so a reclaimed instance resumes instead of restarting

Choosing a platform because of its notebook experience

Fix: Score the candidates on data location, credential model, serving shape, and monthly cost at your expected traffic, then weight the notebook last

Assuming the managed feature store is required to ship a model

Fix: Start with a versioned offline table and a low-latency cache; adopt the managed feature store only when several trainers and consumers share features

Best Practices

  • Pin instance families and regions in infrastructure code so cost surprises surface in review rather than in the invoice
  • Keep the training script, evaluation logic, and request schemas outside the vendor SDK, and treat the SDK as an adapter
  • Set a monthly budget alert per project with a forecast threshold at fifty percent, before the month is lost
  • Register every promoted model with the dataset version and the evaluation report attached, never with a bare artifact path
  • Right-size inference from measured p95 latency, then enable autoscaling with a floor of one rather than provisioning for peak
  • Run a quarterly portability rehearsal that loads your saved artifact into a container on a second cloud

Interview Questions

Q1: How do you decide between real-time endpoints, batch transform, and serverless inference?

Start from traffic shape and latency budget. Steady traffic under one request per second with a relaxed budget points to batch or serverless, which bill per prediction. Sustained traffic above roughly ten requests per second with tight latency needs justifies a right-sized always-on endpoint. The mistake is defaulting to an endpoint because it is the documented path, then paying for idle hours.

Q2: What makes a managed ML pipeline reproducible?

Every step must declare its inputs, including the dataset version, and every run must record parameters, environment, and metrics. Caching keyed on those inputs makes a rerun both cheap and honest. If the notebook kernel state or a manually uploaded file can change the result without appearing in the run record, the pipeline is not reproducible.

Q3: When would you deliberately avoid both SageMaker and Vertex AI?

When the workload is a single modest model behind low traffic, the team already operates Kubernetes well, and there is no regulatory need for a managed registry. In that case a container on existing compute with MLflow for tracking is cheaper and easier to reason about. Managed platforms pay off when you have many models, many owners, or compliance requirements that make lineage and approval workflows mandatory.

Q4: Explain how you would cut a cloud ML bill by half without touching model quality.

Audit the three buckets. Replace always-on endpoints sized for peak with autoscaled or serverless inference sized from measured p95 latency, which usually yields the largest single saving. Move training to spot capacity with checkpointing. Compress stored artifacts and lifecycle old model versions. None of these change the weights or the metrics; they change when compute exists.

Key Takeaways

  • Every managed ML platform performs the same four jobs: authoring, training, registry, and serving; vendor names map onto those stages
  • The always-on inference endpoint is usually the largest line item and the least justified one, so price it before you deploy
  • Keep the training script, evaluation code, and serving schemas vendor-neutral, and treat each cloud SDK as a replaceable adapter
  • Spot training is cheap because it is interruptible, which only works if your training script is deterministic and idempotent
  • Feature stores earn their cost only when multiple trainers and consumers share features; small teams should start with tables and a cache
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-13

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert Data Science Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement