Skip to main content
Miles launch scripts are Python (scripts/run_*.py). The grouping is deliberately boring: each script builds one string per operational concern, concatenates them into train_args, and hands that to execute_train, which submits train.py or train_async.py as a Ray job. Use this page to decide where a flag belongs. Use the CLI Reference when you need the full default and type for an individual flag. For how a script is laid out and how to override one, see Launch Script. The names above are the local variables every launcher uses; a script that needs no eval simply leaves eval_args empty. Model args are the one group a launcher does not build: it passes megatron_model_type to execute_train, which resolves the matching file under scripts/models/ and prepends those flags to the command line.

Model args - architecture constants

Model args tell Megatron what model it is instantiating. Megatron cannot infer all architecture details from a HuggingFace checkpoint, so each recipe loads a matching file from scripts/models/. Common entries: Keep these values aligned with the checkpoint’s config.json. If one checkpoint in a family changes rotary base, vocab padding, or normalization epsilon, override the sourced defaults in the launch script.

ckpt_args - checkpoint paths

ckpt_args wires the three model roles in a run: --load and --save usually point to the same directory. If --load has no latest_checkpointed_iteration.txt, Miles warm-starts the actor from --ref-load.

rollout_args - sampling and reward

rollout_args controls data entering the loop and how many samples each rollout produces. The rollout volume and training consumption must satisfy the four-knob invariant.

eval_args - evaluation overrides

Evaluation reuses the rollout stack but usually runs with a different dataset and more deterministic sampling. Common entries: Flags not set in eval_args inherit from rollout_args.

perf_args - parallelism and memory

perf_args controls how training is sharded and how activation memory is managed. Megatron exposes TP, PP, CP, EP, and ETP, but not every product of those dimensions is valid or worth using for every model. Start from the recipe’s tested combination and see parallelism compatibility before changing more than one dimension.

grpo_args - RL objective

grpo_args controls the policy-gradient objective and the stability terms around it. Zero-weight KL is recipe-specific. --use-kl-loss --kl-loss-coef 0.00 still loads the reference and logs KL; it does not remove the reference model.

optimizer_args - optimizer schedule

optimizer_args carries the optimizer choice and scalar schedule. Common entries: Post-training is sensitive to large updates. Most recipes start near 1e-6 and use a constant schedule unless the model page says otherwise.

sglang_args - rollout engine passthrough

sglang_args configures the inference side. Miles owns --rollout-num-gpus-per-engine and --sglang-pp-layer-partition; everything else prefixed with --sglang- is forwarded to python -m sglang.launch_server after removing the prefix. Common entries: SGLang parallelism is separate from trainer parallelism. For example, --rollout-num-gpus-per-engine sets the SGLang server’s GPU count, not Megatron’s --tensor-model-parallel-size. An engine spans tp_size × pp_size GPUs, so with --sglang-pp-size N miles launches it with --tp-size set to the engine’s GPUs divided by N; the GPU count must divide evenly. A model too large for one node can run one pipeline stage per node, which keeps tensor parallelism inside each node:
--sglang-pp-layer-partition gives the layers of each stage, one entry per stage, summing to the model’s layer count. Every pipelined engine receives it as SGLANG_PP_LAYER_PARTITION, so miles refuses at startup any server group whose pp_size or model it does not fit, and refuses the flag when no server group is pipelined. Unset, SGLang splits the layers evenly. A cold health request crosses every pipeline stage, so miles sets each engine’s SGLANG_HEALTH_CHECK_TIMEOUT (the /health_generate budget) to a per-stage budget times the engine’s pp_size, and waits on that budget while the engine starts. The per-stage budget is the launcher’s own SGLANG_HEALTH_CHECK_TIMEOUT when set, otherwise SGLang’s default of 20 s. For an engine miles does not launch (--rollout-external-engine-addrs) it waits 20 s times the pp_size the engine reports.

misc_args - GPU layout and everything else

misc_args carries what the other groups do not: how many GPUs the actor gets, whether it shares them with the rollout engines, the Megatron knobs a recipe pins once and never tunes, and the optional dashboard. Common entries: Under --colocate the actor and the engines share the same GPUs and take turns, so --rollout-num-gpus is ignored; see Training Backends.