# Set up experiment tracking for a machine learning training run

Step-by-step setup to log metrics, hyperparameters, and artifacts from your training script, locally or on a cluster.

- Topic: Software Development
- Framework: Few-Shot
- Level: Standard
- Tags: Coding, Analyze, Code, Fill-in Template, Interactive
- Source: https://www.thinkwithprompt.com/prompts/set-up-experiment-tracking-for-a-machine-learning-training-run

## Prompt

```text
Help me set up experiment tracking for my machine learning training.

**Tracking tool:** [e.g. "Weights & Biases", "MLflow", "TensorBoard", "not chosen yet"]
**Framework:** [e.g. "PyTorch", "PyTorch Lightning", "Hugging Face Trainer", "Keras"]
**Where training runs:** [laptop / single cloud VM / Kubernetes pod / Slurm cluster]
**My training script:** [paste the key parts: config, training loop, evaluation, checkpoint saving]
**What I want to compare across runs:** [e.g. "learning rate and batch size vs. validation loss"]

Give me:
1. If I haven't chosen a tool, a short comparison for my setup and a recommendation.
2. The code changes to my script: initializing a run, logging the full config/hyperparameters, logging metrics per step and per epoch, logging the git commit and dataset version, and saving checkpoints as artifacts.
3. How to pass credentials safely in my environment (environment variables or secrets objects, never hard-coded in code or container images). Do not ask me to paste API keys.
4. If I run on Kubernetes or a cluster: the job or pod spec changes, how logs reach the tracker, and how to handle preemption and resumed runs without creating duplicate runs.
5. A naming and tagging convention for runs so I can find and compare them later.
6. A quick test: a 2-minute dry run that confirms logging works before a long job.
7. Common mistakes: logging too often, missing random seeds, forgetting to log the evaluation split, and tracking runs that crashed.

Keep code minimal and explain each change in one line.
```

## What to fill in

- laptop / single cloud VM / Kubernetes pod / Slurm cluster
- e.g. "learning rate and batch size vs. validation loss"

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
