EXPERIMENTATION & A/B TESTING · INTERVIEW QUESTION
What is experiment tracking (MLflow, W&B) and why is it important for LLM projects?
🟡 intermediate · Advanced Experimentation
Hint: Systematically log runs, compare configs, and share results across teams.
Answer
Systematically logging metadata about training runs:
Interview reasoning
Experiment Tracking
import wandb
wandb.init(project="llm-finetuning", config={
"model": "llama-2-7b",
"lr": 3e-4,
"batch_size": 32,
"lora_rank": 16,
})
for step, batch in enumerate(dataloader):
loss = train_step(batch)
wandb.log({"loss": loss, "step": step})
if step % 1000 == 0:
val_loss = evaluate()
wandb.log({"val_loss": val_loss})
wandb.finish()What to Track
| Category | Examples |
|---|---|
| Config | Model size, LR, batch size, LoRA rank |
| Metrics | Loss, perplexity, BLEU, accuracy |
| Artifacts | Checkpoints, evaluation outputs |
| System | GPU utilization, memory, training time |
| Code | Git commit hash, diff |
Why It Matters for LLMs
- Runs are expensive ($100K+) — can't afford to lose track
- Multiple team members running experiments
- Need to compare: "Why is run #113 worse than #98?"
- Compliance and reproducibility requirements
Tools: Weights & Biases, MLflow, Neptune, ClearML, TensorBoard
LLM experiment results depend on data, prompts, model versions, decoding and compute budget. Preserve run manifests and artifacts; compare candidates on untouched task evaluations with cost and safety constraints. Expensive tuning should use staged smaller-budget evidence and repeated seeds or prompts where variation affects the conclusion.
Worked example. Link tracked runs to code/data versions, evaluation artifacts, cost and the chosen deployment candidate. Store failure cases and per-slice metrics, not just one aggregate dashboard score, so reviewers can reproduce the decision and detect changed evaluation data.
Validation
Recreate selected runs, verify comparable evaluation inputs and budget accounting, and check sensitivity to stochastic generation. Test resumed versus uninterrupted runs with the saved optimizer, scheduler and data-position state. Retain failed trials and selection criteria so the winning run can be reviewed in the context of the complete search.
Common pitfalls
A tracking dashboard does not prevent test-set overfitting. Identical seeds do not reproduce mutable APIs or overwritten datasets.
Related questions
- What is CUPED and how does it reduce variance in A/B tests?
- How do you ensure reproducible experiments with LLMs?
- How do you approach hyperparameter tuning for large LLMs given the huge training cost?
- What is a p-value? Common misconceptions?
- What is the difference between statistical significance and practical significance?