Engine and memory
Engine and memory settings control training speed, memory use and the checks before training starts.
Attention in a packed pass
Use config.model.attentionImplementation to choose attention. Optimize permits flex_attention for Gemma 4 E2B, E4B, 12B, and 26B-A4B. It refuses other model types.
For flex attention, keep engine.pad_to_length enabled and engine.pad_to_length_bucket at least 128. If startup reports insufficient shared memory, choose a larger GPU or use sdpa.
Default kernels by model type
A supervised run under verl on H200 devices that does not set attentionImplementation or a liger.* setting takes its model type’s default. The defaults apply only on H200 devices. A run on any other device profile takes no defaults. The following table lists the defaults for H200 devices:
| Model type | attentionImplementation |
Liger kernels |
|---|---|---|
Gemma 4 E2B and E4B |
|
|
Gemma 4 12B |
|
None |
Gemma 4 26B-A4B |
|
None |
Any other model |
|
None |
Flex attention trains more tokens a second than sdpa, more so on longer sequences. On Gemma 4 12B it can take more device memory than sdpa. Set attentionImplementation to sdpa for a run that does not fit a device under the default.
Set attentionImplementation or a liger.* setting explicitly to override its default. To keep SDPA when copying a plan from JSON output, add attentionImplementation: sdpa; the output can omit that default value.
Check the chosen kernels with training runs get --settings or training runs start --dry-run --show-resolved. A branch keeps its parent’s kernels.
Engine settings
Use engineSettings to set the training engine’s settings directly. Most settings affect only memory use and speed. Use them to fit your model to its devices. Precision settings change the arithmetic used during training. The engineSettings object has the following fields:
| Field | Description |
|---|---|
|
Required. Set |
|
Each setting’s value, by its name. Required. |
A run can set the following settings, where its deployment allows each one:
| Setting | Default | Description |
|---|---|---|
|
|
Fetches the next layer’s weights while the current layer computes. A step can be faster, and it needs more memory. |
|
|
Frees each layer’s gathered weights after the forward pass. Setting |
|
|
Pads each pass up to a multiple of |
|
|
The multiple |
|
|
Set |
|
|
The data type used for computation in the forward and backward passes: |
|
|
The data type used to sum gradients across devices: |
|
|
The data type used to store the model’s buffers, such as its rotary tables: |
|
|
The maximum number of compiled versions of a function that Torch compile keeps for one layer. For example, each sequence shape can have its own version. After this limit, the function runs without compilation. SFT only. |
|
|
The maximum number of compiled versions of a function that Torch compile keeps across all layers that run it. SFT only. |
|
|
Setting |
|
Normally |
Enable Liger RMS normalization to improve speed and memory use on verified model types. Not available for Gemma 4 12B. SFT only. |
|
Normally |
Enable Liger GeGLU to improve speed and memory use on verified model types. Not available for Gemma 4 12B. SFT only. |
|
|
Checks the run’s numerics before its first update. Setting |
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
Automatic, at least |
Maximum log-probability difference at the run’s precision. SFT only. Change only when the fp32 checks pass. See Checks before the first update. |
|
Automatic, at least |
Mean log-probability difference at the run’s precision. SFT only. Change only when the fp32 checks pass. |
|
Automatic, at least |
Mean loss difference at the run’s precision. SFT only. See Checks before the first update. |
|
Automatic, at least |
Maximum log-probability difference at fp32. SFT only. |
|
|
The |
|
|
Tokens computed at once by the output head. Lower it to reduce memory. Must be positive. SFT only. |
|
|
Leave |
|
|
Splits a long prompt’s prefill into chunks. Reinforcement runs only. |
|
|
Reuses the cache for prompts with a common prefix, such as the completions of one group. Reinforcement runs only. |
|
|
Runs the rollout engine without CUDA graphs. It starts faster and uses less memory, but generates more slowly. Reinforcement runs only. |
|
The step’s rollouts |
The most sequences the rollout engine generates at once. Reinforcement runs only. |
|
The larger of |
The most tokens the rollout engine processes in one batch. Reinforcement runs only. |
|
Automatic, at most |
Reward worker processes. Lower the count to reduce host memory use if the failure names this setting. Reinforcement learning only. |
|
|
Set |
The following example sets engine.forward_prefetch and rollout.enforce_eager:
engineSettings:
engine: verl
settings:
engine.forward_prefetch: true
rollout.enforce_eager: true
Inspect resolved settings with training runs get --settings or training runs start --dry-run --show-resolved. Before submitting, check that the device profile supports the named engine. Optimize refuses engine settings on one-GPU SFT runs.
If a setting is refused, check its method and deployment support with a dry run. A branch keeps applicable settings from its parent.
To see how many reward workers your run uses, read training runs engine-config.
Each reward worker holds host memory for the whole reinforcement run. If host memory runs out and the run has more than one reward worker, the failure names reward.num_workers and its current value. Lower this setting to use less host memory where your deployment allows it.
Memory settings
Use these settings to adjust memory use, training speed, or learning. You cannot set them on a supervised run on one device. If you omit a setting with a deployment value, your run uses that value. The execution.memory.offload.optimizer field and execution.memory.offload.activations default to false. The execution.memory.sharding field defaults to all. The following table explains each setting’s tradeoffs:
| Setting | Tradeoff |
|---|---|
|
A larger share gives the rollout engine more room for its cache, so it generates more completions at once. It leaves less memory for training. A model that fills most of the device needs a larger share to load at all. A reinforcement run only, since a supervised run has no rollout engine. |
|
Setting |
|
Set |
|
Set |
|
Set |
|
Use |
Check resolved values with training runs get --settings. If a setting is unavailable for your engine or device profile, remove it or select a compatible profile. A run and its branches keep the values recorded at submission.
Checks before the first update
A multi-GPU SFT run checks its numerical results before training. Read the verdict in training runs get. Use --checks for each check’s result, bound, and controlling setting.
akka optimize training runs get RUN_ID --checks
The following example shows the check results:
akka optimize training runs get 2c7f4e9a1b3d --checks
State
Run 2c7f4e9a1b3d5e601acde0294582a2e4fd460d953e233a7926d4bed4e6c61f3f
Project triage
Method SFT
Base model unsloth/Llama-3.2-1B-Instruct
Dataset triage/train:v1 — 2000 example(s)
Evaluated on triage/llama-3.2-1b-instruct:v2 on triage/eval:v1 by json-label-match, score 0.8600 (6a1d3f5b7c9e)
Phase Completed
Progress 120/120 steps (100%), loss 0.1960
Saved step 120 (latest reported step)
Results
Model triage/llama-3.2-1b-instruct:v2
Validation loss 0.2310 (perplexity 1.26)
Training loss 2.3100 → 0.1960 (mean 0.4120)
Start checks ✓ passed 4 of 4 in 41s with a warning: packing lossError 0.0062 against 0.005, refused over 0.025
Cost
GPU 3384.0 seconds over 2000 examples
Duration 31m, ended 3h28m ago (waiting for devices 41s, queued 14s, preparing 96s, training 28m, other 20s)
Throughput 1,005 tokens per second per device, the mean over its steps
Training peak 9.8 GiB per device, held by the training pass
Host memory 41.3 GiB in use on node 1 at peak (12.4 GiB at start)
Memory at step 88, of 79.6 GiB: weights 1.2, adapter 0.0, gradients 0.0, activations 7.9, optimizer 0.1, other 0.5, allocator 0.8, outside 0.5, free 68.5
Start checks
head ✓ passed gradientError 0.0009 against 0.005 (checks.head.max_gradient_error), logProbError 0.0021 against 0.01 (checks.head.max_logprob_error)
packing ✓ passed lossError 0.0062 against 0.005, refused over 0.025 (checks.packing.max_loss_error)
isolation ✓ passed logProbError 0 against 0.0001 (checks.isolation.max_logprob_error)
reference ✓ passed fp32LogProbError 0.00108 against 0.002 (checks.reference.fp32_max_logprob_error), fp32MeanLogProbError 3.33e-05 against 0.0001 (checks.reference.fp32_mean_logprob_error), logProbError 0.61 against 1 (checks.reference.max_logprob_error), meanLogProbError 0.0175 against 0.03 (checks.reference.mean_logprob_error), nllError 0.0075 against 0.011 (checks.reference.max_nll_error)
A failure stops the run before training. Read the check and setting named in the failure. Widen a bound at the run’s precision only when its fp32 results pass. To skip the checks, set checks.start: false if your deployment permits it.
Bounds must be non-negative. Optimize refuses bounds when checks.start is false, and packing or isolation bounds when data.use_dynamic_bsz is false. Remove those bounds if the checks are disabled.