Skip to navigation

Ergo

HellaSwag SFT and packed Tulu 3 with context parallelism
View as MarkdownOpen in Claude

Ergo is a text-only Mixture-of-Experts model with approximately 1.106 trillion stored parameters. NeMo AutoModel provides a native model implementation, SentencePiece tokenizer, checkpoint adapter, and distributed fine-tuning recipes for the full 64-layer Ergo checkpoint.

These recipes load a local copy of the published BF16 weights, Amazon-FMR/Ergo-bf16 on Hugging Face.

The complete model finished the HellaSwag and Tulu 3 training runs reported below. These short runs establish training execution for the listed settings. Full-model logits parity with SGLang and strict BF16 reference-gradient parity remain unresolved. The training curves do not establish those numerical gates or downstream model quality.

Model Reference

Model Architecture

PropertyValue
ArchitectureErgoForCausalLM
Model typeergo
TaskText generation; no vision encoder
Stored parametersApproximately 1.106T
Language backbone64 layers, hidden size 8192
AttentionGQA; three local layers followed by one global layer
Local attention512-token causal window, including the current token; interleaved RoPE
Global attentionFull causal attention, without RoPE
Experts256 routed experts, top-8 sigmoid routing, plus a shared expert
Feed-forward activationReLU squared; one leading dense layer, then MoE layers
Source precisionBF16 and FP32 tensors
Embedding and LM headUntied

Attention applies per-head Q/K normalization. Each expert applies its own output RMSNorm before routing-weight multiplication and reduction. Correction bias changes expert selection, while normalized unbiased sigmoid scores weight the selected experts. Correction biases remain fixed during fine-tuning. Residual arithmetic, learned normalization/residual scales, and router arithmetic retain FP32; branch compute can use BF16.

The model-owned tokenizer supports reasoning and tool turns. Chat boundaries use explicit CONTROL IDs, and NeMoAutoTokenizer provides assistant masks for the shared ChatDataset pipeline. Its chat method requires tokenize=True.

Choose a Workflow

GoalBase recipeMeasured configuration
Text SFT, packed 2KHellaSwag SFT128 GB200 GPUs; EP64 / PP2 / CP1; compiled normalization; one epoch, 12 updates
Text SFT, packed 128K with context parallelismTulu 3 with TE context parallelism128 GB200 GPUs; EP64 / PP2 / CP64 overrides; 50 updates
LoRA qualificationHellaSwag LoRATemplate uses EP8 / PP8; no full-release LoRA training curve reported here

The two measured SFT runs train all 64 layers. Both use FSDP2, HybridEP, torch_mm experts, activation checkpointing, and pipeline microbatch size 1. EP overlaps the data/context mesh: EP64 / PP2 / CP64 uses 128 GPUs, not 64 times 2 times 64 GPUs.

Prepare the Checkpoint and Data

Follow the installation instructions and the Slurm cluster guide. The measured environment requires HybridEP, Transformer Engine for FusedAdam and Tulu attention, and Cut Cross-Entropy for the fused loss.

Download Amazon-FMR/Ergo-bf16 (about 2.2 TB) to storage that every worker can read. The weights load as downloaded, with no conversion step: each PP stage and EP rank reads its own layers and experts through the standard weight index. Reuse the same download when changing batch size, learning rate, or parallelism.

Keep runtime code, compiler caches, dataset caches, and logs on node-local storage. The measured runs reused one shared checkpoint, with local metadata/indexes and bounded staging of reusable runtime and dataset archives. They did not copy the entire checkpoint to every node.

HellaSwag

The HellaSwag preprocessor supervises the correct ending and masks context and padding. NEAT packing preserves document boundaries in 2048-token rows. The validation input uses the full validation split: a 1024-example subset packs into too few rows for a complete DP64 batch. With drop_last: true, only complete batches contribute to validation.

Tulu 3: Packed Sequences with Context Parallelism

The Tulu recipe reads packs that are prepared once and saved to disk; it does not tokenize or pack at startup. Packs made with another model’s tokenizer cannot be reused. Prepare them as follows:

  1. Tokenize allenai/tulu-3-sft-mixture with the Ergo tokenizer through ChatDataset, without padding or truncation. Only assistant turns are supervised.
  2. Shuffle the documents with seed 1234.
  3. Pack them into 131,072-token THD rows with pack_dataset. A conversation longer than a row is dropped whole. Each document is aligned to 2 * cp_size tokens: 64 for the recipe’s CP32, 128 for CP64.
  4. Shuffle the packed rows with the same seed and save them at the recipe’s dataset.dataset_path.
import random
from torch.utils.data import Subset
from nemo_automodel import NeMoAutoTokenizer
from nemo_automodel.components.datasets.llm.chat_dataset import ChatDatasetConfig
from nemo_automodel.components.datasets.llm.packed_sequence import pack_dataset
seed = 1234
tokenizer = NeMoAutoTokenizer.from_pretrained("/path/to/Ergo-bf16")
dataset = ChatDatasetConfig(
path_or_dataset_id="allenai/tulu-3-sft-mixture",
split="train",
padding=False,
truncation=False,
unshifted=False,
).build(tokenizer=tokenizer)
indices = list(range(len(dataset)))
random.Random(seed).shuffle(indices)
packs = pack_dataset(
Subset(dataset, indices),
split=None,
packed_sequence_size=131072,
max_packs=416, # 50 updates of 8 rows, plus 16 spare rows
padding_idx=tokenizer.pad_token_id,
drop_long_samples=True,
cp_size=1,
pad_to_multiple_of=64, # 128 for CP64
).shuffle(seed=seed)
packs.save_to_disk("data/ergo_tulu3_packed128k/train")

This step needs the tokenizer files only: no model weights and no GPU.

CP64 requires document alignment to 128 tokens (2 * cp_size). The measured CP64 run used a separately retained 128-aligned dataset; changing only the training YAML does not realign existing packs. Repacking the original 416 rows produced 432 rows while preserving all 63,347 documents and their real token content. Freeze and reuse that aligned dataset and row order for comparisons.

The following launch example assumes the 128-aligned dataset already exists. TE context parallelism distributes each 131,072-token microbatch across 64 ranks, yielding 2048 tokens per rank. THD boundaries preserve causal attention within each document, including the model’s local-attention windows.

Run HellaSwag SFT

Run from a checkout containing the Ergo implementation. Point the checkpoint and dataset variables to locations visible to every worker, and choose a node-local output directory on each node:

export ERGO_CHECKPOINT=/path/to/Ergo-bf16
export ERGO_HELLASWAG_DATASET=/path/to/hellaswag
export ERGO_OUTPUT_DIR=/raid/ergo-output
export WANDB_ENTITY=your-wandb-entity
export WANDB_PROJECT=ergo-finetuning
export WANDB_RUN_ID=ergo-hellaswag-001
export TORCHDYNAMO_DISABLE=0
mkdir -p "${ERGO_OUTPUT_DIR}"

Within a 32-node allocation with four GB200 GPUs per node, run one launcher per node. Set NODE_RANK from 0 to 31 and MASTER_ADDR to the first node’s reachable hostname. Authenticate W&B before launching:

torchrun --nnodes=32 --nproc-per-node=4 \
--node-rank="${NODE_RANK}" \
--rdzv-id="${WANDB_RUN_ID}" \
--rdzv-backend=c10d --rdzv-endpoint="${MASTER_ADDR}:29500" \
-m nemo_automodel.cli.app \
examples/llm_finetune/ergo/ergo_hellaswag_sft_pp2_ep64.yaml \
--model.pretrained_model_name_or_path "${ERGO_CHECKPOINT}" \
--dataset.path_or_dataset="${ERGO_HELLASWAG_DATASET}" \
--validation_dataset.path_or_dataset="${ERGO_HELLASWAG_DATASET}" \
--checkpoint.checkpoint_dir="${ERGO_OUTPUT_DIR}/hellaswag" \
--model.backend.compile_norm=true \
--wandb.enable=true --wandb.mode=online \
--wandb.entity="${WANDB_ENTITY}" --wandb.project="${WANDB_PROJECT}" \
--wandb.id="${WANDB_RUN_ID}" --wandb.name="${WANDB_RUN_ID}" \
--wandb.dir="${ERGO_OUTPUT_DIR}/wandb"

Compiled normalization reduces temporary activation memory in the expert and shared-expert RMSNorm operations. It must run with Dynamo enabled. Both SFT recipes disable checkpoint writing by default; configure checkpoint retention explicitly for training whose updated weights must be saved.

Run Tulu 3 SFT with Packed Sequences and Context Parallelism

The checked-in recipe defaults to 64 GPUs with EP32 / PP2 / CP32. Apply the following overrides for the measured 128-GPU topology, using the aligned packs described above. The completed baseline used eager normalization and disabled Dynamo:

export ERGO_TULU_PACKS=/path/to/ergo-tulu3-128k-aligned128/train
export WANDB_RUN_ID=ergo-tulu3-001
export TORCHDYNAMO_DISABLE=1
torchrun --nnodes=32 --nproc-per-node=4 \
--node-rank="${NODE_RANK}" \
--rdzv-id="${WANDB_RUN_ID}" \
--rdzv-backend=c10d --rdzv-endpoint="${MASTER_ADDR}:29500" \
-m nemo_automodel.cli.app \
examples/llm_finetune/ergo/ergo_tulu3_packed128k_ep32_pp2_cp32_te.yaml \
--model.pretrained_model_name_or_path "${ERGO_CHECKPOINT}" \
--dataset.dataset_path="${ERGO_TULU_PACKS}" \
--distributed.ep_size=64 --distributed.cp_size=64 \
--model.backend.dispatcher_hybridep_max_tokens_per_rank=2048 \
--model.backend.compile_norm=false \
--packed_sequence.pad_to_multiple_of=128 \
--checkpoint.checkpoint_dir="${ERGO_OUTPUT_DIR}/tulu" \
--wandb.enable=true --wandb.mode=online \
--wandb.entity="${WANDB_ENTITY}" --wandb.project="${WANDB_PROJECT}" \
--wandb.id="${WANDB_RUN_ID}" --wandb.name="${WANDB_RUN_ID}" \
--wandb.dir="${ERGO_OUTPUT_DIR}/wandb"

Training Measurements

Both runs completed on OCI HSG using 32 nodes with four GB200 GPUs per node, short QoS, and online W&B logging. Completion reports from all 128 ranks confirmed the expected optimizer updates. Model checkpoint writing was disabled, so these measurements do not qualify full-release checkpoint save/resume.

SettingHellaSwagTulu 3
Job / W&B94788459476973
EP / PP / CP / DP64 / 2 / 1 / 6464 / 2 / 64 / 1
Packing / sequence lengthNEAT / 2048THD / 131,072
Global / local batch128 / 28 / 8
Pipeline1F1B; 32 layers per stageInterleaved1F1B; VPP2; 16 layers per virtual stage
AttentionSDPATransformer Engine
Model / compute dtypeFP32 masters / BF16 computeBF16 model and compute; optimizer FP32 masters
OptimizerAdamW, foreach: falseTE FusedAdam, BF16 moments, parameter remainders
Learning rate1e-4 peak; cosine to 1e-5; 10 warmup steps5e-6; constant after 5 warmup steps
Weight decay / betas / epsilon0.1 / (0.9, 0.95) / 1e-80.1 / (0.9, 0.95) / 1e-8
Compiled normalizationEnabledDisabled
Completed updates12; one packed-loader epoch50
First to last training loss2.2435 to 1.77650.7332 to 0.6113
Validation loss1.8048 after update 10Not measured
Allocation elapsed time14m 49s46m 38s

The HellaSwag run was measured with FP32 master weights in the model and AdamW. The recipe has since moved to BF16 weights with TE FusedAdam, which keeps the FP32 master weights in the optimizer, as the Tulu recipe does. That setting has not been rerun on the full model.

Allocation times include preparation and cleanup; they are not training-only benchmarks. HellaSwag supervises correct endings, while Tulu supervises assistant turns. Their losses therefore measure different objectives and are not directly comparable.

HellaSwag loss

Ergo HellaSwag loss over 12 optimizer updates, with validation after update 10

Every recorded training point is shown without smoothing. The diamond is the single recorded validation result, taken from complete batches of the packed validation split. It is a next-token loss, not HellaSwag multiple-choice accuracy.

Tulu 3 loss: Packed Sequences with CP64

Ergo Tulu 3 packed-sequence training loss over 50 optimizer updates with TE context parallelism at CP64

This is the completed eager-normalization baseline. It must not be interpreted as a result for the later compiled-normalization rerun or the latest PR commit. The fluctuations reflect different packed training batches; no validation curve was collected.

Measurement provenance

Figures use the retained rank-zero training.jsonl records, with loss on the y-axis and step + 1 on the x-axis. HellaSwag’s validation record has logged step: 9, shown as completed update 10.

HellaSwag used the compiled-normalization implementation from 5f06b5ba on its retained runtime baseline. Tulu used the retained runtime based on d8164538. These were packaged runtimes, not clean checkouts of the later PR head b21db815. A Tulu rerun at that head with compiled normalization is separate and is not included in these completed-run measurements.

Distributed and Kernel Support

The measured paths combine FSDP2, HybridEP, torch_mm experts, pipeline parallelism, activation checkpointing, and fused linear cross entropy. Tulu additionally exercises packed TE context parallelism at CP64. Keep dense and MoE reshard_after_forward enabled for these capacity points, and preserve the recipe’s batch, microbatch, and parallelism relationships.

Tensor parallelism greater than one is rejected. Full-release LoRA, other parallel layouts, the advertised 1M context limit, and quantized training are not established by these runs. Reduced-fixture loading, optimizer continuation, and LoRA tests are distinct from full-release qualification.

HybridEP’s BF16 combine and the fused BF16 loss path differ from strict FP32 reference reductions and head backward. Some strict BF16 gradient and attention-reference numerical gates remain failing. Decreasing training loss does not replace those checks. The architecture and protocol reference is SGLang revision bd598c4f927288ea5c2bb9e84359f51d9c0b5aaf (Apache-2.0); full-model serving-logit parity remains unresolved.

See the LLM fine-tuning guide for shared training options.