Spectral-MoE: Heterogeneous Per-Layer Expert Utilization in Dense-to-MoE Conversion
Organizations: Stanford University
Abstract
Large language models impose substantial memory demands and arithmetic costs during inference. Dense-to-mixture-of-experts (MoE) conversion is a model optimization technique that aims to reduce these arithmetic costs. Dense-to-MoE conversion partitions pretrained feed-forward network (FFN) neurons into experts and selects a subset for each token. Leading methods fall into two categories: analytic methods produce a converted model quickly using heuristics, while learning methods produce a model much more slowly by optimizing via gradients. Both approaches, however, fix the same active expert count, or "utilization," at every layer. We introduce Spectral-MoE, which learns to allocate a utilization budget heterogeneously across layers. Its name draws a metaphor between separating a dense FFN into experts and separating a light beam into its spectrum. Spectral-MoE consists of two distinct approaches: a static approach that uses a single per-layer scalar which is shared across tokens, and a dynamic approach which emits a per-token schedule. We demonstrate that both allocators improve performance over uniform on both the analytic-based and learning-based SOTA dense-to-MoE methods. At 25% FFN utilization, dynamic allocation reduces WikiText-2 perplexity relative to uniform by 1.04, 2.96, and 2.71 points on the learned base for Llama-2-7B, Llama-3-8B, and Qwen2.5-7B, respectively. The corresponding reductions on the analytic base are 2.45, 6.26, and 2.17 points. On the learned base, dynamic allocation improves six-task mean accuracy over uniform by an average of 1.5, 4.2, and 3.6 percentage points across the three models at FFN utilizations of 12.5%, 25%, and 50%, respectively. These results establish per-layer expert utilization as a novel optimization axis in dense-to-MoE conversion.
Figures & tables
| FFN Util. | Model | Allocator | PPL ( ) | BoolQ | SciQ | PIQA | WinoG. | ARC-C | HellaS. | Avg. | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| [32, acc] | [0, acc] | [0, acc] | [5, acc] | [25, acc-n] | [10, acc-n] | ||||||
| Llama-2-7B | Uniform | 15.93 | 55.4 | 84.7 | 60.9 | 54.3 | 27.0 | 41.4 | 54.0 | ||
| Dynamic | 14.87 | 60.5 | 85.2 | 60.3 | 53.0 | 26.9 | 44.6 | 55.1 | |||
| Llama-3-8B | Uniform | 27.69 | 59.9 | 84.6 | 60.8 | 52.5 | 25.9 | 39.5 | 53.9 | ||
| Dynamic | 25.46 | 62.1 | 86.3 | 62.6 | 54.5 | 28.2 | 40.9 | 55.8 | |||
| Qwen2.5-7B | Uniform | 23.60 | 53.5 | 84.2 | 63.1 | 55.6 | 28.5 | 41.6 | 54.4 |
| Seed | Router | Overlap | Coverage | BoolQ | SciQ | PIQA | WinoG. | ARC-C | HellaS. | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|
| A | Original | 50.11 | 87.66 | 69.5 | 89.5 | 65.8 | 57.4 | 32.0 | 56.2 | 61.74 |
| Refit | 69.42 | 95.62 | 66.8 | 89.7 | 67.5 | 60.9 | 34.9 | 56.6 | 62.73 | |
| B | Original | 50.02 | 87.66 | 67.1 | 88.8 | 68.4 | 60.5 | 35.8 | 56.5 | 62.84 |
| Refit | 69.53 | 95.66 | 65.4 | 88.4 | 67.8 | 60.8 | 35.8 | 56.6 | 62.48 |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Definition | Symbol | Definition |
|---|---|---|---|
| , | FFN layers and zero-based layer index. | , | Uncommitted layers , and the current layer’s softmax share. |
| , , | Token count, token index, and routed-expert index. | , , | Vector of schedule logits, proposed revisions, and accumulated corrections in . |
| , , | Neurons per expert, FFN width, and residual-stream width. | , , | Committed budget, remainder , and the STE for . |
| , , | Total, routed, and shared experts per layer, with . | , | Feasible integer bounds on the current commitment. |
| , | Minimum routed count and selected routed count at layer . | , , | FFN input, its -normalized vector, and the allocator’s shared-projection output. |
| , | Free count and its layer mean. | , , | Matrices for the shared projection, initial output head, and revision output head. |
| Model | Nominal | Realized | |||||
|---|---|---|---|---|---|---|---|
| Llama-2-7B | 32 | 86 | 11,008 | 10 | 320 | ||
| 21 | 672 | ||||||
| 42 | 1,344 | ||||||
| Llama-3-8B | 32 | 112 | 14,336 | 13 | 416 | ||
| 27 | 864 | ||||||
| 55 | 1,760 |
| Task | Shots | Metric | Examples | Split |
|---|---|---|---|---|
| BoolQ ( Clark et al., 2019 ) | 32 | accuracy | 3,270 | validation |
| SciQ ( Welbl et al., 2017 ) | 0 | accuracy | 1,000 | test |
| PIQA ( Bisk et al., 2019 ) | 0 | accuracy | 1,838 | validation |
| WinoGrande ( Sakaguchi et al., 2019 ) | 5 | accuracy | 1,267 | validation |
| ARC-Challenge ( Clark et al., 2018 ) | 25 | length-normalized accuracy | 1,172 | test |
| HellaSwag ( Zellers et al., 2019 ) | 10 | length-normalized accuracy | 10,042 | validation |
| Learned base | Analytic base | |
|---|---|---|
| Trained tensors | , , allocator | allocator only |
| Frozen | pretrained FFN weights | weights, partition, router |
| Steps / tokens | 3,500 / 458.8M | 1,024 / 4.19M |
| Preceding stage | – | LoRA recovery, 4.19M tokens |
| , peak rate | – | |
| Static peak rate |
| Allocation | Initialization | Step-0 PPL | Final PPL | Six-task avg. (%) |
|---|---|---|---|---|
| Dynamic | seed C | 1115.01 | 10.72 | 62.2 |
| seed A | 1279.96 | 10.59 | 61.7 | |
| seed B (Table ) | 1365.54 | 10.57 | 62.8 |
| Inclusion temperature | Final PPL |
|---|---|
| Uniform control | 16.30 |
| 16.57 | |
| 16.15 | |
| 15.89 |
Mixture-of-Experts Language Models
Mixture-of-Experts language models use input-dependent routing to activate a small subset of expert networks, increasing capacity without proportional compute.
See all 216 papers