Run settings
Set these when you create the training client withcreate_lora_training_client():
integer
default:32
LoRA rank: the width of the adapter’s low-rank matrices. Creating a run above the model’s maximum rank fails with an error that names the limit. With automatic mode selection, a rank serverless doesn’t support uses dedicated capacity. With
scope="serverless", the request fails instead. See Availability modes.integer
Longest sequence the run handles, in tokens. Omit it to use the model’s default. Check the model catalog for maximum sequence lengths and your workspace’s enabled limits.
integer
Random seed for reproducibility. Defaults to
None.Optimizer settings
PassAdamParams to optim_step() on every step. The trainer uses Adam:
number
default:0.0001
Optimizer step size.
number
default:0.9
Decay rate of the first-moment estimate.
number
default:0.95
Decay rate of the second-moment estimate.
number
default:1e-12
Value added to the denominator for numerical stability.
number
default:0
Weight decay applied to the adapter weights.
number
default:1
Clip the gradient’s global norm to this value. Set
0.0 to turn off clipping.Apply a learning-rate schedule
The trainer applies the values you pass on each call and has no learning-rate schedule of its own. Compute the rate in your script to warm up and then decay it. In SFT with the SDK, replace the training-loop block with the following code. It uses thetraining_client and tokenized data prepared earlier in that example, derives the step count from the dataset, and prints the rate and loss for each batch:
2e-5 and 4e-5. The remaining six decay to zero. Use your evaluation to choose the peak rate and warmup length.
Batch size is also a choice your loop makes. forward_backward() accumulates gradients until the next optim_step(), so the examples you pass across those calls make up one batch.
Loss settings
Choose a loss withloss_fn on forward_backward(), and tune it with loss_fn_config. Loss functions defines each loss’s keys and defaults.
Sampling settings
PassSamplingParams to sample(), with num_samples for the number of completions per prompt:
number
default:1
Sampling temperature.
number
default:1
Nucleus sampling threshold.
integer
default:-1
Sample from the
top_k most likely tokens. Zero or a negative value turns off this filter.integer
Maximum tokens to generate. Defaults to
None.integer
Random seed for reproducible samples. Defaults to
None.string | string[] | integer[]
Stop sequences, as strings or token IDs. Defaults to
None.object
Constrain generation to a structure, such as a JSON schema or regular expression. Defaults to
None, which leaves generation unconstrained. See SamplingParams for the accepted format.Settings Loops fixes
- LoRA alpha is fixed at
32, so the adapter’s output is scaled by32 / rank. A higher rank lowers that scale, so retune the learning rate when you change the rank. - LoRA target modules are fixed for each model family.
- Parallelism and hardware are chosen for each model and sequence length.
Next steps
- Loss functions: Look up the keys and defaults for each loss.
- Evaluate a model: Compare runs with different settings on a held-out set.
- Check whether an RL run is learning: Read the metrics that show whether a setting change helped.