Skip to main content
Megatron Bridge supports checkpoint conversion, inference, pretraining, full SFT and LoRA PEFT for Beam, a 52-layer sparse mixture-of-experts language model with about 501B parameters. Three dense layers are followed by 49 MoE layers with 256 routed experts each (top-8). Attention alternates five sliding-window layers (window 512, RoPE) with one full-attention NoPE layer, and the last layer uses full attention. See the Beam verification card for the exact commands, revisions, metrics and current verification status.

Supported Variants

The commands below pin the public release revision 06641076793dad51b8907f7eb2a14f4e08fd3ec8.

Modeling

Beam uses the builder-backed API. BeamBridge translates the Hugging Face configuration directly into BeamModelConfig, and BeamModelBuilder constructs a native Megatron-Core HybridModel: each Beam layer is an attention/MLP (or attention/MoE) pair in the hybrid layer pattern. BeamModelProvider remains only as a compatibility path for provider-based callers. The Beam stack spec preserves the published decoder math: GQA (48 query heads, 8 KV heads) with Q/K RMSNorm, a full-width sigmoid attention output gate with a per-head bias, sandwich RMSNorms after attention and after the MLP, depth-scaled residual connections, SSMax query scaling on the NoPE layers, grouped sigmoid routing (8 groups, top-4 groups, normalized top-8 weights, routed scaling 2.5) with an expert bias and FP32 router parameters, and a tanh soft cap of 30 on the output logits. The bridge maps the expert-bias update rate to zero, so fine-tuning and the bounded pretraining recipe keep the published router bias fixed and add no auxiliary load-balancing loss.

Builder-backed configuration

Runtime Requirements

Beam runs on the repository’s default Megatron-Core pin. The bridge adds Beam’s SSMax scaling, attention-gate bias, sandwich norms, depth-scaled residuals and FP32 router parameters on top of an unmodified Megatron-Core HybridModel, so no Megatron-LM branch switch is needed. Transformers 5.20.1 or newer (below 5.21) supplies the native BeamConfig and BeamForCausalLM used for checkpoint loading and Hugging Face reference inference. This minimum applies to Beam; Megatron Bridge’s package-wide Transformers lower bound remains 5.15. Native Beam HF integration tests skip on older Transformers versions, while tests that do not need those classes run. See the repository installation instructions for environment setup. The Slurm launchers require an account, partition, and container image. Set them before running any --executor slurm conversion or train.sh command:
The examples below use the public release revision and relative paths. The training commands are shortened from the card’s commands, which add the pinned dataset revision, seeds, NaN checks and logging options.

Conversion

Bridge uses Transformers’ native Beam configuration for model construction and checkpoint conversion. The BF16 checkpoint is about 1 TB. GPU import and export on H200 use two nodes at EP16, which places about 69 GiB of weights on each GPU; EP8 on one node would need about 127 GiB per GPU and leaves too little headroom.
CPU import and export run in a single process on a host with well over 1 TB of memory and need one runtime GPU (--gpus-per-node 1): Beam’s attention layers are Transformer Engine modules, and Transformer Engine refuses to construct them without CUDA even though the weights stay on CPU. The GPU holds only the CUDA context.

Inference

Megatron generation uses the non-cached legacy full-prefix path on 2 x 8 H200:
Beam’s chat template opens each response in the analysis channel, so short token budgets end before the final channel. To compare the imported checkpoint with Hugging Face, use --task model-comparison with reference logits from a BF16 Hugging Face forward of the same revision (--hf-logits-path). For Hugging Face inference on a single 8 x H200 node, cap each GPU at 110 GiB so Transformers offloads the remaining layers to CPU and leaves room for temporary buffers while loading the per-expert weights:

Recipes

Hardware-qualified library recipes are defined under recipes/beam: These H200 recipes resolve the model and tokenizer from the pinned Hub revision; pass hf_path to use a local checkpoint instead. They use the all-to-all MoE dispatcher and full recompute. Use expert parallelism first: the experts hold about 493B of the 501B parameters, so pipeline parallelism does not lower the memory floor. All-to-all context parallelism needs the KV heads per tensor-parallel rank to be divisible by the context-parallel size, so CP8 runs at TP1. With context parallelism, SFT switches to per-token loss normalization, which is why the 8K SFT layout reaches DP8 without it.

GB200 library recipes

The GB200 variants use four GPUs per node within one NVLink domain. Pretraining, full SFT and LoRA have each completed 100-step validation with the public checkpoint. These variants use HybridEP with natural routing, fixed expert biases, BF16 computation, and FP32 main gradients, master parameters and Adam moments. Pretraining captures attention and router CUDA graphs and selectively recomputes only expert activations to provide memory headroom. It does not recompute the expert projections or communication. Full SFT and LoRA use neither activation recompute nor CUDA graphs. Unlike H200 pretraining, the GB200 pretraining recipe does not use BF16 gradients or optimizer moments; performance comparisons must account for this precision difference. Full SFT and LoRA retain the H200 learning rates, schedules, dataset selection and adapter scope. All three recipes collect Python garbage every 10 updates, disable activation fusion, and set NVTE_ALLOW_NONDETERMINISTIC_ALGO=0. HybridEP uses 32 communication and preprocessing SMs. All three runs recorded in the verification card completed 100 finite updates with no skipped or NaN updates in NeMo 26.10 RC5 with Transformers 5.20.1, verified on 2026-10-18. The table uses the card’s synchronized updates 51–100 measurements, including five garbage-collection cycles and intervening logging. These are separate from the card’s final-ten-step logger averages. Checkpoint writes and evaluation were disabled for these measurements. Each rate uses the slowest rank’s synchronized elapsed time and Bridge’s hybrid-layer model-FLOP estimate; token rates count physical processed tokens, including padding. The LoRA model-work estimate uses the full-training FLOP formula. It is not actual executed LoRA compute or MFU. These runs validate training behavior; they do not establish checkpoint save, adapter export or resume behavior. Offline packing aligns individual sequences to 8 tokens for SFT and 4 for LoRA. The LoRA alignment differs from the H200 recipe’s alignment of 2 and can change pack membership and order. Prepare a separate dataset output for each alignment. Matched performance comparisons must use the same prepared packs and starting checkpoint. The pretraining input is Salesforce/wikitext, configuration wikitext-103-raw-v1, revision b08601e04326c79dfdd32d625aee71d232d685c3, training split. Each nonblank row becomes one document in source order, tokenized with the pinned Beam tokenizer and an appended EOD token: 1,165,029 documents and 125,410,048 tokens. Finetuning uses the recipes’ pinned Tulu3 revision b14afda60f1bbebe55d5d2fa1e4df5042f97f8be, split train[:10000], dataset seed 1234 and model seed 5678. The separate SFT and LoRA packing outputs contain 503 and 500 packs, respectively. Pretraining uses seed 1234 for both the dataset and model. Fine-grained expert communication overlap is disabled because its layer schedule does not execute Beam’s sandwich norms and depth-scaled residuals. Enabling that schedule would change the model’s computation.

Launching the GB200 recipes

Use the imported public checkpoint and keep all GPUs within one NVLink domain. On a Slurm cluster with segment placement, request segment=16 for pretraining/SFT and segment=8 for LoRA, and verify the allocated nodes share one domain. The examples below use four GPUs per node, 16 CPU cores per rank, and 900 GiB of host memory per node. Set the account, partition and container image as described above, and mount the checkpoint and dataset paths. These 100-step training checks disable checkpoint writes and evaluation. They retain the recipes’ performance settings; pretraining uses a shortened 100-step cosine schedule with 40 warmup updates. Finetuning uses each recipe’s pinned Tulu3 configuration and packing alignment. Keep its dataset configuration by omitting --dataset.

H200 training examples

The H200 commands below start from the imported Megatron checkpoint, keep Beam’s routing natural (model.transformer.moe_router_force_load_balancing=false), and raise the collective timeout because rank 0 packs the dataset offline while the other ranks wait.

Supervised Fine-Tuning

For 64K sequences, keep the SFT recipe and switch to all-to-all context parallelism of 8 at TP1: --seq_length 65536 model.transformer.context_parallel_size=8 model.transformer.tensor_model_parallel_size=1 model.transformer.sequence_parallel=false model.transformer.pipeline_model_parallel_size=2 model.transformer.expert_model_parallel_size=64 +dataset.offline_packing_specs.pad_seq_to_mult=16.

Parameter-Efficient Fine-Tuning

The adapter checkpoint holds 208 LoRA matrices (52 attention layers x 2 projections x 2 matrices).

Pretraining

The dataset must be tokenized with Beam’s tokenizer into Megatron’s indexed format. To resume, pass --load_dir work/results/beam-pretrain with checkpoint.ckpt_step=<step> and a new --save_dir.

Storage

Known Limitations

  • Full-checkpoint conversion and inference have not been revalidated with native Transformers 5.20.1 Beam support.
  • The launcher’s distributed CPU export requests no GPU resources and therefore fails for Beam with “TransformerEngine needs CUDA”. Use the single-process CPU commands above with one runtime GPU.
  • Megatron KV-cache inference is not verified; use the legacy full-prefix generation path.
  • Only BF16 recipes are provided; no FP8 recipe is provided.
  • Transformers 5.20.1 or newer (below 5.21) is required for native Beam support.
Last modified on October 20, 2026