ml-production-debug
Skill0 starsChanged 6 months agoMITView on GitHub
This skill should be used when the user reports "model performance dropped", "predictions look wrong in production", "metrics regressed after deploy", "data drift", "feature drift", "the model works offline but not online", "scores shifted", or needs to triage a production ML incident, investigate training/serving skew, or diagnose a data quality issue.
In this repository18 other files it gives its agents.
- experiment-designSkill
- llm-engineeringSkill
- ml-autoplanSkill
- ml-canarySkill
- ml-carefulSkill
- ml-code-reviewSkill
- ml-experiment-journalSkill
- ml-iterateSkill
- ml-learnSkill
- ml-office-hoursSkill
- ml-principlesSkill
- ml-red-teamSkill
- ml-retroSkill
- ml-setupSkill
- ml-shipSkill
- ml-system-designSkill
- model-evaluationSkill
- tech-leadershipSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 34
When did it move? Correlate: model deploys, feature pipeline changes, upstream schema changes, retrains, product/UI changes shifting …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Production ML debugging
ML failures are usually data failures. Rule out causes in probability order; don't jump to retraining.
The iron laws
DIAGNOSIS BEFORE REMEDIATION — "RETRAIN" WITHOUT A ROOT CAUSE TREATS THE SYMPTOM
ONE HYPOTHESIS AT A TIME, CHEAPEST DISCRIMINATING TEST FIRST
NO FIX WITHOUT A CONFIRMED DIAGNOSIS — STOP AFTER 3 FAILED FIXES AND RE-PLANDrive the triage: state the leading hypothesis + its probability + the cheapest test that confirms or kills it. Given logs/data → analyze in code directly.
Scope freeze: once a hypothesis is under test, activate ml-careful freeze on the module under investigation — debugging must not leak "improvements" into unrelated pipeline code.
Three-strikes rule: three fixes attempted without resolution → stop. Write up what was tried, what each attempt ruled out, and the surviving hypotheses. Re-plan from the evidence (or escalate) rather than thrash — a fourth blind fix is how incidents acquire second incidents.
Runbook — in order, each step halves the search space
1. Timeline (5 min)
When did it move? Correlate: model deploys, feature pipeline changes, upstream schema changes, retrains, product/UI changes shifting traffic mix, marketing, calendar. Sharp step → something shipped. Slow bleed → drift or feedback.
2. Verify the measurement
- Metric definition / logging / join logic changed?
- Label lag: "regression" = immature labels in recent cohorts?
- Mix shift: compute within fixed segments. Per-segment flat + aggregate moved = Simpson's, not model failure. Different fix.
3. Serving path (most common true cause)
- Feature skew: served feature vectors (from prediction logs) vs offline recompute, same entities/timestamps. Top offenders: null-handling, timezone/window boundaries, stale online store, silent default fallbacks.
- Null/default rates over time per feature: a feature going 100% default flattens output, throws no errors.
- Version mismatch: model + preprocessing + tokenizer/vocab in prod match the trained pair. NLP: tokenizer drift = plausible-looking, degraded predictions. Check hashes, not filenames.
4. Only then, drift
- Covariate: PSI/KS per feature, training snapshot vs recent serving. Rank by importance × PSI, not PSI alone; PSI > 0.2 on important features = actionable.
- Prediction drift: score distributions release-over-release. Shifted scores + stable inputs → pipeline/model change; shifted inputs → upstream.
- Concept drift: inputs stable, input→label relation changed. Detect: frozen model on freshly matured labels. The only category where retraining is the actual fix.
- Embedding/text drift: distance-to-training-centroids; new topics and language mix evade token stats.
5. Feedback loop (ranking/behavioral)
Model shapes its own training data → slow self-inflicted decay: popularity reinforcement, exploration collapse. Check: exploration/propensity logging alive? Holdback cohort same trend? Holdback degraded equally → external cause; only treated → the loop.
Stabilize, then fix
Mitigations fastest-first: rollback model, pin/repair feature with sane default, route segment to fallback, freeze automated retrains. Never let a retrain consume incident-window data uncleaned — converts an outage into persistent contamination.
Post-incident
Recommend the cheapest monitor that catches this class earliest: per-feature null/range at serving > prediction distribution per version > sampled offline/online parity > label-joined online metric > drift dashboards. Page only on must-act-within-hours. Log the incident + lesson into experiments/lessons.md (ml-experiment-journal): the NEVER/ALWAYS rule that prevents the repeat.
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.

