4.3. CI/CD Pipelines for ML Workflows
💡 First Principle: ML models are not static software—think of it like a newspaper: yesterday's model, trained on yesterday's data, may be wrong for today's predictions. CI/CD for ML (often called MLOps) automates the retrain-evaluate-deploy cycle so that model updates go from training to production with the same rigor as software releases: tested, validated, and rollback-ready. Can your team deploy a retrained model to production in under an hour? Without CI/CD, model updates require manual coordination that's slow, error-prone, and doesn't scale — whereas automated pipelines catch regressions before they reach customers.
Consider a team that retrains their fraud model monthly. Without CI/CD, someone manually runs a training notebook, eyeballs the metrics, uploads the model artifact, and updates the endpoint. This process has no automated tests, no approval gates, no rollback plan, and no audit trail. With CI/CD, a pipeline automatically retrains on new data, validates metrics against a threshold, registers the model in Model Registry, deploys via blue/green strategy, and rolls back if production metrics degrade—all without human intervention.
Think of ML CI/CD like an automobile assembly line with quality checkpoints. Raw materials (data) enter, get processed (training), tested (evaluation), assembled (packaging), inspected (validation), and shipped (deployment). At each checkpoint, a failure stops the line until the issue is resolved. No defective product reaches the customer.
⚠️ Common Misconception: SageMaker Pipelines and CodePipeline serve the same purpose. SageMaker Pipelines is an ML-specific workflow orchestrator — it manages training, processing, and model registration steps with ML-native integrations. CodePipeline is a general CI/CD orchestrator that can trigger SageMaker Pipelines as one step in a broader release workflow. The exam tests whether you know that SageMaker Pipelines handles the ML workflow while CodePipeline handles the software release workflow, and that production architectures often use both together.