BXUP Track progress & test yourself — free
Data Science & ML/AI · Playbook · Foundation · ~4 min read
DATA SCIENCE & ML/AI · PLAYBOOK · FOUNDATION

Hyperparameter Search and Experiment Tracking, with Auto-Drafted Run Reports

Untracked experiments are the technical debt of data science: three weeks later nobody can say which config produced the model in staging.

Tier: Foundation · Workflow area: Experimentation & reporting

This playbook uses an assistant to generate a complete Optuna + MLflow (or W&B) harness against a written experiment spec, then closes the loop the way governance actually demands: model cards and experiment reports drafted automatically from tracked runs — grounded in logged artifacts, never in the model's memory of what you probably did.

When to use

  • Moving past a frozen baseline (pb-05/pb-06) into systematic tuning.
  • Your team asks "which run is this model?" and the honest answer is a shrug.
  • You owe stakeholders a model card or experiment report and want it generated from ground truth.

Skip heavy search when the baseline is within noise of the ceiling — tuning a hopeless feature set is procrastination.

Prerequisites

  • Optuna, MLflow (self-hosted, free) or W&B (free personal tier); your pb-05 pipeline as a function of its hyperparameters.
  • An AI assistant for codegen and report drafting.
  • A compute budget decision: how many trials, how much wall-clock, made before the search starts.

The workflow

  1. Write the experiment spec; make the assistant implement it exactly:

    Generate an Optuna study over my existing build_pipeline(params) function
    (HistGradientBoostingClassifier). Spec:
    - Search space: learning_rate loguniform 0.01-0.3; max_leaf_nodes {15,31,63,
      127}; min_samples_leaf int 10-200; l2_regularization loguniform 1e-4-1.0.
    - Objective: mean PR-AUC over the existing TimeSeriesSplit folds (reuse my
      cv object; do NOT create a shuffled split).
    - 60 trials, MedianPruner after fold 2, fixed sampler seed 42.
    - Each trial = one nested MLflow run logging: params, per-fold and mean
      metrics, fit time, data snapshot hash, git commit, pip freeze.
    - Parent run logs: search space as JSON, best trial, and the final refit
      model as an artifact with signature + input example.
    
  2. Review for the three classic harness bugs before launching: objective computed on a different split than the baseline (numbers no longer comparable); pruner keying on a metric other than the objective; refit-on-full-train missing at the end (best CV params ≠ a trained artifact).

  3. Run, watch, stop honestly. Launch the study; monitor the optimization history plot. If the best value plateaus by trial ~30, stop — ask the assistant to add a callback that halts after N non-improving trials so the budget decision is enforced by code, not willpower.

  4. Compare against baseline with uncertainty. Pull best-trial fold scores and baseline fold scores; a paired comparison across folds (even eyeballing mean ± std overlap) decides whether the tuned model is genuinely better. A +0.003 mean with overlapping stds is not a win to announce.

  5. Auto-draft the experiment report from the tracking API — not from memory:

    Here is JSON from mlflow.search_runs() for study churn_hgb_v3 (all trials:
    params, metrics, tags) and the parent-run metadata. Draft an experiment
    report with sections: objective & search space; best config vs baseline
    (table, mean ± std per metric); parameter-importance summary; what was NOT
    explored; reproduction command. Use ONLY values present in the JSON; where
    information is missing, write "not logged" rather than guessing.
    

    The "not logged" instruction is the anti-hallucination valve — and its output doubles as a checklist of what your harness should start logging.

  6. Draft the model card the same way. Feed the registered model's run data plus your evaluation-slice results into a model-card template (intended use, training data description, metrics overall and by key segments, limitations, ethical considerations). You write the intended-use and limitations judgments; the assistant assembles the evidence sections from logs.

  7. Register and link. Register the refit model in the MLflow registry; the report and card become run artifacts. The chain dataset-hash → run → model → card is now navigable by anyone.

Note

Reports drafted from search_runs() output are reproducible documentation; reports drafted from "summarize my experiment" are historical fiction with confident formatting.

Tool variants

  • MLflow (OSS, self-hosted): the default here; prompt-cost-free, runs anywhere, registry included.
  • W&B: richer built-in visualizations and free personal tier; the harness prompt changes only in logging calls (wandb.log), and reports draft from api.runs() exports.
  • Warehouse-native (Databricks managed MLflow): identical workflow; autologging covers some of step 1, but keep the explicit spec — autolog does not capture data hashes or your CV discipline.

Verification

  • Any trial can be reproduced: checkout logged commit, same data hash, same params → metric within seed noise.
  • The registered model's params exactly match the best trial's params (refit step verified).
  • Report and card contain zero numbers absent from the tracking store.
  • Baseline and tuned metrics come from identical splits (diff the fold boundaries if unsure).
  • Parameter-importance claims match Optuna's plot_param_importances, not narrative intuition.

Pitfalls

  • Split drift between baseline and search. The most damaging harness bug; makes every comparison meaningless. Reuse the same cv object, verified in step 2.
  • Test-set peeking via repeated evaluation. The held-out test period is evaluated once, after the search closes — never inside the objective.
  • Over-wide search spaces. 12 hyperparameters × 60 trials explores nothing; tune the 3–4 that matter for your model family (the assistant knows the folklore; make it justify each included dimension).
  • Logging everything except what reproduces. Metrics without data hash, commit, and environment reproduce nothing. The spec in step 1 exists to prevent this.
  • Card-washing. A model card whose limitations section is generic boilerplate ("may reflect biases in data") signals no one looked; write limitations from your actual slice metrics and known data gaps.

Restricted-environment variant

  • The entire loop runs on self-hosted OSS (Optuna + MLflow) with zero external calls; only the assistant needs handling. Prompts contain schema, spec, and aggregate run metrics — usually acceptable for hosted models; raw data never appears.
  • Air-gapped: generate the harness from the spec with a local code model; report drafting from runs-JSON works well locally since it is constrained summarization.
  • If run names/metrics reveal sensitive projects, export runs-JSON with aliased experiment names before pasting.

Success criteria

  • A tuned model that beats (or honestly ties) the baseline, with fold-level uncertainty reported.
  • Every experiment from now on answers who/what/when/how from the tracking UI alone.
  • Report + model card produced in minutes from logs, and a reviewer confirms every number traces to a run.
  • A teammate reproduces your best run from the card's reproduction command without messaging you.
This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in