Blogs / Why a Mixture-of-Experts Model Needs So Much Memory

Why a Mixture-of-Experts Model Needs So Much Memory

Why the Hugging Face post says mixture-of-experts models have a costly memory caveat, how few experts run per token and what pruning does.

  • Learning
  • 1 min read

For: Learners curious about large models.

The cost of having many experts

Mixture-of-Experts (MoE) models have enabled state-of-the-art LLMs to be scaled to hundreds of billions of parameters, but they come with a fundamental and costly caveat: every expert MLP must occupy memory at inference time, even though the vast majority are idle for any given token.[1]

How few experts run per token

However, for any given token, only 8 experts in each layer are actually used.[1]

All experts held inmemorya costly caveatFew experts used pertokenPruningpermanently delete theleast useful expertsshrinks
How many experts does the post say are used for any given token?

What pruning does

Expert pruning is one of the most direct fixes to this memory bottleneck.[1]

That is, permanently delete the least useful experts.[1]

Sources

  1. Higher-Order Pruning of Experts (huggingface.co · checked )

Related concepts

More articles