Skip to content

Run a parameter sweep

A sweep turns a single spec into one job per combination of parameters — the Cartesian product of every value you list. Each job is scheduled independently, so the whole grid runs in parallel across the greenest available EU capacity.

Add a sweep block mapping each parameter to the list of values it should take. Reference a parameter in the command as ${PARAM}; Komputo substitutes the value and also exposes it as an environment variable.

name: lr-sweep
image: registry.komputo.eu/examples/train:latest
command: python train.py --lr ${learning_rate} --batch ${batch_size}
resources:
accelerators: H100:8
policy:
optimize: greenest-eu
sweep:
learning_rate: [0.1, 0.01, 0.001]
batch_size: [16, 32]

This expands to 3 × 2 = 6 jobs, named lr-sweep-0 through lr-sweep-5. Each one gets its own learning_rate and batch_size substituted into the command and set in the environment.

Terminal window
komputo sweep lr-sweep.komputo.yaml

Komputo prints the job id for every combination. Every job in the sweep carries a shared sweep tag, so you can list them together:

Terminal window
komputo ps --tag sweep=<sweep-id>

Each job produces its own receipt and artifacts. Pull a job’s outputs once it completes:

Terminal window
komputo cp <job-id>:outputs/ ./results/<job-id>/

Because the jobs are independent, a failure in one combination never blocks the rest — re-submit just that spec with the single set of values that failed.