ml-model-deployment
Skill1 starsChanged 5 days agoMITView on GitHub
Deploy ML models to production — serving infrastructure, monitoring, drift detection, safe rollouts. Triggers: deploy model, serve model, model API, model monitoring, data drift, concept drift, model degradation, A/B test model, canary model, inference endpoint, prediction API, retrain trigger.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-designSkill
- ai-evaluationSkill
- api-designSkill
- architecture-designSkill
- architecture-documentationSkill
- brainstormingSkill
- browser-verificationSkill
- bug-investigatingSkill
- build-vs-buySkill
- cicd-pipelineSkill
- code-archaeologySkill
- code-reviewingSkill
- code-slop-cleanupSkill
- compliance-privacySkill
- configuration-strategySkill
- containerizationSkill
- data-modelingSkill
- data-pipeline-designSkill
- data-qualitySkill
- dependency-impact-analysisSkill
- dependency-managementSkill
- deployment-checklistSkill
- deployment-repoSkill
- dx-auditSkill
- effort-estimationSkill
- exploratory-data-analysisSkill
- feature-planningSkill
- finops-cost-optimizationSkill
- frontend-architectureSkill
- gitops-deliverySkill
- git-workflowSkill
- incident-responseSkill
- infrastructure-as-codeSkill
- llm-app-engineeringSkill
- metrics-and-okrsSkill
- ml-experiment-trackingSkill
- ml-pipeline-designSkill
- mobile-architectureSkill
- mobile-releaseSkill
- notebook-to-productionSkill
- observability-designSkill
- performance-optimizationSkill
- plan-executionSkill
- prd-writingSkill
- project-documentationSkill
- project-proposalSkill
- project-reviewSkill
- refactoringSkill
- release-managementSkill
- research-methodologySkill
- resilience-engineeringSkill
- retrospectiveSkill
- rollback-strategySkill
- security-auditSkill
- skill-routerSkill
- statistical-analysisSkill
- strategic-reviewSkill
- subagent-orchestrationSkill
- tdd-workflowSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Before deployment, the model must be a self-contained, versioned artifact:
- Distinctive: line 20
Serialize the model: Use framework-native formats (joblib/pickle for sklearn, SavedModel for TF, TorchScript for PyTorch, ONNX for …
- Distinctive: line 75
After deployment, monitor continuously.
- Distinctive: line 84
Use statistical tests: Population Stability Index (PSI), Kolmogorov-Smirnov (KS) test, Jensen-Shannon divergence
- Distinctive: line 101
Every model deployment needs a rollback plan:
- Distinctive: line 108
KISS: Start with REST API + batch monitoring.
- Distinctive: line 109
YAGNI: Don't build an A/B testing framework for your first model.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ML Model Deployment
Deploy models to production with serving infrastructure that is reliable, observable, and safely updatable. Deploying a model is not the finish line — it's the beginning of the operational lifecycle.
Key Difference from Software Deployment
Software deployment is primarily concerned with "does the code work?" Model deployment adds: "does the model still work well on real-world data that changes over time?" Models degrade silently — they keep returning predictions, just increasingly wrong ones.
Workflow
Step 1: Package the Model
Before deployment, the model must be a self-contained, versioned artifact:
- Serialize the model: Use framework-native formats (joblib/pickle for sklearn, SavedModel for TF, TorchScript for PyTorch, ONNX for cross-framework)
- Pin dependencies: Exact versions of libraries used during training
- Include preprocessing: The serving pipeline must apply the same feature transformations as training. Feature skew (different preprocessing in training vs serving) is the #1 cause of silent model failure
- Version it: Tag with model registry version, git commit, training data version, and training metrics
Step 2: Choose the Serving Pattern
| Pattern | When to Use | Latency | Complexity |
| REST API (Flask/FastAPI + model) | Low traffic, simple models | Medium (50-200ms) | Low |
| Dedicated serving (TF Serving, Triton, Seldon) | High traffic, GPU inference | Low (5-50ms) | Medium |
| Batch prediction (scheduled job) | High volume, latency-tolerant | N/A (scheduled) | Low |
| Streaming (Kafka + model) | Real-time event processing | Low | High |
| Edge / embedded | Offline, privacy-sensitive | Very low | High |
For most teams starting out: REST API with FastAPI is the right default. Optimize for lower latency only when measured need justifies complexity.
Step 3: Build the Serving Application
The serving app needs:
Request → Validate input → Preprocess → Predict → Postprocess → ResponseKey requirements:
- Input validation: Reject malformed requests before they reach the model. With FastAPI
this is a Pydantic request model on the predict endpoint — declare the feature schema with
types and ranges, and return 422 on a bad payload (see
references/serving-patterns.md). Under a high-throughput requirement this is the first thing people cut, and it is the wrong cut. Trimming pandas, fixing column order, and batching are the latency wins; the request schema is not one. An unvalidated fraud endpoint scores garbage features silently instead of rejecting them — a wrong prediction costs more than the microseconds the check takes. - Feature preprocessing: Apply the same transformations used in training
- Error handling: Model errors should return 500 with diagnostic info, not crash the service
- Logging: Log every prediction request/response for monitoring and debugging
- Health check: Endpoint that verifies the model is loaded and responsive
See references/serving-patterns.md for implementation templates.
Step 4: Deploy Safely
Models should be deployed with the same caution as any production service — more, given their non-deterministic nature:
Shadow mode: Deploy the new model alongside the current one. Both receive traffic, but only the current model's predictions are used. Compare predictions to evaluate the new model on real data.
Canary deployment: Route a small percentage of traffic (5-10%) to the new model. Monitor metrics. Gradually increase if performance is acceptable.
A/B testing: Split traffic between model versions to measure business impact (conversion rate, click-through, etc.), not just ML metrics.
Blue-green: Deploy new model to a separate environment, switch all traffic at once after validation. Fastest rollback.
Step 5: Monitor in Production
After deployment, monitor continuously. See references/serving-patterns.md for implementation details.
Model performance monitoring:
- Track prediction accuracy against ground truth (when available)
- Monitor prediction distribution (are predictions shifting?)
- Track business KPIs that the model influences
Data drift detection:
- Compare input feature distributions against the training data baseline
- Use statistical tests: Population Stability Index (PSI), Kolmogorov-Smirnov (KS) test, Jensen-Shannon divergence
- Alert when drift exceeds thresholds
System monitoring:
- Prediction latency (P50, P95, P99)
- Request throughput and error rates
- Resource utilization (CPU, memory, GPU)
- Model loading time
Retraining triggers:
- Accuracy drops below threshold
- Data drift exceeds threshold
- Scheduled retraining (weekly/monthly depending on domain)
- New labeled data becomes available
Step 6: Plan Rollback
Every model deployment needs a rollback plan:
- Previous model version tagged and ready in the registry
- One-command rollback through CI/CD or model registry stage transition
- Automated rollback on monitoring alert (if confidence is high)
Principles Applied
- KISS: Start with REST API + batch monitoring. Add real-time drift detection when scale justifies it.
- YAGNI: Don't build an A/B testing framework for your first model. Shadow mode is enough.
- Defense in depth: Validate inputs, monitor outputs, detect drift, and have rollback ready.
- Functional Independence: Serving, monitoring, and retraining should be independent components, not monolithic.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

