Qwen3-4B Elastic Rollout Recipe
This recipe starts Qwen3-4B with four Actor GPUs and four initial one-GPU SGLang Rollout engines. The included Autoscaler config scales the Rollout pool between 4 and 8 engines while training continues.
Required Elastic Settings
| Setting | This recipe | Purpose |
|---|---|---|
| Execution mode | --fully-async | Keeps Actor and Rollout in separate resource pools so Rollout engines can scale independently. Hybrid mode also works — use --hybrid instead (see run-qwen3-4B-8xgpu-elastic-hybrid.sh). |
| Autoscaler | --autoscaler-config <yaml> with enabled: true | Enables automatic scaling decisions. |
| Initial floor | "rollout": [1, 4] in --resource and min_engines: 4 | Starts and protects four initial Rollout engines. |
| Scaling unit | --rollout-num-gpus-per-engine 1 | Each added engine requests 1 GPU and 1 CPU. |
The run script already passes these flags; AUTOSCALER_CONFIG selects the YAML file. The baseline needs 8 GPUs: 4 for Actor and 4 for the initial Rollout engines.
Relax submits Ray resource demand but does not create nodes or Pods. The cluster provisioner must add each engine's additional 1 GPU and 1 CPU to the same Ray cluster.
Launch
Prepare these paths:
<MODEL_DIR>/Qwen3-4B/
<DATA_DIR>/dapo-math-17k/dapo-math-17k.jsonl
<DATA_DIR>/aime-2024/aime-2024.jsonlThen launch from the repository root:
RAY_ADDRESS=ray-head.example.com:6379 \
RAY_DASHBOARD_ADDRESS=http://ray-head.example.com:8265 \
MODEL_DIR=/path/to/models DATA_DIR=/path/to/data EXP_DIR=/path/to/output \
AUTOSCALER_CONFIG=examples/elastic_rollout/autoscaler.yaml \
WORKING_DIR=./ \
bash scripts/entrypoint/ray-job.sh \
examples/elastic_rollout/run-qwen3-4B-8xgpu-elastic-async.shThe marker prefix comes from RELAX_INITIAL_NODE_GROUP and defaults to stable, which requires stable_gpu and stable_cpu. For example, RELAX_INITIAL_NODE_GROUP=baseline requires baseline_gpu and baseline_cpu. Baseline affinity pins the fixed engines to that node group. With baseline affinity enabled, new scale-out engines request elastic_gpu by default. If the cluster publishes only baseline markers, add RELAX_ELASTIC_NODE_GROUP='' before bash scripts/entrypoint/ray-job.sh in the command above to use generic GPU and CPU resources for scale-out while keeping baseline affinity.
Ray, Kubernetes, or the resource platform determines whether a node group can be preempted. On a plain Ray cluster without marker resources, set ENABLE_AFFINITY=0.
Confirm the Result
- Training advances with four initial Relax
ACTIVERollout engines. - Under load, external capacity becomes ready, the Ray placement group becomes ready, and Relax reports more than four
ACTIVEengines. - After load falls, the Autoscaler returns to four engines and training keeps advancing.
For external eviction, the platform must deliver SIGTERM to the elastic SGLangEngine Ray actor and allow enough time to drain; Relax does not install a Pod preStop hook.
Advanced Configuration
For Autoscaler policies, scaling APIs, lifecycle states, and troubleshooting, see Elastic Rollout Scaling.
