Skip to navigation

Beam-1.0-501B-A23B

View as MarkdownOpen in Claude

Beam-1.0-501B-A23B is Reflection AI’s text-only sparse Mixture-of-Experts (MoE) language model: 501.3B total parameters with 23.4B activated per token. NeMo AutoModel trains it with a native implementation on the shared MoE stack, with expert parallelism, pipeline parallelism, context parallelism, packed sequences, and a Hugging Face state-dict adapter.

TaskText Generation (MoE, mixed sliding-window and full attention)
ArchitectureBeamForCausalLM (model_type: beam)
Parameters501B total, 23B activated per token
Validated hardwareLoRA: 1 node, 8 H200 GPUs, EP8; LoRA with NVFP4-resident experts: 1 node, 8 H200 GPUs, EP8, and 4 nodes, 32 H200 GPUs, EP32; full-parameter SFT: 8 nodes, 64 H200 GPUs, EP64
HF Orgreflection

Fine-Tune Beam

Follow the installation instructions, then run the LoRA recipe from the repository root on one node of 8x H200 GPUs (141 GB VRAM):

uv run automodel --nproc-per-node=8 examples/llm_finetune/beam/beam_1_0_501b_a23b_tulu3_lora_ep8.yaml

The recipe trains rank-32 LoRA adapters on the attention and dense-MLP projections and on the routed experts with EP8, packed 2,048-token sequences of the Tulu-3 SFT mixture, and a global batch of 64 packs.

To train the same adapters against the frozen experts of an NVFP4 checkpoint instead of the BF16 weights, run the NVFP4 LoRA recipe, which points at Beam-1.0-501B-A23B-NVFP4, an experts-only NVFP4 export of the model quantized with NVIDIA ModelOpt (hf_quant_config.json with quant_algo: NVFP4 and group_size: 16):

uv run automodel --nproc-per-node=8 examples/llm_finetune/beam/beam_1_0_501b_a23b_tulu3_lora_nvfp4_ep8.yaml

With peft.expert_weight_format: nvfp4, the packed FP4 expert weights, their E4M3 block scales, and per-tensor scales load as stored. The packed format uses 0.56 bytes per expert parameter instead of 2 bytes. The grouped expert GEMMs dequantize the weights, so no FP4 tensor cores are needed, and the adapters train against the same expert weights that an NVFP4 inference engine serves. The rest of the checkpoint (dense projections, attention, router, norms, and embeddings) stays in floating point and loads as usual.

This format has the following requirements:

  • Set backend.experts: torch_mm. The torch, DeepEP, and HybridEP expert dispatchers all work; the recipe dispatches with HybridEP like the BF16 LoRA recipe.
  • On more than one GPU, use expert parallelism over the whole non-pipeline mesh. Set ep_size equal to the number of GPUs per pipeline stage, both within a node and across nodes.
  • Save adapters only. Keep checkpoint.save_consolidated: false and merge the adapter into a floating-point checkpoint offline.

The recipe keeps FP32 master weights and FP32 Adam moments for the BF16 adapters with TE FusedAdam.

For full-parameter SFT, run the 8-node recipe on each of 8 nodes of 8x H200 GPUs, with NODE_RANK set from 0 to 7 and MASTER_ADDR set to the first node:

uv run torchrun --nnodes=8 --nproc-per-node=8 --node-rank=$NODE_RANK --master-addr=$MASTER_ADDR --master-port=29500 \
-m nemo_automodel.cli.app examples/llm_finetune/beam/beam_1_0_501b_a23b_tulu3_ep64_8nodes.yaml

It trains all weights with EP64 on the same Tulu-3 data, using 4,096-token packing and a global batch of 64 packs. TE FusedAdam keeps FP32 master weights and Adam moments while the model weights and checkpoints stay BF16. Each checkpoint holds about 6 TB, so checkpoint_dir must be on a shared filesystem.

Choose a Workflow

GoalStart Here
Run the primary recipe for this modelUse the recipe configuration.
Run full-parameter SFT on 8 nodesUse the full-parameter recipe.
Train LoRA against NVFP4-resident expertsUse the NVFP4 LoRA recipe with an experts-only ModelOpt NVFP4 export.
Prepare your environmentFollow the installation instructions.

Configuration

SettingConfiguration
Hardware8x H200 (141 GB)
StrategyFSDP2; tp_size=1, pp_size=1, cp_size=1, ep_size=8
Nodes1
FeaturesCheckpointing (enabled=true), Activation checkpointing (activation_checkpointing=true), LoRA, Packed sequences (packed_sequence_size=2048), Transformer Engine, HybridEP (dispatcher=hybridep)
Advancedbfloat16, attention=te, linear=torch, experts=torch_mm, dispatcher=hybridep

The NVFP4 LoRA recipe keeps this configuration and changes only the checkpoint (an experts-only NVFP4 export) and peft.expert_weight_format: nvfp4.

Model Reference

Model Architecture

PropertyValue
Layers52 (3 dense MLP + 49 MoE)
Hidden size5120
AttentionGQA, 48 query / 8 KV heads, head dim 128, q/k RMSNorm, sigmoid output gate per head
Attention layout43 sliding-window layers (window 512, RoPE) and 9 full-attention layers (NoPE with scalable-softmax query scaling)
MoE256 routed experts, top-8, no shared expert, expert FFN 2560 (SwiGLU)
RouterSigmoid scores with an e_score_correction_bias for selection, grouped top-k (8 groups, top 4), normalized weights, scaling factor 2.5, computed in FP32
NormsSandwich RMSNorm around attention and MLP, depth-scaled residual adds
Vocabulary151,936, untied embeddings and LM head
OutputFinal logit soft-capping at 30.0

Architecture

  • BeamStateDictAdapter converts the per-expert gate_proj, up_proj, and down_proj weights of the Hugging Face checkpoint to the grouped expert layout and back, so exports keep the Hugging Face layout.
  • The router weight and e_score_correction_bias stay FP32 through the model cast, checkpoint load, FSDP2 sharding (their own FP32 unit), and export.
  • Parallelism: EP, FSDP2, PP, and CP are supported; TP is not. Context parallelism requires the TE attention backend. Full-attention layers use TE’s p2p exchange; sliding-window layers use all_gather, or a2a for packed (THD) input, which needs the CP size to divide the 48 query and 8 KV heads (CP 2, 4, or 8).
  • NVFP4-resident experts (peft.expert_weight_format: nvfp4): the routed experts are kept in the ModelOpt NVFP4 checkpoint format (packed FP4 E2M1 codes, one float8_e4m3fn scale per 16 columns, one FP32 scale per tensor) as frozen packed parameters; the Beam state-dict adapter maps the per-expert ModelOpt tensors onto them, so the standard base-checkpoint load fills them in place, also on the expert-parallel sharded path, and the grouped GEMMs dequantize them on the fly in the forward and backward passes. The format needs torch_mm experts, expert parallelism over the whole non-pipeline mesh on several ranks, and adapter-only saves; merged PEFT export and consolidated saves refuse packed experts.
  • Backends: attention te, sdpa, or flex, linear torch or te, experts torch or torch_mm. flex handles only unpadded, unpacked batches: it rejects a padding attention_mask and packed (THD) input, so use te or sdpa for padded or packed data. FP8 uses the existing torchao and TE paths; the grouped experts stay BF16.

Validated Configuration

AreaValidated Configuration
TrainingFull-parameter SFT with FSDP2 and activation checkpointing
OptimizerTE FusedAdam with FP32 master weights (BF16 weights plus 16-bit remainders) and FP32 Adam moments
Distributed setupEP64 / CP1, TP1 / PP1
Workloadallenai/tulu-3-sft-mixture, packed 4,096-token sequences
BatchLocal batch size 1; global batch size 64
Scale8 nodes / 64 H200 GPUs
Duration100 optimizer steps

The full-parameter recipe reduced training loss from 0.6622 at step 0 to 0.5137 at step 99. The mean was 0.5183 over steps 10 to 99, and validation loss fell from 0.4832 after 25 steps to 0.4682 after 100. Peak logged memory was 117.0 GiB per GPU. The run completed without non-finite losses or gradient norms and saved the model and optimizer state after 50 and 100 steps, with about 6 TB per checkpoint. Resuming from the checkpoint saved after 50 steps on the same 8 nodes reproduced the next step’s loss bit-exactly. It stayed within 0.05% of the uninterrupted run over the following 10 steps and did not raise peak memory. This validates the training mechanics, not model convergence.

NVFP4-Resident Experts

AreaValidated Configuration
TrainingRank-128 per-expert LoRA (alpha 256) on the attention and dense-MLP projections and on every routed expert, FSDP2 with activation checkpointing
Expert storageExperts-only ModelOpt NVFP4 export (quant_algo: NVFP4, group_size: 16), loaded packed; the BF16-expert control uses the same adapters on the BF16 checkpoint
OptimizerTE FusedAdam with FP32 master weights and FP32 Adam moments on the adapters, learning rate 1e-4 constant
Distributed setupEP32 / CP1, TP1 / PP1, torch expert dispatcher
Workloadallenai/tulu-3-sft-mixture, packed 4,096-token sequences, the full-parameter recipe’s data, batch, and validation settings
BatchLocal batch size 1; global batch size 64
Scale4 nodes / 32 H200 GPUs per LoRA run; the full-parameter reference ran on 8 nodes / 64 H200 GPUs
Duration100 optimizer steps

On the full-parameter recipe’s Tulu-3 workload, LoRA on the NVFP4-resident experts tracked LoRA on the BF16 experts and the full-parameter run step for step (the three runs consumed the same tokens at every step):

RunResourcesPeak Logged MemoryMean Loss, Steps 90 to 99Validation Loss After 25 / 50 / 75 / 100 StepsMedian Step Time
Full-parameter SFT8 nodes / 64 H200s117.0 GiB0.51660.4832 / 0.4752 / 0.4711 / 0.468213.4 s
LoRA, BF16 experts4 nodes / 32 H200s53.9 GiB0.51560.4784 / 0.4727 / 0.4694 / 0.467213.6 s
LoRA, NVFP4 experts4 nodes / 32 H200s33.3 GiB0.51620.4789 / 0.4732 / 0.4698 / 0.467514.8 s

Across the 100 matched steps, the NVFP4 training loss differed from the BF16-expert LoRA by a mean absolute difference of 0.0006 (maximum 0.0018), and the validation loss differed by at most 0.0006. The on-the-fly dequantization added about 9% to the step time at EP32 (14.8 s compared to 13.6 s). On one node of 8 H200 GPUs (EP8), the base load of the experts-only NVFP4 export (274 GB, 47 GB per rank) took 186 s from a cold network filesystem. The packed experts take 32 GiB per GPU, and a rank-128 run peaked at 94.5 GiB per GPU. The BF16 experts (114 GiB per GPU) do not fit in this configuration.

Numerical Validation

Hugging Face Logit Parity

Logits of the native implementation against the Hugging Face reference on four held-out Tulu-3 conversations of 4,096 tokens (16,384 positions, full vocabulary). Truncated models keep the first N decoder layers plus embeddings, final norm, and LM head.

ModelComputeMean KLLogits cosineTop-1 agreement
First 6 layersFP320.0000000260.99999999100%
First 6 layersBF160.00120.9999590.7%
Full model, 52 layersBF160.00530.992798.4%

The FP32 row shows numerical equivalence; the BF16 rows measure rounding noise, which grows with depth and with near-tie expert selection. Loading the full checkpoint maps all 38,366 tensors with no missing or mismatched entries, and a load, sharded save, and offline consolidation round trip reproduces all 38,366 tensors bit-exactly at EP1, EP2, and EP8.

100-Step LoRA Training

The LoRA recipe, beam_1_0_501b_a23b_tulu3_lora_ep8.yaml, trained for 100 steps on one node with 8 H200 GPUs.

MetricResult
Step 0 loss0.7253
Step 99 loss0.4777
Mean loss, steps 10-990.5110
Validation loss, after 10 / 100 steps0.5272 / 0.4945
Peak logged memory129.7 GiB

The validation loss on 256 held-out conversations fell at every evaluation. The run completed without non-finite losses or gradient norms.

Packed CP1, CP4, and CP8 Training Parity

The full model trained for 100 steps with the same Tulu-3 workload, global batch size 64, EP64, TP1, and PP1, using torch AdamW with BF16 optimizer state. The CP1 reference packs documents with the same per-document alignment as the CP runs.

RunResourcesPeak Logged MemoryStep 99 Loss
CP18 nodes / 64 H200s74.30 GiB0.6219
CP48 nodes / 64 H200s92.67 GiB0.6213
CP88 nodes / 64 H200s91.55 GiB0.6219

Across all 100 matched steps, the CP4 loss curve differed from CP1 by a mean absolute difference of 0.000413 (RMSE 0.000465, maximum 0.0012), and the CP8 curve by 0.000582 (RMSE 0.000880, maximum 0.0022).

Current Scope

  • Tensor parallelism is not supported, and the LM head must stay untied from the embeddings.
  • Packed context parallelism needs CP 2, 4, or 8.
  • NVFP4-resident experts need an experts-only ModelOpt export with 16-column blocks and torch_mm experts (torch, DeepEP, or HybridEP dispatch); on several ranks ep_size must equal the number of GPUs per pipeline stage, and the run saves adapters only (no merged export or consolidated save).