Summary (Overview)

  • Novel optimization axis: Spectral-MoE introduces learnable per-layer expert utilization allocation for dense-to-MoE conversion, adding a third optimization axis alongside expert partitioning and routing.
  • Two allocator tiers: A static allocator learns one scalar per layer shared across tokens, while a dynamic allocator emits per-token schedules—both strictly conserving a user-specified utilization budget.
  • Consistent gains: Dynamic allocation reduces WikiText-2 perplexity over uniform allocation by 1.04–2.96 points (learned base) and 2.17–6.26 points (analytic base) across Llama-2-7B, Llama-3-8B, and Qwen2.5-7B at 25% FFN utilization.
  • SOTA accuracy: On the learned base at 25% utilization, dynamic allocation improves six-task mean accuracy by 3.0–5.8 percentage points over uniform and matches or exceeds published DOT-MoE results.
  • Budget-exact architecture: Both allocators enforce exact per-token budget conservation via straight-through estimators, largest-remainder rounding, and dynamic programming-style feasibility bounds.

Introduction and Theoretical Foundation

Large language models (LLMs) impose substantial memory and arithmetic costs during inference. Dense-to-MoE conversion partitions pretrained feed-forward network (FFN) neurons into experts and selects a subset per token, retaining pretrained weights while reducing active computation. This technique is orthogonal to both quantization and pruning.

Existing dense-to-MoE methods fall into two categories:

  • Analytic methods (e.g., CMoE, MoEfication, LLaMA-MoE-v2): produce converted models quickly using heuristics like clustering of neuron activation patterns.
  • Learning methods (e.g., DOT-MoE, LTE): optimize via slower gradient-based training, jointly learning partitions and routers.

Key limitation addressed: All prior methods fix the same active expert count ("utilization") at every layer. However, research on layer-dependent sensitivity to compression in quantization and pruning motivates heterogeneous per-layer allocation as an optimization axis.

Theoretical foundation: The paper draws a metaphor between separating a dense FFN into experts and separating a light beam into its spectrum—hence the name "Spectral-MoE." The approach builds on straight-through estimators (Bengio et al., 2013) and budget-preserving allocation techniques.

Methodology

Utilization Budget Formulation

Consider LL FFN layers indexed by l∈{0,…,L−1}l \in \{0, \ldots, L-1\}. Each layer contains ErE_r routed and EsE_s always-active shared experts, for Et=Er+EsE_t = E_r + E_s total experts. Each expert contains mm neurons, giving FFN width dffn=Etmd_{\mathrm{ffn}} = E_t m. Per-layer FFN utilization is:

ul=Es+ElEr+Es=Es+Emin+flEr+Esu_l = \frac{E_s + E_l}{E_r + E_s} = \frac{E_s + E_{\mathrm{min}} + f_l}{E_r + E_s}

where ElE_l is the routed count at layer ll, EminE_{\mathrm{min}} is the minimum routed experts, and fl=El−Eminf_l = E_l - E_{\mathrm{min}} is the free count. The user specifies a nominal utilization utargetu_{\mathrm{target}}, which determines the uniform initial routed count Eˉ\bar{E} and total routed budget BB:

Eˉ=⌊utarget(Er+Es)−Es⌉,B=LEˉ,Emin⁡≤Eˉ≤Er(1)\bar{E} = \left\lfloor u_{\mathrm{target}}(E_r + E_s) - E_s \right\rceil, \qquad B = L\bar{E}, \qquad E_{\min} \leq \bar{E} \leq E_r \tag{1}

Both allocators enforce ∑lEl=B\sum_l E_l = B for every token.

Static Per-Layer Allocation

Learns one continuous routed count ϵl\epsilon_l per layer, shared across tokens. Key components:

  • Hard expert selection: Uses largest-remainder rounding ΓB\Gamma_B to produce integer counts E=ΓB(ϵ)\mathbf{E} = \Gamma_B(\boldsymbol{\epsilon}), flooring each count then adding one to layers with the largest fractional parts.
  • Gradients through hard selection: Defines soft inclusion via logistic sigmoid:
R~te(l)=σ(ϵl−rankl(t,e)−12T)(2)\tilde{R}_{te}^{(l)} = \sigma\left(\frac{\epsilon_l - \mathrm{rank}_l(t,e) - \frac{1}{2}}{T}\right) \tag{2}

where T>0T > 0 is the inclusion temperature. The router STE combines the inherited router term with the count-gradient term:

RSTE=R+(P−sg⁡[P])+(R~(l)−sg⁡[R~(l)])(3)\mathbf{R}_{\mathrm{STE}} = \mathbf{R} + (\mathbf{P} - \operatorname{sg}[\mathbf{P}]) + (\tilde{\mathbf{R}}^{(l)} - \operatorname{sg}[\tilde{\mathbf{R}}^{(l)}]) \tag{3}

Dynamic Per-Layer Allocation

Produces per-token schedules revised from current hidden states. The architecture uses:

  • Shared projection Win∈RL×(dmodel+1)\mathbf{W}_{\mathrm{in}} \in \mathbb{R}^{L \times (d_{\mathrm{model}} + 1)}
  • Initial head W0∈RL×L\mathbf{W}_0 \in \mathbb{R}^{L \times L}
  • Revision heads Wl∈Rql×(L+ql)\mathbf{W}_l \in \mathbb{R}^{q_l \times (L + q_l)} for 1≤l≤L−21 \leq l \leq L-2

The schedule computation involves GELU activations, tanh-bounded revisions, and accumulated corrections. Exact budget conservation is achieved through feasibility bounds:

al=max⁡{Emin⁡,Rl−(ql−1)Er},bl=min⁡{Er,Rl−(ql−1)Emin⁡}a_l = \max\{E_{\min}, R_l - (q_l - 1)E_r\}, \qquad b_l = \min\{E_r, R_l - (q_l - 1)E_{\min}\}

where Rl=B−SlR_l = B - S_l is the remaining budget after earlier commitments.

Integration with Conversion Bases

  • Analytic base: Uses CMoE for partition/router, recovers weights with LoRA, then freezes everything while training only the allocator.
  • Learned base: Extends DOT-MoE to jointly train partition affinities, router weights, and allocator parameters while keeping pretrained weights frozen.

Empirical Validation / Results

Experimental Setup

  • Models: Llama-2-7B, Llama-3-8B, Qwen2.5-7B
  • Expert configuration: 128 neurons per expert, giving 86, 112, and 148 experts per layer respectively
  • Evaluation: WikiText-2 test perplexity and six downstream benchmarks (BoolQ, SciQ, PIQA, WinoGrande, ARC-Challenge, HellaSwag)

Key Results at 25% FFN Utilization

ModelBaseAllocatorPPL (↓)Avg. Accuracy
Llama-2-7BLearnedUniform11.6159.9%
Llama-2-7BLearnedDynamic10.5762.8%
Llama-3-8BLearnedUniform19.4058.5%
Llama-3-8BLearnedDynamic16.4462.3%
Qwen2.5-7BLearnedUniform16.9257.6%
Qwen2.5-7BLearnedDynamic14.2163.3%

Utilization Sweep (Learned Base)

Dynamic allocation improves perplexity and accuracy over uniform across all tested utilizations (12.5%, 25%, 50%):

  • 12.5% utilization: Perplexity falls by 1.06–2.46 points; accuracy gains average 1.5 percentage points
  • 25% utilization: Perplexity falls by 1.04–2.96 points; accuracy gains average 4.2 percentage points
  • 50% utilization: Perplexity falls by 0.91–2.55 points; accuracy gains average 3.6 percentage points

Training Stability Analysis

  • Neuron-to-expert turnover: Averages 8.92% over final 500 steps but falls to 0.33% at the final step due to learning-rate decay
  • Router refitting: Closed-form ridge regression refitting showed mixed results (+1.0 and −0.4 percentage points for two seeds), suggesting potential for future improvement

Theoretical and Practical Implications

Theoretical Contributions

  1. New optimization axis: Establishes per-layer expert utilization as a novel, learnable dimension in dense-to-MoE conversion, analogous to how layer-wise sensitivity has informed quantization and pruning research.
  2. Budget-exact allocation: Both allocators strictly conserve the user-specified utilization budget for every token, making the approach practical for deployment with predictable computational costs.
  3. Gradient flow through discrete decisions: Demonstrates effective use of straight-through estimators for both expert selection counts and per-token schedule logits.

Practical Implications

  • Deployment flexibility: Users can specify a target utilization budget and the allocator automatically distributes it optimally across layers.
  • Model-agnostic: Works with both analytic (fast) and learning (accurate) conversion bases, offering a trade-off between conversion time and quality.
  • Negligible overhead: The dynamic allocator adds only 158,942 parameters for Llama-2-7B (32 layers, model width 4096)—negligible compared to billion-scale models.

Conclusion

Spectral-MoE learns per-layer expert utilization during dense-to-MoE conversion under a user-specified budget. Key takeaways:

  1. Static allocation learns a schedule shared across tokens, providing modest but consistent gains over uniform allocation.
  2. Dynamic allocation revises each token's schedule based on hidden states, delivering substantial perplexity and accuracy improvements across all models and utilization levels tested.
  3. The learned schedules combine stable layer averages with context-dependent variation while preserving the same routed budget for every token.
  4. Dynamic allocation exceeds published DOT-MoE mean accuracy on Llama-2-7B and Llama-3-8B and matches it on Qwen2.5-7B.

Future directions: The authors suggest investigating whether stabilizing expert assignments during training improves the joint adaptation of routers and allocators, and exploring additional router-refitting methods that could improve accuracy with minimal token overhead.

Related papers