$\textit{Read-ME}$: Refactorizing LLMs as Router-Decoupled Mixture of Experts with System Co-Design

Ruisi Cai, Yeonju Ro, Geon-Woo Kim, Peihao Wang, Babak Ehteshami Bejnordi, Aditya Akella, Zhangyang Wang

Abstract

Read-ME is a novel framework that refactorizes pre-trained dense Large Language Models (LLMs) into efficient Mixture-of-Experts (MoE) models. By decoupling routing logic from the model backbone, Read-ME enables system-level optimizations like lookahead scheduling and optimal caching. This approach significantly reduces inference latency in resource-constrained environments while maintaining high performance at a fraction of the traditional training cost.

Introduction

Mixture-of-Experts (MoE) architectures offer high performance through sparse activation. However, they introduce significant system challenges, primarily the routing bottleneck: layer-wise routers prevent efficient weight pre-fetching because the expert for a given layer is unknown until the previous layer completes. This leads to expert fragmentation and high memory traffic. Read-ME addresses these issues by refactoring existing dense models and co-designing the architecture with hardware constraints in mind.

Methodology: Algorithmic Refactoring and System Co-Design

The Read-ME framework integrates algorithmic innovations with system-level optimizations to bridge the gap between model sparsity and hardware efficiency.

The Read-ME pipeline: from dense model refactoring to pre-gated inference serving.

Algorithmic Refactoring

  • Domain-Aware Expert Construction: Instead of training from scratch, Read-ME identifies neuron activation sparsity in dense models (e.g., Llama-2) across specific domains to prune and create specialized experts.
  • Router Decoupling (Pre-gating): A single, lightweight auto-regressive router is placed at the start of the model. This router predicts the entire routing path across all layers before backbone computation begins, removing the layer-by-layer dependency.

System Co-Design

  • Belady-inspired Caching: With the "foresight" provided by the decoupled router, the system implements a near-optimal cache replacement policy for expert weights in GPU memory.
  • Expert-aware Batching: Since the system knows the requirements of all tokens in the queue ahead of time, it can intelligently group tokens that share the same experts, minimizing the number of unique experts that need to be loaded per batch.

Key Insights: Router Redundancy and Training

The feasibility of a single decoupled router rests on the observation of high correlation between expert selections across adjacent layers.

Empirical evidence of router redundancy (b) and the router training mechanism (c).

As shown in Figure 6(b), the mutual information $I(S_i; S_{i-1})$ between layers is high, indicating that expert choice is not independent. This justifies the "pre-gating" approach. Figure 6(c) illustrates how the router is trained to minimize distance between its choices and the optimal experts derived from the frozen pre-trained model.

Experimental Results

Evaluated on Llama2-7B-chat and Mistral-7B using a subset of RedPajama (1.04B tokens), Read-ME demonstrated:

  • Performance: Achieved a 10.1% improvement on MMLU compared to similar-scale dense models.
  • Efficiency: Reduced mean end-to-end latency by 6.1% and tail (p95) latency by 10%.
  • Memory Optimization: In memory-constrained settings, Belady-inspired caching improved latency by up to 30%.

Conclusion

Read-ME proves that "refactorizing" is a viable alternative to training MoEs from scratch. By providing the system with foresight through router decoupling, it enables significant inference speedups without sacrificing model quality. Future work includes extending these optimizations to multi-GPU distributed serving and exploring scaling effects on 70B+ parameter models.

Summary updated

BibTeX
@inproceedings{cai2024textit,
  author = {Ruisi Cai and Yeonju Ro and Geon-Woo Kim and Peihao Wang and Babak Ehteshami Bejnordi and Aditya Akella and Zhangyang Wang},
  title = {{$\textbackslash\{\}textit\{Read-ME\}$: Refactorizing LLMs as Router-Decoupled Mixture of Experts with System Co-Design}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=i8JaxY7tDI},
}
Figure