Config Reference#
This document describes every field in conf/default.yaml. Use it as a reference when writing your own experiment yaml (via Hydra defaults: [default]).
Do not edit
default.yamldirectly — it holds global defaults. Put user overrides in a separate yaml.???marks a Hydra missing value: it must be set explicitly in your yaml or on the command line.The “Default” column reflects the current values in
default.yaml. The “Constraints” column summarizes rules that the code actually enforces or that couple fields together, not style suggestions.The document is organized by top-level section, one parameter table per section. Section 11. Cross-field constraints cheatsheet collects the dependencies that span multiple sections.
1. Top-level runtime#
Global run mode, randomness, checkpoint paths and logging.
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Entry mode. |
Fully-async mode ( |
|
|
Global random seed for data shuffle, sampling and init. |
— |
|
|
Whether rollout and trainer share the same GPUs (time-multiplexed). |
Must be |
|
|
Training model checkpoint base directory: both the output dir for checkpoints saved during training and the resume input. The step to resume from is found via |
Required. |
|
|
HuggingFace-format initial weight path; used to initialize both actor and the inference engine. |
Required; the tokenizer is also loaded from here. |
|
|
Output dir for |
Only used when |
|
|
Reference model weights from a megatron dist checkpoint (preferred). Names one concrete |
When |
|
|
Reference model HF weight dir. Used when |
Same as above. |
|
|
Total training steps. |
— |
|
|
Global log level. |
One of |
2. Fully-async (fully_async)#
Switches that turn on the “rollout runs concurrently with training” pipeline. See Fully Async Mode for the full design and tuning guide.
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Enable the fully-async pipeline (rollout and trainer on disjoint GPU pools). |
Requires |
|
|
Dispatch / collection strategy for prompt groups. One of |
See the “sliding-window strategies” section of fully-async-mode.md. |
|
|
Extra pipeline capacity, in units of training step: |
|
3. Data sources (data_source / data_sources)#
data_source defines the default fields for a single data source; data_sources is the actual list used at runtime. Each list element inherits from data_source and may override individual fields. Fully-async mode currently supports exactly one data source.
3.1 dataset sub-node#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Prompt dataset path. Supports |
Required. |
|
|
Eval split path, same format as above. |
|
|
|
Maximum characters allowed per prompt. Rows exceeding this are dropped at load time. |
|
|
|
Column holding the prompt text or message list. |
Required. |
|
|
Column holding the ground-truth label. |
Required; set to |
|
|
Column holding per-row metadata dicts. Passed to the agent unchanged as |
Column value must be a dict; absent means an empty dict. |
|
|
Whether to shuffle the training split. |
The eval split is never shuffled. |
|
|
Name of a raw-record pre-processor applied before messages are built (register with |
|
|
|
Name of the buffer-replay-strategy function (register with |
Only used by |
3.2 agent / reward / others#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Agent implementation name. |
Multi-turn agents must be registered via the registry; see Custom Agent Development Guide. |
|
|
Reward function name; must be registered in the registry — see Custom Reward Function Development Guide. |
Required. Other fields under |
|
|
Teacher name used by this data source (paired with OPD). |
Empty string means no teacher; must match some |
|
|
Cap on response-area tokens (LLM replies + tool responses) per attempt. Single-turn uses this as request |
Must be |
|
|
Number of prompt groups |
|
|
|
Trajectories per prompt |
Group-level advantage normalization requires equal group sizes. |
|
|
Sampling params forwarded to the inference engine (e.g. |
Empty dict means use the engine defaults. This dict is spread last into the request body, so a |
data_sources defaults to [${data_source}], i.e. a single data source. For multiple data sources, spell out the list explicitly in your experiment yaml — each element independently inherits from data_source.
4. Rollout (inference & sampling)#
Controls the SGLang inference cluster, the sampler, filters and eval.
4.1 Top level and SGLang#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Whether to abort in-flight requests at step boundaries (preserve already-generated tokens; resume from the same point next step). |
Recommended |
|
|
When restoring a partial trajectory, zero out |
Only valid when |
|
|
Whether to launch a |
Engine-level health monitoring and recovery. Independent of |
|
|
Maximum number of attempts per trajectory inside AgentFlow (including the first attempt): if an attempt throws and is marked |
Always in effect, independent of |
|
|
Inference backend. |
Currently only |
|
|
GPUs per rollout node. |
Multiplied by |
|
|
Environment variables injected into rollout workers. |
— |
|
See below |
Dict forwarded to SGLang |
Field names track the SGLang version. The table below only lists fields that |
rollout.sglang_args overrides:
Field |
Default |
Description |
|---|---|---|
|
|
Fraction of GPU memory reserved by SGLang for KV cache. |
|
|
Disable CUDA graph (helps with hot weight updates and debugging). |
|
|
Disable custom all-reduce (compatibility with the training-side comms). |
|
|
Weight loading strategy. |
4.2 sglang_replicas (PD disaggregation)#
sglang_replicas describes how the inference cluster is split by role; each role can own dedicated GPUs. By default only the regular group is enabled (i.e. no PD split).
Note: Full PD disaggregation is not supported yet. For now keep
prefill.num_nodesanddecode.num_nodesat0and useregularonly.
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Number of “unified prefill+decode” replicas (each replica owns |
Mutually exclusive with |
|
|
GPUs per regular replica. |
Must divide evenly against |
|
|
Number of dedicated prefill replicas. |
Full PD disaggregation is unsupported; keep at |
|
|
GPUs per prefill replica. |
|
|
|
Number of dedicated decode replicas. |
|
|
|
GPUs per decode replica. |
|
|
|
Overrides |
Only affects the decode replica. |
4.3 sampler / filter / eval#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Sampler implementation. Only |
For fully-async mode |
|
|
Extra prompt groups dispatched during synchronous dynamic sampling. |
Must be |
|
|
Amplification factor when refilling prompts from the buffer: |
|
|
|
Maximum prompts per refill call. |
|
|
|
Max seconds to wait for one rollout. On timeout, the current rollout is aborted and the next one starts. |
Unit: seconds. |
|
enabled (empty dict) |
Drop the entire group if it contains any FAILED trajectory. |
Set to |
|
disabled |
Drop groups with identical rewards across all trajectories (no contrastive signal). |
Set |
|
|
Run eval every N steps; |
Also requires |
|
|
Sampling temperature used during eval. |
|
5. AgentFlow#
Agent-side router, tokenizer and sandbox. Multi-turn agents forward requests to SGLang through AgentFlow.router, which also manages the tokenizer and code sandbox.
5.1 router#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
When non-empty, dump every trajectory to this directory for later replay / analysis. |
— |
|
|
Router listen IP. Empty means auto-resolve to the local routable IP at runtime. |
Usually no manual configuration needed. |
|
|
Router listen port. |
— |
|
|
Accumulate reasoning tokens into the context across multi-turn dialogues. |
If disabled, reasoning content only affects the current turn. |
|
|
Per-worker load threshold; above it the router load-balances. |
Smaller values balance more aggressively at higher scheduling overhead. |
|
|
Router → SGLang per-request timeout in seconds. |
Must be |
|
|
Seconds to wait when aborting in-flight requests at a step boundary. |
Paired with |
|
|
Max concurrent connections accepted by the router. |
Tune together with |
|
— |
Placeholder for a middleware parser; users can extend with their own. |
Empty by default. |
5.2 tokenizer#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Path to a Jinja2 chat-template file. Relative paths resolve against |
To control thinking mode, use |
|
|
kwargs forwarded to the tokenizer’s |
Common use: enable thinking with |
|
|
Tokenizer concurrency mode. |
Currently |
|
|
Number of concurrent tokenize workers. |
Tune with rollout concurrency and CPU count. |
5.3 sandbox#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Sandbox type. |
|
|
|
Timeout for a single command inside the sandbox (seconds). |
— |
|
|
Sandbox creation timeout (seconds). |
— |
|
|
Working directory inside the sandbox. |
— |
|
|
Path to the k8s kubeconfig. |
Relative paths resolve against the project |
|
|
Path to the sandbox pod template. |
Relative paths resolve against the project |
6. Tracking#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Project name for experiments (e.g. MLflow project). |
— |
|
|
Experiment name. |
— |
|
|
Metrics backend, e.g. |
— |
|
|
MLflow server URI. |
Required when |
7. Megatron training backend#
The megatron node controls parallelism, optimizer and LR scheduling for the actor. Field names follow upstream Megatron-LM.
7.1 model (parallelism and precision)#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Train in bf16. |
Mutually exclusive with |
|
|
Train in fp16. |
Mutually exclusive with |
|
|
FP8 training recipe; |
Requires Hopper+; used together with |
|
|
Detailed FP8 recipe. |
Only used when |
|
|
Store parameters in FP8 as well. |
Memory savings vs. precision trade-off. |
|
|
Tensor parallel size (TP). |
Total trainer GPUs must be divisible by |
|
|
Pipeline parallel size (PP). |
Same as above; participates in |
|
|
Virtual PP (VPP) size, used to shrink PP bubbles. |
Requires PP > 1. |
|
|
Context parallel size (CP, sequence sharding). |
Paired with |
|
|
CP partitioning strategy (e.g. |
Only used when CP > 1. |
|
|
Expert parallel size (EP) for MoE. |
Keep at 1 for non-MoE models. Total trainer GPUs must be divisible by |
|
|
TP size for the MoE experts. |
|
|
|
Overlap PP P2P communication with computation. |
Only worthwhile when PP > 1. |
|
|
Use grouped GEMM to accelerate MoE. |
Enable for MoE models. |
|
|
Overlap MoE shared-expert compute with dispatch. |
Known issue: can produce NaN on some MoE models, keep it off unless verified (RCA doc |
The commented-out recompute_* triplet (granularity / method / num_layers) enables activation recomputation — enable it in your own yaml when needed.
Note:
megatron.modeltransparently supports every field of Megatron’sTransformerConfig; the table above only lists commonly tuned entries. Most model-structural parameters (number of layers, hidden size, num heads, rotary, norm type, etc.) are auto-populated by megatron-bridge based onhf_model_path— users do not need to declare them. In yaml you only override training-side switches such as parallelism, precision, recomputation and communication overlap.
7.2 ddp_config / optimizer / scheduler#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Use the Megatron distributed optimizer (ZeRO-1-style sharding). |
Interacts with |
|
|
Overlap param all-gather with forward. |
Has a memory cost. |
|
|
Overlap grad reduce-scatter with backward. |
— |
|
|
Reduce gradients in fp32 for numerical stability. |
Keep the default for best precision. |
|
|
Peak learning rate. |
Common RLHF starting point. |
|
|
AdamW weight decay. |
— |
|
|
Offload optimizer state to CPU. |
Useful when GPU memory is tight for large models. |
|
|
Fraction of optimizer state to offload; |
Only used when |
|
|
Warmup steps. |
— |
|
|
Total LR decay steps. |
Combined with |
|
|
LR decay style, e.g. |
— |
|
|
Weight-decay ramp steps. |
Usually left at 0. |
|
|
Weight-decay ramp style. |
— |
|
|
Parameter-name substrings (fuzzy match) whose FP32 master weights are kept; the value (bool) indicates whether that layer’s output should also stay FP32. |
Example: |
|
|
Optimizer-state sharding scheme: |
Controls checkpoint compatibility and DP re-sharding — see Model Loading and Saving. |
Note: all three sub-nodes are forwarded as
**kwargsto the corresponding upstream Megatron structure. The table only lists commonly tuned entries; any other upstream field can be added by name in yaml:
megatron.ddp_config→megatron.core.distributed.DistributedDataParallelConfig
megatron.optimizer→megatron.core.optimizer.OptimizerConfig(torch.dtypefields are auto-converted from strings)
megatron.scheduler→ constructor kwargs ofmegatron.core.optimizer_param_scheduler.OptimizerParamScheduler. Ifmax_lr/min_lr/init_lr/start_wd/end_wdare not set explicitly, they default frommegatron.optimizer.lr/min_lr/weight_decay.
8. OPD (On-Policy Distillation)#
OPD (On-Policy Distillation) attaches one or more teacher models to the RL loop and mixes a configurable KL term with policy gradient, yielding L = (1-gkd_ratio) × [A - pg_ratio × KL_token] + gkd_ratio × L_GKD. See On-Policy Distillation for details.
8.1 Top-level#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Enable OPD. |
Requires a non-empty |
|
|
KL coefficient in the policy-gradient branch of the mixture. |
No upper bound in code; at least one of this / |
|
|
Weight on the GKD branch of the mixture. |
Must be |
|
|
KL estimator for the PG branch. |
One of |
|
|
KL estimator for the GKD branch. |
One of |
|
|
Top-K logits retained by |
Only relevant to top-k methods. |
|
|
Number of teacher nodes. |
Shared across all teachers. |
|
|
GPUs per teacher node. |
Same as above; the resulting |
|
|
Teacher list; each entry has |
Required when OPD is enabled; |
8.2 opd.model / memory_pool#
opd.model mirrors megatron.model field-for-field (bf16 / fp16 / fp8* / TP / PP / VPP / CP / EP / ETP / overlap_p2p_comm / moe_grouped_gemm) and drives the teacher-side megatron forward pass.
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Teacher memory-pool backend; |
Mainly used when co-locating teachers to reuse GPU memory. |
|
|
Environment variables for teacher workers. |
— |
9. Algorithm#
The algorithm node bundles advantage estimation, policy loss, off-policy safeguards, regularizers and loss aggregation — it is the main entry point for training algorithm configuration. See Training Algorithms.
9.1 Main switches#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Advantage estimator name. |
Registered via the registry; built-in: |
|
|
Advantage normalization mode. |
|
|
|
Policy loss name. |
Built-in: |
|
|
Loss aggregation mode. |
|
|
|
Entropy regularization coefficient. |
When non-zero, subtracts |
|
|
Lower clip ratio for GRPO / GSPO. |
Combined with |
|
|
Upper clip ratio. |
Same as above. |
|
|
Dual-clip upper bound for negative advantages. |
Only active for |
9.2 is_correction (importance-sampling correction)#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Enable IS correction. |
Mutually exclusive with |
|
|
Out-of-bound handling: |
— |
|
|
Weight granularity: |
— |
|
|
IS weight lower bound. |
Required; suggested |
|
|
IS weight upper bound. |
Required; suggested |
9.3 opsm / m2po#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Enable Off-Policy Sequence Masking: drop a sequence’s gradient when |
Composable with IS correction / M2PO. |
|
|
OPSM sequence-level KL threshold. |
— |
|
|
Enable M2PO (Second-Moment Trust Policy Optimization): mask the tokens with the largest |
Mutually exclusive with |
|
|
M2PO second-moment threshold. |
— |
9.4 ref_kl (reference-model KL)#
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Add |
Requires |
|
|
KL coefficient. |
— |
|
|
KL estimator: |
— |
|
|
Multiply per-token KL by |
— |
|
|
|
Requires |
10. Trainer#
The trainer node controls batch organization, precision, timeouts and checkpoint saving on the training side.
Field |
Default |
Description |
Constraints |
|---|---|---|---|
|
|
Training backend. |
Only |
|
|
Number of training nodes. |
Multiplied by |
|
|
GPUs per training node. |
Same as above; participates in |
|
|
Use |
Mutually exclusive with IS correction and M2PO. |
|
|
Replay MoE routing recorded on the inference side. |
Used to align rollout / training MoE routing. |
|
|
Compute the LM head in FP32. |
Enable in precision-sensitive settings. |
|
|
Sampling temperature. Eval rounds use |
This value is overridden by |
|
|
Trajectories |
|
|
|
Samples per forward per GPU. |
Only when |
|
|
Per-GPU token cap for dynamic batching. |
Only used when |
|
|
Pack micro-batches by token count. |
When enabled, |
|
|
Bit-exact reproducibility: force deterministic NCCL / TransformerEngine / cuBLAS kernels. |
Noticeably slower; use only for debugging / precision alignment. |
|
|
NCCL comms timeout in minutes; |
— |
|
|
GLOO comms timeout in minutes; |
Consider setting explicitly for large-scale cross-node CPU comms. |
|
|
Save a checkpoint every N training steps; |
— |
|
|
Save checkpoints asynchronously (saver thread runs concurrently with training). |
|
|
|
Whether to save the megatron distributed checkpoint. |
If disabled, recovery only works when |
|
|
Also export HuggingFace-format weights to |
Convenient for downstream inference. |
|
|
Environment variables for training workers. |
— |
11. Cross-field constraints cheatsheet#
The dependencies below span multiple sections and are the most common pitfalls when writing an experiment yaml. The three most frequent are 11.9 DP and batch sizes, 11.10 colocate resource relationships and 11.11 OPD teacher parallelism.
11.1 Reference model#
When
algorithm.ref_kl.enable=true, at least one ofref_dist_ckpt_path/ref_hf_model_pathmust be provided. If both are set, the megatron dist checkpoint (ref_dist_ckpt_path) wins.ref_dist_ckpt_pathnames one concretedist_ckptdir (<run>/train_step_<N>/dist_ckpt), not a base dir. It is validated at startup, and a set-but-unusable path never falls back toref_hf_model_path.algorithm.ref_kl.update_interval > 0refreshes the ref from the actor every N steps — a “moving ref” KL penalty.<= 0keeps the ref frozen.
11.2 Train/rollout log-prob and off-policy safeguards#
trainer.use_rollout_log_probs: trueuses the inference engine’srollout_log_probsin place of the training-sideold_log_probsrecomputation. When enabled, you cannot simultaneously turn on:algorithm.is_correction.enable: truealgorithm.m2po.enable: true
algorithm.opsm.*is compatible with all of the above.
11.3 Fully-async mode#
To enable
fully_async.enable: trueyou must also set:colocate: falserun_mode: defaultrollout.sampler.num_oversample: 0(extra capacity is provided byfully_async.stale_steps)
Only a single entry in
data_sourcesis supported today.B × Nmust be divisible bytrainer.mini_batch_size;M % N == 0is strongly recommended (otherwise you cannot form complete groups). HereB = num_prompts_per_step,N = num_trajectories_per_prompt,M = mini_batch_size.
11.4 Partial rollout#
rollout.mask_offpolicy_in_partial_rollout: trueis only meaningful whenrollout.partial: true(otherwise there are no resumed partial trajectories to mask).Long trajectories or multi-turn agents typically benefit from
rollout.partial: true, which cuts the long-tail wait at step boundaries.
11.5 SGLang PD disaggregation#
Full PD disaggregation is not supported yet. For now keep the single
regularshape, i.e. bothsglang_replicas.prefill.num_nodesanddecode.num_nodesat0.
11.6 Eval#
Eval only actually runs when
rollout.eval.interval > 0anddata_source.dataset.eval_prompt_data_pathis non-null.rollout.eval.temperature: nullmeans eval reusestrainer.temperature.
11.7 Precision combinations#
megatron.model.bf16andfp16are mutually exclusive — pick one.Even with
megatron.model.fp8enabled, keepbf16orfp16as the primary precision;fp8_param: trueadditionally stores weights in FP8.megatron.ddp_config.grad_reduce_in_fp32: trueis the numerically stable recommendation — usually keep it on.
11.8 Checkpoint saving#
trainer.save_freq <= 0disables periodic saves. Keep at least one oftrainer.save_checkpoint/trainer.save_hfset totrue, otherwise nothing is written (unless the run is one-shot).trainer.async_save: truerequires extra memory for the background save queue — see Model Loading and Saving.
11.9 DP and batch sizes#
This is the easiest group to get wrong. The four rules form a chain:
Definition of DP size:
dp_size = trainer.num_nodes × trainer.num_gpus_per_node / (TP × PP × CP). Note that EP does not participate; the MoE expert side has its own DP.Total trainer GPUs must be divisible by
TP × PP × CP, otherwisedp_sizeis meaningless. Validated at startup; the error readstrainer GPUs (8) must be divisible by TP*PP*CP (3).(B × N) % M == 0, whereB = num_prompts_per_step,N = num_trajectories_per_promptandM = trainer.mini_batch_size; with multiple data sources,B × Nis summed over all of them. This yieldsnum_mini_batch = (B × N) / M.B % (dp_size × num_mini_batch) == 0for every data source. This one is most often missed because it couples batch configuration to GPU parallelism. The error readsdata_sources[0] num_prompts_per_step (64) is not divisible by (dp_size * num_mini_batch) = (8 * 2) = 16.
M % dp_size == 0 needs no separate configuration: rule 4 gives B_i = dp_size × num_mini_batch × m_i, and substituting into M = (B × N) / num_mini_batch shows M is always a multiple of dp_size.
Separately, micro_batch_size only participates when use_dynamic_batch_size: false (requiring M % micro_batch_size == 0); with dynamic batching, micro-batches are packed by token count and this field is ignored.
11.10 colocate resource relationships#
With colocate: true the placement group is sized from the trainer’s GPU count only, and rollout and teacher reuse those same GPUs. Therefore:
total rollout GPUs (
Σ sglang_replicas[*].num_nodes × rollout.num_gpus_per_node) must be ≤ total trainer GPUs;with OPD enabled, total teacher GPUs (
opd.teacher_nodes × opd.teacher_gpus_per_node) must also be ≤ total trainer GPUs.
With colocate: false the three counts are additive: the Ray cluster must supply trainer + rollout + teacher GPUs simultaneously.
11.11 OPD teacher parallelism#
With OPD enabled there are four divisibility rules on the teacher side, all validated at startup:
opd.teacher_nodes × opd.teacher_gpus_per_node > 0;that product must be divisible by
opd.model’sTP × PP × CP, which yieldsteacher_dp;teacher_dpandlen(opd.teachers)must be mutually divisible (either may divide the other, but they cannot be coprime-ish);teacher_dpandtrain_dp(thedp_sizefrom 11.9) must be mutually divisible.