Who decides which expert works? #
Imagine fitting travel-time observations from two routes. Most trips on one route are short until traffic reaches a particular junction. The second route has a steadier relationship between distance and duration. A model could learn two predictors and a third component that uses the input to decide how much each predictor contributes. Jacobs and colleagues explored this division of labor in a 1991 paper. The gate and the predictors both learned from data.
An expert is a numerical function. The term describes its role in a computation. A researcher may later discover correlations between a routing choice and a language or subject, but the architecture itself supplies no assurance that each expert corresponds to a profession or a human-readable concept.
Activating a subset #
A dense neural layer ordinarily applies the same large parameter blocks to every input. A sparsely gated mixture scores a set of experts and sends an input to a small selected subset. Shazeer and colleagues investigated this arrangement for large networks. Switch Transformers simplified the choice to one expert per token in the mixture layer. Shared parts of the transformer still process those tokens.
For a toy example, consider eight experts with a million parameters apiece. If one processes each token, the model has access to eight million expert parameters across its inputs, while a single token visits one million of them. A real implementation also pays for shared layers, routing, memory and communications. Counting all stored parameters gives a different quantity from counting operations on one token.
The cost of a popular expert #
Suppose a batch contains 100 tokens and most are sent to the same device. That device can limit the speed of the entire batch even while others have unused capacity. Switch Transformers allocated a capacity to each expert, studied what happens when the capacity is exceeded, and used an auxiliary objective to encourage a more balanced distribution. Increasing capacity can reduce overflow while reserving resources that other batches may not use.
Reading a reported speed advantage #
A fair comparison needs a target and a budget. Two models might reach the same loss after different numbers of steps, or take the same number of steps at different wall-clock speeds. A cluster with fast links between processors can make a different design attractive from one that must move data across slow links. The Switch study reported gains in particular training comparisons. To apply such a result to another setting, examine active parameters, batch size, hardware layout, communication and the quality level being matched.
When the experts choose the tokens #
Expert-choice routing reverses the assignment question. Each expert ranks the tokens in a batch and accepts its highest-scoring tokens up to a capacity. Suppose four experts each have two slots for a batch of eight tokens. There are eight expert assignments, yet nothing in that count guarantees one assignment per token. Two experts might select the same token and another token might receive no expert computation in that layer. The fixed quota gives an engineer control over the work allocated to each expert while allowing the work per token to vary.
Yanqi Zhou and colleagues compared this scheme with token-choice routing in language-model training. They reported more than a twofold improvement in convergence time in their comparisons under matched computing resources. Interpreting that result requires the training target and baseline routing method. It is a measurement of how quickly the tested models converged, separate from the latency a reader would experience when requesting a single generated answer.
Sources
- Robert Jacobs and colleagues, Adaptive Mixtures of Local Experts (1991) cs.toronto.eduCited in
- Noam Shazeer and colleagues, Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer (2017) arxiv.org
- William Fedus, Barret Zoph and Noam Shazeer, Switch Transformers (2022) jmlr.org
- Yanqi Zhou and colleagues, Mixture-of-Experts with Expert Choice Routing (2022) arxiv.org