Klotski: Efficient Mixture-of-Expert Inference via Expert-Aware Multi-Batch Pipeline

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Fang, Zhiyuan, Huang, Yuegui, Hong, Zicong, Lyu, Yufeng, Chen, Wuhui, Yu, Yue, Yu, Fan, Zheng, Zibin
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910821850808320
author Fang, Zhiyuan
Huang, Yuegui
Hong, Zicong
Lyu, Yufeng
Chen, Wuhui
Yu, Yue
Yu, Fan
Zheng, Zibin
author_facet Fang, Zhiyuan
Huang, Yuegui
Hong, Zicong
Lyu, Yufeng
Chen, Wuhui
Yu, Yue
Yu, Fan
Zheng, Zibin
contents Mixture of Experts (MoE), with its distinctive sparse structure, enables the scaling of language models up to trillions of parameters without significantly increasing computational costs. However, the substantial parameter size presents a challenge for inference, as the expansion in GPU memory cannot keep pace with the growth in parameters. Although offloading techniques utilise memory from the CPU and disk and parallelise the I/O and computation for efficiency, the computation for each expert in MoE models is often less than the I/O, resulting in numerous bubbles in the pipeline. Therefore, we propose Klotski, an efficient MoE inference engine that significantly reduces pipeline bubbles through a novel expert-aware multi-batch pipeline paradigm. The proposed paradigm uses batch processing to extend the computation time of the current layer to overlap with the loading time of the next layer. Although this idea has been effectively applied to dense models, more batches may activate more experts in the MoE, leading to longer loading times and more bubbles. Thus, unlike traditional approaches, we balance computation and I/O time and minimise bubbles by orchestrating their inference orders based on their heterogeneous computation and I/O requirements and activation patterns under different batch numbers. Moreover, to adapt to different hardware environments and models, we design a constraint-sensitive I/O-compute planner and a correlation-aware expert prefetcher for a schedule that minimises pipeline bubbles. Experimental results demonstrate that Klotski achieves a superior throughput-latency trade-off compared to state-of-the-art techniques, with throughput improvements of up to 85.12x.
format Preprint
id arxiv_https___arxiv_org_abs_2502_06888
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Klotski: Efficient Mixture-of-Expert Inference via Expert-Aware Multi-Batch Pipeline
Fang, Zhiyuan
Huang, Yuegui
Hong, Zicong
Lyu, Yufeng
Chen, Wuhui
Yu, Yue
Yu, Fan
Zheng, Zibin
Machine Learning
Artificial Intelligence
Mixture of Experts (MoE), with its distinctive sparse structure, enables the scaling of language models up to trillions of parameters without significantly increasing computational costs. However, the substantial parameter size presents a challenge for inference, as the expansion in GPU memory cannot keep pace with the growth in parameters. Although offloading techniques utilise memory from the CPU and disk and parallelise the I/O and computation for efficiency, the computation for each expert in MoE models is often less than the I/O, resulting in numerous bubbles in the pipeline. Therefore, we propose Klotski, an efficient MoE inference engine that significantly reduces pipeline bubbles through a novel expert-aware multi-batch pipeline paradigm. The proposed paradigm uses batch processing to extend the computation time of the current layer to overlap with the loading time of the next layer. Although this idea has been effectively applied to dense models, more batches may activate more experts in the MoE, leading to longer loading times and more bubbles. Thus, unlike traditional approaches, we balance computation and I/O time and minimise bubbles by orchestrating their inference orders based on their heterogeneous computation and I/O requirements and activation patterns under different batch numbers. Moreover, to adapt to different hardware environments and models, we design a constraint-sensitive I/O-compute planner and a correlation-aware expert prefetcher for a schedule that minimises pipeline bubbles. Experimental results demonstrate that Klotski achieves a superior throughput-latency trade-off compared to state-of-the-art techniques, with throughput improvements of up to 85.12x.
title Klotski: Efficient Mixture-of-Expert Inference via Expert-Aware Multi-Batch Pipeline
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2502.06888