Machine learning playbook
Rules for models you train yourself. Training data, leak-free splits, baselines, evaluation, a registry, safe releases, drift and decisions about people.
- Required 7
- Recommended 27
- Avoid 4
A machine learning playbook for teams that train their own models. It covers classifiers, ranking, recommendations, forecasting and fine-tuned models that score or sort things inside a product. It works with any framework, such as scikit-learn, PyTorch or XGBoost, and any tracking tool, such as MLflow.
A trained model is code that nobody wrote by hand. Its behaviour comes from the data, so a mistake in the data becomes a mistake in every answer. These rules make each model traceable to its data, tested against a simple baseline, and watched once it runs.
The chapters follow the life of a model. First come the decision the model serves and the baseline it must beat. Then come training data, splits that keep the test honest, and evaluation. Next are training runs and the model registry, serving and release, and monitoring with retraining. The last chapter covers people affected by the model, from fairness per group to explaining a decision.
Start with Beat a simple baseline before you ship a model. Then read Splits and leakage before you trust any score.
Product features built on language models, such as chat, summaries and retrieval, live in the AI features playbook. That playbook also holds the rules on fine-tuning a language model, such as when to fine-tune. The legal duties of the AI Act live in the compliance playbook.
Chapters
Problem and baseline
Write down the decision a model serves and what each error costs. Then build a simple baseline, and ship a model only when it beats that baseline.
- Recommended 3
Training data
Record where every dataset came from and why you may use it. Keep identifiers out, freeze each version, and measure label quality and group coverage.
- Required 2
- Recommended 3
Splits and leakage
Split data the way the model meets it in production, by time and by person. Fit every step on training data only, and keep the test set untouched.
- Recommended 5
- Avoid 1
Evaluation
Judge a model with metrics that fit the decision, with their uncertainty and with behaviour tests. Then let an automatic gate decide on each release.
- Recommended 4
- Avoid 1
Training runs and the registry
Record the data, code, seed and environment of every training run. Keep each model in a registry with versions, and describe it in a model card.
- Recommended 3
Serving and release
Compute features once for training and serving, check every input, and log what the model saw. Release in shadow and canary steps, with a fallback ready.
- Required 1
- Recommended 5
Monitoring and retraining
Alert when inputs or predictions drift, measure live quality once outcomes arrive, retrain on written triggers, and keep feedback loops out of the data.
- Recommended 4
- Avoid 1
People affected by the model
Measure quality for each group of people, keep proxies for protected traits out, and give every person a decision touches an explanation and a record.
- Required 4
- Avoid 1
This is a lot to check. An Expert can check it for you.
Related playbooks
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/machine-learning">Agent Wranglers machine learning playbook</a>. In code you write, add a comment next to it with the same link.