ml-experiment-tracking
Skill2 starsChanged 12 days agoMITView on GitHub
Make ML experiments reproducible, comparable, and promotable with MLflow 3 (or Weights & Biases), covering run structure, config management, seeding and determinism, data and code versioning, run manifests, honest evaluation protocols, model registry with aliases, and experiment hygiene. Includes a stdlib run-manifest script (git, packages, lockfile, data and config hashes) and a tested MLflow training example. Use when setting up experiment tracking, when a result cannot be reproduced, when comparing models or hyperparameters, when registering or promoting a model, or when reviewing an ML training pipeline for reproducibility.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- SWEStash/swe-workflow-skillstheir own version, first seen Nov 8, 2026
- agent-packs/registrytheir own version, first seen Jun 15, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- SWEStash/swe-workflow-skills★ 1same name
- agent-packs/registry★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- agent-observabilitySkill
- data-qualitySkill
- git-pr-workflowSkill
- langgraph-patternsSkill
- llm-evalsSkill
- mcp-server-builderSkill
- prompt-engineeringSkill
- python-qualitySkill
- rag-pipelinesSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Every tracked run records:
- Very specific: line 49
Use a dataclass, Pydantic model, or Hydra config as the single source of truth.
- Very specific: line 103
Use name= in log_model (MLflow 3.
- Very specific: line 105
Use a real backend for teams (MLFLOW_TRACKING_URI pointing at a tracking server or sqlite:///mlflow.db locally).
- Very specific: line 113
Group and time-aware splits: when rows are correlated (users, sessions, patients) or the model predicts the future (GroupKFold, …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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 Experiment Tracking and Reproducibility
A result you cannot reproduce is an anecdote. Every run should answer five questions without archaeology: which code, which data, which config, which environment, which seed, and what it scored on which evaluation protocol.
When To Use
- Starting a modeling project or adding tracking to notebooks and scripts.
- "We got 0.91 last month and 0.87 now and nobody knows why."
- Hyperparameter sweeps, model comparisons, or ablations.
- Registering, promoting, or rolling back a model.
- Reviewing a training pipeline before it goes to production.
The Reproducibility Contract
Every tracked run records:
| What | How |
| Code | Git commit SHA; refuse or flag dirty trees (run_manifest.py capture --strict) |
| Environment | Lockfile hash (uv.lock), Python version, key package versions, GPU / driver |
| Data | Content hash or immutable version (DVC, lakeFS, Delta / Iceberg snapshot, dated object path) |
| Config | Single config object logged as params, plus the config file hash |
| Randomness | Seed logged; deterministic settings documented |
| Evaluation | Split definition, metric code version, test set hash |
scripts/run_manifest.py captures all of this in one JSON file and diffs two runs:
python scripts/run_manifest.py capture --data data/train.parquet data/val/ --config configs/exp.yaml \
--seed 42 --strict --out runs/exp-017/manifest.json -- python train.py --config configs/exp.yaml
python scripts/run_manifest.py check runs/exp-012/manifest.json runs/exp-017/manifest.jsoncheck flags critical differences (code, data, config, lockfile, seed) and lists changed packages, which is usually the answer to "why did the number change?"
Workflow
1. One config object, logged whole
Use a dataclass, Pydantic model, or Hydra config as the single source of truth. Log it with mlflow.log_params(asdict(cfg)) and never read hyperparameters from scattered globals or notebook cells.
2. Seed and control determinism
import random
import numpy as np
def seed_everything(seed: int) -> None:
random.seed(seed)
np.random.seed(seed)
try:
import torch
torch.manual_seed(seed) # seeds CPU and all CUDA devices
torch.backends.cudnn.benchmark = False
torch.use_deterministic_algorithms(True, warn_only=True)
except ImportError:
pass
# Before the process starts: PYTHONHASHSEED=<seed> and, for deterministic cuBLAS,
# CUBLAS_WORKSPACE_CONFIG=:4096:8Full GPU determinism costs speed and some ops do not support it. Choose per project: deterministic for debugging and papers, seeded-but-fast with multiple seeds for model selection.
3. Track runs with MLflow 3
assets/train_example.py is a complete, runnable example (uv run assets/train_example.py). The core pattern:
import mlflow
from mlflow.models import infer_signature
mlflow.set_experiment("churn-model")
with mlflow.start_run(run_name="xgb-depth6"):
mlflow.log_params(asdict(cfg))
mlflow.log_dict(manifest, "run_manifest.json")
mlflow.log_input(mlflow.data.from_pandas(train_df, name="churn_2026_10"), context="training")
for epoch, loss in train(...):
mlflow.log_metric("val_loss", loss, step=epoch)
mlflow.log_metrics({"test_auc": auc, "test_f1": f1})
info = mlflow.sklearn.log_model(
model,
name="model",
signature=infer_signature(X_train, model.predict(X_train)),
input_example=X_train.head(3),
registered_model_name="churn-model",
)- Use
name=inlog_model(MLflow 3;artifact_pathis deprecated). mlflow.autolog()is a good start for sklearn, XGBoost, LightGBM, and PyTorch Lightning; still log the manifest and your own eval metrics.- Use a real backend for teams (
MLFLOW_TRACKING_URIpointing at a tracking server orsqlite:///mlflow.dblocally); the plain file store does not support the registry. - Name experiments by problem, runs by the change being tested, and tag runs (
purpose=ablation,owner=...).
Weights & Biases equivalent: wandb.init(project=..., config=asdict(cfg)), wandb.log({...}, step=epoch), wandb.save("run_manifest.json"), and Artifacts for datasets and models.
4. Evaluate honestly
- Split before anything else; fit preprocessing (scalers, encoders, imputers, target encoding) inside a pipeline on train only.
- Group and time-aware splits when rows are correlated (users, sessions, patients) or the model predicts the future (
GroupKFold,TimeSeriesSplit, or a time cutoff). - Hold out a test set you look at rarely. Model selection uses validation or cross-validation; the test set confirms.
- Report variance: mean and spread over 3-5 seeds or CV folds, plus a bootstrap CI on the test metric. A 0.3-point gain inside the noise is not a gain.
- Compare against baselines: a trivial baseline (majority class, last value) and the current production model on the same split.
- Slice metrics by segment (region, device, cohort) and check calibration if probabilities drive decisions.
- See the
data-qualityskill for leakage checks.
5. Register and promote with aliases
from mlflow import MlflowClient
client = MlflowClient()
client.set_registered_model_alias("churn-model", "challenger", version)
# after validation / shadow / A-B test:
client.set_registered_model_alias("churn-model", "champion", version)
model = mlflow.pyfunc.load_model(
"models:/churn-model@champion"
) # serving code never hardcodes versionsModel stages (Staging / Production) are deprecated; use aliases and tags. Promotion should be a reviewed, logged action with the eval report attached, and rollback is re-pointing the alias.
6. Version data and pipelines
- Small/medium files: DVC (
dvc add data/train.parquet, remote storage,.dvcfiles in git) or dated, immutable object-store paths. - Tables: Delta Lake / Iceberg snapshots or time travel, and log the snapshot ID.
- Pipelines: make each stage a script with explicit inputs/outputs (DVC pipelines, Make, or an orchestrator) so a rerun recomputes only what changed.
Checklist
- Every run logs code SHA, lockfile hash, data version, full config, and seed (manifest attached)
- Dirty-tree runs are blocked or clearly tagged
- Preprocessing fit on train only, inside a pipeline
- Split strategy matches the data (group / time aware where needed)
- Results reported as mean +/- spread over seeds or folds, with baselines
- Test set touched only for final confirmation
- Model logged with signature and input example; registered with an alias
- Serving loads by alias, never by hardcoded version or local path
- A teammate can reproduce a run from the tracker alone
Common Mistakes
- Tracking metrics but not the data version, so reruns silently use new data.
- Tuning hyperparameters against the test set ("just one more look").
- Comparing single-seed runs and celebrating noise.
- Logging models without signatures, so schema drift breaks serving at runtime.
- Promoting by copying files around instead of moving a registry alias.
- Notebook state (out-of-order cells) as the only record of how a model was trained.
References
- MLflow docs: https://mlflow.org/docs/latest/
- MLflow model registry and aliases: https://mlflow.org/docs/latest/ml/model-registry/
- PyTorch reproducibility notes: https://docs.pytorch.org/docs/stable/notes/randomness.html
- DVC: https://dvc.org/doc
- Weights & Biases docs: https://docs.wandb.ai/
- scikit-learn, common pitfalls (data leakage): https://scikit-learn.org/stable/common_pitfalls.html
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.

