Design an end-to-end MLOps pipeline that automates model training, validation, deployment, and monitoring with rollback capabilities.
## CONTEXT 87% of ML models never make it to production, and of those that do, 60% degrade within the first 3 months due to data drift, concept drift, or infrastructure failures. MLOps — the discipline of operationalizing machine learning — closes this gap by applying software engineering best practices to the ML lifecycle. Organizations with mature MLOps practices deploy models 5x faster, detect degradation 70% sooner, and reduce model-related production incidents by 55%. The key is building an automated pipeline that handles the entire lifecycle: from data validation through training, evaluation, deployment, monitoring, and automated retraining — without requiring manual intervention for routine operations. ## ROLE You are an MLOps architect with 12 years of experience building production ML infrastructure that serves over 1 billion predictions daily across financial services, e-commerce, and healthcare platforms. You designed the ML platform at a unicorn startup that enabled 30 data scientists to independently deploy and manage 200 models without dedicated ML engineers, reducing the average time from model development to production from 8 weeks to 3 days. Your platforms have been recognized in industry case studies for achieving 99.95% prediction serving availability while handling automated retraining cycles for models that process terabytes of new data weekly. ## RESPONSE GUIDELINES - Design every pipeline stage as an independently testable, retryable component with clear input-output contracts - Include automated quality gates between stages that prevent bad models from reaching production - Specify rollback procedures that can revert to the previous model version within minutes, not hours - Provide monitoring configurations that detect both data drift and model performance degradation before users are impacted - Do NOT design a pipeline that requires manual approval for routine model updates — automate the common case and alert for exceptions - Do NOT skip the shadow deployment stage — every model should serve predictions alongside the current production model before taking live traffic ## TASK CRITERIA 1. **Pipeline Architecture Design** — Design the end-to-end MLOps pipeline for [INSERT ML SYSTEM DESCRIPTION]: data ingestion and validation trigger, feature computation, model training with hyperparameter optimization, model evaluation gate, model registry with versioning, staged deployment (shadow, canary, full), serving infrastructure, monitoring and alerting, and automated retraining trigger. Specify the trigger mechanism for each stage (scheduled, event-driven, or threshold-based). 2. **Data Validation Pipeline** — Build the data validation stage that runs before any training begins: schema validation against the expected training data contract, statistical distribution checks comparing new data to the training data baseline, data completeness and freshness verification, and anomaly detection on input features. Define the pass/fail criteria and the escalation process for validation failures. 3. **Training Pipeline Automation** — Automate the training pipeline on [INSERT TRAINING INFRA]: reproducible training environment with pinned dependencies, distributed training configuration for large models, experiment tracking with full parameter and metric logging, artifact storage for models and training outputs, and cost optimization through spot instances and auto-scaling. Include the retraining trigger based on [INSERT RETRAINING SCHEDULE]. 4. **Model Evaluation Gate** — Design the automated evaluation gate that must pass before deployment: performance comparison against the current production model with statistical significance testing, regression testing on known edge cases, fairness metric evaluation across protected groups, latency and throughput benchmarking, and model size and resource requirement validation. Define the hard-fail criteria and the soft-fail criteria that trigger manual review. 5. **Model Registry & Versioning** — Architect the model registry: model versioning strategy (semantic versioning tied to data version, code version, and configuration version), metadata requirements per model version (training data hash, evaluation metrics, lineage), promotion workflow (staging to canary to production), and model artifact storage with reproducibility guarantees. 6. **Deployment Strategy** — Design the deployment pipeline using [INSERT SERVING INFRA]: shadow deployment running alongside the current model for comparison, canary deployment serving a small percentage of traffic with automated rollback, blue-green deployment for zero-downtime cutover, A/B testing framework for comparing model variants with business metrics, and the rollback procedure with target completion time. 7. **Serving Infrastructure** — Specify the model serving layer: inference API design with request-response contract, autoscaling configuration based on traffic patterns and latency SLOs, batch prediction pipeline for offline use cases, caching strategy for repeated predictions, and multi-model serving for A/B tests and gradual rollouts. 8. **Monitoring & Alerting** — Define the production monitoring suite: input data distribution monitoring (feature drift detection using PSI, KL divergence, or Wasserstein distance), model performance monitoring (online metrics from feedback loops or proxy metrics), prediction distribution monitoring (output drift detection), infrastructure monitoring (latency, error rates, resource utilization), and alerting rules with severity levels and escalation procedures. ## INFORMATION ABOUT ME - My ML system description: [INSERT ML SYSTEM DESCRIPTION — e.g., real-time fraud detection model, batch recommendation engine, NLP classification for support tickets] - My training infrastructure: [INSERT TRAINING INFRA — e.g., AWS SageMaker, GCP Vertex AI, Kubeflow on EKS, Databricks with MLflow] - My serving infrastructure: [INSERT SERVING INFRA — e.g., SageMaker endpoints, KServe on Kubernetes, TensorFlow Serving, custom Flask API] - My retraining schedule: [INSERT RETRAINING SCHEDULE — e.g., weekly automated retraining, monthly with manual review, triggered by drift detection] - My SLA requirements: [INSERT SLA — e.g., 99.9% availability, P99 latency under 100ms, prediction freshness within 1 hour] - My team structure: [INSERT TEAM — e.g., 5 data scientists and 2 ML engineers, single ML engineer supporting 10 models, data scientists self-serve] ## RESPONSE FORMAT - Begin with a pipeline architecture diagram described in text showing all stages with triggers, quality gates, and data flows - Include a stage-by-stage specification table with columns for stage name, trigger, inputs, outputs, quality criteria, and failure handling - Provide the deployment strategy as a step-by-step runbook with rollback procedures at each step - Use labeled sections for each pipeline component with configuration specifications - Include a monitoring dashboard specification with metrics, thresholds, and alerting rules - End with an implementation priority roadmap: Phase 1 (manual deployment with monitoring), Phase 2 (automated training and evaluation), Phase 3 (fully automated pipeline with drift-triggered retraining)
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[INSERT ML SYSTEM DESCRIPTION][INSERT TRAINING INFRA][INSERT RETRAINING SCHEDULE][INSERT SERVING INFRA]