Brifing

Optimizing Mixture-of-Experts Training for Biological AI Models

NVIDIA's techniques achieve 2.21x throughput gains in foundation model training

Nvidia Developer Blog3 min

1MoE vs dense transformers

Mixture-of-experts architectures differ from dense transformers by activating only a subset of subnetworks per token, enabling more efficient scaling. While dense models process every token through every layer, MoE models selectively route tokens to specialized expert networks. This approach reduces computation for both training and inference as model capacity grows. NVIDIA's implementation specifically targets biological foundation models, which face unique scaling challenges due to their parameter counts and sequence lengths.

2GroupedLinear optimization

NVIDIA's Transformer Engine introduces GroupedLinear to batch expert computations, reducing kernel launch overhead. Instead of iterating through experts in Python loops (like Hugging Face's implementation), it submits multiple expert GEMMs as one grouped operation. Each expert retains its own weight tensor while sharing computation resources. This approach particularly benefits biological models where expert networks may receive varying numbers of tokens, handled through per-expert token counts (split_sizes). The technique shows measurable improvements in GPU utilization.

3MXFP8 memory efficiency

The BioNeMo recipe employs MXFP8 block-scaled 8-bit precision to reduce memory usage compared to BF16. MXFP8 assigns scaling factors to blocks of 32 consecutive values, preserving numerical range while using half the bits. On NVIDIA Blackwell GPUs, this format receives hardware acceleration through specialized Tensor Core instructions. For genomics workloads with long sequences, this memory optimization proves critical, as activation memory becomes a bottleneck during training of large biological foundation models.

4Fused kernel architecture

Transformer Engine's Sequential API combines GroupedLinear, ScaledSwiGLU, and routing-weight scaling into a single fused kernel (ForwardGroupedMLP_CuTeGEMMSwiGLU_MXFP8). This fusion eliminates intermediate materialization steps between operations and incorporates quantization/dequantization directly into the computation path. The approach specifically optimizes the gate-up projections and down projections in MoE architectures, reducing framework overhead while maintaining model accuracy. The fused operations handle both forward and backward passes during training.

5Training benchmark results

On eight NVIDIA B200 Tensor Core GPUs, the optimized BioNeMo recipe achieved up to 2.21x the throughput of the Hugging Face baseline for Mixtral-8x7B training. The implementation combines expert parallelism with MXFP8 precision across multiple GPUs. Users can select between BF16 and MXFP8 based on their hardware capabilities and memory requirements. The recipe supports scaling configurations from two-GPU validation setups to full eight-GPU production training runs with expert parallelism.

6Implementation workflow

The tutorial provides a practical workflow starting with L0_sanity checks on two GPUs, then scaling to full Mixtral-8x7B configurations. Key steps include setting data-parallel and expert-parallel sizes (where their product equals total GPU count), configuring checkpoint directories, and selecting precision formats. The implementation handles both the model architecture (through TEMixtralMXFP8ForCausalLM) and training framework optimizations, demonstrating how to apply these techniques to biological foundation model development.

7Biological modeling implications

These optimizations specifically address challenges in biological sequence modeling, where long sequences and specialized architectures create unique computational demands. The techniques maintain model capacity while improving training efficiency - crucial for domains requiring frequent model updates or large-scale experimentation. The fused operations and memory optimizations enable researchers to work with larger parameter counts and more complex architectures than previously practical on equivalent hardware.

8Future directions

NVIDIA's work establishes a foundation for further MoE optimizations in specialized domains. The techniques demonstrate how hardware-aware algorithm design can dramatically improve training efficiency. As biological foundation models grow in complexity, such optimizations will become increasingly critical. The implementation also provides a template for applying similar approaches to other MoE applications beyond biological sequences, potentially benefiting any domain using large, specialized model architectures.

Original article: Nvidia Developer Blog — Optimizing Mixture-of-Experts Training for Biological AI Models