agentleFS
SWEStashSWEStash/swe-workflow-skills/skills/ml-experiment-tracking/SKILL.md

ml-experiment-tracking

Skill1 starsChanged 5 days agoMITView on GitHub

Design reproducible ML experiments — tracking, versioning, run comparison with MLflow, W&B, or DVC. Triggers: experiment tracking, MLflow, wandb, weights and biases, DVC, track experiments, compare models, hyperparameter, reproducibility, model registry, which model is better, experiment results, log metrics. Defining WHAT to measure (metrics, golden datasets, judges) → ai-evaluation; this skill records and compares the runs.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    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
  1. Distinctive:

    Before running experiments, establish:

    line 23
  2. Distinctive:

    All hyperparameters (learning rate, batch size, epochs, model architecture choices)

    line 41
  3. Distinctive:

    Run duration and compute cost

    line 55
  4. Distinctive:

    Before running anything, define:

    line 60
  5. Distinctive:

    Stopping criteria: When do you stop iterating?

    line 66
  6. Distinctive:

    Document this as the experiment description in your tracker.

    line 68
  7. Distinctive:

    Run experiments with full tracking.

    line 72
  8. Distinctive:

    When a model is ready for staging or production:

    line 82
  9. Distinctive:

    Document what makes this model better than the previous version

    line 87
  10. Distinctive:

    YAGNI: Start with simple tracking (parameters + metrics + artifacts).

    line 94

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ML Experiment Tracking

Establish disciplined experiment tracking that makes ML development reproducible, comparable, and auditable. Without tracking, ML work degenerates into "which notebook had the good results?"

Why This Matters

ML experiments differ from traditional software in critical ways:

  • Non-deterministic: Same code + same data can produce different results (random seeds, GPU nondeterminism)
  • Multi-dimensional: Performance depends on code, data, hyperparameters, and environment simultaneously
  • Retrospective: You often realize a past experiment was better only after running new ones

Without systematic tracking, reproducing results becomes archaeology.

Workflow

Step 1: Set Up Tracking Infrastructure

Before running experiments, establish:

  • Experiment tracker: MLflow, Weights & Biases, Neptune, or even a structured CSV/JSON approach
  • Data versioning: DVC, Delta Lake, or immutable dataset snapshots in object storage
  • Code versioning: Git (this should already exist)
  • Environment capture: Docker image hash, conda environment export, pip freeze

Recommend MLflow for open-source simplicity, W&B for rich visualization needs. See references/tracking-tools.md for setup patterns.

Training code the tracker can re-run. A logged commit hash only means something if the commit contains the training run. A loop living in notebook cells doesn't qualify — cell execution order isn't in the commit, so two runs from "the same code" aren't comparable, which is the thing tracking exists to fix. Extract the training loop into a script or module the notebook (or the tracker) calls with parameters, and log from there. This extraction stays in this skill — it is what makes a run reproducible. Turning that script into a scheduled, tested production job is notebook-to-production's work; naming that skill is not a reason to leave the training loop in the notebook.

Step 2: Define What to Track

For every experiment run, log:

Inputs:

  • Dataset version or hash (not just "training_data.csv" — the specific version)
  • Git commit hash of the code
  • All hyperparameters (learning rate, batch size, epochs, model architecture choices)
  • Random seed
  • Environment (Python version, key library versions, GPU type)

Outputs:

  • Primary metric (what you're optimizing: accuracy, F1, RMSE, etc.)
  • Secondary metrics (latency, model size, memory usage)
  • Training curves (loss per epoch)
  • Evaluation on held-out test set
  • Model artifacts (serialized model, weights)
  • Confusion matrix, ROC curves, or other diagnostic plots

Metadata:

  • Experiment name and description (what hypothesis is being tested)
  • Run duration and compute cost
  • Tags for filtering (e.g., "baseline", "feature_engineering", "architecture_search")

Step 3: Design the Experiment

Before running anything, define:

  1. Hypothesis: What do you expect to happen and why?
  2. Baseline: What's the current best result to beat?
  3. Variable: What exactly are you changing? (Change one thing at a time)
  4. Metric: What defines "better"? Set this before seeing results to avoid cherry-picking.
  5. Stopping criteria: When do you stop iterating? (Target metric reached, diminishing returns, time budget exhausted)

Document this as the experiment description in your tracker.

Step 4: Run and Compare

Run experiments with full tracking. After a batch of runs:

  1. Compare metrics across runs in a table or parallel coordinates plot
  2. Identify the best run by the pre-defined primary metric
  3. Verify reproducibility — can you re-run the best experiment and get similar results?
  4. Check for data leakage — is the test set truly held out? No information from test in training?
  5. Assess overfitting — compare train vs validation metrics

Step 5: Register the Best Model

When a model is ready for staging or production:

  1. Register it in a model registry (MLflow Model Registry, or equivalent)
  2. Tag it with a stage: staging, production, archived
  3. Link it to the experiment run that produced it (full lineage)
  4. Document what makes this model better than the previous version

This creates an auditable trail from "model in production" back to "exact data + code + params that created it."

Principles Applied

  • DRY: Track once, query many times. Don't reconstruct experiment details from memory or notebooks.
  • YAGNI: Start with simple tracking (parameters + metrics + artifacts). Add complexity (feature stores, automated comparisons) when the number of experiments justifies it.
  • Reproducibility over speed: A fast experiment you can't reproduce has zero long-term value.
  • KISS: One experiment changes one variable. Multi-variable changes make it impossible to attribute improvement.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.