Scenario

An engine share of 0.02 and a rollout six times slower

L2WorkingIncident20 minDebuggingML depth

RolesInference EngineeringAI Evaluation and Reliability

Engine
Miles main 08752a12 with its own SGLang 0.5.22 build
Model
Qwen/Qwen3-0.6B
Hardware
one GB10 with 128 GB of unified memory

Situation

A team trains with GRPO on one GB10. The week before, a larger model was stopped by a memory kill, and the team learned to fear the node total. Someone sets the engine memory share, --sglang-mem-fraction-static, to 0.02 for the next runs, to leave the trainer as much room as possible. The launcher default is 0.4.

The next morning a one-step check run has finished, with a reward in the usual range. The step took far longer than the day before. Nobody saw an error. One engineer blames the heat guard, another blames a slow disk, and a third says the engine must have fallen back to a slow kernel. You get the log of the check run, the log of the same check at 0.25, and the log of a normal run at 0.4.

Questions

  1. Three rollout times, three pool sizes. Which number moved with the time, and which did not?
  2. The reward of the slow run is normal. Why does that not clear the run?
  3. The KV cache line prints before the first step. What in it tells you the step will be slow, and how slow is the GPU?
  4. Count the sequences that one step must generate and the longest answer. What can a pool of this size hold at once?
  5. Which direction do you change the share, by how much per try, and what do you read after each try?
  6. The engine did not run out of memory and did not crash. Why is the low direction of this flag harder to notice than the high direction?

Commit to a cause after each listing. Write it down before you read the next one.

Evidence

1/6

the pool size, the rollout time and the reward of three runs

Read the rollout time of the first row against the other two, then the pool size in tokens.

evidence/three-runs.txt
frac-low: max_total_num_tokens=3082 perf/rollout_time': 385.5003604888916 rollout/raw_reward': 0.61328125 steps=1
frac-check: max_total_num_tokens=211813 perf/rollout_time': 60.696292877197266 rollout/raw_reward': 0.66015625 steps=1
plain: max_total_num_tokens=347841 perf/rollout_time': 63.839099407196045 rollout/raw_reward': 0.625 steps=12

Source: manuals/miles-101/capture/gpu/out-gb10/frac-low-kv.txt, lines 3-5

2/6

the KV cache line of the slow run at startup

The pool line that the engine prints before the first step.

evidence/engine-pool-line.txt
frac-low engine line: KV Cache is allocated. dtype: torch.bfloat16, #tokens: 3082, K size: 0.16 GB, V size: 0.16 GB

Source: manuals/miles-101/capture/gpu/out-gb10/frac-low-kv.txt, lines 6-6

3/6

the one flag that differed between the runs

The second line gives the fraction of each run.

evidence/what-each-run-set.txt
# Live check 2026-10-23, Qwen3-0.6B, 1 step, launcher defaults plus one flag.
# frac-low: --sglang-mem-fraction-static 0.02. frac-check: 0.25. plain: launcher default 0.4.

Source: manuals/miles-101/capture/gpu/out-gb10/frac-low-kv.txt, lines 1-2

4/6

the default run settings of the manual

Read the prompts per step, the answers per prompt and the answer limit, then the engine memory fraction.

evidence/default-run-settings.txt
| Setting | Value |
|---|---|
| Prompts per step | 32 (`--rollout-batch-size`) |
| Answers per prompt | 8 (`--n-samples-per-prompt`) |
| Samples per optimizer step | 256 (`--global-batch-size`) |
| Answer limit | 1,024 tokens |
| Temperature | 1 |
| Learning rate | 1e-6, constant |
| Trainer | FSDP on one GPU, colocated with the engine |
| Engine memory fraction | 0.4 |
| Weight update bucket | 536870912 bytes, 512 MiB |

Source: manuals/miles-101/sections/r-3-lab-notes.md, lines 23-33

5/6

how the engine turns the fraction into a pool

The fraction covers the weights and the KV pool together, and the pool gets what is left after the weights load.

evidence/how-the-split-works.txt
**--mem-fraction-static:** the share of memory that SGLang gives to the model weights plus the KV pool. Everything outside that share is for activations, CUDA graphs, and other programs. The flag defaults to `None`, and SGLang computes a value at startup {{code}}.

On a GPU, the automatic value comes from a reserve. SGLang starts with 512 MB and adds 1.5 MB for each token of the prefill chunk {{code}}. Then it adds more for tensor and pipeline parallelism and for CUDA graphs. On a GPU with more than 60 GB, the reserve is at least 10 GiB. The fraction is then the GPU memory minus the reserve, divided by the GPU memory. When SGLang cannot read the device capacity, it uses 0.95.

After the weights load, SGLang measures free memory again. The KV budget is the free memory minus the `1 - fraction` share of the memory that was free before loading {{code}}. The pool holds that budget divided by the bytes per token from [section 3.1](#s-kv-bytes-per-token-and-the-kv-pool). If the budget is not positive, startup stops and prints the smallest fraction that would work.

Source: manuals/sglang-101/sections/3-2-mem-fraction-static-and-startup-sizing.md, lines 55-59

6/6

the troubleshooting entry for the engine memory fraction

Read the Check line for the case of a fraction that is too low.

evidence/manual-entry.txt
## The engine runs out of memory at start

- **Cause:** `--sglang-mem-fraction-static` does not fit the GPU. With `--colocate`, the trainer can already hold GPU memory when the engine starts. A fraction that is too high leaves no room for activations and CUDA graphs. A fraction that is too low leaves no room for the KV cache.
- **Check:** a CUDA out-of-memory error in the engine lines during startup or on the first batch, and no `Ray OutOfMemoryError`. A fraction that is too low does not always stop the engine. Read `#tokens` in the `KV Cache is allocated` line. In our check at 0.02, the engine started with 3,082 tokens, and the first rollout took 386 s against 61 s at 0.25.
- **Fix:** lower the fraction for the first case, or raise it for the second, by 0.05 or 0.1 at a time. The Miles documentation asks for 0.8 or lower with `--colocate`. Our runs used 0.4. [SGLang 101, section 3.2](https://aiengineeringfromscratch.com/manual-sglang-101.html#s-mem-fraction-static-and-startup-sizing) explains how the engine divides its memory.

Source: manuals/miles-101/sections/7-1-troubleshoot-by-symptom.md, lines 59-63

The answer

Show the walkthrough
  1. Line up the three runs. Read perf/rollout_time on each line. The run with the low share took 386 s for one rollout. The run at 0.25 took 61 s, and the normal run at 0.4 took about a minute as well. The rewards were 0.61328125, 0.66015625 and 0.625. The reward did not follow the setting. The time did, by about six times.
  2. Read the pool sizes on the same lines. The slow run had max_total_num_tokens=3082. The other two had 211,813 and 347,841. The pool is the number of tokens that the engine can hold in its KV cache at one time. The rollout time moved with the pool, and nothing else in the three lines differed.
  3. Read the engine line that came first. At startup the slow engine printed KV Cache is allocated with 3082 tokens, and a K size and a V size of 0.16 GB each. This line appears before any step runs. A reader who knows the normal value for the machine sees the problem here, minutes before the first slow step ends.
  4. Count the work of one step. The manual's defaults are 32 prompts per step, 8 answers per prompt and an answer limit of 1,024 tokens. One step generates 256 answers. A pool of 3082 tokens holds three answers at the length limit at once, and fewer with their prompts. The engine must run the step as a long series of small batches. Nothing is broken. The GPU is almost idle while it waits for room.
  5. Follow the flag to the pool. The share names the memory for the model weights plus the KV pool together. After the weights load, the engine measures free memory again and gives the pool what is left of the share. At 0.02 of the memory, the weights of even a small model take most of the share, and the pool gets the remainder.
  6. Use the manual's entry. The troubleshooting page lists both failures of this flag. A share that is too high leaves no room for activations and CUDA graphs, so CUDA reports that it is out of memory. A share that is too low does not always stop the engine, so the check is to read #tokens in the KV cache line. The fix for the low case is to raise the share by 0.05 or 0.1 at a time.
Show the resolution

The engine share of 0.02 left a pool of 3082 tokens, and the rollout of one step took 386 s against 61 s at 0.25 and about a minute at the default of 0.4. The reward stayed in range because the answers were the same work, only in many more rounds. The fix is to put the share back to 0.4, or to 0.25 when the trainer needs more room, and never below the point where the pool stops holding a full step.

The proving measurement is the pair of numbers at startup and after the first step: the #tokens in the KV cache line and perf/rollout_time. At 0.25 the pool held 211,813 tokens and the rollout took 61 s. Record both for every new setting of the flag, and change the share by 0.05 or 0.1 at a time. The memory kill of the week before was a trainer problem, and a smaller engine share did not prevent it, as the Ray incident shows.

Show the wrong turns
  • “The reward is fine, so the run is fine.”

    The reward measures what the model learned, not what the step cost. At six times the rollout time, the same training takes six times the GPU hours.

  • “The heat guard paused the run.”

    A pause adds wall-clock time to a step, but the pool line of 3082 tokens explains the time without any pause, and the run at 0.25 on the same day took 61 s.

  • “Raise the number of running requests.”

    The engine admits requests only while the pool has room for their tokens. With 3082 tokens the pool, not the request cap, sets the batch.

  • “Lower the share further, the trainer is what matters.”

    The trainer kill of the week before happened at 0.4 and again at 0.2, so the share was not the cause there. Below 0.25 the trainer gains little and the rollout loses a lot.

Show the general rule

A setting can be wrong in both directions, and the two failures look different. Too much memory for one component crashes it, which everyone sees. Too little makes it slow, which nobody sees until the bill arrives. Know the normal value of the sizing line that each component prints at startup, read it before the first step, and when you change a share, move it in small steps and record the size and the time together.

Taught in

The Miles manual names the two ways an engine share goes wrong in its symptom table, shows that a smaller share did not save the trainer in the Ray page, gives the run defaults in the lab notes, and the SGLang manual explains how the share becomes a pool in its memory sizing page.