# Spectral-MoE: Heterogeneous Per-Layer Expert Utilization in Dense-to-MoE Conversion

> Spectral-MoE learns per-layer expert utilization budgets during dense-to-MoE conversion, improving accuracy by up to 5.8 points and perplexity by up to 2.96 points over uniform allocation.

- **Source:** [arXiv](https://arxiv.org/abs/2610.19232)
- **Published:** 2026-11-28
- **Permalink:** https://picx.dev/p/HZ9tDF
- **Whiteboard:** https://picx.dev/p/HZ9tDF/image

## Summary

## 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 $L$ FFN layers indexed by $l \in \{0, \ldots, L-1\}$. Each layer contains $E_r$ routed and $E_s$ always-active shared experts, for $E_t = E_r + E_s$ total experts. Each expert contains $m$ neurons, giving FFN width $d_{\mathrm{ffn}} = E_t m$. Per-layer FFN utilization is:

$$
u_l = \frac{E_s + E_l}{E_r + E_s} = \frac{E_s + E_{\mathrm{min}} + f_l}{E_r + E_s}
$$

where $E_l$ is the routed count at layer $l$, $E_{\mathrm{min}}$ is the minimum routed experts, and $f_l = E_l - E_{\mathrm{min}}$ is the free count. The user specifies a nominal utilization $u_{\mathrm{target}}$, which determines the uniform initial routed count $\bar{E}$ and total routed budget $B$:

$$
\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 $\sum_l E_l = B$ for every token.

### Static Per-Layer Allocation

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

- **Hard expert selection**: Uses largest-remainder rounding $\Gamma_B$ to produce integer counts $\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:

$$
\tilde{R}_{te}^{(l)} = \sigma\left(\frac{\epsilon_l - \mathrm{rank}_l(t,e) - \frac{1}{2}}{T}\right) \tag{2}
$$

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

$$
\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 $\mathbf{W}_{\mathrm{in}} \in \mathbb{R}^{L \times (d_{\mathrm{model}} + 1)}$
- Initial head $\mathbf{W}_0 \in \mathbb{R}^{L \times L}$
- Revision heads $\mathbf{W}_l \in \mathbb{R}^{q_l \times (L + q_l)}$ for $1 \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:

$$
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 $R_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

| Model | Base | Allocator | PPL (↓) | Avg. Accuracy |
|-------|------|-----------|---------|---------------|
| Llama-2-7B | Learned | Uniform | 11.61 | 59.9% |
| Llama-2-7B | Learned | Dynamic | **10.57** | **62.8%** |
| Llama-3-8B | Learned | Uniform | 19.40 | 58.5% |
| Llama-3-8B | Learned | Dynamic | **16.44** | **62.3%** |
| Qwen2.5-7B | Learned | Uniform | 16.92 | 57.6% |
| Qwen2.5-7B | Learned | Dynamic | **14.21** | **63.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.

---

_Markdown view of https://picx.dev/p/HZ9tDF, served by PicX — AI-generated visual whiteboard summaries of research papers._
