How does mixture of experts work?
In a standard model every input passes through every parameter. A mixture-of-experts layer instead holds many feed-forward sub-networks, the experts, and a trainable gating network picks a sparse subset of them for each input [1]. Shazeer and colleagues reported in 2017 that a layer with thousands of experts raised model capacity by more than 1000x with only minor losses in efficiency on GPU clusters [1]. They tested models of up to 137 billion parameters on language modelling and machine translation [1].
Why does it need less compute?
Each token uses only a small slice of the model. Mixtral 8x7B is a good example: every layer has 8 experts, and a router network picks 2 of them for each token [2]. The model has 47 billion parameters in total, but only 13 billion are active for any given token during inference [2].
The Switch Transformer paper calls this a sparsely activated model, with a huge parameter count and a constant computational cost [3]. With the same compute budget, its authors report up to 7x faster pre-training than T5-Base and T5-Large, and a 4x speed-up over T5-XXL with trillion-parameter models [3].
What is it often confused with?
It is not an ensemble, where several separate models vote on an answer. The experts live inside one model and are trained together, and the router decides per token which ones run [2].