> ## Documentation Index
> Fetch the complete documentation index at: https://starforge.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# sf sweep

> Grid expansion for batch submission

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf sweep <EXP> -g KEY=V1,V2 [options]
```

Each variant is one standard submission (quotas / queuing apply as usual). See [Hyperparameter Sweeps](/en/guides/sweep) for the workflow walkthrough.

| Option                                            | Description                                         |
| ------------------------------------------------- | --------------------------------------------------- |
| `-g, --set-grid KEY=V1,V2` (required, repeatable) | Grid axis; multiple axes take the Cartesian product |
| `-s, --set KEY=VALUE`                             | Fixed overrides shared by all variants, repeatable  |
| `--profile`                                       | Resource declaration, same as `sf submit`           |
| `-m, --method`                                    | Method id; if omitted, read from the lock file      |
| `--dry-run`                                       | Only print the variant list, do not submit          |
| `--allow-dirty` / `--no-validate`                 | Same as `sf submit`                                 |

## Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
# 3 × 2 = 6 variants; review first, then submit
sf sweep my-grpo --profile h200:4 \
  -g policy.optimizer.kwargs.lr=1e-6,2e-6,5e-6 \
  -g grpo.kl_coef=0.01,0.05 \
  --dry-run
sf sweep my-grpo --profile h200:4 \
  -g policy.optimizer.kwargs.lr=1e-6,2e-6,5e-6 \
  -g grpo.kl_coef=0.01,0.05

# Stop the whole group with one command
sf job stop-sweep <SWEEP_ID>
```

## `sf sweep`

Submit a hyperparameter sweep

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf sweep <EXP> [options]
```

| Argument | Description                            |
| -------- | -------------------------------------- |
| `EXP`    | Experiment name or path (**required**) |

| Option                 | Description                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--set-grid`, `-g`     | A grid axis, repeatable; several axes form a cartesian product. e.g. -g policy.lr=1e-5,2e-5 -g grpo.kl=0.01,0.05 (**required** · repeatable)                                                                                                                                                                                                                    |
| `--set`, `-s`          | A fixed override shared by every variant, repeatable (repeatable)                                                                                                                                                                                                                                                                                               |
| `--profile`            | Target hardware and resources in one argument: h200 (the registry default shape), h200:4 (4 GPUs), h200:16 (2 full nodes). Repeat it to split pools per role (the heterogeneous extension point): --profile train=h200:8 --profile rollout=h100:2. Comma-separate roles that share a pool: --profile actor,rollout=h200:8 --profile teacher=h200:8 (repeatable) |
| `--method`, `-m`       | Method identifier; read from the experiment's recipe.lock.json when omitted                                                                                                                                                                                                                                                                                     |
| `--allow-dirty`        | Allow uncommitted changes in the working tree                                                                                                                                                                                                                                                                                                                   |
| `--no-validate`        | Skip the pre-submission validation                                                                                                                                                                                                                                                                                                                              |
| `--dry-run`            | Only print the variant list, submit nothing                                                                                                                                                                                                                                                                                                                     |
| `--early-stop`         | Enable ASHA early stopping: cut the clearly hopeless variants at a few step rungs                                                                                                                                                                                                                                                                               |
| `--stop-metric`        | Which metric early stopping watches; defaults to the method's declared primary metric (see sf methods \<method>)                                                                                                                                                                                                                                                |
| `--rungs`              | Early-stopping rungs (steps), comma separated. Defaults to 100,300,900                                                                                                                                                                                                                                                                                          |
| `--keep` `<int range>` | Keep 1/keep of the variants at each rung. 3 is the usual value: cutting harder hurts slow starters (default `3`)                                                                                                                                                                                                                                                |
