You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page lists the flat configuration keys exposed by Primus when framework: megatron. Unless a section says otherwise, values are the defaults from primus/configs/modules/megatron/trainer_base.yaml and related model presets. The effective pretraining preset is pre_trainer.yaml, which extends trainer_base.yaml and overrides several high-impact training defaults.
Where parameters live. Set overrides under modules.pre_trainer.overrides: in your experiment YAML. Model architecture keys usually come from models.<role>.overrides: (or your chosen model preset), but the same names map to Megatron’s argparse namespace either way.
Presets.
Module presets: primus/configs/modules/megatron/ (the main pretraining bundle is pre_trainer.yaml, which extends trainer_base.yaml and Primus Megatron add-ons).
Model presets: primus/configs/models/megatron/ (for example language_model.yaml).
Mapping to Megatron-LM. Keys are passed through 1:1 to Megatron’s training arguments (same names as argparse / Namespace). Primus builds that namespace with MegatronArgBuilder.
Sources: trainer_base.yaml and primus_megatron_module.yaml.
Parameter
Default
Description
recompute_activations
false
Enable activation recomputation globally.
recompute_granularity
null
full or selective checkpointing.
recompute_method
null
uniform or block selective recomputation.
recompute_num_layers
null
Layers to recompute per block / schedule.
recompute_layer_ids
null
Primus: explicit global layer indices to recompute. Decoder layers are 0 … num_layers-1; the MTP depths continue the numbering, so depth d is num_layers + d. Requires recompute_granularity: full and recompute_method: null.
distribute_saved_activations
false
Distribute saved activations across TP/PP for memory balance.
checkpoint_activations
false
Deprecated alias for activation checkpointing.
moe_layer_recompute
false
Recompute MoE layer activations (model preset).
9. Logging and profiling
Sources: trainer_base.yaml and primus_megatron_module.yaml.
9.1 Logging
Parameter
Default
Description
log_avg_skip_iterations
2
Skip first N iterations for throughput averaging.
log_avg_reset_interval
10
Reset moving averages periodically.
log_params_norm
false
Log L2 norms of parameters.
log_num_zeros_in_grad
false
Log fraction of zero gradients.
log_throughput
false (true in pre_trainer.yaml)
Log tokens/sec and timing.
log_progress
false
Verbose progress logging.
timing_log_level
0
Verbosity for timing logs.
timing_log_option
minmax
Aggregate style for timing (minmax, all, …).
tensorboard_log_interval
1
Steps between TensorBoard scalars.
tensorboard_queue_size
1000
TensorBoard event queue size.
log_timers_to_tensorboard
false (true in pre_trainer.yaml)
Write timer stats to TensorBoard.
log_batch_size_to_tensorboard
false (true in pre_trainer.yaml)
Log batch size.
log_learning_rate_to_tensorboard
true
Log LR.
log_validation_ppl_to_tensorboard
false
Log validation perplexity.
log_memory_to_tensorboard
false
Log memory usage.
log_world_size_to_tensorboard
false
Log distributed world size.
log_loss_scale_to_tensorboard
true
Log FP16/FP8 loss scale.
wandb_project
null
Weights & Biases project name.
wandb_exp_name
null
W&B run name.
wandb_save_dir
null
W&B local directory.
wandb_entity
null
W&B entity / team.
enable_one_logger
true
Enable NVIDIA OneLogger integration.
one_logger_project
megatron-lm
OneLogger project string.
one_logger_run_name
null
OneLogger run name.
log_interval
100 (1 in pre_trainer.yaml)
Console log interval in iterations.
tensorboard_dir
null
TensorBoard output directory.
logging_level
null
Python logging level override.
config_logger_dir
""
Directory for dumped config logs.
one_logger_async
false
Async OneLogger flushing.
app_tag_run_name
null
Application tag for telemetry.
app_tag_run_version
0.0.0
Application tag version.
disable_tensorboard
true
Primus: disable TensorBoard integration in Primus-wrapped runs.
disable_wandb
true
Primus: disable W&B.
disable_mlflow
true
Primus: disable MLflow.
mlflow_run_name
null
Primus: MLflow run name.
mlflow_experiment_name
null
Primus: MLflow experiment name.
use_rocm_mem_info
false
Primus: collect ROCm memory info via rocm-smi every step when true.
use_rocm_mem_info_iters
[1, 2]
Primus: iterations at which to log memory if use_rocm_mem_info is false.
9.2 Profiling
Parameter
Default
Description
profile
false
Enable lightweight Nsight / CUDA profiling hooks.
use_pytorch_profiler
false
Enable torch.profiler regions.
profile_ranks
[0]
Ranks to profile.
profile_step_start
10
First step to profile.
profile_step_end
12
Last step to profile.
iterations_to_skip
null
Skip listed iterations in profiling.
result_rejected_tracker_filename
null
Log rejected samples to this file.
enable_gloo_process_groups
true
Create auxiliary Gloo groups for CPU-side ops.
record_memory_history
false
Record CUDA memory history (debug).
memory_snapshot_path
snapshot.pickle
Path for memory snapshot dumps.
disable_profiler_activity_cpu
false
Primus: omit CPU activities from profiler traces.
torch_profiler_record_shapes
true
Primus: record tensor shapes in PyTorch profiler.
torch_profiler_with_stack
true
Primus: capture Python stacks in profiler.
torch_profiler_use_gzip
false
Primus: gzip profiler outputs.
10. Model architecture
Sources: primus/configs/models/megatron/language_model.yaml and primus/configs/models/megatron/primus_megatron_model.yaml.
10.1 Core architecture
Parameter
Default
Description
use_legacy_models
false
Use legacy Megatron model code paths.
deprecated_use_mcore_models
false
Deprecated flag for Megatron-Core models; prefer current transformer_impl + stack.
model_type
gpt
gpt or mamba family.
num_layers
24
Transformer layers (decoder or unified stack).
encoder_num_layers
null
Encoder depth (encoder–decoder).
decoder_num_layers
null
Decoder depth.
hidden_size
1024
Hidden / model width.
num_attention_heads
16
Attention heads.
attention_backend
auto
Attention kernel backend selection.
group_query_attention
false
Enable grouped-query attention (GQA).
qk_layernorm
false
LayerNorm on Q/K projections.
qk_l2_norm
false
L2-normalize Q/K vectors.
num_query_groups
null
Number of query groups for GQA; null means MHA.
add_position_embedding
false
Add absolute position embeddings (non-RoPE stacks).
position_embedding_type
learned_absolute
Position embedding style.
max_position_embeddings
null
Maximum sequence positions (context length cap).
original_max_position_embeddings
null
Original pretrained length for interpolation / scaling.
untie_embeddings_and_output_weights
true
Separate input embedding and LM head weights.
ffn_hidden_size
null
FFN hidden size; null often defaults via hidden_size heuristics.
kv_channels
null
Per-head KV channels override.
hidden_dropout
0.1
Dropout on residual / hidden states.
attention_dropout
0.1
Attention dropout.
fp32_residual_connection
false
Accumulate residuals in FP32.
apply_residual_connection_post_layernorm
false
Apply residual after (vs before) norm where supported.
add_bias_linear
false
Biases in linear / column-parallel layers.
add_qkv_bias
false
Biases in QKV projections.
swiglu
true
SwiGLU activation in FFN.
quick_geglu
false
Faster GeGLU path.
openai_gelu
false
OpenAI GELU variant.
squared_relu
false
Squared ReLU activation.
rotary_base
10000
RoPE base frequency.
rotary_percent
1.0
Fraction of head dim spanned by RoPE.
rotary_interleaved
false
Interleaved RoPE layout.
rotary_seq_len_interpolation_factor
null
Positional interpolation factor for long contexts.
use_rotary_position_embeddings
null
Force RoPE on/off; null follows model type.
use_rope_scaling
false
Enable LLaMA-style rope scaling.
rope_scaling_factor
8.0
Scaling factor for extended contexts (LLaMA-3 style).
transformer_impl
transformer_engine
Backend library (transformer_engine, local, …).
rope_type
null
rope or yarn style extensions.
norm_epsilon
1.0e-05
LayerNorm / RMSNorm epsilon.
normalization
"LayerNorm"
Norm type (LayerNorm, RMSNorm with TE, …).
apply_layernorm_1p
false
LayerNorm with +1 offset trick.
clone_scatter_output_in_embedding
true
Clone embedding scatter for autograd safety.
perform_initialization
true
Run weight initialization.
use_cpu_initialization
null
Initialize on CPU then move to GPU.
use_te_activation_func
false
Use Transformer Engine activation kernels.
gradient_accumulation_fusion
true
Fuse gradient accumulation kernels.
delay_wgrad_compute
false
Delay weight-gradient computation for scheduling.
10.2 Tokenizer and vocabulary
Parameter
Default
Description
tokenizer_type
null
Tokenizer class name (GPT2BPETokenizer, HuggingFaceTokenizer, …).
tokenizer_model
null
Path to tokenizer model / vocabulary file.
vocab_size
null
Vocabulary size (often inferred from tokenizer).
vocab_file
null
Vocabulary file path for BPE/WP tokenizers.
vocab_extra_ids
0
Extra reserved token slots.
tiktoken_pattern
null
Regex pattern for tiktoken.
tiktoken_num_special_tokens
1000
Special token count for tiktoken setup.
tiktoken_special_tokens
null
Serialized special tokens for tiktoken.
legacy_tokenizer
false
Legacy tokenizer behavior.
trust_remote_code
false
trust_remote_code for Hugging Face tokenizers.
10.3 Initialization and attention numerics
Parameter
Default
Description
init_method_std
0.02
Standard deviation for weight init.
apply_query_key_layer_scaling
false
Scale Q/K by layer index (deprecated GPT-3 trick).
attention_softmax_in_fp32
false
Force softmax in FP32.
10.4 Kernel fusion flags
Parameter
Default
Description
bias_gelu_fusion
true
Fuse bias + GELU.
cross_entropy_loss_fusion
false
Fused cross-entropy + softmax.
cross_entropy_fusion_impl
"native"
native or te fused CE.
bias_swiglu_fusion
true
Fuse bias + SwiGLU.
masked_softmax_fusion
true
Fused masked softmax.
no_persist_layer_norm
false
Non-persistent LayerNorm mode in TE.
bias_dropout_fusion
true
Fuse bias + dropout.
apply_rope_fusion
true
Fused RoPE kernels.
10.5 Multi-latent attention (MLA)
Parameter
Default
Description
multi_latent_attention
false
Enable MLA blocks instead of standard MHA.
q_lora_rank
null
Low-rank query projection rank.
kv_lora_rank
32
Low-rank KV compression rank.
qk_head_dim
128
Q/K head dimension for MLA.
qk_pos_emb_head_dim
64
Positional head dimension for MLA.
v_head_dim
128
Value head dimension for MLA.
rotary_scaling_factor
1.0
RoPE scaling inside MLA (distinct from rope_scaling_factor above).
Primus: Control the force load balancing type for the MoE router. Choices: even, uniform.
10.7 Logit softcapping (Primus / Grok-style)
Parameter
Default
Description
final_logit_softcapping
null
Softcap value for final logits; null disables.
attn_logit_softcapping
null
Softcap for attention logits.
router_logit_softcapping
null
Softcap for MoE router logits.
11. Primus extensions
11.1 Build and compile
Parameter
Default
Description
disable_compile_dependencies
true
Primus: avoid compiling dependency stacks in the trainer wrapper.
11.2 Primus-Turbo (primus_turbo.yaml)
Parameter
Default
Description
enable_primus_turbo
false
Master switch for Primus-Turbo integrations. Many sub-features require this plus specific kernels.
use_turbo_attention
false
Turbo attention implementation.
use_sink_attention
false
GPT-OSS-style learned sink attention.
sink_sliding_window
0
Sliding-window size for sink attention (GPT-OSS uses 128).
sink_window_even_layers_only
true
Apply the sliding window only to even layers (GPT-OSS pattern).
use_turbo_gemm
false
Active Turbo GEMM flag for Dense paths.
use_turbo_parallel_linear
(removed)
Removed—use use_turbo_gemm. Passing this key now raises an assertion error (use_turbo_parallel_linear has been removed; please use use_turbo_gemm instead).
use_turbo_grouped_gemm
false
Active Turbo grouped GEMM flag for MoE paths.
use_turbo_grouped_mlp
(removed)
Removed—use use_turbo_grouped_gemm. Passing this key now raises an assertion error (use_turbo_grouped_mlp has been removed; please use use_turbo_grouped_gemm instead).
moe_use_fused_router_with_aux_score
false
Fused MoE router with auxiliary scores.
enable_turbo_attention_float8
false
FP8 path inside Turbo attention (spacing in YAML is normalized to this key).
use_turbo_deepep
false
Turbo DeepEP expert communication.
turbo_deepep_num_cu
32
DeepEP compute units / channels.
turbo_deepep_use_comm_stream
false
Use a dedicated communication stream for DeepEP.
turbo_sync_free_moe_stage
0
Stage selector for sync-free MoE.
use_turbo_fused_act_with_probs
false
Fuse activation + probability tensors to remove redundant work.
use_turbo_rms_norm
false
Turbo RMSNorm kernels.
11.3 Zero-bubble pipeline (zero_bubble.yaml)
Parameter
Default
Description
patch_zero_bubble
false
Install Primus zero-bubble PP patches when true.
debug_scheduler_table
false
Print PP scheduler tables (also in primus_pipeline.yaml; last merge wins—defaults match).
enable_zb_runtime
true
Unified runtime for zero-bubble and related schedules.
pre_communication_optimization
false
Issue a tiny comm before real comm to tune overlap.
zero_bubble_pipeline_timers_start_iter
100
Start iter for auto-scheduler timers.
zero_bubble_pipeline_timers_end_iter
110
End iter for auto-scheduler timers.
zero_bubble_max_pending_backward
auto
Max pending backward ops (ZB1p vs ZB2p style); auto adapts.
zero_bubble_adaptive_memory_limit_percentile
85
GPU memory percentile cap for adaptive ZB.
enable_optimizer_post_validation
false
Post-optimizer validation step (needs FSDP path).
enable_exactly_numeric_match
true
Require bitwise match in post validation when enabled.
enable_zero_bubble
true
Enable zero-bubble schedule features in the ZB runtime.
zero_bubble_v_schedule
false
Zero-bubble “V” schedule without extra memory vs some baselines.
zero_bubble_v_schedule_mem_setup
half
Memory setup variant: half, min, or zb.
enable_1f1b_v
false
1F1B-V schedule variant.
allow_padding_num_layers
true
Allow PP layer padding for divisibility.
profile_memory_iter
-1
Iteration to profile memory (-1 disables).
interleave_group_size
0
Interleaved PP group size.
offload_chunk_num
0
Activation offload chunk count.
offload_time
1.0
Time budget for offload (scheduler hint).
auto_offload_time
true
Auto-tune offload timing.
offload_overlap_sr
true
Overlap save/resume in offload path.
num_seq_splits
1
Splits along sequence dimension for ZB.
cpu_offload
false
CPU offload of activations in ZB path.
11.4 Primus pipeline (primus_pipeline.yaml)
Parameter
Default
Description
patch_primus_pipeline
false
Enable Primus pipeline scheduling patches.
pp_algorithm
"1f1b-interleaved"
Schedule name (1f1b, 1f1b-interleaved, zero-bubble, zero-bubble-heuristic, zbv-formatted, v-half, v-min).
communication_method
"async_p2p"
async_p2p or batch_p2p PP transfers.
offload
false
Generic PP activation offload toggle in Primus pipeline.
offload_ops
""
Comma-separated offload targets (attn today; other ops listed in-file are not supported yet).
pp_max_mem
null
zero-bubble-heuristic only: max activation memory per stage (null = unlimited).
pp_cost_f
null
zero-bubble-heuristic only: forward cost per stage (scalar or list; null = default 1000).
pp_cost_b
null
zero-bubble-heuristic only: backward cost per stage (scalar or list; null = default 1000).
pp_cost_w
null
zero-bubble-heuristic only: weight-grad cost per stage (scalar or list; null = default 1000).
pp_warmup and dump_pp_data are Primus helpers defined in primus_megatron_module.yaml (not primus_pipeline.yaml):
Parameter
Default
Description
pp_warmup
false
Primus: warm-up PP stages to reduce first-iteration latency.
dump_pp_data
false
Primus: dump PP tensors for debugging.
12. Reinforcement learning and GRPO-related settings
Source: trainer_base.yaml. Names follow Megatron’s grpo_* / rl_* prefixes (there is no rl_grpo single flag in these presets).
Parameter
Default
Description
perform_rl_step
false
Run RL / preference optimization steps (GRPO / LangRL integration).
rl_prompts_per_eval
32
Prompts per RL evaluation pass.
grpo_prompts_per_step
32
GRPO prompts sampled per training step.
grpo_group_size
2
Samples per prompt group for GRPO.
grpo_iterations
2
Inner GRPO iterations.
grpo_clamp_eps_lower
0.01
PPO-style lower clip epsilon.
grpo_clamp_eps_upper
0.01
Upper clip epsilon.
grpo_kl_beta
0.001
KL penalty weight toward reference policy.
grpo_entropy_term_weight
0.0
Entropy bonus weight.
grpo_filter_groups_with_same_reward
false
Drop groups with identical rewards.
grpo_default_temperature
1.0
Default softmax temperature for rollouts.
grpo_default_top_p
0
Top-p sampling (0 often means disabled / greedy—see Megatron RL docs).
langrl_inference_server_type
inplace_megatron
LangRL inference backend.
langrl_inference_server_conversation_template
null
Conversation template path / name.
langrl_env_config
null
Environment / task YAML for LangRL.
rl_offload_optimizer_during_inference
false
Offload optimizer to CPU during rollout inference.
rl_offload_kv_cache_during_training
false
Offload KV cache while training forward runs.
rl_remove_kv_cache_during_training
false
Drop KV cache between RL phases to save memory.
rl_reset_cuda_graphs
false
Reset CUDA graphs when switching RL phases.
rl_partial_rollouts
false
Partial sequence rollouts.
rl_inference_logprobs_is_correction
false
Interpret inference logprobs as IS correction term.
rl_importance_sampling_truncation_coef
null
Truncate importance ratios at this value.
rl_calculate_intra_group_similarity
false
Log similarity within GRPO groups.
13. Additional specialized parameters
Source: trainer_base.yaml (remaining domains).
13.1 Vision pretraining
Parameter
Default
Description
vision_pretraining
false
Enable vision backbone pretraining.
vision_pretraining_type
classify
Objective (classify, etc.).
vision_backbone_type
vit
Vision backbone family.
swin_backbone_type
tiny
Swin variant size.
num_classes
1000
Classification classes.
img_h
224
Image height.
img_w
224
Image width.
num_channels
3
Input channels.
patch_dim
16
ViT patch size.
classes_fraction
1.0
Fraction of classes used.
data_per_class_fraction
1.0
Fraction of data per class.
13.2 RETRO
Parameter
Default
Description
retro_project_dir
null
RETRO project directory with indices.
retro_add_retriever
false
Add frozen retriever tower.
retro_cyclic_train_iters
null
Cyclic iterator length.
retro_encoder_layers
2
Retriever encoder layers.
retro_encoder_hidden_dropout
0.1
Retriever dropout.
retro_encoder_attention_dropout
0.1
Retriever attention dropout.
retro_num_neighbors
2
Neighbors per query chunk.
retro_num_retrieved_chunks
2
Chunks concatenated per neighbor set.
retro_attention_gate
1
Gating between retrieval and LM.
retro_verify_neighbor_count
true
Assert neighbor counts for debugging.
13.3 DINO self-supervised
Parameter
Default
Description
dino_local_img_size
96
Local crop size.
dino_local_crops_number
10
Number of local crops.
dino_head_hidden_size
2048
Projection head width.
dino_bottleneck_size
256
Bottleneck dimension.
dino_freeze_last_layer
1
Freeze last layer epochs.
dino_norm_last_layer
false
Normalize last layer weights.
dino_warmup_teacher_temp
0.04
Teacher temperature warmup start.
dino_teacher_temp
0.07
Teacher temperature.
dino_warmup_teacher_temp_epochs
30
Epochs to warm teacher temperature.
13.4 Biencoder / ICT / retriever utilities
Parameter
Default
Description
ict_head_size
null
ICT projection head width.
biencoder_projection_dim
0
Biencoder shared projection dimension.
biencoder_shared_query_context_model
false
Share query/context encoders.
ict_load
null
ICT checkpoint path.
bert_load
null
BERT encoder checkpoint for biencoder.
titles_data_path
null
Titles file for ICT datasets.
query_in_block_prob
0.1
Probability of in-block queries.
use_one_sent_docs
false
Single-sentence pseudo documents.
evidence_data_path
null
Evidence passages for open-domain QA.
retriever_report_topk_accuracies
[]
k values for top-k accuracy logging.
retriever_score_scaling
false
Scale retriever scores.
block_data_path
null
Block JSON data for retrieval.
embedding_path
null
Precomputed embeddings path.
indexer_batch_size
128
Batch size when building ANN index.
indexer_log_interval
1000
Indexer progress log interval.
13.5 Straggler detection
Parameter
Default
Description
log_straggler
false
Log straggler diagnostics.
disable_straggler_on_startup
false
Skip straggler detection at startup.
straggler_ctrlr_port
65535
Controller port for straggler service.
straggler_minmax_count
1
Min/max samples for straggler stats.
13.6 Inference-oriented options
Parameter
Default
Description
inference_batch_times_seqlen_threshold
-1
Heuristic threshold tying batch and sequence length.