Backend patch notes#
Primus integrates several large-model backends (Megatron-LM, TorchTitan, JAX MaxText, …) and applies a lightweight patch layer to keep configuration flags consistent with the Primus CLI. This page captures those backend-specific switches so they live alongside the rest of the documentation (instead of the historical primus/README_patch.md file).
How to read these notes#
Start with the Base Module Parameters table below—every backend module inherits these knobs.
Jump to the backend-specific section for details on extra CLI/config options and links to the patched source files.
When editing configs or CLI presets, cross-reference the Primus CLI Reference so command examples and backend parameters stay in sync.
Supported models#
This section lists, at a high level, the model families Primus currently targets on each backend. For more details and configuration examples, refer to the backend-specific patch notes below.
Megatron-LM#
LLaMA family: LLaMA2, LLaMA3, LLaMA3.1, LLaMA3.3, LLaMA4 (various sizes from 7B up to 405B+)
DeepSeek family: DeepSeek-V2 (lite/base/full) and DeepSeek-V3
MoE / Mixtral: Mixtral-8x7B / 8x22B, large MoE configs (515B, 1T, 2T, 4T) and DeepSeek-style MoE
Qwen family: Qwen2.5 (7B/72B) and Qwen3 (8B/30B/235B variants)
Other GPT-style models: Grok1/2, GPT-OSS 20B and generic
language_model.yaml
TorchTitan#
LLaMA family: LLaMA3, LLaMA3.1, LLaMA3.3 (various sizes, including FP8 variants)
DeepSeek family: DeepSeek-V3 (16B and 671B, FP8 and BF16 configs)
Qwen family: Qwen3 small/medium models (0.6B, 1.7B, 32B)
JAX MaxText#
LLaMA family: LLaMA2 (7B/70B), LLaMA3 (8B/70B), LLaMA3.3 (70B)
DeepSeek family: DeepSeek-V2 16B
MoE / Mixtral: Mixtral-8x7B
Other models: Grok1 and additional MaxText-supported transformers (see MaxText docs for the full list)
Base module parameters#
All modules inherit the options defined in primus/configs/modules/module_base.yaml:
Argument Name |
Default Value |
Description |
|---|---|---|
|
|
Whether the module participates in training. |
|
|
Global sink level for logging. Overrides |
|
|
Logging level for file sink (log files). |
|
|
Logging level for stderr/console output. |
Backend index#
Megatron-LM patch notes#
Primus keeps a curated patch layer on top of upstream Megatron-LM so CLI presets and configs can expose additional controls. Use this section with the Base Module Parameters above for shared module parameters, and the Primus CLI Reference for CLI/config usage patterns.
ℹ️ The Version column maps to Primus internal patch tags (v0.x.y) so you know when a flag landed.
1. Module-level parameters#
These arguments are introduced in the Megatron module logic (e.g., training loop, logging, resume logic). They are defined via patching and can be configured to control training behavior and logging utilities.
New Argument |
Default Value |
Version |
Description |
Patched Files |
Notes |
|---|---|---|---|---|---|
|
|
v0.1.0 |
Whether to disable TensorBoard. Set to |
NA |
Required for timeline and performance debugging. |
|
|
v0.1.0 |
Whether to disable Weights & Biases logging. |
NA |
Useful for internal benchmarking. |
|
|
v0.1.0 |
Disables Megatron’s custom kernel compilation. Most ops are already covered by TE. |
NA |
Avoids redundant compilation steps. |
|
|
v0.1.0 |
Automatically resume training from the latest checkpoint if found in the |
NA |
Simplifies job restarts. |
|
|
v0.1.0 |
Skip saving the final checkpoint at the last iteration. |
NA |
Useful for profiling or benchmarking runs. |
|
|
v0.2.0 |
Disable the FP8 weight transpose cache to save memory. |
|
May affect performance but reduce memory use. |
|
|
v0.2.0 |
Enable manual pipeline split in (interleaved) 1F1B pipeline parallelism. |
|
Deprecated. Use |
|
|
v0.2.0 |
Add fwd/bwd warmup to save iter1’s time when pp degree is large. |
NA |
Can save much time for pipeline debug. |
|
|
v0.2.0 |
Enable dumping pp schedule data for visualization. |
|
Useful for pipeline schedule visualization. |
|
|
v0.2.0 |
Disable CPU activity in torch profiling. |
NA |
If you only want to trace CUDA kernels and get a smaller trace JSON file, you can enable this option. However, if you plan to run with TraceLen, please do not enable it. more torch profiler args: |
|
|
v0.2.0 |
Logging ROCm memory information in Megatron-LM Trainer |
NA |
If |
|
|
v0.2.0 |
Logging ROCm memory information in Megatron-LM Trainer for some iterations |
NA |
If |
|
|
v0.2.0 |
Using Zero-Bubble pipeline parallism |
|
If |
|
|
v0.3.0 |
Track model development using MLflow |
NA |
Envs: |
|
|
v0.4.0 |
Specify the exact IDs of layers to recompute, enabling more flexible memory reduction |
NA |
Using |
|
|
v0.5.0 |
Set |
|
Accepted values: |
2. Model-definition parameters#
These arguments affect the internal architecture or layer implementations. They are patched into the model construction logic and used for tuning or debugging specific variants.
New Argument |
Default Value |
Version |
Description |
Patched Files |
Notes |
|---|---|---|---|---|---|
|
|
v0.1.0 |
Disable PrimusTopkRouter and use TopkRouter implemented by megatron. |
|
Used to debug internal. |
|
|
v0.1.0 |
Force token redistribution in MoE to achieve load balance across experts. |
|
Use to debug MoE imbalance issues. |
|
|
v0.1.0 |
Enable legacy MoE implementation for debugging/perf comparison. |
|
Deprecated, used for internal testing only. |
|
|
v0.1.0 |
Permutation and unpermutation fusion. |
|
Fuse permutation and unpermutation in moe layer. |
|
|
v0.2.0 |
Fused router topk and calculation of moe aux loss score. Need Primus turbo backend |
|
Used to reduce launch overhead of the small kernels in router. |
TorchTitan patch notes#
TorchTitan integration uses the same Primus configuration surface (CLI flags + YAML) but exposes a few extra knobs via patches. Pair this with the Base Module Parameters above for shared module parameters.
New Argument |
Default Value |
Version |
Description |
Patched Files |
Notes |
|---|---|---|---|---|---|
|
|
v0.4.0 |
Automatically casts |
(Primus TorchTitan patch set) |
Disable only if you manage casting manually. |
JAX MaxText patch notes#
Primus integrates JAX MaxText as a backend for running LLaMA and related transformer models on AMD GPUs. At the moment, Primus does not apply any additional patch-layer arguments on top of MaxText—the MaxText configuration surface (YAML + CLI) is used as-is.
Use this section together with:
The Base Module Parameters and Supported Models above for a high-level model overview
The Primus CLI Reference for Primus CLI usage patterns
The official MaxText documentation for the full set of MaxText-specific arguments
MaxText-specific notes#
Primus currently wires MaxText via
primus/configs/models/maxtextandprimus/configs/modules/maxtext.Model families currently exercised in examples include:
LLaMA2 7B/70B
LLaMA3 8B/70B
LLaMA3.3 70B
DeepSeek-V2 16B
Mixtral-8x7B
Grok1
There are no extra Primus-only flags for MaxText yet; as we add MaxText-specific patches (e.g., ROCm optimizations, logging helpers), they will be documented in tables here in the same style as the Megatron-LM and TorchTitan patch notes.