Optimizing MoE inference on NVIDIA Hopper GPUs with kernel engineering
AWS engineers detail three kernel optimizations for Mixture-of-Experts models on Hopper GPUs, improving throughput by 10% and reducing latency by 9%.
Amazon Web Services engineers have released a technical deep dive into optimizing Mixture-of-Experts (MoE) large language models on NVIDIA Hopper architecture GPUs. Published in October 2026, the report outlines specific kernel-level changes that address hardware inefficiencies during the decode phase of model inference. These optimizations target the unique computational patterns of sparse architectures to reduce latency and improve cost efficiency for AI infrastructure builders.
What happened
Mixture-of-Experts is a sparsely-activated architecture designed to scale model capacity while keeping per-token compute low. However, the operations required for routing tokens to specific experts account for a significant share of total compute time. Inefficiencies in these operations directly increase request latency and operational costs. To address this, AWS focused on fused MoE techniques, which merge token routing, data shuffling, and network calculations into a single batched GPU operation. This approach replaces sequential loop operations but introduces complexity in kernel implementation and debugging.
The engineering team identified that high GPU utilization for this architecture requires hardware-specific optimizations. They implemented three key changes targeting the NVIDIA Hopper GPU architecture, specifically the H200 model. These changes were tested on representative MoE models to measure real-world performance gains. The results showed measurable improvements in both end-to-end throughput and time to first token (TTFT), which are critical metrics for serving large-scale AI applications.
The optimizations were upstreamed to the open-source vLLM library and integrated into the AWS Large Model Inference (LMI) containers. This ensures that developers using these frameworks can benefit from the improvements without needing to write custom CUDA code. The work highlights how low-level hardware constraints can dictate high-level software performance in modern AI systems.
How it works
The first optimization, called Swap-AB, addresses a structural mismatch between MoE matrix dimensions and Hopper GPU hardware constraints. NVIDIA Hopper uses the Warp Group Matrix Multiply Accumulate (WGMMA) instruction, which fixes the matrix row dimension (M) at 64 for parallel thread mapping. During the decode phase, MoE models often process single tokens, resulting in an M dimension of 1. This leaves most of the Tensor Core capacity idle because the hardware expects a minimum block height of 64. By transposing the matrices before multiplication, the large expert dimension (N) is moved to the primary operand slot. This saturates the hardware layout and enables asynchronous prefetching, leading to a 2–4 percent throughput improvement.
The second optimization involves backend routing for FP8 tensor quantization. Profiling revealed that the Triton backend outperforms the default FlashInfer+CUTLASS path for FP8 quantized models on Hopper GPUs. CUTLASS treats scaling, multiplication, and aggregation as discrete operations, causing slow global memory roundtrips. Triton consolidates these steps into a single hardware pass, processing data entirely within fast local registers. This dynamic scheduling handles the variable, thin batch profiles of MoE decode phases more efficiently, yielding a 10 percent end-to-end throughput improvement.
The third optimization eliminates unnecessary just-in-time (JIT) recompilation in Triton. By default, Triton specializes integer arguments, triggering recompilation whenever a parameter like sequence length changes. In multi-GPU clusters, this causes synchronization delays as other GPUs wait for the recompiling unit. Adding do_not_specialize annotations to variable-length parameters removed this overhead. This change improved TTFT by 9 percent on H200 GPUs with 8-way tensor parallelism, smoothing out coordination overhead across the cluster.
Key details
- Swap-AB optimization improves throughput by 2–4 percent by aligning matrix dimensions with Hopper WGMMA constraints.
- Routing FP8 quantized models to the Triton backend instead of CUTLASS yields a 10 percent throughput gain.
- Eliminating JIT recompilation for variable parameters reduces Time to First Token by 9 percent in multi-GPU setups.
- The Swap-AB and recompilation fixes are available in vLLM version 0.24.0 and 0.22.0 respectively.
- The backend routing improvement is included in the AWS LMI v28 container.
- All optimizations target NVIDIA Hopper architecture GPUs, specifically tested on H200 instances.
Why it matters
For engineers building AI infrastructure, these optimizations demonstrate that significant performance gains are still available at the kernel level. As models grow larger and more complex, generic software abstractions often fail to utilize hardware fully. Understanding the specific constraints of GPU architectures, such as the fixed M dimension in Hopper Tensor Cores, allows developers to make targeted changes that yield disproportionate benefits. This is particularly important for MoE models, where the sparse activation pattern creates unique bottlenecks not present in dense networks.
The improvements also highlight the importance of choosing the right backend for specific quantization schemes. Default configurations may not be optimal for all workloads, especially when dealing with low-concurrency or variable batch sizes. By profiling and selecting the appropriate execution path, teams can achieve better resource utilization without altering model architecture. This knowledge is crucial for managing costs in production environments where every percentage point of efficiency translates to significant savings.
Furthermore, the elimination of JIT recompilation underscores the need to treat the compiler as part of the optimization surface. In distributed systems, small delays in one node can cascade into larger latency issues. Simple code annotations can prevent these synchronization penalties, ensuring smoother operation in multi-GPU clusters. This approach requires minimal code change but delivers substantial latency improvements for end users.
What you can do
- Upgrade to vLLM version 0.24.0 or later to benefit from the Swap-AB optimization for MoE models.
- Use AWS LMI v28 container or later to access the improved FP8 backend routing for Hopper GPUs.
- Profile your MoE workloads to determine if switching from CUTLASS to Triton backend improves throughput.
- Add
do_not_specializeannotations to variable-length parameters in Triton kernels to avoid JIT recompilation. - Ensure your infrastructure uses NVIDIA Hopper architecture GPUs to leverage these specific hardware optimizations.
- Monitor Time to First Token metrics in multi-GPU setups to verify the impact of recompilation elimination.



