Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
444a583
Add Gemma 4 (26B MoE and 31B Dense) support for Megatron-Bridge
yeandy Aug 17, 2026
53687e8
fix(megatron-bridge): bump to v0.6.0 and force text path for Gemma 4
yeandy Aug 26, 2026
8db059e
fix(megatron-bridge): repair stale Gemma 4 recipe imports for Bridge …
yeandy Aug 27, 2026
79c50f3
fix(megatron-bridge): honor text conversion mode on the Gemma 4 MoE path
yeandy Aug 27, 2026
1adb5b4
fix(gemma4): use parallelism that fits on a single 8xMI300X node
yeandy Aug 27, 2026
d17a8de
style(gemma4): apply isort and black to the Gemma 4 recipe
yeandy Aug 27, 2026
c636497
feat(gemma4): add diagnostics and config-override hooks for tuning
yeandy Aug 31, 2026
ac95d36
perf(gemma4): add opt-in fused RMSNorm for the Gemma 4 norm stack
yeandy Aug 31, 2026
b290fc9
docs(gemma4): point the example configs at the memory levers that matter
Sep 11, 2026
4efa480
fix(gemma4): honour transformer_impl instead of freezing the spec to TE
Sep 11, 2026
8d773a8
fix(gemma4): coerce dotted-path overrides to the target field's enum …
Sep 11, 2026
18cc6fd
fix(env): point HIPBLASLT_TENSILE_LIBPATH at hipBLASLt's real Tensile…
Sep 11, 2026
0221d4b
docs(gemma4): add MI455X single-GPU proxy configs for 26B and 31B
Sep 11, 2026
2aa3355
test(gemma4): cover the config-override parser and enum coercion
Sep 11, 2026
d79cac3
test(gemma4): cover transformer_impl handling, and decouple the optim…
Sep 11, 2026
c131c2d
feat(gemma4): allow CPU optimizer offload without TransformerEngine's…
Sep 12, 2026
7aa9678
test(gemma4): isolate local_spec tests from the CPU offload environment
Sep 13, 2026
a78c003
feat(gemma4): restore the MoE post-attention norm, and add two opt-in…
Sep 15, 2026
dbf6bda
fix(gemma4): fail instead of continuing when a PRIMUS_GEMMA4_SET key …
Sep 15, 2026
e313cac
examples(megatron_bridge): factor proxy depth into presets, fix the r…
Sep 15, 2026
c40dca7
docs(gemma4): measure the shipped configs at their own defaults, and …
Sep 15, 2026
8c8c296
docs(gemma4): say which fingerprint was measured on this tree, and wh…
Sep 15, 2026
54fcdba
docs(gemma4): verify both fingerprints on this revision, and check th…
Sep 15, 2026
28611c6
docs(gemma4): drop the FlyDSL speedup figures, which no reader could …
Sep 15, 2026
07d832d
docs(gemma4): the Tensile fix is mandatory, not a 2.93x optimisation
Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/02-user-guide/pretraining.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,4 @@ The tables above in the Megatron, TorchTitan, and MaxText sections are curated M
- [CLI reference](cli-reference.md): launcher usage
- [Configuration system](configuration-system.md): YAML merge rules
- Backend parameter references: [Megatron parameters](../03-configuration-reference/megatron-parameters.md), [TorchTitan parameters](../03-configuration-reference/torchtitan-parameters.md), [MaxText parameters](../03-configuration-reference/maxtext-parameters.md)
- [Gemma 4 pre-training on MI455X](../04-technical-guides/Gemma4_Bridge_MI455X_README.md): single-GPU gfx1250 Megatron-Bridge proxies for Gemma-4-26B MoE and 31B dense
349 changes: 349 additions & 0 deletions docs/04-technical-guides/Gemma4_Bridge_MI455X_README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/04-technical-guides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Deep technical topics for advanced users.
- [Hybrid models](hybrid-models/README.md): Hylo hybrid hybrid recurrent-attention (Mamba/KDA/GDN + MLA) models, FLA-parity recipes, and checkpoint conversion
- [Native SFT and LoRA](native-sft-lora.md): Megatron-native SFT/LoRA runbook (BF16 / FP8 / FP4), no Megatron-Bridge dependency
- [Native SFT LoRA on MI455X](LoRA_Native_Trainer_MI455_README.md): 1-GPU gfx1250 recipes (Llama-3.2-1B + 70B/72B/235B proxies)
- [Gemma 4 pre-training on MI455X](Gemma4_Bridge_MI455X_README.md): 1-GPU gfx1250 Megatron-Bridge proxies (26B MoE + 31B dense), hipBLASLt Tensile fix

---

Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Deep technical topics for advanced users.
- [Diffusion models](./04-technical-guides/diffusion-models/README.md): Flux diffusion architecture, data pipeline, and FP8 / MXFP4 training
- [Native SFT and LoRA](./04-technical-guides/native-sft-lora.md): Megatron-native SFT/LoRA runbook (BF16 / FP8 / FP4), no Megatron-Bridge dependency
- [Native SFT LoRA on MI455X](./04-technical-guides/LoRA_Native_Trainer_MI455_README.md): 1-GPU gfx1250 native LoRA recipes and launch notes
- [Gemma 4 pre-training on MI455X](./04-technical-guides/Gemma4_Bridge_MI455X_README.md): 1-GPU gfx1250 Megatron-Bridge Gemma 4 proxies and launch notes

### [Operations](./05-operations/)

Expand Down Expand Up @@ -137,6 +138,7 @@ Long-form articles on the reasoning behind Primus features, most of them publish
| Train a diffusion (Flux) model | [Diffusion models](./04-technical-guides/diffusion-models/README.md) |
| Fine-tune with native SFT / LoRA | [Native SFT and LoRA](./04-technical-guides/native-sft-lora.md) |
| Run native LoRA on MI455X (gfx1250) | [Native SFT LoRA on MI455X](./04-technical-guides/LoRA_Native_Trainer_MI455_README.md) |
| Pre-train Gemma 4 on MI455X (gfx1250) | [Gemma 4 pre-training on MI455X](./04-technical-guides/Gemma4_Bridge_MI455X_README.md) |
| Auto-tune my training configuration | [Tuning agent](./02-user-guide/tuning-agent.md) |
| Profile a training run | [Profiling and observability](./04-technical-guides/profiling-and-observability.md) |
| Track experiments (WandB/MLflow/TensorBoard) | [Logging and experiment tracking](./04-technical-guides/logging-and-experiment-tracking.md) |
Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx/_toc.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ subtrees:
title: Native SFT LoRA
- file: 04-technical-guides/LoRA_Native_Trainer_MI455_README.md
title: Native SFT LoRA on MI455X
- file: 04-technical-guides/Gemma4_Bridge_MI455X_README.md
title: Gemma 4 pre-training on MI455X
- file: 04-technical-guides/hybrid-models/README.md
title: Hybrid recurrent-attention models
subtrees:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
work_group: ${PRIMUS_TEAM:amd}
user_name: ${PRIMUS_USER:root}
exp_name: ${PRIMUS_EXP_NAME:gemma4_26b_pretrain}
workspace: ${PRIMUS_WORKSPACE:./output}

modules:
pre_trainer:
framework: megatron_bridge
config: pretrain_trainer.yaml

# Model to run
model: gemma4_26b.yaml

overrides:
stderr_sink_level: DEBUG

# Recipe override: use pretrain config instead of finetune
flavor: gemma4_26b_pretrain_config
dataset: null

# Training configuration
train_iters: 50
global_batch_size: 512
micro_batch_size: 1
seq_length: ${PRIMUS_SEQ_LENGTH:8192}

# Nested overrides
log_interval: 1
eval_interval: 500
eval_iters: 0
skip_save: true

# Optimizer
lr: 1.0e-5
min_lr: 0.0
lr_warmup_iters: 2
lr_decay_iters: null

# Parallelism - MoE with expert parallelism.
# TP=1/EP=8 runs out of memory at this sequence length because the
# non-expert weights are replicated on every rank; TP=2/EP=4 fits.
# TP=1/EP=8 is still usable at shorter sequence lengths, and is the faster
# of the two: the expert all-to-all is latency-bound on small messages, so
# spreading the experts as wide as possible and pushing as many tokens as
# possible through each dispatch both help. Activation recompute is what
# buys the memory for the larger micro-batch:
# PRIMUS_GEMMA4_SET="model.recompute_granularity=full;\
# model.recompute_method=uniform;model.recompute_num_layers=1"
# At seq 4096 with TP=1/EP=8 that reaches micro_batch_size 6.
tensor_model_parallel_size: 2
expert_model_parallel_size: 4 # Critical for 26B MoE
pipeline_model_parallel_size: 1
context_parallel_size: 1
sequence_parallel: true
use_megatron_fsdp: false
enable_primus_turbo: false

# Data
mock: true
data_paths: ${PRIMUS_TOKENIZED_DATA_PATH:null}
train_data_path: null
valid_data_path: null
test_data_path: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
work_group: ${PRIMUS_TEAM:amd}
user_name: ${PRIMUS_USER:root}
exp_name: ${PRIMUS_EXP_NAME:gemma4_26b_sft}
workspace: ${PRIMUS_WORKSPACE:./output}

modules:
post_trainer:
framework: megatron_bridge
config: sft_trainer.yaml

# Model to run
model: gemma4_26b.yaml

overrides:
stderr_sink_level: DEBUG

# Training configuration
train_iters: 100
global_batch_size: 128
micro_batch_size: 1
seq_length: ${PRIMUS_SEQ_LENGTH:2048}

# Nested overrides
log_interval: 1
eval_interval: 50
eval_iters: 10
skip_save: true

# Optimizer
finetune_lr: 1.0e-4
min_lr: 0.0
lr_warmup_iters: 10
lr_decay_iters: null

# Parallelism - MoE with expert parallelism
tensor_model_parallel_size: 1
expert_model_parallel_size: 8 # Critical for 26B MoE
pipeline_model_parallel_size: 1
context_parallel_size: 1
sequence_parallel: false
use_megatron_fsdp: false
enable_primus_turbo: false

# PEFT configuration (LoRA)
peft: lora
peft_dim: 16
peft_alpha: 32

# Data
mock: true
data_paths: ${PRIMUS_TOKENIZED_DATA_PATH:null}
train_data_path: null
valid_data_path: null
test_data_path: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
work_group: ${PRIMUS_TEAM:amd}
user_name: ${PRIMUS_USER:root}
exp_name: ${PRIMUS_EXP_NAME:gemma4_31b_pretrain}
workspace: ${PRIMUS_WORKSPACE:./output}

modules:
pre_trainer:
framework: megatron_bridge
config: pretrain_trainer.yaml

# Model to run
model: gemma4_31b.yaml

overrides:
stderr_sink_level: DEBUG

# Recipe override: use pretrain config instead of finetune
flavor: gemma4_31b_pretrain_config
dataset: null

# Training configuration
train_iters: 50
global_batch_size: 512
micro_batch_size: 1
seq_length: ${PRIMUS_SEQ_LENGTH:8192}

# Nested overrides
log_interval: 1
eval_interval: 500
eval_iters: 0
skip_save: true

# Optimizer
lr: 1.0e-5
min_lr: 0.0
lr_warmup_iters: 2
lr_decay_iters: null

# Parallelism - Dense model with TP and sequence parallelism
# TP=8 is the smallest degree that fits on a single 8xMI300X node;
# TP=4 leaves almost no headroom and TP=2 runs out of memory.
# Two opt-in patches under primus/backends/megatron_bridge/patches/gemma4
# each free activation memory and so allow a larger micro_batch_size, which
# is what throughput on this model is most sensitive to:
# PRIMUS_GEMMA4_DENSE_ATTENTION_BACKEND=te core attention on Transformer
# Engine instead of LocalSpec
# PRIMUS_GEMMA4_FUSED_NORMS=compile fuse the RMSNorm chain and
# drop its fp32 temporaries
# With both enabled at seq 4096, micro_batch_size 6 fits on one node.
tensor_model_parallel_size: 8
expert_model_parallel_size: 1
pipeline_model_parallel_size: 1
context_parallel_size: 1
sequence_parallel: true # Recommended for activation memory
use_megatron_fsdp: false
enable_primus_turbo: false

# Data
mock: true
data_paths: ${PRIMUS_TOKENIZED_DATA_PATH:null}
train_data_path: null
valid_data_path: null
test_data_path: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
work_group: ${PRIMUS_TEAM:amd}
user_name: ${PRIMUS_USER:root}
exp_name: ${PRIMUS_EXP_NAME:gemma4_31b_sft}
workspace: ${PRIMUS_WORKSPACE:./output}

modules:
post_trainer:
framework: megatron_bridge
config: sft_trainer.yaml

# Model to run
model: gemma4_31b.yaml

overrides:
stderr_sink_level: DEBUG

# Training configuration
train_iters: 100
global_batch_size: 128
micro_batch_size: 1
seq_length: ${PRIMUS_SEQ_LENGTH:2048}

# Nested overrides
log_interval: 1
eval_interval: 50
eval_iters: 10
skip_save: true

# Optimizer
finetune_lr: 1.0e-4
min_lr: 0.0
lr_warmup_iters: 10
lr_decay_iters: null

# Parallelism - Dense model with TP
tensor_model_parallel_size: 4 # For LoRA
expert_model_parallel_size: 1
pipeline_model_parallel_size: 1
context_parallel_size: 1
sequence_parallel: false
use_megatron_fsdp: false
enable_primus_turbo: false

# PEFT configuration (LoRA)
peft: lora
peft_dim: 16
peft_alpha: 32

# Data
mock: true
data_paths: ${PRIMUS_TOKENIZED_DATA_PATH:null}
train_data_path: null
valid_data_path: null
test_data_path: null
Loading
Loading