1
Set the Global Batch Size (GBS)
In your YAML or Python file, set Make sure
num_csx and batch_size parameters:batch_size is greater than or equal to num_csx. In this example, the global batch size of “12” will be split between two CS-X systems into a per-box batch size of “6”, and each CS-X will process this via microbatches of size “2”.2
Choose Your Training Mode
Decide which mode fits your goal:If using
explore and you have a specific range in mind for acceptable microbatch sizes, you can define a batch exploration range to limit the search space and get a set of recommended options more quickly. You can specify this range by providing either one or both of the bounds as follows:3
Launch a Job
Launch a
compile_only run:cszoo fit <params_model.yaml> --compile_only4
Set Optimal MBS
After your initial run (whether using
auto or explore), you should:- Check what
micro_batch_sizethe system selected (printed in logs). - Update your YAML to explicitly set that value for future runs.
explore or auto mode to ensure the batch size is optimized for the new configuration.- Model performance is a function of the microbatch size used on a Cerebras system. For example, for a given model, a microbatch of “2” will perform equally well regardless of the values used for
num_csxor the globalbatch_size(as long asbatch_size / num_csxis a multiple of the micro-batch size). - The microbatching feature will auto-disable for models that it does not support even if
micro_batch_sizeis set. This includes models using batch normalization, or other kinds of non-linear computation over the batch dimension. - Since the examples above are limited to training, the microbatch size will be restored to its previous value after training is completed.