In the design-space lesson MoE was one line: enters the total, the active count. Every frontier model of 2026 except the smallest is built on that line, and the line hides almost everything that is hard about MoE. A router must decide, per token, which of experts to use; it must do so without collapsing onto a few experts; the chosen experts live on different GPUs, so the decision turns into network traffic; and the busiest GPU sets the step time for everyone. This lesson follows a token through an MoE layer and stops at each of those places.
The individual reports already have deep dives on single pieces (aux-loss-free balancing in V3, global-batch LBL in Qwen3, Quantile Balancing in K3, multi-round dropless in MAI, LatentMoE in Nemotron 3). Here we put them side by side and ask what each one is reacting to.
The router: four gate functions
For a token representation , the router computes one logit per expert, , turns it into a score for some function , picks the top- set and mixes:
Released configs use four variants.
| score | selection | weights | scale | |
|---|---|---|---|---|
| Qwen3, MAI-Base-1 | softmax over all | top- of | renormalised over | 1 |
| gpt-oss | logits | top- of | softmax over the logits | 1 |
| DeepSeek-V3, Kimi K2/K3 | sigmoid | top- of | renormalised over | 2.5 / 2.827 / 1.0 |
| DeepSeek-V4 | top- of | renormalised over | 2.5 (Pro), 1.5 (Flash) |
config.json: scoring_func, norm_topk_prob, routed_scaling_factor; MAI from T1 §2.1.The first two rows are the same function. With softmax probabilities ,
and since softmax is monotone, the top- of and of coincide. What does differ is what the weights respond to. Softmax weights depend only on logit differences (add a constant to every and nothing changes); sigmoid and √softplus scores are absolute, so the renormalised weight changes when all logits move together. And the softmax gradient couples every expert, , while a sigmoid score has its own gradient per expert. The aux-loss-free paper chose sigmoid because “the sigmoid baseline performs better than the softmax baseline”, and found softmax “more sensitive to load imbalance” (Wang et al., §3 and App. C). V4 swapped sigmoid for without an ablation in the report.
Two consequences of renormalisation matter in practice. The routed weights always sum to , so the router cannot say “this token needs less MoE”; it can only redistribute mass among its choices. And with a shared expert that always contributes with weight 1, sets the routed-to-shared ratio, which is one reading of why DeepSeek uses (the reports do not explain the value).
Fine-grained experts and the shared expert
Split each expert of a top-2-of-16 MoE into four quarter-width experts and route top-8 of 64: parameters and FLOPs are identical, but the number of expert combinations a token can choose goes from to (DeepSeekMoE §3.1). Every 2025–26 frontier MoE is fine-grained: DeepSeek-V3 , Kimi K3 .
Finer experts are not free. Each expert’s GEMM gets smaller (worse hardware efficiency), the router and the per-expert bookkeeping grow with , and the dispatch fans out to more GPUs. MAI measured exactly this tension: putting MoE in every layer won in FLOPs but lost in wall-clock time until they rewrote the MoE kernels (MAI lesson).
A shared expert is an expert every token passes through. DeepSeekMoE’s rationale: “through compressing common knowledge into these shared experts, redundancy among other routed experts will be mitigated”. Not everyone agrees it is needed: Qwen3’s MoE has none, and gpt-oss has none. MAI’s ablation is the most informative statement: with MoE in every layer the model “relies much more heavily on shared experts”, whereas adding shared experts to the interleaved MoE/dense layout “has little or no benefit” (T1 §2.1). Read that way, the dense FFN of an interleaved layout already plays the shared expert’s role.
Load balancing: what each scheme pushes on
An unconstrained router collapses: experts that receive more tokens train faster, become better, and attract more tokens. Even short of collapse, imbalance costs twice: with expert parallelism the most loaded GPU sets the step time, and with finite capacity the overflow is dropped. Five schemes are in use, and they differ in where the pressure acts.
Aux loss (Switch / GShard). With the fraction of routed slots that went to expert (a count, not differentiable) and the mean router probability (differentiable),
It equals at perfect balance and the gradient lowers the probability of overloaded experts. The pressure acts on the router’s logits and, through them, on every layer below: it is a gradient that competes with the language-modelling loss. Switch used ; DeepSeekMoE used – at the expert level plus a device-level term.
Over which tokens? If are computed per micro-batch, and a micro-batch is a handful of packed sequences from one domain, the loss demands balance inside each sequence. Qiu et al. synchronise only the vector over the global batch, which turns the penalty into one on the global load, and report lower perplexity as the “balance batch size” grows (e.g. 5.778 → 5.603 for a 15A2.54B model, BSZ 16 → 512). MAI states it more strongly: “the aggregation strategy [matters] much more than the load balancing loss type” (T1 §2.1).
Aux-loss-free bias (DeepSeek-V3). Add a per-expert bias to the scores for selection only, , keep from the unbiased , and nudge after each step. No gradient touches the model. Wang et al. report at 1B: perplexity 9.56 → 9.50 and global MaxVio 0.72 → 0.04 against the loss-controlled baseline, with . V3 and V4 keep a tiny sequence-wise loss (weight ) next to it.
Quantile Balancing (Kimi K3). The sign update is SignSGD on the dual of the balanced-assignment LP; K3 instead jumps to that coordinate’s exact minimiser: with token cutoffs (the -th biased score), , recentred. No step size (K3 lesson derives it).
Expert choice (each expert picks its top tokens) balances perfectly by construction but uses future tokens of the batch to decide the routing of earlier ones, which “violates” causality for language modelling (Wang et al.); it is not used in the decoder LLMs here.
The figure runs all five on the same synthetic stream. It is a toy with one honest ingredient: an expert’s general usefulness grows with the share of tokens it receives, which is the rich-get-richer loop that makes collapse possible.
설계 공간 레슨에서 MoE는 한 줄이었다. 는 총량에, 는 활성량에 들어간다. 2026년의 프론티어 모델은 가장 작은 것을 빼면 모두 이 한 줄 위에 서 있고, 이 줄은 MoE의 어려운 부분을 거의 다 숨긴다. router는 토큰마다 개 중 어느 개를 쓸지 정해야 하고, 몇몇 expert로 쏠려 무너지지 않아야 한다. 고른 expert들은 서로 다른 GPU에 있으니 그 결정은 네트워크 트래픽이 되고, 가장 바쁜 GPU가 모두의 step 시간을 정한다. 이 레슨은 토큰 하나를 따라 MoE 층을 지나가며 그 지점마다 멈춘다.
개별 보고서 레슨에는 이미 한 조각씩 깊이 다룬 부분이 있다(V3의 aux-loss-free 균형, Qwen3의 global-batch LBL, K3의 Quantile Balancing, MAI의 multi-round dropless, Nemotron 3의 LatentMoE). 여기서는 그것들을 나란히 놓고 각각이 무엇에 대응하는지 묻는다.
Router: gate 함수 네 가지
토큰 표현 에 대해 router는 expert마다 logit 를 계산하고, 어떤 함수 로 점수 를 만들고, top- 집합 를 골라 섞는다.
공개 config는 네 가지 변형을 쓴다.
| 점수 | 선택 | 가중치 | 배율 | |
|---|---|---|---|---|
| Qwen3, MAI-Base-1 | 전체 에 대한 softmax | 의 top- | 에서 재정규화 | 1 |
| gpt-oss | logit | 의 top- | 개 logit의 softmax | 1 |
| DeepSeek-V3, Kimi K2/K3 | sigmoid | 의 top- | 에서 재정규화 | 2.5 / 2.827 / 1.0 |
| DeepSeek-V4 | 의 top- | 에서 재정규화 | 2.5 (Pro), 1.5 (Flash) |
config.json의 scoring_func, norm_topk_prob, routed_scaling_factor. MAI는 T1 §2.1.처음 두 줄은 같은 함수다. softmax 확률 에 대해
이고, softmax는 단조이므로 의 top-와 의 top-는 같다. 다른 것은 가중치가 무엇에 반응하느냐다. softmax 가중치는 logit의 차이에만 의존한다(모든 에 상수를 더해도 그대로다). sigmoid와 √softplus 점수는 절대값이라 모든 logit이 함께 움직이면 재정규화된 가중치 가 바뀐다. 또 softmax의 기울기는 모든 expert를 엮지만() sigmoid 점수는 expert마다 자기 기울기 만 갖는다. aux-loss-free 논문은 “sigmoid 기준선이 softmax 기준선보다 낫다”며 sigmoid를 골랐고, softmax가 “부하 불균형에 더 민감하다”고 보고했다(Wang et al. §3, 부록 C). V4는 보고서에서 ablation 없이 sigmoid를 로 바꿨다.
재정규화의 결과 두 가지가 실제로 중요하다. routed 가중치의 합은 항상 라서 router는 “이 토큰은 MoE가 덜 필요하다”고 말할 수 없고, 개 선택 사이에서 질량을 옮길 수만 있다. 그리고 가중치 1로 늘 더해지는 shared expert가 있으면 가 routed 대 shared 비율을 정한다. DeepSeek가 를 쓰는 이유를 이렇게 읽을 수 있다(보고서는 값의 이유를 설명하지 않는다).
세분화 expert와 shared expert
top-2/16 MoE의 expert 하나를 폭이 1/4인 expert 넷으로 쪼개고 64개 중 top-8을 고르면 파라미터와 FLOPs는 같지만, 토큰이 고를 수 있는 expert 조합 수가 에서 이 된다(DeepSeekMoE §3.1). 2025–26년의 프론티어 MoE는 모두 세분화돼 있다. DeepSeek-V3는 , Kimi K3는 이다.
세분화는 공짜가 아니다. expert마다 GEMM이 작아지고(하드웨어 효율 저하), router와 expert별 관리 비용이 와 함께 늘고, dispatch가 더 많은 GPU로 퍼진다. MAI가 바로 이 긴장을 쟀다. 모든 층에 MoE를 두는 쪽이 FLOPs로는 이겼지만 MoE 커널을 다시 쓰기 전까지는 실제 시간으로 졌다(MAI 레슨).
shared expert는 모든 토큰이 지나가는 expert다. DeepSeekMoE의 근거는 “공통 지식을 shared expert로 압축하면 다른 routed expert들 사이의 중복이 줄어든다”는 것이다. 모두가 필요하다고 보지는 않는다. Qwen3 MoE와 gpt-oss에는 없다. 가장 쓸모 있는 진술은 MAI의 ablation이다. 모든 층이 MoE이면 모델이 “shared expert에 훨씬 크게 의존”하지만, MoE와 dense를 번갈아 두는 구조에 shared expert를 더하면 “이득이 거의 없다”(T1 §2.1). 그렇게 읽으면 번갈이 구조의 dense FFN이 이미 shared expert 역할을 한다.
부하 균형: 각 방식이 미는 곳
제약 없는 router는 무너진다. 토큰을 많이 받은 expert가 더 빨리 학습하고, 더 좋아지고, 더 많은 토큰을 끌어온다. 무너지지 않더라도 불균형은 두 번 비용을 치른다. expert parallel에서는 가장 많이 받은 GPU가 step 시간을 정하고, capacity가 유한하면 넘친 몫은 버려진다. 쓰이는 방식은 다섯 가지이고, 압력이 어디에 작용하는지가 다르다.
aux loss (Switch / GShard). 를 expert 로 간 라우팅 슬롯 비율(개수라서 미분 불가), 를 router 확률의 평균(미분 가능)이라 하면
완전 균형에서 가 되고, 기울기는 과부하 expert의 확률을 낮춘다. 압력은 router의 logit, 그리고 그것을 통해 아래의 모든 층에 작용한다. 언어 모델링 손실과 경쟁하는 기울기다. Switch는 , DeepSeekMoE는 expert 수준에서 –에 device 수준 항을 더했다.
어떤 토큰들 위에서? 를 micro-batch마다 계산하고 micro-batch가 한 도메인에서 온 packed sequence 몇 개라면, 손실은 시퀀스 안에서의 균형을 요구한다. Qiu et al.은 벡터 만 global batch에서 동기화해 벌점을 전역 부하에 대한 것으로 바꾸고, “balance batch size”가 클수록 perplexity가 낮아진다고 보고한다(예: 15A2.54B 모델에서 BSZ 16 → 512일 때 5.778 → 5.603). MAI는 더 강하게 말한다. “집계 방식이 균형 손실의 종류보다 훨씬 중요하다”(T1 §2.1).
aux-loss-free bias (DeepSeek-V3). expert마다 bias 를 점수에 선택용으로만 더해 로 고르고, 는 bias 없는 로 계산하며, 매 step 뒤 로 조금씩 민다. 모델에 닿는 기울기가 없다. Wang et al.은 1B에서 손실 제어 기준선 대비 perplexity 9.56 → 9.50, 전역 MaxVio 0.72 → 0.04를 로 보고한다. V3와 V4는 그 옆에 아주 작은 sequence-wise 손실(가중치 )을 둔다.
Quantile Balancing (Kimi K3). sign 업데이트는 균형 할당 LP의 쌍대에 대한 SignSGD다. K3는 그 좌표의 정확한 최솟값으로 바로 뛴다. 토큰별 cutoff (번째 bias 포함 점수)를 두고 , 그리고 평균을 뺀다. step size가 없다(K3 레슨에서 유도한다).
Expert choice(expert가 자기 top 토큰을 고른다)는 구조상 완전 균형이지만 배치 안의 미래 토큰을 써서 앞 토큰의 routing을 정하므로 언어 모델링의 인과성을 “위반”한다(Wang et al.). 여기의 decoder LLM들은 쓰지 않는다.
아래 그림은 다섯 가지를 같은 합성 토큰 흐름 위에서 돌린다. 장난감이지만 정직한 재료 하나가 들어 있다. expert의 일반적인 쓸모가 받은 토큰 몫과 함께 커진다. routing collapse를 가능하게 하는 부익부 고리다.
What to look for.
- No balancing (grey) drifts to a global MaxVio around 1.5: a few experts carry 2.5× the mean load.
- With one domain per micro-batch (the default), the micro-batch aux loss (amber) reaches the best balance by flattening every domain over all experts: specialisation falls from about 0.65 to about 0.2. The same loss with global statistics (green) keeps specialisation where it was. Switch to mixed micro-batches and the two move much closer together (at default α), which is exactly Qiu et al.’s argument: the damage comes from computing the statistics over one-domain micro-batches.
- The sign-update bias (blue) depends on γ: at γ = 0.001 (the value Wang et al. and V3 use with real models, whose logits are on a different scale) it has barely moved after 150 steps; from about 0.01 up it balances, and larger steps buy little more. Quantile Balancing (red) has no γ and gets there in a few steps. The residual MaxVio of ~0.3 under mixed micro-batches is sampling noise: with only 512 tokens per step, even a perfectly fair router shows some spread.
- Raise α for the aux losses and they balance better while specialisation drops; that trade-off is the “tug of war” the aux-free method was designed to remove. The bias methods never change the weights , so they cannot distort what each expert sees.
The toy’s numbers are not claims about any real model; its job is to make the mechanisms visible. The V3 lesson has a complementary figure in which the domains have fixed affinities.
Capacity, dropping and dropless
Under expert parallelism, each expert (or each GPU) has buffers sized in advance. Switch sets
and tokens beyond it are dropped: “computation is skipped and the token representation is passed directly to the next layer through the residual connection”. A capacity factor above 1 trades memory for fewer drops. The alternative is dropless: process every routed token. That either requires buffers sized for the worst case (memory proportional to the maximum, not the mean, load), variable-size all-to-all and grouped GEMMs, or — MAI-Base-2’s choice — a fixed capacity with extra rounds for the overflow. DeepSeek-V3 drops no tokens in training or inference, relying on good balance; MAI found that even “carefully designed” token dropping with a generous capacity changed which balancing method looked best, and “converged to a fully dropless MoE” (T1 §2.1).
Expert parallelism and the all-to-all
With experts spread over GPUs (expert parallelism, EP), each MoE layer does two all-to-alls: dispatch sends each token’s vector to the GPUs hosting its experts, combine brings the weighted outputs back. Per token and layer, with hidden size and bytes per element:
If experts are picked uniformly at random among experts spread evenly over GPUs, the expected number of distinct GPUs is
so deduplicating per GPU saves little when (7.68 copies instead of 8 for V3’s top-8 over 64 GPUs). What matters more is which links the copies cross: NVLink inside a node is several times faster than the inter-node network. DeepSeek-V3’s node-limited routing first picks at most nodes per token (by the sum of the top affinities on each node) and only then the top- experts inside them, capping the slow inter-node copies at 4 regardless of . V4 dropped that constraint.
볼 것.
- 균형 장치 없음(회색)은 전역 MaxVio 1.5 근처로 흘러간다. 몇몇 expert가 평균의 2.5배를 진다.
- micro-batch마다 도메인이 하나인 기본 설정에서 micro-batch aux loss(황색)는 모든 도메인을 모든 expert에 평평하게 펴서 가장 좋은 균형에 도달한다. 전문화가 약 0.65에서 약 0.2로 떨어진다. 같은 손실을 전역 통계로 계산하면(초록) 전문화가 그대로다. micro-batch를 섞으면 (기본 α에서) 둘이 훨씬 가까워진다. Qiu et al.의 논증이 정확히 이것이다. 피해는 한 도메인짜리 micro-batch 위에서 통계를 내는 데서 온다.
- sign 업데이트 bias(파랑)는 γ에 달려 있다. γ = 0.001(Wang et al.과 V3가 logit 척도가 다른 실제 모델에 쓰는 값)이면 150 step 뒤에도 거의 움직이지 않았고, 약 0.01부터 균형을 맞추며, 그보다 큰 step은 별 이득이 없다. Quantile Balancing(빨강)은 γ가 없고 몇 step 만에 도달한다. 섞인 micro-batch에서 남는 MaxVio ~0.3은 표본 잡음이다. step당 토큰이 512개뿐이라 완벽히 공정한 router도 어느 정도 퍼진다.
- aux loss의 α를 올리면 균형은 나아지고 전문화는 떨어진다. aux-free 방식이 없애려던 “줄다리기”가 이것이다. bias 방식은 가중치 를 바꾸지 않으므로 각 expert가 보는 것을 왜곡할 수 없다.
장난감의 숫자는 실제 모델에 대한 주장이 아니다. 메커니즘을 보이게 하는 것이 목적이다. V3 레슨에는 도메인 affinity가 고정된, 보완적인 그림이 있다.
Capacity, dropping, dropless
expert parallel에서는 expert(또는 GPU)마다 버퍼 크기를 미리 정한다. Switch는
로 두고, 넘친 토큰은 버린다(drop). “계산을 건너뛰고 토큰 표현을 residual 연결로 다음 층에 그대로 넘긴다.” capacity factor를 1보다 크게 하면 메모리를 내고 drop을 줄인다. 대안은 dropless, 라우팅된 토큰을 전부 처리하는 것이다. 최악의 경우에 맞춘 버퍼(평균이 아니라 최대 부하에 비례하는 메모리)와 가변 크기 all-to-all, grouped GEMM이 필요하거나, MAI-Base-2처럼 capacity를 고정하고 넘친 몫을 추가 라운드로 처리한다. DeepSeek-V3는 좋은 균형에 기대어 학습과 추론 모두에서 토큰을 버리지 않는다. MAI는 넉넉한 capacity로 “신중하게 설계한” token dropping조차 어떤 균형 방식이 좋아 보이는지를 바꾼다는 것을 발견하고 “완전 dropless MoE로 수렴했다”(T1 §2.1).
Expert parallel과 all-to-all
개 expert를 GPU 장에 나누면(expert parallelism, EP) MoE 층마다 all-to-all이 두 번 일어난다. dispatch는 토큰 벡터를 그 expert가 있는 GPU로 보내고, combine은 가중된 출력 개를 되가져온다. hidden 크기 , 원소당 바이트이면 토큰·층당
개 expert가 GPU 장에 고르게 있고 개를 무작위로 고르면 서로 다른 GPU 수의 기댓값은
이므로, 이면 GPU별 중복 제거의 이득은 작다(V3의 top-8을 64 GPU에 펼치면 8 대신 7.68). 더 중요한 것은 사본이 어떤 링크를 건너느냐다. 노드 안의 NVLink는 노드 사이 네트워크보다 몇 배 빠르다. DeepSeek-V3의 node-limited routing은 토큰마다 먼저 노드를 최대 개 고르고(각 노드 expert의 상위 개 affinity 합으로), 그 안에서 top- expert를 고른다. 그러면 느린 노드 간 사본은 와 무관하게 4개로 묶인다. V4는 이 제약을 없앴다.
Try: skew 0.6, capacity factor 1.25: token dropping loses a sizeable share of slots, while a multi-round dropless MoE needs 2–3 rounds and a worst-case buffer of about twice the fixed one. k from 2 to 16 at 64 GPUs: per-expert copies grow 8×, distinct GPUs a bit less, distinct nodes saturate at 8. Node limit M = 4: inter-node copies drop to ≤ 4 at the same k. d/ℓ = 2 or 4: the bytes halve or quarter — the LatentMoE trade.
LatentMoE: spend the saved bandwidth on experts
The dispatched vector is the -dimensional token representation. LatentMoE (Elango et al.; used by Nemotron 3, MAI-Base-1/2 and Kimi K3) projects it once to a latent , runs the routed experts in and projects the mixed output back:
The router and the shared expert still see the full (the routing decision is made on the uncompressed representation). Dispatch bytes and every routed expert’s weights shrink by , and the designs spend that factor on more and more-active experts. Kimi K3 makes the bookkeeping exact: , so K3 moves the same bytes per token as K2 while routing to twice as many experts out of 896 (K3 lesson). Nemotron 3 Ultra uses and routes top-22 of 512. The price is two matrices per layer and a rank bottleneck; K3 adds an RMSNorm before because the chain expert blew up activations at 2.8T scale.
Sparsity scaling
With fixed, more experts lowers loss at constant FLOPs: Kimi K2 measured that sparsity 48 needs 1.69× / 1.39× / 1.15× fewer FLOPs than sparsity 8 / 16 / 32 to reach the same validation loss (K2 Figure 5), and stopped at 48 because of infrastructure complexity. The 2026 configs sit in a narrow band:
| Model | routed / active | shared | sparsity | latent | balancing (as reported) |
|---|---|---|---|---|---|
| Qwen3-235B-A22B | 128 / 8 | 0 | 16 | – | global-batch LBL |
| gpt-oss-120b | 128 / 4 | 0 | 32 | – | not stated |
| DeepSeek-V3 | 256 / 8 | 1 | 32 | – | aux-free bias () + seq-wise , node-limited |
| Kimi K2 | 384 / 8 | 1 | 48 | – | bias-based selection (noaux_tc) |
| Qwen3.8-Flash-Next | 512 / 10 | 1 | 51 | – | not stated in the report body |
| Kimi K3 | 896 / 16 | 2 | 56 | 7168 → 3584 | Quantile Balancing |
| DeepSeek-V4-Pro | 384 / 6 | 1 | 64 | – | aux-free bias () + balance loss |
| MAI-Base-1 | 512 / 8 | 0 | 64 | 6656 → 3072 | GShard loss, global aggregation, dropless |
| MAI-Base-2 | 512 / 7 | 1 | 73 | 8704 → 4096 | multi-round dropless |
| Nemotron 3 Ultra | 512 / 22 | 1 | 23 | 8192 → 2048 | not covered here |
The trend from 2025 to 2026 is up and to the right — more experts, more active experts per token, latents to pay for it — with the per-expert width shrinking (Qwen3.8: 640). Sparsity is not the whole story either: Nemotron’s 22-of-512 in a 4× latent is, in bytes and FLOPs, about the same as 5.5-of-128 at full width (Nemotron lesson), but with instead of combinations.
Building it
The NumPy block checks the claims above: the two softmax gates are identical; sigmoid weights are not shift-invariant; the aux-loss gradient (with held constant) matches finite differences and pushes down only the overloaded expert; the combinatorics; capacity drops versus dropless rounds; and the expected fan-out of the all-to-all.
import numpy as np
from math import comb
rng = np.random.default_rng(0)
# ---- 1. four gate functions used by released configs ---------------------------
def topk(scores, k):
return np.argsort(-scores, axis=-1)[..., :k]
def gate_softmax_then_topk(z, k): # Qwen3 / MAI: softmax over all, keep top-k, renormalise
p = np.exp(z - z.max(-1, keepdims=True)); p /= p.sum(-1, keepdims=True)
idx = topk(p, k); w = np.take_along_axis(p, idx, -1)
return idx, w / w.sum(-1, keepdims=True)
def gate_topk_then_softmax(z, k): # gpt-oss: top-k on logits, softmax over the k
idx = topk(z, k); zz = np.take_along_axis(z, idx, -1)
w = np.exp(zz - zz.max(-1, keepdims=True))
return idx, w / w.sum(-1, keepdims=True)
def gate_score_renorm(z, k, f, scale=1.0): # DeepSeek-V3/K2/K3 (sigmoid), V4 (sqrt softplus)
s = f(z); idx = topk(s, k); w = np.take_along_axis(s, idx, -1)
return idx, scale * w / w.sum(-1, keepdims=True)
sigmoid = lambda z: 1 / (1 + np.exp(-z))
sqrt_softplus = lambda z: np.sqrt(np.log1p(np.exp(z)))
z = rng.normal(size=(4, 16))
i1, w1 = gate_softmax_then_topk(z, 4)
i2, w2 = gate_topk_then_softmax(z, 4)
print("softmax->top-k->renorm == top-k->softmax:", np.array_equal(i1, i2) and np.allclose(w1, w2))
i3, w3 = gate_score_renorm(z, 4, sigmoid)
i4, w4 = gate_score_renorm(z, 4, sqrt_softplus)
print("sigmoid and sqrt-softplus pick the same experts (both monotone):", np.array_equal(i3, i4))
print("but give different weights:", np.round(w3[0], 3), "vs", np.round(w4[0], 3), "vs softmax", np.round(w1[0], 3))
_, ws = gate_topk_then_softmax(z + 3.0, 4); _, wg = gate_score_renorm(z + 3.0, 4, sigmoid)
print("shift all logits by +3: softmax weights unchanged:", np.allclose(ws, w2),
"| sigmoid weights unchanged:", np.allclose(wg, w3))
# ---- 2. the Switch/GShard aux loss and its gradient ---------------------------
def lbl(zb, k):
"""E * sum_i f_i P_i over a batch; f from top-k counts (constant), P from softmax (differentiable)."""
E = zb.shape[1]
p = np.exp(zb - zb.max(1, keepdims=True)); p /= p.sum(1, keepdims=True)
f = np.bincount(topk(zb, k).ravel(), minlength=E) / (zb.shape[0] * k)
return E * (f * p.mean(0)).sum(), f, p
zb = rng.normal(size=(256, 8)); zb[:, 0] += 1.5 # expert 0 is popular
L0, f, p = lbl(zb, 2)
E, N = 8, zb.shape[0]
analytic = (E / N) * p * (f - (f * p).sum(1, keepdims=True)) # dLBL/dz_tj with f held fixed
eps, t, j = 1e-6, 3, 0
zp = zb.copy(); zp[t, j] += eps
p2 = np.exp(zp - zp.max(1, keepdims=True)); p2 /= p2.sum(1, keepdims=True)
numeric = (E * (f * p2.mean(0)).sum() - L0) / eps
print(f"\nLBL = {L0:.3f} (1.0 = perfectly balanced); load of expert 0 = {f[0]*E:.2f}x mean")
print(f"dLBL/dz[3,0]: analytic {analytic[t, j]:.6f} numeric {numeric:.6f}")
print("sign of the mean gradient per expert (+ = pushed down):", np.sign(analytic.mean(0)).astype(int))
# ---- 3. combinatorial flexibility --------------------------------------------
print("\nexpert combinations per token, C(E, k):")
for name, E_, k_ in [("16 experts top-2 (DeepSeekMoE baseline)", 16, 2), ("64 experts top-8 (same FLOPs, 4x finer)", 64, 8),
("gpt-oss-120b 128/4", 128, 4), ("DeepSeek-V3 256/8", 256, 8), ("Kimi K2 384/8", 384, 8),
("Kimi K3 896/16", 896, 16), ("Nemotron 3 Ultra 512/22", 512, 22)]:
print(f" {name:40s} {comb(E_, k_):.3e}")
# ---- 4. capacity: token dropping vs dropless rounds ---------------------------
def route_counts(n_tok, E_, k_, skew):
w = rng.permutation((np.arange(E_) + 1.0) ** -skew)
g = np.log(w)[None, :] + rng.gumbel(size=(n_tok, E_)) # Gumbel top-k = sampling without replacement
return np.bincount(np.argpartition(-g, k_, axis=1)[:, :k_].ravel().astype(np.intp), minlength=E_)
print("\nskew CF dropped dropless rounds")
for skew in (0.0, 0.5):
loads = route_counts(8192, 64, 8, skew)
for cf in (1.0, 1.25, 2.0):
cap = cf * loads.sum() / 64 # Switch: capacity = CF * tokens*k / E
print(f"{skew:4.1f} {cf:4.2f} {100*np.maximum(loads-cap, 0).sum()/loads.sum():6.1f}% {int(np.ceil(loads.max()/cap))}")
# ---- 5. all-to-all fan-out: copies per token ---------------------------------
R, k_, E_ = 64, 8, 256 # 64 GPUs (8 nodes x 8), V3-like 256 experts
idx = np.argsort(rng.random((20000, E_)), 1)[:, :k_] # uniform routing
gpus = idx // (E_ // R); nodes = gpus // 8
d_gpu = np.mean([len(set(r)) for r in gpus]); d_node = np.mean([len(set(r)) for r in nodes])
expect = lambda groups: groups * (1 - comb(E_ - E_ // groups, k_) / comb(E_, k_)) # P(group hit) = 1 - C(E-e,k)/C(E,k)
print(f"\nuniform top-{k_} over {R} GPUs: distinct GPUs per token {d_gpu:.2f} (exact {expect(R):.2f}),"
f" distinct nodes {d_node:.2f} (exact {expect(8):.2f}); node-limited routing caps it at M = 4")
print(f"dispatch+combine bytes/token/layer, BF16, d=7168: per expert {2*k_*7168*2/1024:.0f} KiB,"
f" deduplicated per GPU {2*d_gpu*7168*2/1024:.0f} KiB, latent d/2 {d_gpu*7168*2/1024:.0f} KiB")Note in part 2 that the aux-loss gradient is positive only for expert 0: the loss pushes every token’s logit for the popular expert down, regardless of whether that token was well served by it. That is the interference the bias methods avoid. In part 4, a skew of 0.5 already drops 13% of slots at CF = 1.25, which is why the large models went dropless.
A PyTorch MoE layer with a sigmoid router, a selection-only bias updated by sign, a shared expert and dropless dispatch by sorting token slots by expert:
import torch
import torch.nn as nn
import torch.nn.functional as F
class SwiGLU(nn.Module):
def __init__(self, d, f):
super().__init__()
self.w1, self.w3, self.w2 = nn.Linear(d, f, bias=False), nn.Linear(d, f, bias=False), nn.Linear(f, d, bias=False)
def forward(self, x):
return self.w2(F.silu(self.w1(x)) * self.w3(x))
class MoE(nn.Module):
def __init__(self, d, f, n_experts, k, n_shared=1, scale=2.5, bias_lr=1e-3):
super().__init__()
self.router = nn.Linear(d, n_experts, bias=False)
self.experts = nn.ModuleList(SwiGLU(d, f) for _ in range(n_experts))
self.shared = nn.ModuleList(SwiGLU(d, f) for _ in range(n_shared))
self.register_buffer("bias", torch.zeros(n_experts)) # aux-loss-free: used for selection only
self.k, self.scale, self.bias_lr = k, scale, bias_lr
def forward(self, x): # x: [T, d] (flattened tokens)
scores = torch.sigmoid(self.router(x).float()) # [T, E], router in fp32
idx = torch.topk(scores + self.bias, self.k, dim=-1).indices
w = scores.gather(-1, idx)
w = (self.scale * w / w.sum(-1, keepdim=True)).to(x.dtype) # weights from unbiased scores
# dropless dispatch: sort the T*k slots by expert id, run each expert on its contiguous slice
flat = idx.flatten()
order = flat.argsort()
counts = torch.bincount(flat, minlength=len(self.experts)).tolist()
tok = order // self.k # which token each sorted slot belongs to
wts = w.flatten()[order].unsqueeze(-1)
y = torch.zeros_like(x)
start = 0
for e, n in enumerate(counts):
if n:
t = tok[start:start + n]
y.index_add_(0, t, self.experts[e](x[t]) * wts[start:start + n])
start += n
if self.training: # sign update of the bias, once per step
with torch.no_grad(): # (all-reduce `load` across ranks in DP/EP)
load = torch.tensor(counts, device=x.device, dtype=torch.float32)
self.bias += self.bias_lr * torch.sign(load.mean() - load)
return y + sum(s(x) for s in self.shared)
moe = MoE(d=64, f=32, n_experts=16, k=4)
print(moe(torch.randn(10, 64)).shape) # torch.Size([10, 64])A team trains with a GShard-style aux loss computed per micro-batch, and each micro-batch packs a few long documents of one domain. The experts end up nearly uniform across domains. Which single change most directly addresses this?
Computed per micro-batch, penalises imbalance within a one-domain micro-batch, i.e. it asks each domain to use every expert equally, which forbids specialisation. Synchronising over the global batch (a single -vector all-reduce) turns it into a penalty on the global load only (Qiu et al.; Qwen3, MAI). Raising α makes it worse; the gate function and capacity do not change what is being balanced.
Kimi K3 routes 16 of 896 experts with a 3584-wide latent (d = 7168). Compared with Kimi K2 (8 of 384, no latent), the dispatch bytes per token are…
Dispatch carries one vector per routed expert (before deduplication): K2 sends numbers, K3 sends . LatentMoE halves the vector and the design spends the saving on doubling (and the expert count), so communication stays flat while the combinatorial capacity explodes.
Summary
- The gate: softmax-then-top-k with renormalisation equals top-k-then-softmax; sigmoid and √softplus scores are absolute rather than relative; renormalised weights always sum to the scale λ.
- Fine-grained experts buy combinatorial flexibility () at constant FLOPs; shared experts matter most when every layer is MoE.
- Balancing schemes differ in where they push: aux loss on the router gradient (and its scope, micro or global batch, decides whether it kills specialisation), bias methods on selection only, Quantile Balancing with an exact one-step bias.
- Capacity turns imbalance into dropped tokens or extra rounds; frontier models are dropless.
- All-to-all bytes ≈ 2 · copies · d · b; node-limited routing caps the expensive copies, LatentMoE shrinks d and spends the saving on more experts and a larger k.
해 볼 것. skew 0.6, capacity factor 1.25: token dropping은 슬롯의 상당 부분을 잃고, multi-round dropless MoE는 2–3 라운드와 고정 버퍼의 약 두 배인 최악 버퍼가 필요하다. GPU 64장에서 k를 2에서 16으로: expert별 사본은 8배가 되고, 서로 다른 GPU 수는 그보다 조금 덜, 노드 수는 8에서 포화한다. 노드 제한 M = 4: 같은 k에서 노드 간 사본이 4 이하로 떨어진다. d/ℓ = 2 또는 4: 바이트가 절반, 1/4이 된다. 이것이 LatentMoE의 거래다.
LatentMoE: 아낀 대역폭을 expert에 쓴다
dispatch되는 벡터는 차원 토큰 표현이다. LatentMoE(Elango et al.; Nemotron 3, MAI-Base-1/2, Kimi K3가 사용)는 그것을 latent 로 한 번 투영하고, routed expert를 에서 돌리고, 섞은 출력을 다시 올린다.
router와 shared expert는 여전히 온전한 를 본다(routing 결정은 압축 전 표현에서 내린다). dispatch 바이트와 모든 routed expert의 가중치가 배 줄고, 설계들은 그 배수를 expert 수와 활성 expert 수에 쓴다. Kimi K3의 회계가 정확하다. 이라 K3는 토큰당 K2와 같은 바이트를 옮기면서 896개 중 두 배 많은 expert로 보낸다(K3 레슨). Nemotron 3 Ultra는 이고 512개 중 top-22다. 대가는 층마다 행렬 두 개와 rank 병목이다. K3는 expert 사슬이 2.8T 규모에서 activation을 폭발시켰기 때문에 앞에 RMSNorm을 넣었다.
Sparsity scaling
를 고정하고 expert를 늘리면 FLOPs가 같은 채로 손실이 내려간다. Kimi K2는 같은 검증 손실에 도달하는 데 sparsity 48이 sparsity 8 / 16 / 32보다 1.69배 / 1.39배 / 1.15배 적은 FLOPs가 든다고 측정했고(K2 Figure 5), 인프라 복잡도 때문에 48에서 멈췄다. 2026년의 config는 좁은 띠 안에 있다.
| 모델 | routed / 활성 | shared | sparsity | latent | 균형 방식(보고된 대로) |
|---|---|---|---|---|---|
| Qwen3-235B-A22B | 128 / 8 | 0 | 16 | – | global-batch LBL |
| gpt-oss-120b | 128 / 4 | 0 | 32 | – | 밝히지 않음 |
| DeepSeek-V3 | 256 / 8 | 1 | 32 | – | aux-free bias () + seq-wise , node-limited |
| Kimi K2 | 384 / 8 | 1 | 48 | – | bias 기반 선택(noaux_tc) |
| Qwen3.8-Flash-Next | 512 / 10 | 1 | 51 | – | 보고서 본문에 없음 |
| Kimi K3 | 896 / 16 | 2 | 56 | 7168 → 3584 | Quantile Balancing |
| DeepSeek-V4-Pro | 384 / 6 | 1 | 64 | – | aux-free bias () + 균형 손실 |
| MAI-Base-1 | 512 / 8 | 0 | 64 | 6656 → 3072 | GShard 손실, 전역 집계, dropless |
| MAI-Base-2 | 512 / 7 | 1 | 73 | 8704 → 4096 | multi-round dropless |
| Nemotron 3 Ultra | 512 / 22 | 1 | 23 | 8192 → 2048 | 여기서는 다루지 않음 |
2025년에서 2026년으로의 흐름은 오른쪽 위다. expert를 늘리고, 토큰당 활성 expert를 늘리고, 그 비용을 latent로 치른다. expert 하나의 폭은 줄어든다(Qwen3.8: 640). sparsity가 전부도 아니다. Nemotron의 512개 중 22개를 4배 latent에서 고르는 것은 바이트와 FLOPs로는 온전한 폭에서 128개 중 5.5개를 고르는 것과 비슷하지만(Nemotron 레슨), 조합 수는 대신 다.
직접 만들기
NumPy 블록이 위의 주장들을 확인한다. 두 softmax gate는 같고, sigmoid 가중치는 이동 불변이 아니며, (를 상수로 둔) aux loss 기울기는 유한차분과 맞고 과부하 expert만 내리누른다. 조합 수, capacity drop 대 dropless 라운드, all-to-all의 기대 사본 수도 계산한다.
import numpy as np
from math import comb
rng = np.random.default_rng(0)
# ---- 1. 공개 config가 쓰는 gate 함수 네 가지 ---------------------------------
def topk(scores, k):
return np.argsort(-scores, axis=-1)[..., :k]
def gate_softmax_then_topk(z, k): # Qwen3 / MAI: 전체 softmax, top-k, 재정규화
p = np.exp(z - z.max(-1, keepdims=True)); p /= p.sum(-1, keepdims=True)
idx = topk(p, k); w = np.take_along_axis(p, idx, -1)
return idx, w / w.sum(-1, keepdims=True)
def gate_topk_then_softmax(z, k): # gpt-oss: logit의 top-k, k개에 대한 softmax
idx = topk(z, k); zz = np.take_along_axis(z, idx, -1)
w = np.exp(zz - zz.max(-1, keepdims=True))
return idx, w / w.sum(-1, keepdims=True)
def gate_score_renorm(z, k, f, scale=1.0): # DeepSeek-V3/K2/K3 (sigmoid), V4 (sqrt softplus)
s = f(z); idx = topk(s, k); w = np.take_along_axis(s, idx, -1)
return idx, scale * w / w.sum(-1, keepdims=True)
sigmoid = lambda z: 1 / (1 + np.exp(-z))
sqrt_softplus = lambda z: np.sqrt(np.log1p(np.exp(z)))
z = rng.normal(size=(4, 16))
i1, w1 = gate_softmax_then_topk(z, 4)
i2, w2 = gate_topk_then_softmax(z, 4)
print("softmax->top-k->renorm == top-k->softmax:", np.array_equal(i1, i2) and np.allclose(w1, w2))
i3, w3 = gate_score_renorm(z, 4, sigmoid)
i4, w4 = gate_score_renorm(z, 4, sqrt_softplus)
print("sigmoid and sqrt-softplus pick the same experts (both monotone):", np.array_equal(i3, i4))
print("but give different weights:", np.round(w3[0], 3), "vs", np.round(w4[0], 3), "vs softmax", np.round(w1[0], 3))
_, ws = gate_topk_then_softmax(z + 3.0, 4); _, wg = gate_score_renorm(z + 3.0, 4, sigmoid)
print("shift all logits by +3: softmax weights unchanged:", np.allclose(ws, w2),
"| sigmoid weights unchanged:", np.allclose(wg, w3))
# ---- 2. Switch/GShard aux loss와 그 기울기 -----------------------------------
def lbl(zb, k):
"""배치 위의 E * sum_i f_i P_i. f는 top-k 개수(상수), P는 softmax(미분 가능)."""
E = zb.shape[1]
p = np.exp(zb - zb.max(1, keepdims=True)); p /= p.sum(1, keepdims=True)
f = np.bincount(topk(zb, k).ravel(), minlength=E) / (zb.shape[0] * k)
return E * (f * p.mean(0)).sum(), f, p
zb = rng.normal(size=(256, 8)); zb[:, 0] += 1.5 # expert 0이 인기
L0, f, p = lbl(zb, 2)
E, N = 8, zb.shape[0]
analytic = (E / N) * p * (f - (f * p).sum(1, keepdims=True)) # f를 고정한 dLBL/dz_tj
eps, t, j = 1e-6, 3, 0
zp = zb.copy(); zp[t, j] += eps
p2 = np.exp(zp - zp.max(1, keepdims=True)); p2 /= p2.sum(1, keepdims=True)
numeric = (E * (f * p2.mean(0)).sum() - L0) / eps
print(f"\nLBL = {L0:.3f} (1.0 = perfectly balanced); load of expert 0 = {f[0]*E:.2f}x mean")
print(f"dLBL/dz[3,0]: analytic {analytic[t, j]:.6f} numeric {numeric:.6f}")
print("sign of the mean gradient per expert (+ = pushed down):", np.sign(analytic.mean(0)).astype(int))
# ---- 3. 조합의 유연성 ----------------------------------------------------------
print("\nexpert combinations per token, C(E, k):")
for name, E_, k_ in [("16 experts top-2 (DeepSeekMoE baseline)", 16, 2), ("64 experts top-8 (same FLOPs, 4x finer)", 64, 8),
("gpt-oss-120b 128/4", 128, 4), ("DeepSeek-V3 256/8", 256, 8), ("Kimi K2 384/8", 384, 8),
("Kimi K3 896/16", 896, 16), ("Nemotron 3 Ultra 512/22", 512, 22)]:
print(f" {name:40s} {comb(E_, k_):.3e}")
# ---- 4. capacity: token dropping 대 dropless 라운드 ---------------------------
def route_counts(n_tok, E_, k_, skew):
w = rng.permutation((np.arange(E_) + 1.0) ** -skew)
g = np.log(w)[None, :] + rng.gumbel(size=(n_tok, E_)) # Gumbel top-k = 비복원 추출
return np.bincount(np.argpartition(-g, k_, axis=1)[:, :k_].ravel().astype(np.intp), minlength=E_)
print("\nskew CF dropped dropless rounds")
for skew in (0.0, 0.5):
loads = route_counts(8192, 64, 8, skew)
for cf in (1.0, 1.25, 2.0):
cap = cf * loads.sum() / 64 # Switch: capacity = CF * tokens*k / E
print(f"{skew:4.1f} {cf:4.2f} {100*np.maximum(loads-cap, 0).sum()/loads.sum():6.1f}% {int(np.ceil(loads.max()/cap))}")
# ---- 5. all-to-all 사본 수 ------------------------------------------------------
R, k_, E_ = 64, 8, 256 # GPU 64장(8노드 x 8), V3 같은 expert 256개
idx = np.argsort(rng.random((20000, E_)), 1)[:, :k_] # 균등 routing
gpus = idx // (E_ // R); nodes = gpus // 8
d_gpu = np.mean([len(set(r)) for r in gpus]); d_node = np.mean([len(set(r)) for r in nodes])
expect = lambda groups: groups * (1 - comb(E_ - E_ // groups, k_) / comb(E_, k_)) # P(그룹 적중) = 1 - C(E-e,k)/C(E,k)
print(f"\nuniform top-{k_} over {R} GPUs: distinct GPUs per token {d_gpu:.2f} (exact {expect(R):.2f}),"
f" distinct nodes {d_node:.2f} (exact {expect(8):.2f}); node-limited routing caps it at M = 4")
print(f"dispatch+combine bytes/token/layer, BF16, d=7168: per expert {2*k_*7168*2/1024:.0f} KiB,"
f" deduplicated per GPU {2*d_gpu*7168*2/1024:.0f} KiB, latent d/2 {d_gpu*7168*2/1024:.0f} KiB")2번에서 aux loss 기울기는 expert 0에서만 양수다. 그 토큰이 인기 expert에게 잘 처리되었는지와 상관없이 모든 토큰의 인기 expert logit을 내리누른다. bias 방식이 피하는 간섭이 이것이다. 4번에서 skew 0.5만으로도 CF = 1.25에서 슬롯의 13%가 버려진다. 큰 모델들이 dropless로 간 이유다.
sigmoid router, sign으로 갱신되는 선택용 bias, shared expert, 토큰 슬롯을 expert별로 정렬하는 dropless dispatch를 갖춘 PyTorch MoE 층:
import torch
import torch.nn as nn
import torch.nn.functional as F
class SwiGLU(nn.Module):
def __init__(self, d, f):
super().__init__()
self.w1, self.w3, self.w2 = nn.Linear(d, f, bias=False), nn.Linear(d, f, bias=False), nn.Linear(f, d, bias=False)
def forward(self, x):
return self.w2(F.silu(self.w1(x)) * self.w3(x))
class MoE(nn.Module):
def __init__(self, d, f, n_experts, k, n_shared=1, scale=2.5, bias_lr=1e-3):
super().__init__()
self.router = nn.Linear(d, n_experts, bias=False)
self.experts = nn.ModuleList(SwiGLU(d, f) for _ in range(n_experts))
self.shared = nn.ModuleList(SwiGLU(d, f) for _ in range(n_shared))
self.register_buffer("bias", torch.zeros(n_experts)) # aux-loss-free: 선택에만 쓴다
self.k, self.scale, self.bias_lr = k, scale, bias_lr
def forward(self, x): # x: [T, d] (펼친 토큰)
scores = torch.sigmoid(self.router(x).float()) # [T, E], router는 fp32
idx = torch.topk(scores + self.bias, self.k, dim=-1).indices
w = scores.gather(-1, idx)
w = (self.scale * w / w.sum(-1, keepdim=True)).to(x.dtype) # 가중치는 bias 없는 점수로
# dropless dispatch: T*k 슬롯을 expert id로 정렬하고 expert마다 연속 구간을 돌린다
flat = idx.flatten()
order = flat.argsort()
counts = torch.bincount(flat, minlength=len(self.experts)).tolist()
tok = order // self.k # 정렬된 슬롯이 속한 토큰
wts = w.flatten()[order].unsqueeze(-1)
y = torch.zeros_like(x)
start = 0
for e, n in enumerate(counts):
if n:
t = tok[start:start + n]
y.index_add_(0, t, self.experts[e](x[t]) * wts[start:start + n])
start += n
if self.training: # bias의 sign 업데이트, step마다 한 번
with torch.no_grad(): # (DP/EP에서는 rank 간에 load를 all-reduce)
load = torch.tensor(counts, device=x.device, dtype=torch.float32)
self.bias += self.bias_lr * torch.sign(load.mean() - load)
return y + sum(s(x) for s in self.shared)
moe = MoE(d=64, f=32, n_experts=16, k=4)
print(moe(torch.randn(10, 64)).shape) # torch.Size([10, 64])한 팀이 GShard식 aux loss를 micro-batch마다 계산해 학습하고, micro-batch마다 한 도메인의 긴 문서 몇 개를 packing한다. expert들이 도메인과 무관하게 거의 균일해졌다. 이것을 가장 직접 고치는 변화 하나는?
micro-batch마다 계산한 는 한 도메인짜리 micro-batch 안의 불균형을 벌한다. 즉 도메인마다 모든 expert를 똑같이 쓰라고 요구하니 전문화가 금지된다. 를 global batch에서 동기화하면(차원 벡터 all-reduce 한 번) 전역 부하에 대한 벌점이 된다(Qiu et al.; Qwen3, MAI). α를 올리면 더 나빠지고, gate 함수나 capacity는 무엇을 균형 맞추는지를 바꾸지 않는다.
Kimi K3는 896개 중 16개 expert로, 폭 3584인 latent(d = 7168)에서 라우팅한다. Kimi K2(384개 중 8개, latent 없음)와 비교하면 토큰당 dispatch 바이트는?
dispatch는 (중복 제거 전) routed expert마다 벡터 하나를 나른다. K2는 개, K3는 개다. LatentMoE가 벡터를 절반으로 줄이고, 설계는 그 절약으로 (그리고 expert 수)를 두 배로 했다. 통신은 그대로인데 조합 용량은 폭발한다.
정리
- gate: softmax→top-k→재정규화는 top-k→softmax와 같다. sigmoid와 √softplus 점수는 상대값이 아니라 절대값이다. 재정규화된 가중치의 합은 항상 배율 λ다.
- 세분화 expert는 FLOPs를 그대로 두고 조합의 유연성()을 산다. shared expert는 모든 층이 MoE일 때 가장 중요하다.
- 균형 방식은 미는 곳이 다르다. aux loss는 router 기울기를(그리고 집계 범위, micro냐 global이냐가 전문화를 죽이는지를 정한다), bias 방식은 선택만을, Quantile Balancing은 한 step짜리 정확한 bias로 민다.
- capacity는 불균형을 버려지는 토큰이나 추가 라운드로 바꾼다. 프론티어 모델은 dropless다.
- all-to-all 바이트 ≈ 2 · 사본 수 · d · b. node-limited routing은 비싼 사본을 묶고, LatentMoE는 d를 줄여 그 절약을 expert 수와 k에 쓴다.
더 읽을거리Further reading
- Fedus, Zoph, Shazeer, Switch Transformers (JMLR 2022) — capacity factor(용량 = 배치 토큰/expert 수 × CF), aux loss α·N·Σf·P(α=10⁻²), 넘친 토큰은 residual로 건너뛴다.The capacity factor (capacity = tokens per batch / experts × CF), the aux loss α·N·Σf·P with α = 10⁻², and overflowing tokens skipping through the residual.
- Dai et al., DeepSeekMoE: Towards Ultimate Expert Specialization (2024) — 세분화 분할(16 top-2의 120가지 → 64 top-8의 4,426,165,368가지)과 shared expert 분리, expert·device 수준 균형 손실.Fine-grained segmentation (120 combinations for 16 top-2 vs 4,426,165,368 for 64 top-8), shared-expert isolation, expert- and device-level balance losses.
- Wang et al., Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Experts (2024) — 선택에만 쓰는 bias와 sign 업데이트(u = 0.001), MaxVio 정의. 1B에서 ppl 9.56→9.50, MaxVio_global 0.72→0.04.A selection-only bias with a sign update (u = 0.001), the MaxVio metric; at 1B, perplexity 9.56 → 9.50 and MaxVio_global 0.72 → 0.04.
- Qiu et al., Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized MoE Models (2025) — micro-batch LBL은 사실상 시퀀스 단위 균형을 강요한다. f_i만 동기화하는 global-batch LBL(Qwen3가 사용).Micro-batch LBL effectively forces balance per sequence; global-batch LBL synchronises only f_i (used by Qwen3).
- Kimi Team, Kimi K3 (2026) — Quantile Balancing, Stable LatentMoE — 균형 할당 LP의 쌍대에서 expert bias를 한 번에 푸는 분위수 업데이트.The quantile update that solves the expert bias of the balanced-assignment LP dual in one step.
- Elango et al., LatentMoE: Toward Optimal Accuracy per FLOP and Parameter in Mixture of Experts (2026) — routed expert를 latent 공간에서 돌려 통신·가중치 읽기를 줄이고 그만큼 expert 수와 k를 늘린다.Run the routed experts in a latent space to cut communication and weight reads, and spend the saving on more experts and a larger k.
- Microsoft AI, MAI-Thinking-1 report §2.1, §2.8.1 (2026) — 균형 손실은 종류보다 집계 범위가 중요했고, capacity가 유한하면 결론이 달라져 완전 dropless로 갔다.The aggregation scope mattered more than the type of balance loss, and finite capacity changed the conclusions, so they went fully dropless.