HAP: Hybrid Adaptive Parallelism for Efficient Mixture-of-Experts Inference

Haoran Lin, Xianzhi Yu, Kang Zhao, Han Bao, Zongyuan Zhan, Ting Hu, Wulong Liu, Zekun Yin, Xin Li, Weiguo LiuarXiv 2025 · DOI

Abstract

Mixture-of-Experts (MoE) models have emerged as a powerful architecture for Large Language Models (LLMs), offering high performance with reduced computational overhead. However, efficient inference remains a challenge due to the limitations of static parallelization strategies. We introduce HAP (Hybrid Adaptive Parallelism), a novel framework that dynamically optimizes MoE inference by tailoring parallel strategies to specific model modules and hardware constraints. By decomposing layers into Attention and Expert modules and utilizing Integer Linear Programming (ILP) for strategy selection, HAP achieves up to a 1.77x speedup over traditional tensor parallelism across various hardware platforms and model families.

Introduction

Modern LLMs like Mixtral and Qwen leverage MoE architectures to scale parameters without a proportional increase in compute. Despite their efficiency, these models are difficult to deploy at scale. Current inference systems typically rely on static parallelism—either Tensor Parallelism (TP) or Expert Parallelism (EP).

This "one-size-fits-all" approach suffers from three primary flaws: it cannot adapt to the differing computational needs of Attention versus Expert modules, it fails to account for mismatched hardware bandwidths (e.g., PCIe vs. NVLink), and it is often suboptimal for the diverse expert counts found in different model families. HAP addresses these issues by treating parallelization as a dynamic optimization problem.

The Case for Adaptive Parallelism

A key insight of the HAP framework is that the optimal parallel strategy changes not only between modules but also between the different stages of a single request.

Latency breakdown for Prefill and Decoding stages, comparing Tensor Parallelism (TP) and Expert Parallelism (EP).

As shown in the latency analysis above, the prefill stage (input processing) is often communication-bound, where strategies like EP can significantly reduce data movement. Conversely, the decoding stage (token generation) is typically compute or memory-bound, making TP more effective. Static systems are unable to bridge this gap, leading to significant performance bottlenecks.

The HAP Framework

HAP introduces a three-pronged approach to optimize inference:

  1. Module Decomposition: HAP splits transformer layers into distinct Attention and Expert modules. This allows the system to apply different strategies (DP, TP, or EP) to each part of the layer simultaneously.
  2. Latency Simulation & ILP Search: To navigate the complex search space of possible strategies, HAP employs high-accuracy simulation models. These models use Floating-Point Operations (FLOPs) and Random Forest regressors to predict compute and communication costs. An Integer Linear Programming (ILP) solver then identifies the combination of strategies that minimizes end-to-end latency within memory constraints.
  3. Dynamic Parallelism Transition: Switching strategies between prefill and decoding usually incurs high overhead. HAP mitigates this by maintaining a 4-bit (INT4) quantized backup of weights in CPU memory. These weights are asynchronously uploaded and dequantized to GPUs as needed, effectively hiding the transition costs.

Experimental Results

The researchers evaluated HAP using several state-of-the-art MoE models, including Mixtral-8x7B, Qwen1.5-MoE, and Qwen2-57B. Testing across NVIDIA A100, A6000, and V100 platforms demonstrated consistent performance gains.

Performance comparison of HAP vs. standard Tensor Parallelism (TP) across Mixtral and Qwen MoE models.

Compared to standard TP-based inference, HAP achieved speedups of 1.68x on A100, 1.77x on A6000, and 1.57x on V100. Furthermore, the framework's simulation models proved highly reliable, with communication error margins within 5% and computational margins below 10%. This accuracy ensures that the ILP solver consistently selects the most efficient execution path.

Conclusion

HAP represents a significant step forward in MoE inference efficiency. By moving away from static partitioning and embracing a hybrid, adaptive approach, it unlocks the full potential of MoE architectures across diverse hardware environments. Future work will focus on extending HAP to multi-node inference and optimizing for real-time dynamic serving scenarios where varying request lengths further complicate the parallelization landscape.

Summary updated

BibTeX
@misc{lin2025hap,
  author = {Haoran Lin and Xianzhi Yu and Kang Zhao and Han Bao and Zongyuan Zhan and Ting Hu and Wulong Liu and Zekun Yin and Xin Li and Weiguo Liu},
  title = {{HAP: Hybrid Adaptive Parallelism for Efficient Mixture-of-Experts Inference}},
  year = {2025},
  eprint = {2508.19373},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.19373},
}
Figure