CryptoMoE: Privacy-Preserving and Scalable Mixture of Experts Inference via Balanced Expert Routing

Yifan Zhou, Tianshi Xu, Jue Hong, Ye Wu, Meng Li

TL;DR

CryptoMoE is the first privacy-preserving inference framework designed specifically for Mixture-of-Experts (MoE) large language models. By enforcing balanced expert routing and introducing optimized cryptographic protocols, it protects sensitive routing information while achieving up to a 3.5× latency reduction and 4.3× communication reduction over standard dense baselines with negligible accuracy loss.

What Problem Does This Paper Address?

Private LLM inference frameworks use cryptographic primitives like Homomorphic Encryption (HE) and Secure Multi-Party Computation (MPC) to allow users to run prompts through a cloud-hosted model without revealing their data to the provider, and without the provider revealing model weights to the user. However, existing frameworks only support dense models (like LLaMA-1).

Modern state-of-the-art LLMs (like DeepSeek and Qwen) increasingly use sparse Mixture-of-Experts (MoE) architectures to scale up model capacity without a proportional increase in computing cost. In an MoE model, a "router" directs each token to a small subset of specialized "expert" sub-networks.

The core challenge is that these routing patterns are highly input-dependent. For example, mathematical prompts consistently trigger specific "math experts" while text understanding tasks trigger others.

Figure 1: (a) Structure of MoE-based LLM; (b) Expert activation in 10-th layer of DeepSeekMoE differs notably between text understanding and math reasoning tasks. The underlying data is provided in Appendix A; (c) CryptoMoE features a privacy-preserving balanced expert routing.

If a malicious server observes which experts are activated, it can infer sensitive information about the user's prompt. Simply routing all tokens to all experts to hide the pattern (the "dense baseline") destroys the efficiency of MoE, increasing expert computation by up to 15×.

Methods

CryptoMoE introduces a suite of novel techniques to make private MoE inference both secure and performant:

  • Inference-Time Balanced Expert Routing: To hide the true routing distribution, CryptoMoE forces every expert to process a fixed number of tokens ($t$). If an expert receives fewer than $t$ tokens, it is padded with dummy tokens. If it receives more, the excess tokens are discarded. This makes the workload completely uniform and input-independent.
  • Confidence-Aware Token Selection: Naively discarding excess tokens tanks model accuracy. CryptoMoE mitigates this by re-ranking tokens assigned to an expert based on their routing confidence scores, ensuring that only the top-$t$ most critical tokens are kept.
  • Secure Dispatch and Combine Protocols: The authors designed custom MPC and HE protocols to privately sort tokens to their designated experts and aggregate the outputs back into the original sequence order without leaking any routing choices.
  • Batch Ciphertext-Plaintext Matrix Multiplication (Batch MatMul): Linear layers are the primary bottleneck in HE. Instead of encrypting each expert's tokens separately, CryptoMoE packs partial token embeddings from all experts into a single ciphertext. This drastically reduces the number of expensive homomorphic rotation operations.
Figure 3: The workflow of private MoE layer inference in CryptoMoE.

Datasets

The authors evaluated CryptoMoE across three prominent MoE-based LLM families:

  • DeepSeekMoE-16.4B (activating 6 out of 64 experts)
  • QWenMoE-14.3B (activating 4 out of 60 experts)
  • OLMoE-6.9B (activating 6 out of 60 experts)

The models were tested on eight zero-shot common-sense reasoning benchmarks: SIQA, OBQA, BoolQ, ARC-easy, ARC-challenge, HellaSwag, PIQA, and WinoGrande.

Key Insights and Ideas

  • Routing as a Side-Channel: The dynamic nature of MoE routing acts as a structural privacy leak. Enforcing a rigid, uniform capacity per expert completely plugs this leak.
  • Decoupling Indices from Embeddings: Prior token-pruning methods (like CipherPrune) securely swap entire high-dimensional token embeddings, which is incredibly slow. CryptoMoE's breakthrough is separating token scores from the heavy embeddings during the selection phase. It performs the selection on small index matrices and only manipulates the full embeddings at the very end via efficient HE matrix multiplications.
  • Cross-Expert Packing: Standard HE packing schemes optimize for dense layers but fail on sparse MoE layers because each expert only handles a few tokens. Packing across experts rather than just within a single expert's token pool limits the growth of expensive HE rotations.

Key Results

  • Speed and Efficiency: Compared to a secure dense baseline, CryptoMoE achieves a $2.8\sim3.5\times$ reduction in end-to-end latency and a $2.9\sim4.3\times$ reduction in communication overhead.
  • High Accuracy: CryptoMoE retains 99.2% of the original unencrypted model's accuracy on average, demonstrating that the confidence-aware token selection successfully preserves critical information.
  • Baseline Comparison: When compared against an adapted version of CipherPrune, CryptoMoE cuts communication by up to $4.3\times$ and latency by $2.4\times$.

Limitations and Future Work

  • WAN Bottlenecks: In wide-area network (WAN) environments, the secure Top-$K$ protocol ($\Pi_{topk}$) requires numerous communication rounds, which remains a major latency bottleneck.
  • Short Sequences: The balanced routing strategy is less effective for very short input sequences (e.g., length < 64), where load imbalance across experts is naturally more severe.
  • Memory Overhead: Due to the massive size of LLMs and the overhead of cryptographic secret sharing, memory usage during execution can exceed physical capacity, making memory optimization a critical area for future work.

Summary updated

BibTeX
@inproceedings{zhou2025cryptomoe,
  author = {Yifan Zhou and Tianshi Xu and Jue Hong and Ye Wu and Meng Li},
  title = {{CryptoMoE: Privacy-Preserving and Scalable Mixture of Experts Inference via Balanced Expert Routing}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=8pEqukyGrj},
}
Figure