← Back to Index

3. Stages of ML Systems

ML pipeline stages: data ingestion, preprocessing, feature store, training, registry, serving, monitoring

Every ML system can be understood as three major stages. Each stage has its own infrastructure requirements, failure modes, and design patterns.

Stage 1: Data Pipeline

The data pipeline is responsible for getting raw data from sources into a usable form for training and serving.

# Data pipeline failure modes
- Schema change in source (new field, removed field, type change)
- Missing values increase beyond threshold
- Late-arriving data breaks training-serving consistency
- Data quality issue (duplicates, outliers) degrades model silently

Stage 2: Training Pipeline

Transforms features and labels into a trained model artifact.

# Training pipeline success criteria
- Training completes within SLA (e.g., under 4 hours)
- Validation metrics meet thresholds (e.g., AUC > 0.85)
- No data leakage between train and val sets
- Model artifact size within deployment budget

Stage 3: Serving Pipeline

Exposes the trained model for inference requests.

Exercise: Draw the three-stage pipeline for a spam detection ML system. For each stage, list: the specific technologies you would use, the data formats flowing through, what could go wrong, and how you would detect failure.