Mixture-of-Experts Serving: A Comprehensive Summary

Summary (Overview)

  • New formal model: Introduces the Dynamic and Static MoE Serving problems, where a serving system must dynamically allocate GPUs to experts in a Mixture-of-Experts language model, balancing latency cost against reconfiguration overhead.
  • Online algorithm: Presents a polynomial-time O(logk)O(\sqrt{\log k})-competitive online algorithm for Dynamic MoE Serving, where k=nmk = n - m is the number of extra GPUs beyond one per expert.
  • Matching lower bound: Proves an Ω(logk)\Omega(\sqrt{\log k}) barrier for the online dual problem, showing the competitive ratio is tight for the primal-dual analysis framework.
  • Offline results: Gives a polynomial-time constant-factor approximation for Dynamic MoE Serving, a 2-approximation for the Static variant with an integrality gap of 21/m2 - 1/m, and proves NP-hardness with no FPTAS under ETH.
  • Technical contributions: Combines online primal-dual methods with Fenchel duality and KL-divergence regularization, exploiting smoothness of the latency function to improve the competitive ratio from logk\log k to logk\sqrt{\log k}.

Introduction and Theoretical Foundation

Background

Dense language models scale by increasing parameters per token, tying computation to capacity. Mixture-of-Experts (MoE) models break this tie by maintaining multiple expert networks but routing each token to only a few experts. This architecture underlies prominent models including DeepSeek-V3, Mixtral, and Gemini 3 Pro. For instance, DeepSeek-V3 activates only 37 billion of its 671 billion parameters per token.

The MoE Serving Problem

Consider mm experts deployed on n>mn > m GPUs. At each step tt, the system observes the workload rt=(rt,i)i[m]r_t = (r_{t,i})_{i \in [m]} routed to each expert and decides how many GPUs to assign to each. The objective minimizes the sum of two costs:

  1. Latency cost: The time for all experts to finish their workloads:
ft(xt)=maxi[m]rt,i1+xt,if_t(x_t) = \max_{i \in [m]} \frac{r_{t,i}}{1 + x_{t,i}}

where xt,i=ct,i1x_{t,i} = c_{t,i} - 1 is the number of extra GPUs assigned to expert ii (beyond the mandatory one), subject to i[m]xt,i=k=nm\sum_{i \in [m]} x_{t,i} = k = n - m.

  1. Reconfiguration cost: The L1L_1 distance between consecutive configurations:
i[m]xt1,ixt,i\sum_{i \in [m]} |x_{t-1,i} - x_{t,i}|

The total objective over horizon [T][T] is:

t[T](maxi[m]rt,i1+xt,i+i[m]xt1,ixt,i)\sum_{t \in [T]} \left(\max_{i \in [m]} \frac{r_{t,i}}{1 + x_{t,i}} + \sum_{i \in [m]} |x_{t-1,i} - x_{t,i}|\right)

Key Theoretical Properties

The latency function ftf_t satisfies three crucial properties (Lemma 3.3):

  1. Conjugate Pair: For any γtft(xt)\gamma_t \in -\partial f_t(x_t): ft(xt)=γt,xt+1f_t(x_t) = \langle \gamma_t, x_t + \mathbf{1}\rangle

  2. Smoothness: For any θ1\theta \geq 1, if xt,i+1θ(xt,i+1)x_{t,i} + 1 \leq \theta(x'_{t,i} + 1) for all ii, then:

ft(xt)θft(xt)f_t(x'_t) \leq \theta f_t(x_t)

(Doubling GPUs at best halves the cost.)

  1. Sublinearity of conjugate: For any θ(0,1]\theta \in (0,1]:
f^t(θγt)θf^t(γt)\hat{f}_t(\theta\gamma_t) \geq \sqrt{\theta}\,\hat{f}_t(\gamma_t)

where f^t(γt)=infxt0(ft(xt)+xt,γt)\hat{f}_t(\gamma_t) = \inf_{x_t \geq 0}(f_t(x_t) + \langle x_t, \gamma_t\rangle) is the offset Fenchel conjugate.


Methodology

Convex Program Relaxation

The dynamic problem is relaxed to a convex program (PRIMAL):

minimizet[T]ft(xt)+t[T]i[m]yt,i\text{minimize} \quad \sum_{t \in [T]} f_t(x_t) + \sum_{t \in [T]} \sum_{i \in [m]} y_{t,i} subject toi[m]xt,ik,yt,ixt,ixt1,i,xt,i,yt,i0\text{subject to} \quad \sum_{i \in [m]} x_{t,i} \leq k, \quad y_{t,i} \geq x_{t,i} - x_{t-1,i}, \quad x_{t,i}, y_{t,i} \geq 0

With the offset Fenchel dual (DUAL):

maximizetf^t(γt)tkαt\text{maximize} \quad \sum_{t} \hat{f}_t(\gamma_t) - \sum_{t} k\alpha_t subject toγt,i+βt+1,iβt,iαt,0βt,i1,γt,i0,αt0\text{subject to} \quad \gamma_{t,i} + \beta_{t+1,i} - \beta_{t,i} \leq \alpha_t, \quad 0 \leq \beta_{t,i} \leq 1, \quad \gamma_{t,i} \geq 0, \quad \alpha_t \geq 0

Weak duality gives DUALPRIMAL+k\text{DUAL}^\star \leq \text{PRIMAL}^\star + k.

Regularized Greedy Algorithm (Online)

At each step tt, select:

xt=argminxR0m:ixi=k(ft(x)+DKL(x+1xt1+1))x_t = \underset{x \in \mathbb{R}_{\geq 0}^m: \sum_i x_i = k}{\arg\min} \left(f_t(x) + D_{KL}(x + \mathbf{1} \| x_{t-1} + \mathbf{1})\right)

where the KL divergence is:

DKL(uv)=i[m](uilnuiviui+vi)D_{KL}(u\|v) = \sum_{i \in [m]} \left(u_i \ln \frac{u_i}{v_i} - u_i + v_i\right)

The regularization parameter is η=max{1,ln(k+1)}\eta = \max\{1, \ln(k+1)\}, chosen to optimize the competitive ratio. The dual variables are scaled by 1/η1/\eta to restore dual feasibility:

αt=1ηαt,βt,i=1ηlnxt1,i+1k+1,γt=1ηγt\alpha_t = \frac{1}{\eta}\alpha'_t, \quad \beta_{t,i} = -\frac{1}{\eta}\ln\frac{x_{t-1,i} + 1}{k+1}, \quad \gamma_t = \frac{1}{\eta}\gamma'_t

Lazy Threshold Rounding

To convert fractional solutions to integral ones, the paper uses a polynomial-time rounding scheme:

  1. Sample thresholds θi[0,1)\theta_i \in [0,1) independently and uniformly for each expert ii.
  2. Compute lower bounds t,i=max{0,xt,iθi}\ell_{t,i} = \max\{0, \lfloor x_{t,i} - \theta_i\rfloor\}.
  3. Choose xˉt\bar{x}_t satisfying t,ixˉt,imax{t,i,xˉt1,i}\ell_{t,i} \leq \bar{x}_{t,i} \leq \max\{\ell_{t,i}, \bar{x}_{t-1,i}\} with ixˉt,i=k\sum_i \bar{x}_{t,i} = k.

Static Model Rounding

For the static problem, the algorithm solves the convex relaxation, rounds down (xˉi=xi\bar{x}_i = \lfloor x^\star_i\rfloor), and allocates the remaining GPUs arbitrarily.


Empirical Validation / Results

Online Results (Theorem 4.1)

The main results for Dynamic MoE Serving:

  1. Polynomial-time O(logk)O(\sqrt{\log k})-competitive online algorithm
  2. Polynomial-time O(1)-approximation algorithm (offline)

The competitive ratio derivation proceeds as follows:

  • Regularized Greedy ensures reconfiguration cost is bounded by latency cost: iyt,ift(xt)\sum_i y_{t,i} \leq f_t(x_t) (Lemma 4.3).
  • The dual objective satisfies: DUAL12ηPRIMALm\text{DUAL} \geq \frac{1}{2\sqrt{\eta}}\text{PRIMAL} - m.
  • Combining with weak duality: PRIMAL2η(OPT+m+k)\text{PRIMAL} \leq 2\sqrt{\eta} \cdot (\text{OPT} + m + k).
  • With η=max{1,ln(k+1)}\eta = \max\{1, \ln(k+1)\}, the competitive ratio is O(logk)O(\sqrt{\log k}).

The rounding preserves both costs up to constant factors (Lemma 4.4):

  1. ft(xˉt)3ft(xt)f_t(\bar{x}_t) \leq 3 f_t(x_t) (latency cost)
  2. E[xˉtxˉt11]xtxt11\mathbb{E}[\|\bar{x}_t - \bar{x}_{t-1}\|_1] \leq \|x_t - x_{t-1}\|_1 (reconfiguration cost)

Online Dual Hardness (Theorem 5.1)

No online algorithm for the dual problem achieves competitive ratio better than 132lnk\frac{1}{32}\sqrt{\ln k}.

The proof constructs a single-phase instance where only one expert receives workload rt,q=1r_{t,q} = 1 for τ\tau steps. The key gadget functions simplify to:

f^t(γt)={2γt,qγt,q,γt,q[0,1]1,γt,q1\hat{f}_t(\gamma_t) = \begin{cases} 2\sqrt{\gamma_{t,q}} - \gamma_{t,q}, & \gamma_{t,q} \in [0,1] \\ 1, & \gamma_{t,q} \geq 1 \end{cases}

The stopping time τ\tau is the first step where Dτ16τ/lnkD_\tau \leq 16\sqrt{\tau/\ln k}, which is guaranteed to exist (Lemma 5.2). The offline strategy spreads the β-budget evenly: γt,q=1/τ\gamma_{t,q} = 1/\tau, achieving dual value at least τ\sqrt{\tau}. Repeating over RR phases with cyclic expert requests yields the lnk/32\sqrt{\ln k}/32 lower bound.

Static Model Results

ResultValue
Approximation ratio2 (Theorem 6.1)
Integrality gap21m2 - \frac{1}{m} (Theorem 6.2)
HardnessNP-hard; No FPTAS under ETH (Theorem 6.4)

The integrality gap instance uses mm experts, n=2m1n = 2m - 1 GPUs, T=1T = 1 step with uniform workload r1,i=1r_{1,i} = 1. The fractional optimum is m/(2m1)m/(2m-1) while integral optimum is 1.

Hardness reduction: From Densest k-Subgraph (DkS), constructing experts as vertices, n=m+kn = m + k GPUs, and one time step per edge with workload re,i=2r_{e,i} = 2 for endpoints and 1 otherwise. The objective becomes ALG(S)=2EE(S)\text{ALG}(S) = 2|E| - |E(S)|, exactly equivalent to maximizing induced edges.


Theoretical and Practical Implications

Theoretical Contributions

  1. New problem formulation: Provides the first formal theoretical model for MoE serving, capturing the fundamental trade-off between latency and reconfiguration costs.

  2. Improved competitive ratio: The O(logk)O(\sqrt{\log k}) ratio improves on the standard logk\log k achieved by naive regularized greedy approaches, exploiting the specific structure (smoothness) of the latency cost function.

  3. Tight dual barrier: The matching Ω(logk)\Omega(\sqrt{\log k}) lower bound for the dual problem shows the analysis framework is tight, though the primal gap remains open.

  4. Offline complexity: Establishes that the static problem is NP-hard with no FPTAS under ETH, while providing near-optimal approximation algorithms.

Practical Implications

  • DeepSeek-V3 deployment context: The paper directly addresses the practical challenge of periodically recomputing expert placement (currently done every ~10 minutes with simple heuristics), providing principled alternatives with provable guarantees.
  • Dynamic reallocation: Demonstrates that dynamic reconfiguration can be beneficial when done carefully, with the online algorithm automatically balancing latency versus overhead.
  • Static deployment: For systems where reconfiguration is prohibitively expensive, the 2-approximation provides a simple, near-optimal static placement strategy.

Key Technical Insights

  1. Smoothness exploitation: The observation that ft(xt)θft(xt)f_t(x'_t) \leq \theta f_t(x_t) when xt,i+1θ(xt,i+1)x_{t,i} + 1 \leq \theta(x'_{t,i} + 1) enables both the improved competitive ratio and the efficient rounding scheme.

  2. Sublinearity of the conjugate: The property f^t(θγt)θf^t(γt)\hat{f}_t(\theta\gamma_t) \geq \sqrt{\theta}\hat{f}_t(\gamma_t) is crucial for the dual analysis, allowing the scaled dual variables to maintain value.

  3. Hardy's inequality: Used to prove the online dual lower bound, showing that early overcommitment forces a lnk\sqrt{\ln k}-factor loss.


Conclusion

This paper initiates the principled study of Mixture-of-Experts serving through a formal optimization lens. The main contributions are:

  1. A formal model capturing the latency-reconfiguration trade-off in MoE serving.
  2. An O(logk)O(\sqrt{\log k})-competitive online algorithm using regularized greedy with KL divergence, improved from the standard logk\log k by exploiting function smoothness.
  3. A matching Ω(logk)\Omega(\sqrt{\log k}) barrier for the online dual problem, showing the analysis is tight.
  4. Offline algorithms: constant-factor approximation for dynamic, 2-approximation for static, with matching integrality gap.
  5. Hardness results: NP-hardness and no FPTAS under ETH for the static problem.

Future Directions

  • Closing the primal gap: Whether the O(logk)O(\sqrt{\log k}) competitive ratio for the primal problem can be improved or matched by a lower bound remains open.
  • Practical validation: Empirical evaluation of the algorithms on real MoE serving workloads.
  • Extensions: Incorporating additional constraints such as memory limits, heterogeneous GPU types, or communication costs between GPUs.
  • Tighter offline bounds: Improving the constant factor in the offline approximation or closing the gap between the 2-approximation and the 21/m2 - 1/m integrality gap for the static problem.

Related papers