Implementing mlops

From ancoleman/ai-design-components · View interactive version

Implementing mlops is an AI agent skill from the GitHub repository ancoleman/ai-design-components. Strategic guidance for operationalizing machine learning models from experimentation to production. Covers experiment tracking (MLflow, Weights & Biases), model registry and versioning, feature stores (Feast, Tecton), model serving patterns (Seldon, KServe, BentoML), ML pipeline orchestration (Kubef

How to use this skill

Skill file

MLOps Patterns

Operationalize machine learning models from experimentation to production deployment and monitoring.

Purpose

Provide strategic guidance for ML engineers and platform teams to build production-grade ML infrastructure. Cover the complete lifecycle: experiment tracking, model registry, feature stores, deployment patterns, pipeline orchestration, and monitoring.

When to Use This Skill

Use this skill when:

Core Concepts

1. Experiment Tracking

Track experiments systematically to ensure reproducibility and collaboration.

Key Components:

Platform Comparison:

MLflow (Open-source standard):

Weights & Biases (SaaS, collaboration-focused):

Neptune.ai (Enterprise-grade):

Selection Criteria:

For detailed comparison and decision framework, see references/experiment-tracking.md.

2. Model Registry and Versioning

Centralize model artifacts with version control and stage management.

Model Registry Components:

Stage Management:

Versioning Strategies:

Semantic Versioning for Models:

Git-Based Versioning:

For model lineage tracking and registry patterns, see references/model-registry.md.

3. Feature Stores

Centralize feature engineering to ensure consistency between training and inference.

Problem Addressed: Training/serving skew

Feature Store Solution:

Online Feature Store:

Offline Feature Store:

Point-in-Time Correctness:

Platform Comparison:

Feast (Open-source, cloud-agnostic):

Tecton (Managed, production-grade):

SageMaker Feature Store (AWS):

Databricks Feature Store (Databricks):

Selection Criteria:

For feature engineering patterns and implementation, see references/feature-stores.md.

4. Model Serving Patterns

Deploy models for synchronous, asynchronous, batch, or streaming inference.

Serving Patterns:

REST API Deployment:

gRPC Deployment:

Batch Inference:

Streaming Inference:

Platform Comparison:

Seldon Core (Kubernetes-native, advanced):

KServe (CNCF standard):

BentoML (Python-first, simplicity):

TorchServe (PyTorch official):

TensorFlow Serving (TensorFlow official):

Selection Criteria:

For model optimization and serving infrastructure, see references/model-serving.md.

5. Deployment Strategies

Deploy models safely with rollback capabilities.

Blue-Green Deployment:

Canary Deployment:

Shadow Deployment:

A/B Testing:

Multi-Armed Bandit (MAB):

Selection Criteria:

For deployment architecture and examples, see references/deployment-strategies.md.

6. ML Pipeline Orchestration

Automate training, evaluation, and deployment workflows.

Training Pipeline Stages:

  1. Data Validation (Great Expectations, schema checks)
  2. Feature Engineering (transform raw data)
  3. Data Splitting (train/validation/test)
  4. Model Training (hyperparameter tuning)
  5. Model Evaluation (accuracy, fairness, explainability)
  6. Model Registration (push to registry if metrics pass thresholds)
  7. Deployment (promote to staging/production)

Continuous Training Pattern:

Platform Comparison:

Kubeflow Pipelines (ML-native, Kubernetes):

Apache Airflow (Mature, general-purpose):

Metaflow (Netflix, data science-friendly):

Prefect (Modern, Python-native):

Dagster (Asset-based, testing-focused):

Selection Criteria:

For pipeline architecture and examples, see references/ml-pipelines.md.

7. Model Monitoring and Observability

Monitor production models for drift, performance, and quality.

Data Drift Detection:

Model Drift Detection:

Performance Monitoring:

Business Metrics Monitoring:

Tools:

For monitoring architecture and implementation, see references/model-monitoring.md.

8. Model Optimization Techniques

Reduce model size and inference latency.

Quantization:

Model Distillation:

ONNX Conversion:

Model Pruning:

For optimization techniques and examples, see references/model-serving.md.

9. LLMOps Patterns

Operationalize Large Language Models with specialized patterns.

LLM Fine-Tuning Pipelines:

Prompt Versioning:

RAG System Monitoring:

LLM Inference Optimization:

Embedding Model Management:

For LLMOps patterns and implementation, see references/llmops-patterns.md.

10. Model Governance and Compliance

Establish governance for model risk management and regulatory compliance.

Model Cards:

Bias and Fairness Detection:

Regulatory Compliance:

Audit Trails:

For governance frameworks and compliance, see references/governance.md.

Decision Frameworks

Framework 1: Experiment Tracking Platform Selection

Decision Tree:

Start with primary requirement:

Detailed Criteria:

| Criteria | MLflow | Weights & Biases | Neptune.ai |

|----------|--------|------------------|------------|

| Cost | Free | $200/user/month | $300/user/month |

| Collaboration | Basic | Excellent | Good |

| Visualization | Basic | Excellent | Good |

| Hyperparameter Tuning | External (Optuna) | Integrated (Sweeps) | Basic |

| Model Registry | Included | Add-on | Included |

| Self-Hosted | Yes | No (paid only) | Limited |

| Enterprise Features | No | Limited | Excellent |

Recommendation by Organization:

For detailed decision framework, see references/decision-frameworks.md.

Framework 2: Feature Store Selection

Decision Matrix:

Primary requirement:

Criteria Comparison:

| Factor | Feast | Tecton | Hopsworks | SageMaker FS |

|--------|-------|--------|-----------|--------------|

| Cost | Free | $$$$ | Free (self-host) | $$$ |

| Online Serving | Redis, DynamoDB | Managed | RonDB | Managed |

| Offline Store | Parquet, BigQuery, Snowflake | Managed | Hive, S3 | S3 |

| Point-in-Time | Yes | Yes | Yes | Yes |

| Monitoring | External | Integrated | Basic | External |

| Cloud Lock-in | No | No | No | AWS |

Recommendation:

For detailed decision framework, see references/decision-frameworks.md.

Framework 3: Model Serving Platform Selection

Decision Tree:

Infrastructure:

Detailed Criteria:

| Feature | Seldon Core | KServe | BentoML | TorchServe |

|---------|-------------|--------|---------|------------|

| Kubernetes-Native | Yes | Yes | Optional | No |

| Multi-Framework | Yes | Yes | Yes | PyTorch-only |

| Deployment Strategies | Excellent | Good | Basic | Basic |

| Explainability | Integrated | Integrated | External | No |

| Complexity | High | Medium | Low | Low |

| Learning Curve | Steep | Medium | Gentle | Gentle |

Recommendation:

For detailed decision framework, see references/decision-frameworks.md.

Framework 4: ML Pipeline Orchestration Selection

Decision Matrix:

Primary use case:

Criteria Comparison:

| Factor | Kubeflow | Airflow | Metaflow | Dagster | Prefect |

|--------|----------|---------|----------|---------|---------|

| ML-Specific | Excellent | Good | Excellent | Good | Good |

| Kubernetes | Native | Compatible | Optional | Compatible | Compatible |

| Learning Curve | Steep | Steep | Gentle | Medium | Medium |

| Maturity | High | Very High | Medium | Medium | Medium |

| Community | Large | Very Large | Growing | Growing | Growing |

Recommendation:

For detailed decision framework, see references/decision-frameworks.md.

Implementation Patterns

Pattern 1: End-to-End ML Pipeline

Automate the complete ML workflow from data to deployment.

Pipeline Stages:

  1. Data Validation (Great Expectations)
  2. Feature Engineering (transform raw data)
  3. Data Splitting (train/validation/test)
  4. Model Training (with hyperparameter tuning)
  5. Model Evaluation (accuracy, fairness, explainability)
  6. Model Registration (push to MLflow registry)
  7. Deployment (promote to staging/production)

Architecture:

Data Lake → Data Validation → Feature Engineering → Training → Evaluation
    ↓
Model Registry (staging) → Testing → Production Deployment

For implementation details and code examples, see references/ml-pipelines.md.

Pattern 2: Continuous Training

Automate model retraining based on drift detection.

Workflow:

  1. Monitor production data for distribution changes
  2. Detect data drift (KS test, PSI)
  3. Trigger automated retraining pipeline
  4. Validate new model (accuracy, fairness)
  5. Deploy via canary strategy (5% → 100%)
  6. Monitor new model performance
  7. Rollback if metrics degrade

Trigger Conditions:

For implementation details, see references/ml-pipelines.md.

Pattern 3: Feature Store Integration

Ensure consistent features between training and inference.

Architecture:

Offline Store (Training):
  Parquet/BigQuery → Point-in-Time Join → Training Dataset

Online Store (Inference):
  Redis/DynamoDB → Low-Latency Lookup → Real-Time Prediction

Point-in-Time Correctness:

For implementation details and code examples, see references/feature-stores.md.

Pattern 4: Shadow Deployment Testing

Test new models in production without risk.

Workflow:

  1. Deploy new model (v2) in shadow mode
  2. v2 receives copy of production traffic
  3. v1 predictions used for responses (no user impact)
  4. Compare v1 and v2 predictions offline
  5. Analyze differences, measure v2 accuracy
  6. Promote v2 to production if performance acceptable

Use Cases:

For deployment architecture, see references/deployment-strategies.md.

Tool Recommendations

Production-Ready Tools (High Adoption)

MLflow - Experiment Tracking & Model Registry

Feast - Feature Store

Seldon Core - Model Serving (Advanced)

KServe - Model Serving (CNCF Standard)

BentoML - Model Serving (Simplicity)

Kubeflow Pipelines - ML Orchestration

Weights & Biases - Experiment Tracking (SaaS)

For detailed tool comparisons, see references/tool-recommendations.md.

Tool Stack Recommendations by Organization

Startup (Cost-Optimized, Simple):

Growth Company (Balanced):

Enterprise (Full Stack):

Cloud-Native (Managed Services):

For scenario-specific recommendations, see references/scenarios.md.

Common Scenarios

Scenario 1: Startup MLOps Stack

Context: 20-person startup, 5 data scientists, 3 models (fraud detection, recommendation, churn), limited budget.

Recommendation:

Rationale:

For detailed scenario, see references/scenarios.md.

Scenario 2: Enterprise ML Platform

Context: 500-person company, 50 data scientists, 100+ models, regulatory compliance, multi-cloud.

Recommendation:

Rationale:

For detailed scenario, see references/scenarios.md.

Scenario 3: LLM Fine-Tuning Pipeline

Context: Fine-tune LLM for domain-specific use case, deploy for production serving.

Recommendation:

Rationale:

For detailed scenario, see references/scenarios.md.

Integration with Other Skills

Direct Dependencies:

Complementary Skills:

Downstream Skills:

Best Practices

  1. Version Everything:
  1. Automate Testing:
  1. Monitor Continuously:
  1. Start Simple:
  1. Point-in-Time Correctness:
  1. Deployment Strategies:
  1. Governance:
  1. Cost Optimization:

Anti-Patterns

❌ Notebooks in Production:

❌ Manual Model Deployment:

❌ No Monitoring:

❌ Training/Serving Skew:

❌ Ignoring Data Quality:

❌ Over-Engineering:

❌ No Rollback Plan:

Further Reading

Reference Files:

Example Projects:

Scripts:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.