> ## 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

> 网格展开批量提交

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

每个变体一次标准提交（配额 / 排队照常生效）。工作流讲解见[超参 Sweep](/zh-Hans/guides/sweep)。

| 选项                                 | 说明                 |
| ---------------------------------- | ------------------ |
| `-g, --set-grid KEY=V1,V2`（必填，可重复） | 网格轴；多轴取笛卡尔积        |
| `-s, --set KEY=VALUE`              | 所有变体共用的固定覆盖，可重复    |
| `--profile`                        | 资源声明，同 `sf submit` |
| `-m, --method`                     | 方法标识；不传读锁文件        |
| `--dry-run`                        | 只打印变体列表，不提交        |
| `--allow-dirty` / `--no-validate`  | 同 `sf submit`      |

## 示例

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
# 3 × 2 = 6 变体，先看后提
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

# 一键停止整组
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]
```

| 参数    | 说明                               |
| ----- | -------------------------------- |
| `EXP` | Experiment name or path (**必填**) |

| 选项                     | 说明                                                                                                                                                                                                                                                                                                                                                       |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--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 (**必填** · 可重复)                                                                                                                                                                                                                          |
| `--set`, `-s`          | A fixed override shared by every variant, 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 (可重复) |
| `--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 (默认 `3`)                                                                                                                                                                                                                                              |
