From 779e35e1984869b130f70bfba2a1f0d336f8f766 Mon Sep 17 00:00:00 2001
From: Noah Luna <15202580+ngrayluna@users.noreply.github.com>
Date: Wed, 18 Feb 2026 17:37:29 -0800
Subject: [PATCH 1/3] word smithing sweeps
---
models/sweeps/define-sweep-configuration.mdx | 32 ++++++++++++--------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/models/sweeps/define-sweep-configuration.mdx b/models/sweeps/define-sweep-configuration.mdx
index 25c0d7cf74..eab19dcb29 100644
--- a/models/sweeps/define-sweep-configuration.mdx
+++ b/models/sweeps/define-sweep-configuration.mdx
@@ -3,32 +3,29 @@ description: Learn how to create configuration files for sweeps.
title: Overview
---
-
-A W&B Sweep combines a strategy for exploring hyperparameter values with the code that evaluates them. The strategy can be as simple as trying every option or as complex as Bayesian Optimization and Hyperband ([BOHB](https://arxiv.org/abs/1807.01774)).
-
-Define a sweep configuration either in a [Python dictionary](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) or a [YAML](https://yaml.org/) file. How you define your sweep configuration depends on how you want to manage your sweep.
+Use a *sweep configuration* to specify the hyperparameters you want to optimize during training. Specify the hyperparameters you want to optimize, the search strategy you want to use, and more. Define sweep configuration in a YAML file or a Python dictionary.
Define your sweep configuration in a YAML file if you want to initialize a sweep and start a sweep agent from the command line. Define your sweep in a Python dictionary if you initialize a sweep and start a sweep entirely within a Python script or notebook.
-The following guide describes how to format your sweep configuration. See [Sweep configuration options](./sweep-config-keys) for a comprehensive list of top-level sweep configuration keys.
+The following sections describes the top-level structure of a sweep configuration. See [Sweep configuration options](./sweep-config-keys) for a comprehensive list of top-level sweep configuration keys.
## Basic structure
Both sweep configuration format options (YAML and Python dictionary) utilize key-value pairs and nested structures.
-Use top-level keys within your sweep configuration to define qualities of your sweep search such as the name of the sweep ([`name`](./sweep-config-keys) key), the parameters to search through ([`parameters`](./sweep-config-keys#parameters) key), the methodology to search the parameter space ([`method`](./sweep-config-keys#method) key), and more.
+Top-level keys define qualities of your sweep search such as the name of the sweep ([`name`](./sweep-config-keys) key), the parameters to search through ([`parameters`](./sweep-config-keys#parameters) key), the methodology to search the parameter space ([`method`](./sweep-config-keys#method) key), and more.
+The values associated with each key can be a string, a number, a list, or another nested key-value pair. The value type depends on the key. For example, the value associated with the `method` key is a string that specifies the search strategy for the sweep, while the value associated with the `parameters` key is a nested key-value pair that specifies the hyperparameters to optimize and their associated values or distributions.
For example, the following code snippets show the same sweep configuration defined within a YAML file and within a Python dictionary. Within the sweep configuration there are five top level keys specified: `program`, `name`, `method`, `metric` and `parameters`.
-
Define a sweep configuration in a YAML file if you want to manage sweeps interactively from the command line (CLI)
-```yaml title="config.yaml"
+```yaml lines title="config.yaml"
program: train.py
name: sweepdemo
method: bayes
@@ -46,13 +43,17 @@ parameters:
optimizer:
values: ["adam", "sgd"]
```
+
+Within the top level `parameters` key (line 7), the following keys are nested: `learning_rate` (line 8), `batch_size` (line 11), `epoch` (line 14), and `optimizer` (line 17).
+
+
Define a sweep in a Python dictionary data structure if you define training algorithm in a Python script or notebook.
The following code snippet stores a sweep configuration in a variable named `sweep_configuration`:
-```python title="train.py"
+```python lines title="train.py"
sweep_configuration = {
"name": "sweepdemo",
"method": "bayes",
@@ -65,16 +66,21 @@ sweep_configuration = {
},
}
```
-
-
+Within the top level `parameters` key (line 5), the following keys are nested: `learning_rate` (line 6), `batch_size` (line 7), `epochs` (line 8), and `optimizer` (line 10). For each of the nested keys you specify, you can provide one or more values, a distribution, a probability, and more.
-Within the top level `parameters` key, the following keys are nested: `learning_rate`, `batch_size`, `epoch`, and `optimizer`. For each of the nested keys you specify, you can provide one or more values, a distribution, a probability, and more. For more information, see the [parameters](./sweep-config-keys#parameters) section in [Sweep configuration options](./sweep-config-keys).
+
+
+
+See [Define sweep configuration options](./sweep-config-keys) for a comprehensive list of top-level sweep configuration keys and their associated values.
+
## Double nested parameters
-Sweep configurations support nested parameters. To define a nested parameter, include an additional `parameters` key under the top-level parameter name.
+Sweep configurations support nested parameters. Double nested parameters are useful for organizing your hyperparameters into categories. For example, you can group hyperparameters related to the optimizer under an `optimizer` category and group hyperparameters related to the model architecture under a `model` category.
+
+To define a nested parameter, include an additional `parameters` key under the top-level parameter name.
The following example shows a sweep configuration with three nested parameters: `nested_category_1`, `nested_category_2`, and `nested_category_3`. Each nested parameter includes two additional parameters: `momentum` and `weight_decay`.
From 52e3806d7228dadc606a7c56ea84b8140b48940a Mon Sep 17 00:00:00 2001
From: Noah Luna <15202580+ngrayluna@users.noreply.github.com>
Date: Wed, 18 Feb 2026 22:52:27 -0800
Subject: [PATCH 2/3] Rewrites
---
models/sweeps/add-w-and-b-to-your-code.mdx | 114 +++++++++++++++----
models/sweeps/define-sweep-configuration.mdx | 29 ++---
2 files changed, 104 insertions(+), 39 deletions(-)
diff --git a/models/sweeps/add-w-and-b-to-your-code.mdx b/models/sweeps/add-w-and-b-to-your-code.mdx
index 206045728c..bccfd0deb9 100644
--- a/models/sweeps/add-w-and-b-to-your-code.mdx
+++ b/models/sweeps/add-w-and-b-to-your-code.mdx
@@ -19,7 +19,7 @@ Next you define a function called `main` that mimics a typical training loop. Fo
This code is a mock training script. It does not train a model, but simulates the training process by generating random accuracy and loss values. The purpose of this code is to demonstrate how to integrate W&B into your training script.
-```python
+```python lines title="train.py"
import random
import numpy as np
@@ -64,13 +64,19 @@ To use the W&B Python SDK to start, stop, and manage sweeps, follow the instruct
-Create a YAML configuration file with your sweep configuration. The
-configuration file contains the hyperparameters you want the sweep to explore. In
-the following example, the batch size (`batch_size`), epochs (`epochs`), and
-the learning rate (`lr`) hyperparameters are varied during each sweep.
+Create a YAML files with the hyperparameters you want to optimize and the metric you want to optimize for. W&B uses the YAML file to know which hyperparameters to vary during the sweep and which metric to optimize for.
+
+Add the name of your Python script to the `program` key in the YAML file (Line 1).
+
+
+The sweep agent picks a value from the values list and passes it to `wandb.config` in the training script. For example, if you define the `batch_size` parameter with the values `[16, 32, 64]`, the sweep agent picks one of those values and passes it to the training script with `wandb.config.batch_size`.
+
+
+The following YAML file maps to the original training script shown above. The original training script varied the `batch_size`, `lr`, and `epochs` hyperparameters. The YAML file defines those same hyperparameters and specifies the values to try for each hyperparameter (Lines 8-14).
+
+The previous training script also computes the validation accuracy (`val_acc`) metric. The YAML file specifies that the sweep should maximize the `val_acc` metric (Line 5).
-```yaml
-# config.yaml
+```yaml lines title="config.yaml"
program: train.py
method: random
name: sweep
@@ -89,38 +95,45 @@ parameters:
For more information on how to create a W&B Sweep configuration, see [Define sweep configuration](/models/sweeps/define-sweep-configuration/).
-You must provide the name of your Python script for the `program` key
-in your YAML file.
+After you define your sweep configuration in a YAML file, you need to add W&B to your training script to read in the YAML file and log the metric you want to optimize for.
-Next, add the following to the code example:
+Within your training script, add the following code snippets to integrate W&B:
-1. Import the W&B Python SDK (`wandb`) and PyYAML (`yaml`). PyYAML is used to read in our YAML configuration file.
-2. Read in the configuration file.
-3. Use [`wandb.init()`](/models/ref/python/functions/init) to start a background process to sync and log data as a [W&B Run](/models/ref/python/experiments/run). Pass the config object to the config parameter.
-4. Define hyperparameter values from `wandb.Run.config` instead of using hard coded values.
-5. Log the metric you want to optimize with [`wandb.Run.log()`](/models/ref/python/experiments/run.md/#method-runlog). You must log the metric defined in your configuration. Within the configuration dictionary (`sweep_configuration` in this example) you define the sweep to maximize the `val_acc` value.
+1. Import the W&B Python SDK (`wandb`).
+2. Initialize a [run](/models/runs) with `wandb.init()`.
+3. Read in the YAML configuration file with a Python package such as `yaml` and pass the configuration file as a parameter to the `wandb.init()` method.
+4. Pass the configuration object to the config parameter in `wandb.init()` (`wandb.init(config=)`) method.
+5. Fetch the hyperparameter values from the `wandb.Run.config` object to use the hyperparameter values defined in the YAML file instead of hard coded values. W&B flattens the configuration values, so you access nested values with dot notation or bracket notation as if they were top-level keys.
+6. Log the metric you are optimizing for with `wandb.Run.log()`.
-```python
+
+You must log the metric defined in your configuration.
+
+
+The following code snippet shows how to integrate W&B into your training script. Lines 4-7 show how to read in the YAML configuration file and pass the configuration to `wandb.init()`.
+
+Lines 9-10 show how to fetch the hyperparameter values from the `wandb.Run.config` object. Line 17 shows how to log the metric you are optimizing for (`val_acc`) to W&B.
+
+```python lines title="train.py"
import wandb
import yaml
import random
import numpy as np
-
def train_one_epoch(epoch, lr, batch_size):
+ """Simulates training for one epoch and returns the training accuracy and loss."""
acc = 0.25 + ((epoch / 30) + (random.random() / 10))
loss = 0.2 + (1 - ((epoch - 1) / 10 + random.random() / 5))
return acc, loss
-
def evaluate_one_epoch(epoch):
+ """Simulates evaluation for one epoch and returns the validation accuracy and loss."""
acc = 0.1 + ((epoch / 20) + (random.random() / 10))
loss = 0.25 + (1 - ((epoch - 1) / 10 + random.random() / 6))
return acc, loss
-
def main():
- # Set up your default hyperparameters
+ # Read in the configuration file
with open("./config.yaml") as file:
config = yaml.load(file, Loader=yaml.FullLoader)
@@ -142,9 +155,60 @@ def main():
main()
```
-In your CLI, set a maximum number of runs for the sweep
-agent to try. This is optional. This example we set the
-maximum number to 5.
+
+**W&B flattens configuration values passed to `wandb.init(config=)`**
+
+Normally you access nested values in the configuration object using dot notation or bracket notaion. For example, if you have a nested configuration like:
+
+```yaml sample.yaml
+key1: value1
+key2:
+ nested_key1: nested_value1
+ nested_key2: nested_value2
+```
+
+You then read in the file with `yaml` and pass the configuration to `wandb.init(config=)`:
+
+```python
+import yaml
+
+with open("sample.yaml") as file:
+ yaml_sample = yaml.load(file, Loader=yaml.FullLoader)
+```
+
+You access `nested_value1` with `yaml_sample["key2"]["nested_key1"]` or `yaml_sample.key2.nested_key1`.
+
+With W&B, the configuration values are flattened if you pass the configuration file to `wandb.init(config=)`. This means that you access nested values with dot notation or bracket notation as if they were top-level keys. For example, if you have the following YAML file:
+
+```yaml config.yaml
+program: train.py
+method: random
+name: sweep
+metric:
+ goal: maximize
+ name: val_acc
+parameters:
+epochs:
+ values: [10, 20, 30]
+learning_rate:
+ min: 0.001
+ max: 0.1
+```
+
+After you read in the file and pass the configuration to `wandb.init(config=)`, you access the `goal` value with `run.config["goal"]` instead of `run.config["metric"]["goal"]` or `run.config.metric.goal`.
+
+```python
+import yaml
+with open("config.yaml") as file:
+ config = yaml.load(file, Loader=yaml.FullLoader)
+with wandb.init(config=config) as run:
+ # Access the metric goal
+ metric_goal = run.config["goal"] # "maximize"
+```
+
+
+
+In your shell, set a maximum number of runs for the sweep agent to try. This is optional. This example we set the maximum number to 5.
```bash
NUM=5
@@ -153,7 +217,7 @@ NUM=5
Next, initialize the sweep with the [`wandb sweep`](/models/ref/cli/wandb-sweep) command. Provide the name of the YAML file. Optionally provide the name of the project for the project flag (`--project`):
```bash
-wandb sweep --project sweep-demo-cli config.yaml
+wandb sweep --project project_name config.yaml
```
This returns a sweep ID. For more information on how to initialize sweeps, see
@@ -164,7 +228,7 @@ the sweep job with the [`wandb agent`](/models/ref/cli/wandb-agent)
command:
```bash
-wandb agent --count $NUM your-entity/sweep-demo-cli/sweepID
+wandb agent --count $NUM your-entity/project_name/sweepID
```
For more information, see [Start sweep jobs](./start-sweep-agents).
diff --git a/models/sweeps/define-sweep-configuration.mdx b/models/sweeps/define-sweep-configuration.mdx
index eab19dcb29..6f01b98e8a 100644
--- a/models/sweeps/define-sweep-configuration.mdx
+++ b/models/sweeps/define-sweep-configuration.mdx
@@ -3,27 +3,31 @@ description: Learn how to create configuration files for sweeps.
title: Overview
---
-Use a *sweep configuration* to specify the hyperparameters you want to optimize during training. Specify the hyperparameters you want to optimize, the search strategy you want to use, and more. Define sweep configuration in a YAML file or a Python dictionary.
-
-
-Define your sweep configuration in a YAML file if you want to initialize a sweep and start a sweep agent from the command line. Define your sweep in a Python dictionary if you initialize a sweep and start a sweep entirely within a Python script or notebook.
-
+Use a *sweep configuration* to specify the hyperparameters you want to optimize during training. Specify the hyperparameters you want to optimize, the search strategy you want to use, and more.
The following sections describes the top-level structure of a sweep configuration. See [Sweep configuration options](./sweep-config-keys) for a comprehensive list of top-level sweep configuration keys.
## Basic structure
-Both sweep configuration format options (YAML and Python dictionary) utilize key-value pairs and nested structures.
+Sweep configurations utilize key-value pairs and nested structures. You can define your sweep configuration in a YAML file or in a Python dictionary. The structure of the sweep configuration is the same regardless of where you define it.
+
+
+**Where to define your sweep configuration?**
+
+Define your sweep configuration in a YAML file if you want to manage your sweeps interactively from the command line (CLI) or if you want to keep your sweep configuration separate from your training code.
+
+Define your sweep configuration in a Python dictionary if you define your training algorithm in a Python script or notebook or if you want to keep your sweep configuration close to your training code.
+
Top-level keys define qualities of your sweep search such as the name of the sweep ([`name`](./sweep-config-keys) key), the parameters to search through ([`parameters`](./sweep-config-keys#parameters) key), the methodology to search the parameter space ([`method`](./sweep-config-keys#method) key), and more.
-The values associated with each key can be a string, a number, a list, or another nested key-value pair. The value type depends on the key. For example, the value associated with the `method` key is a string that specifies the search strategy for the sweep, while the value associated with the `parameters` key is a nested key-value pair that specifies the hyperparameters to optimize and their associated values or distributions.
+The values associated with each key can be a string, a number, a list, or another nested key-value pair. The value type depends on the key.
-For example, the following code snippets show the same sweep configuration defined within a YAML file and within a Python dictionary. Within the sweep configuration there are five top level keys specified: `program`, `name`, `method`, `metric` and `parameters`.
+As an example, the following code snippet shows a sweep configuration with the `method`, `metric`, and `parameters` keys. The value associated with the `method` key is a string that specifies the search strategy for the sweep (`bayes`), while the value associated with the `metric` key is a nested key-value pair that specifies the metric to optimize and whether to minimize or maximize it. The value associated with the `parameters` key is a nested key-value pair that specifies the hyperparameters to optimize and their associated values or distributions.
-Define a sweep configuration in a YAML file if you want to manage sweeps interactively from the command line (CLI)
+The following code snippet shows how to define a sweep configuration in a YAML file named `config.yaml`:
```yaml lines title="config.yaml"
program: train.py
@@ -44,13 +48,10 @@ parameters:
values: ["adam", "sgd"]
```
-Within the top level `parameters` key (line 7), the following keys are nested: `learning_rate` (line 8), `batch_size` (line 11), `epoch` (line 14), and `optimizer` (line 17).
-
+Within the top level `parameters` key (line 7), the following keys are nested: `learning_rate` (line 8), `batch_size` (line 11), `epochs` (line 14), and `optimizer` (line 17). For each of the nested keys you specify, you can provide one or more values, a distribution, a probability, and more.
-Define a sweep in a Python dictionary data structure if you define training algorithm in a Python script or notebook.
-
The following code snippet stores a sweep configuration in a variable named `sweep_configuration`:
```python lines title="train.py"
@@ -93,7 +94,7 @@ The following code snippets show how to define nested parameters in both a YAML
-```yaml
+```yaml title="config.yaml"
program: sweep_nest.py
name: nested_sweep
method: random
From fd4a0d771dd80f1d310ce652b22f271fa8efce70 Mon Sep 17 00:00:00 2001
From: Noah Luna <15202580+ngrayluna@users.noreply.github.com>
Date: Fri, 17 Apr 2026 13:20:43 -0700
Subject: [PATCH 3/3] fix branch off
---
models/sweeps/add-w-and-b-to-your-code.mdx | 38 ++++++++++----------
models/sweeps/define-sweep-configuration.mdx | 12 +++----
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/models/sweeps/add-w-and-b-to-your-code.mdx b/models/sweeps/add-w-and-b-to-your-code.mdx
index bccfd0deb9..1d7e0bf4b6 100644
--- a/models/sweeps/add-w-and-b-to-your-code.mdx
+++ b/models/sweeps/add-w-and-b-to-your-code.mdx
@@ -64,17 +64,15 @@ To use the W&B Python SDK to start, stop, and manage sweeps, follow the instruct
-Create a YAML files with the hyperparameters you want to optimize and the metric you want to optimize for. W&B uses the YAML file to know which hyperparameters to vary during the sweep and which metric to optimize for.
+Create a YAML file that defines the hyperparameters to optimize and the metric to optimize. W&B uses this file to determine which hyperparameters to vary during the sweep and which metric to optimize.
-Add the name of your Python script to the `program` key in the YAML file (Line 1).
+Add the name of your Python script to the program key in the YAML file on line 1.
-
-The sweep agent picks a value from the values list and passes it to `wandb.config` in the training script. For example, if you define the `batch_size` parameter with the values `[16, 32, 64]`, the sweep agent picks one of those values and passes it to the training script with `wandb.config.batch_size`.
-
+ The sweep agent selects a value from the `values` list and passes it to `wandb.config` in the training script. For example, if you define the `batch_size` parameter with the values `[16, 32, 64]`, the sweep agent selects one of those values and passes it to the training script as `wandb.config.batch_size`.
-The following YAML file maps to the original training script shown above. The original training script varied the `batch_size`, `lr`, and `epochs` hyperparameters. The YAML file defines those same hyperparameters and specifies the values to try for each hyperparameter (Lines 8-14).
+The following YAML file corresponds to the original training script shown earlier. The training script varies the batch_size, lr, and epochs hyperparameters. The YAML file defines the same hyperparameters and specifies the values to try for each one on lines 8 to 14.
-The previous training script also computes the validation accuracy (`val_acc`) metric. The YAML file specifies that the sweep should maximize the `val_acc` metric (Line 5).
+The training script also computes the validation accuracy metric, val_acc. The YAML file specifies that the sweep should maximize val_acc on line 5.
```yaml lines title="config.yaml"
program: train.py
@@ -101,18 +99,18 @@ Within your training script, add the following code snippets to integrate W&B:
1. Import the W&B Python SDK (`wandb`).
2. Initialize a [run](/models/runs) with `wandb.init()`.
-3. Read in the YAML configuration file with a Python package such as `yaml` and pass the configuration file as a parameter to the `wandb.init()` method.
-4. Pass the configuration object to the config parameter in `wandb.init()` (`wandb.init(config=)`) method.
-5. Fetch the hyperparameter values from the `wandb.Run.config` object to use the hyperparameter values defined in the YAML file instead of hard coded values. W&B flattens the configuration values, so you access nested values with dot notation or bracket notation as if they were top-level keys.
-6. Log the metric you are optimizing for with `wandb.Run.log()`.
+3. Read the YAML configuration file with a Python package such as yaml, and pass the configuration to `wandb.init()`.
+4. Pass the configuration object to the config parameter of `wandb.init()`.
+5. Retrieve the hyperparameter values from `wandb.Run.config` so that your script uses the values defined in the YAML file instead of hard-coded values. W&B flattens configuration values, so you can access nested values with dot notation or bracket notation as though they were top-level keys.
+6. Log the metric that you want to optimize with `wandb.Run.log()`.
-You must log the metric defined in your configuration.
+You must log the metric you defined in your configuration.
-The following code snippet shows how to integrate W&B into your training script. Lines 4-7 show how to read in the YAML configuration file and pass the configuration to `wandb.init()`.
+The following code snippet shows how to integrate W&B into your training script. Lines 4 to 7 show how to read in the YAML configuration file and pass the configuration to `wandb.init()`.
-Lines 9-10 show how to fetch the hyperparameter values from the `wandb.Run.config` object. Line 17 shows how to log the metric you are optimizing for (`val_acc`) to W&B.
+Lines 9 and 10 show how to fetch the hyperparameter values from the `wandb.Run.config` object. Line 17 shows how to log the metric you are optimizing for (`val_acc`) to W&B.
```python lines title="train.py"
import wandb
@@ -158,7 +156,7 @@ main()
**W&B flattens configuration values passed to `wandb.init(config=)`**
-Normally you access nested values in the configuration object using dot notation or bracket notaion. For example, if you have a nested configuration like:
+Normally, you access nested values in a configuration object with dot notation or bracket notation. For example, consider the following nested configuration:
```yaml sample.yaml
key1: value1
@@ -176,9 +174,11 @@ with open("sample.yaml") as file:
yaml_sample = yaml.load(file, Loader=yaml.FullLoader)
```
-You access `nested_value1` with `yaml_sample["key2"]["nested_key1"]` or `yaml_sample.key2.nested_key1`.
+You can then access `nested_value1` with `yaml_sample["key2"]["nested_key1"]` or `yaml_sample.key2.nested_key1`.
-With W&B, the configuration values are flattened if you pass the configuration file to `wandb.init(config=)`. This means that you access nested values with dot notation or bracket notation as if they were top-level keys. For example, if you have the following YAML file:
+When you pass a configuration to `wandb.init(config=)`, W&B flattens the values. This means that you access nested values as though they were top-level keys.
+
+For example, consider the following YAML file:
```yaml config.yaml
program: train.py
@@ -195,7 +195,7 @@ learning_rate:
max: 0.1
```
-After you read in the file and pass the configuration to `wandb.init(config=)`, you access the `goal` value with `run.config["goal"]` instead of `run.config["metric"]["goal"]` or `run.config.metric.goal`.
+After you read in the file and pass the configuration to `wandb.init(config=)`, access the `goal` value with `run.config["goal"]` instead of `run.config["metric"]["goal"]` or `run.config.metric.goal`.
```python
import yaml
@@ -208,7 +208,7 @@ with wandb.init(config=config) as run:
-In your shell, set a maximum number of runs for the sweep agent to try. This is optional. This example we set the maximum number to 5.
+In your shell, set a maximum number of runs for the sweep agent to try. This is optional. In this example, we set the maximum number to 5.
```bash
NUM=5
diff --git a/models/sweeps/define-sweep-configuration.mdx b/models/sweeps/define-sweep-configuration.mdx
index 6f01b98e8a..c5cb2e05fe 100644
--- a/models/sweeps/define-sweep-configuration.mdx
+++ b/models/sweeps/define-sweep-configuration.mdx
@@ -3,27 +3,27 @@ description: Learn how to create configuration files for sweeps.
title: Overview
---
-Use a *sweep configuration* to specify the hyperparameters you want to optimize during training. Specify the hyperparameters you want to optimize, the search strategy you want to use, and more.
+Use a sweep configuration to define the hyperparameters to optimize during training. You can specify the hyperparameters to optimize, the search strategy to use, and other sweep settings.
-The following sections describes the top-level structure of a sweep configuration. See [Sweep configuration options](./sweep-config-keys) for a comprehensive list of top-level sweep configuration keys.
+The following sections describe the top-level structure of a sweep configuration. For a comprehensive list of top-level keys, see [Sweep configuration options](./sweep-config-keys).
## Basic structure
-Sweep configurations utilize key-value pairs and nested structures. You can define your sweep configuration in a YAML file or in a Python dictionary. The structure of the sweep configuration is the same regardless of where you define it.
+Sweep configurations use key-value pairs and nested structures. You can define your sweep configuration in a YAML file or in a Python dictionary. The structure of the sweep configuration is the same regardless of where you define it.
**Where to define your sweep configuration?**
-Define your sweep configuration in a YAML file if you want to manage your sweeps interactively from the command line (CLI) or if you want to keep your sweep configuration separate from your training code.
+Define your sweep configuration in a YAML file if you want to manage sweeps from the command line or keep the sweep configuration separate from your training code.
-Define your sweep configuration in a Python dictionary if you define your training algorithm in a Python script or notebook or if you want to keep your sweep configuration close to your training code.
+Define your sweep configuration in a Python dictionary if your training algorithm is defined in a Python script or notebook, or if you want to keep the sweep configuration close to your training code.
Top-level keys define qualities of your sweep search such as the name of the sweep ([`name`](./sweep-config-keys) key), the parameters to search through ([`parameters`](./sweep-config-keys#parameters) key), the methodology to search the parameter space ([`method`](./sweep-config-keys#method) key), and more.
The values associated with each key can be a string, a number, a list, or another nested key-value pair. The value type depends on the key.
-As an example, the following code snippet shows a sweep configuration with the `method`, `metric`, and `parameters` keys. The value associated with the `method` key is a string that specifies the search strategy for the sweep (`bayes`), while the value associated with the `metric` key is a nested key-value pair that specifies the metric to optimize and whether to minimize or maximize it. The value associated with the `parameters` key is a nested key-value pair that specifies the hyperparameters to optimize and their associated values or distributions.
+For example, the following code snippet shows a sweep configuration with the `method`, `metric`, and `parameters` keys. The method key specifies the search strategy (`bayes`). The `metric` key specifies the metric to optimize and whether to minimize or maximize it. The `parameters` key specifies the hyperparameters to optimize and their values or distributions.