Orchestrating Model Building with SageMaker Pipelines
This lesson explains SageMaker Pipelines, the ML-native workflow service that defines building, evaluating and registering a model as a directed acyclic graph that runs serverlessly and records lineage.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the pipeline step types.
- Use parameters and step caching.
- Build a gated pipeline with a condition step.
Steps
A pipeline is a set of steps with dependencies. ProcessingStep runs data preparation or evaluation scripts; TrainingStep trains a model; TuningStep runs automatic model tuning; ModelStep creates or registers a model; TransformStep runs batch transform; ConditionStep branches on values such as evaluation metrics; ClarifyCheckStep and QualityCheckStep compute bias and data or model quality baselines; LambdaStep and CallbackStep integrate other services or wait for external work; FailStep stops with a message. The @step decorator turns Python functions into steps. EMR steps and notebook jobs are also supported.
Pipeline steps
Parameters, caching and execution
Pipeline parameters (such as input data location, instance type or accuracy threshold) are set per execution, so one definition serves many environments and runs. Step caching reuses the output of a step whose inputs have not changed, saving time and cost when rerunning a pipeline after a later step fails. Executions can be started from the console, SDK, EventBridge rules or schedules, and every execution records lineage linking data, jobs and model versions. Pipelines integrate with the Model Registry and with SageMaker Projects for CI/CD.
Typical structure
A standard model-building pipeline in SageMaker Pipelines follows a common sequence. A processing step prepares the data, a training step trains the model, and an evaluation step measures it on a test set. A condition step then checks whether the model is good enough, for example whether its accuracy exceeds a threshold or beats the current production model. Only if it passes does a step register the model as a new version in the Model Registry, with its approval status set to pending, so a person or automated gate decides on deployment. The following table maps the steps to their purposes.
| Step type | Typical purpose |
|---|---|
| ProcessingStep | Feature engineering, data validation, evaluation metrics |
| TrainingStep / TuningStep | Train or tune the model |
| QualityCheckStep / ClarifyCheckStep | Create Model Monitor and Clarify baselines |
| ConditionStep | Quality gate on evaluation metrics |
| ModelStep (register) | Add a version to a model package group |
| CallbackStep / LambdaStep | Wait for or call external systems |
| FailStep | Stop with a clear reason |
The following diagram shows the steps of a weekly churn training pipeline and the two outcomes of its quality gate.

A gated pipeline
A gated training pipeline
A churn model must be retrained weekly and registered only if its validation AUC is at least 0.80.
evaluate = ProcessingStep(name="Evaluate", processor=sk_processor, code="evaluate.py",
property_files=[eval_report], ...)
register = ModelStep(name="Register", step_args=model.register(
model_package_group_name="churn-models", approval_status="PendingManualApproval", ...))
gate = ConditionStep(
name="AUCAtLeast080",
conditions=[ConditionGreaterThanOrEqualTo(
left=JsonGet(step_name="Evaluate", property_file=eval_report, json_path="metrics.auc.value"),
right=auc_threshold)], # pipeline parameter, default 0.80
if_steps=[register],
else_steps=[FailStep(name="AUCTooLow", error_message="AUC below threshold")])
pipeline = Pipeline(name="churn-train", parameters=[input_data, auc_threshold],
steps=[process, train, evaluate, gate])The gate prevents weak models from even reaching the registry, and the threshold is a parameter, so it can be changed without editing the pipeline definition.
How does a pipeline skip steps whose inputs have not changed?
Show answer
With step caching.
Exam Tips
Remember for the exam
- ML-native workflow with lineage and registry integration: SageMaker Pipelines.
- Quality gate on metrics: ConditionStep with JsonGet from an evaluation report.
- Skip unchanged steps on rerun: step caching.
- Wait for external systems or approvals: CallbackStep.
- Pipeline parameters let one definition serve many runs and environments.