โ† Open Source

Accelerating MoE with IO and Tile-aware Optimizations.

Python
Momentum
+0stars in 24 hours0.0%
796
Stars
117
Forks
+2
This week
14
Contributors
Created 2025-12-15 ยท Updated 2026-12-01 ยท #17421 today
Top developers
GarlGuotridaoada-cheng
README

SonicMoE: Accelerating MoE with IO and Tile-aware Optimizations

SonicMoE is a simple but blazing-fast Mixture-of-Experts (MoE) implementation optimized for NVIDIA Hopper (SM90), Blackwell datacenter (SM100, e.g. B200/B300), and Blackwell consumer (SM120, e.g. RTX 5090) GPUs. It mainly leverages CuTeDSL and Triton to deliver state-of-the-art performance through IO-aware optimizations. These 2 figures provide an overview of activation memory usage and training throughput on Hopper GPUs (H100) and Blackwell GPUs (B300). The current version of SonicMoE builds on the Grouped GEMM kernels from the QuACK library which is itself built on CUTLASS.

News

  • 04/22/2026: We release a blogpost on SonicMoE's activation memory-efficient and IO-aware design, and how we extend it to Blackwell GPUs through QuACK's software abstraction.

  • 04/19/2026: we release SonicMoE with Blackwell (SM100) support, built on QuACK's Grouped GEMM kernels.

๐ŸŒ Adoption

SonicMoE's kernels and memory-efficient design are used in model training, open-source frameworks, and new MoE implementations. Selected examples include direct integrations, adaptations of our kernels, and projects building on our algorithmic ideas.

Project Adoption Reference
EUROPA โ€” Domyn & Fraunhofer Uses SonicMoE expert kernels for ~1T-parameter MoE training with TorchTitan on JUPITER. Technical blog
Kimi K3 โ€” Moonshot AI Adopts a SonicMoE-inspired backward formulation to reduce MoE activation memory. Technical report
Gravity 16B โ€” Trillion Labs Uses SonicMoE for model training. Technical blog
Transformers Provides SonicMoE as a selectable fused MoE backend through experts_implementation="sonicmoe". Documentation
Liger-Kernel Adapts SonicMoE routing kernels and implements portable Triton GEMM and backward kernels inspired by our paper. Implementation & attribution
Arctic-Platform Incorporates SonicMoE functional kernels, with backward adaptations for frozen expert weights. Implementation & attribution
Marin / Levanter Adapts SonicMoE's Triton gather kernel for the Grug MoE gather/combine backend. Implementation & attribution
prime-rl Integrates the upstream SonicMoE package for fused BF16 expert computation. Documentation
Axolotl / OPTMoE Integrates SonicMoE for expert computation and LoRA training; OPTMoE also incorporates an FP8 functional path from a SonicMoE fork. Documentation ยท Credits
ArchScale Uses SonicMoE to accelerate fine-grained MoE pretraining and architecture research. README & acknowledgments
AsteroMoE Builds on SonicMoE's gather-kernel design for Blackwell MoE kernels. Blog & acknowledgments
TeraMoE Cites SonicMoE as a design inspiration for its cross-node expert-parallel MoE training library. Acknowledgment
ZONOS3-Mini Uses SonicMoE in its expert execution path, including expert adapter support. Implementation

๐Ÿ“ฆ Installation

Prerequisites

  • NVIDIA Hopper GPUs (H100, H200, etc.), Blackwell datacenter GPUs (GB200, B200, B300, etc.), or Blackwell consumer GPUs (e.g. RTX 5090, SM120)
  • CUDA 12.9+ (13.0+ for B300 GPUs)
  • Python 3.12+ recommended
  • PyTorch 2.11+ (2.12 recommended)

Install from pip

pip install sonic-moe

Install from Source

# Clone the repository
git clone https://github.com/Dao-AILab/sonic-moe.git
cd sonic-moe

# Install dependencies
pip install -r requirements.txt

# Install SonicMoE
pip install -e .

๐ŸŽฏ Quick Start

Basic Usage

import torch
from sonicmoe import MoE, KernelBackendMoE
from sonicmoe.enums import ActivationType

# Create MoE layer
moe = MoE(
    num_experts=128,                           # Number of experts
    num_experts_per_tok=8,                     # Top-k experts per token
    hidden_size=4096,                          # Hidden dimension
    intermediate_size=1536,                    # Expert intermediate size
    activation_function=ActivationType.SWIGLU, # SwiGLU activation
    add_bias=False,                            # Add bias to linear layers
    std=0.02,                                  # Weight initialization std
).to(device="cuda", dtype=torch.bfloat16)

# Forward pass
x = torch.randn(32768, 4096, device="cuda", dtype=torch.bfloat16)
output, aux_loss = moe(x, kernel_backend_moe=KernelBackendMoE.sonicmoe)

๐Ÿงช Testing

Run the test suite to verify correctness:

make test

Example usage

  • SonicMoE with TC top-K routing (softmax-over-topk, or softmax(topk(logits))) and interleaved weight layout format for up-proj weights

    python benchmarks/moe-cute.py --thiek 32768,4096,1024,128,8 --activation swiglu
  • SonicMoE with Qwen3-style routing (topk-over-softmax, or topk(softmax(logits))) with topk probabilities renormalization and interleaved weight layout format for up-proj weights

    python benchmarks/moe-cute.py --thiek 32768,4096,1024,128,8 --topk_over_softmax --norm_topk_probs
  • SonicMoE with token rounding routing (SwiGLU activation) and interleaved weight layout format for up-proj weights

    python benchmarks/moe-token-rounding.py --routing nr --thiekq 16384,4096,1024,256,8,128
  • SonicMoE with concatenated weight layout format for up-proj weights

    By default, SonicMoE expects w1 (the gated up-projection weights) in interleaved format: [gate_0, up_0, gate_1, up_1, ...]. HuggingFace models (Qwen3, Mixtral, DeepSeek, etc.) store gate_up_proj in concatenated format: [gate_0, gate_1, ..., gate_{I-1}, up_0, up_1, ..., up_{I-1}].

    # Concatenated weight layout format with TC top-K routing
    python benchmarks/moe-cute.py --thiek 32768,4096,1024,128,8 --concat_layout

๐Ÿค Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ“š Citation

If you use SonicMoE in your research, please cite:

@misc{guo2025sonicmoeacceleratingmoeio,
      title={SonicMoE: Accelerating MoE with IO and Tile-aware Optimizations}, 
      author={Wentao Guo and Mayank Mishra and Xinle Cheng and Ion Stoica and Tri Dao},
      year={2025},
      eprint={2512.14080},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2512.14080}, 
}
Nearby in the ranking

AI Rank for iPhone

Follow AI model rankings

Download on the App Store