"The model underperforms" is not a bug report. This playbook turns an assistant into a diagnostic partner by feeding it artifacts — error slices, learning curves, importances, confusion matrices — and demanding differential diagnoses with cheap discriminating tests.
Tier: Core · Workflow area: Model debugging & diagnostics
The same skills double as your defense against AI-generated modeling code: the final step is a review drill on code with planted bugs.
learning_curve, permutation_importance, calibration tools) and SHAP for local explanations.Build the evidence pack before prompting. Compute: metric by key slices (df.groupby(['segment','month']).apply(pr_auc)), confusion matrix at the operating threshold, learning curve, permutation importance, calibration curve, and the 20 worst false positives and negatives with features. Diagnosis quality is capped by evidence quality.
Demand a differential, not an answer:
Churn model, PR-AUC 0.41 CV vs 0.27 on Oct-Dec holdout. Artifacts:
[slice-metric table] [importance table] [learning curve values]
[calibration table]. List the 6 most likely root causes ranked by
consistency with THIS evidence. For each: which artifact supports it, which
contradicts it, and a test costing <10 lines of pandas to discriminate it
from the others. Do not recommend fixes yet.
The "no fixes yet" rule prevents the classic failure: optimizing before localizing.
Run the discriminating tests in order of cheapness. Typical differentials and their tests: temporal drift (retrain on rolling windows — does the gap track recency?); leakage in CV (target-shuffle test; grain check for entity overlap across folds); slice concentration (is the drop isolated to one country/segment/month?); label shift (compare positive rates train vs holdout); feature pipeline skew (recompute one feature independently and diff). Paste each result back; make the model update its ranking explicitly.
Use SHAP for the "wrong individual predictions" class. For the 40 worst errors, get SHAP values and ask the assistant to cluster the error stories: Group these 40 misclassified rows by their dominant SHAP features. Name each error cluster, estimate its share, and say whether it looks like a data problem, feature gap, or genuine irreducible case. Verify cluster claims by reading a few rows yourself.
Interpret learning curves with discipline. Paste the curve values, not just the picture: converged-and-close means more data will not help (feature or label problem); a large gap means variance (regularize or simplify); both-bad means bias. Make the assistant commit to one regime and one implied next action, then sanity-check against your slice evidence.
Fix one cause, re-run the full evidence pack. Never bundle fixes: you must know which one worked. Confirm the slice that was broken improved and no other slice regressed.
Run the adversarial review drill (planted-bug practice). Periodically, review code seeded with the canonical bugs: scaler fit before split, train_test_split(shuffle=True) on temporal data, target encoding on full data, evaluation on the training fold, off-by-one in as-of joins, wrong-threshold metrics. Have one assistant plant 3 bugs in a working pipeline; a fresh session — or you, timed — finds them:
Insert 3 realistic evaluation-inflating bugs into this sklearn pipeline
(leakage, split, or metric bugs). Output only the modified code — no hints.
Score yourself: found/missed, and time-to-find. This calibrates how much to trust your own review pass in pb-05/pb-06.
Feed artifacts, demand a ranked differential with discriminating tests, change one thing at a time — the assistant widens your hypothesis space, but the tests you execute do the diagnosing.