model-deployment

Deploy ML models to production with FastAPI, TorchServe, monitoring, and A/B testing.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill model-deployment-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-deployment
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/04-ai-ml/model-deployment
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill model-deployment-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires fastapi, uvicorn, pydantic, scikit-learn, joblib, prometheus-fastapi-instrumentator, mlflow, redis.

What problem does it solve? Moving a trained ML model from a notebook to a production API involves packaging, serving, scaling, monitoring, and safe rollout — this Skill provides production-grade patterns for each step instead of ad-hoc "pickle and Flask" setups. ## Core Features & Use Cases - Serving Frameworks: Build prediction APIs with FastAPI or TorchServe, including Pydantic input validation, batch prediction endpoints, and Docker packaging. - Versioning & Rollout: Register models in MLflow, run shadow mode and canary traffic splitting, and maintain rollback plans for safe releases. - Monitoring & Scaling: Instrument Prometheus metrics (latency, throughput, score distribution for drift detection) and deploy on Kubernetes with HPA autoscaling. - Use Case: You have a trained churn model and need to serve it at 1000 req/s with p95 latency under 50ms, track prediction drift, and safely test a new model version on 10% of traffic before full rollout. ## Quick Start Deploy my trained churn model as a FastAPI service with input validation, Prometheus monitoring, and a Kubernetes autoscaling configuration.

Frequently Asked Questions about model-deployment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a machine learning model as a REST API?

Package the model with joblib or TorchScript, load it once at startup in a FastAPI app, and expose /predict and /health endpoints. Containerize with Docker and deploy to Kubernetes with liveness and readiness probes.

FastAPI vs TorchServe for model serving?

FastAPI suits lightweight custom APIs with any framework like scikit-learn or XGBoost, giving full control over validation and routing. TorchServe is purpose-built for PyTorch models, using MAR archives and handler classes for preprocessing, inference, and postprocessing.

How do I A/B test a new ML model version in production?

Split traffic between model versions, for example 90% to v1 and 10% to v2, and log predictions per version for analysis. Alternatively use shadow mode, where the new model predicts asynchronously without affecting served responses.

How do I monitor ML model predictions in production?

Instrument the API with Prometheus counters and histograms for prediction count, latency, and score distribution. Query p95 latency and score distribution shifts in Grafana to detect performance degradation and data drift.

Why is my model API slow under high traffic?

Common causes are loading the model per request instead of at startup, and looping over single predictions instead of vectorized batch inference. Cache features in Redis and use horizontal pod autoscaling to handle load above 100 req/s.