This document covers:
- Hydra multirun
- Optuna grid sweeps
- search-space syntax
- sweep plotting config
Use Hydra multirun when you want a direct Cartesian product from CLI overrides.
Example:
uv run -m banditdl -m \
topology=dynamic \
sampler=uniform,exp3 \
topology.sampling=0.03,0.05 \
heterogeneity.alpha=0.1,0.5 \
seed=0,1Use this when:
- you already know the values you want to compare
- you want the simplest sweep workflow
- you do not need best-trial selection
Main command:
uv run python -m banditdl.experiments.sweepThis uses conf/sweep.yaml, which composes:
conf/config.yaml- one
conf/optuna/*.yamlprofile
Profiles:
optuna=sanitysweepoptuna=customsweepoptuna=sweep
Example:
uv run python -m banditdl.experiments.sweep optuna=customsweepThe runner supports two search modes:
- categorical-only search spaces are executed as an exhaustive conditional grid
- mixed or continuous search spaces use Optuna suggestions and
optuna.n_trials
Workflow:
- read
optuna.search_space - either enumerate valid categorical combinations or sample continuous values
- respect
when:guards for conditional parameters - run one seed-averaged training job per trial
- save trial outputs under
<hydra_run>/trials/.../results/ - persist the Optuna study to
<hydra_run>/optuna.db - pick the best trial from validation accuracy
- rerun the best trial with test evaluation
- generate sweep plots
Sweep outputs live under:
<hydra_run>/
optuna.db
trials/
<trial_name>/results/
best_trial_test_eval/results/
sweep_artifacts/
Use categorical choices, continuous ranges, and optional when: guards.
search_space:
heterogeneity.alpha:
name: alpha
type: categorical
choices: [0.1, 0.5]
topology.sampling:
type: float
low: 0.01
high: 1.0
log: true
sampler.name:
name: sampler
type: categorical
choices: [uniform, epsilon_greedy]
sampler.params.epsilon:
name: epsilon
type: categorical
choices: [0.1]
when:
sampler.name: epsilon_greedyNotes:
nameis a display label in sweep outputschoicesdefines a categorical axistype: float/type: intdefine Optuna-sampled axesn_trialsinconf/optuna/*.yamlcontrols sampled continuous/mixed sweepswhen:prevents invalid combinations
User-facing sweep plotting config lives in conf/sweep.yaml under plot:.
Current shape:
plot:
enabled: true
directions: [avg, worse]
heatmaps:
- x: heterogeneity.alpha
y: topology.sampling
group_by:
- sampler.name
- [sampler.name, sampler.params.epsilon]
aggregate_by: avg
render: [heatmap]
exclude_metrics: []
per_parameter:
enabled: false
exclude_metrics: []Enable or disable sweep plotting after the sweep completes.
How a metric is reduced over saved timesteps and nodes.
avg: arithmetic meanworse: worst value
worse uses max for losses/regret/drift and min for accuracies/rewards.
plot.heatmaps is a list of explicit heatmap specs. This is the important part of the refactor: heatmaps are no longer generated from every possible parameter pair.
Each heatmap spec defines:
x: x-axis parametery: y-axis parametergroup_by: how to split into multiple slicesaggregate_by: how to collapse unused sweep dimensionsrender: output kindsexclude_metrics: metrics to skip for that spec
Examples:
group_by:
- sampler.name
- [sampler.name, sampler.params.epsilon]Meaning:
- a string creates one slice per value
- a list creates one slice per value combination
When the sweep has more parameters than x, y, and the active group_by, the remaining dimensions are collapsed using:
avgminmax
Supported values:
heatmapheatmap3d
heatmap3d is experimental.
By default, sweep plots try every known scalar metric. Use exclude_metrics to suppress metrics for a specific heatmap spec.
plot.per_parameter.enabled controls whether the per-parameter plotter runs.
Example:
per_parameter:
enabled: falseexclude_metrics works the same way there.
If you want a small sweep artifact set:
- keep
per_parameter.enabled: false - define only the heatmaps you actually care about
- use
exclude_metricsaggressively
If you want to tune parameters without plotting every dimension:
- keep those parameters in
optuna.search_space - only expose the scientifically interesting axes in
plot.heatmaps
That is the main reason for the explicit plot: structure.