research26 min studyLesson 579 in Engineering

Load skew: name the population behind every expert counter

Measure requested, accepted, padded, and executed work by expert and rank without confusing normalized demand, overflow, or aggregate throughput.

On this page

What you’ll understand

  • Compute max-to-mean and coefficient-of-variation statistics under an explicit count convention.
  • Distinguish assignment shares from token fractions and accepted utilization.
  • Connect expert demand measurements to rank, communication, and critical-path evidence.

An expert dashboard can look balanced while hiding dropped work, padded rows, or a rank that hosts several busy experts. A meaningful measurement starts with the population and time window: requested assignments, accepted assignments, unique tokens, or actually scheduled rows. Preserve these distinctions through aggregation, then connect the resulting imbalance to measured compute and communication rather than treating a histogram as a complete performance explanation.

Requested and accepted demand answer different questions

For exactly k requested experts per eligible token, requested expert counts sum to Tk before capacity admission. Dividing by Tk gives each expert's share of assignments. Dividing by T gives assignments per token and produces fractions that sum to k; these are not interchangeable denominators. After dropping, accepted counts sum to a smaller total. Normalizing only by accepted work can hide how much demand was rejected. Record the original requested denominator alongside acceptance and overflow, with padding or masked tokens explicitly excluded or named.

Unique-token counters add information that expert counts cannot provide. A token may lose one branch, all branches, or none. Shared experts may execute regardless of routed admission and therefore need separate path counters. Scheduled rows can include alignment or capacity padding, whereas accepted rows represent useful assigned work. Collect these stages from the actual implementation rather than infer them from one returned tensor called expert_count. DeepSpeed 0.19.7's routing source, for example, exposes counts whose placement before capacity masking matters for interpretation.

ferequested=neTk,rdrop=∑e(ne−ae)Tk,ue=aeCef_e^{\rm requested}=\frac{n_e}{Tk},\qquad r_{\rm drop}=\frac{\sum_e(n_e-a_e)}{Tk},\qquad u_e=\frac{a_e}{C_e}
n_e are requested counts and a_e≤n_e accepted counts for exactly k pre-drop requests per token. T>0, k≥1, and capacity C_e>0 where u_e is reported. These are assignment share, assignment-drop rate, and accepted-slot utilization under a fixed-capacity policy; none is a unique-token drop fraction or hardware utilization.↔ Scroll wide equations horizontally.

Summaries need the zeros and the time window

A max-to-mean count ratio reveals a busiest expert relative to the average over the stated expert set. Include zero-count experts if they are eligible members; removing them makes apparent balance improve without changing the workload. The population coefficient of variation adds information about spread. Both require a positive mean, so an empty routing batch needs a separate not-applicable result. These statistics remain count summaries, not measures of specialization, fairness, hardware occupancy, or convergence quality.

A whole-step average can hide a badly skewed microbatch that caused an allocation spike or stalled a communication phase. Report distributions over layers and microbatches as well as totals, and identify whether reduction combines replicas, expert-parallel groups, or independent data shards. Per-rank totals add the loads of colocated experts and can expose a placement problem invisible to per-expert averages. Aggregate percentages should be computed from compatible summed numerators and denominators rather than averaging rates from batches with unequal populations.

nˉ=1E∑ene,Lmax⁡=max⁡enenˉ,CV=E−1∑e(ne−nˉ)2nˉ\bar n=\frac1E\sum_e n_e,\qquad L_{\max}=\frac{\max_e n_e}{\bar n},\qquad {\rm CV}=\frac{\sqrt{E^{-1}\sum_e(n_e-\bar n)^2}}{\bar n}
E is the complete stated set of eligible experts, including zero counts, and the mean must be positive. CV uses population variance over these counts. The same formulas may be applied separately to requested or accepted counts, but mixing the two in one statistic is invalid.↔ Scroll wide equations horizontally.

Connect demand to the constrained execution resource

Compare expert counts with measured expert durations, scheduled matrix rows, peer bytes, allocation peaks, and exposed layer time. Equal counts need not mean equal costs when widths, kernels, tensor-parallel layouts, or remote paths differ. Conversely, a count imbalance may be harmless if the relevant work overlaps and remains outside the critical path. Use a fixed routing trace to separate placement and kernel changes from a changing router. Evaluate data-group quality and admission rates if an optimization systematically affects certain token populations.

The probability lab gives an exact marginal under deliberately simple assumptions. If twenty independent top-one tokens choose a particular expert with probability 0.25, its count is binomial with mean five and variance 3.75. Reset, set p=0.25 and n=20, predict those values, then Play or Step. Separately Reset, set p=0.50 and n=20, predict mean ten and variance five, then Play or Step. Playback highlights exact bars rather than sampling training batches. Real tokens can be correlated, and expert counts in one multinomial batch are not mutually independent.

Keep clipping out of the requested-skew statistic

Four experts request [8,4,2,2] assignments. All have capacity six with independent branch dropping. Compute requested skew, then report acceptance separately. Suppose the first two experts share one rank.

  1. Requested work totals sixteen, so the expert mean is four. Max-to-mean is 8/4=2. Population squared deviations average (16+0+4+4)/4=6, giving CV=sqrt(6)/4≈0.612372.

  2. Accepted counts are [6,4,2,2], totaling fourteen. Two assignments were dropped, giving rate 2/16=12.5% of requested work; normalizing accepted counts alone would conceal that loss.

  3. Before dropping, the two ranks carry twelve and four assignments if the other two experts share the second rank. Their mean is eight and rank max-to-mean is 12/8=1.5, a different population from the expert statistic.

The result

Requested expert skew, accepted utilization, drop rate, and rank skew describe different stages and must remain separately labeled.

Explore the model

Interactive lab

Interactive lab · probability

A clearly scoped marginal expert-count distribution

Reset, set p=0.25 and n=20, predict mean 5 and variance 3.75, then Play or Step. Separately Reset, set p=0.50 and n=20, predict mean 10 and variance 5, then Play or Step. The exact binomial bars assume independent identical trials; they are not measured expert traffic or a correlated router simulation.

A clearly scoped marginal expert-count distributionThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forStatistical expectations require assumptions in addition to correctly named counters.

Check your understanding

Why can accepted-assignment shares look balanced while training still has a serious routing problem?

Try it yourself

Ten tokens request top-two routing among four experts, producing counts [8,6,4,2]. Compute assignment shares, mean requested load, and max-to-mean. What would dividing counts by ten represent?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

The assignment denominator is twenty rather than ten.

Compare with the solution

Assignment shares are [0.4,0.3,0.2,0.1]. Mean requested load is twenty divided by four, or five, and max-to-mean is 8/5=1.6. Dividing by ten instead gives [0.8,0.6,0.4,0.2], assignments per token for each expert; these sum to two and are not normalized assignment shares.

Take it with you

  • Counter names must include requested, accepted, unique-token, or scheduled scope.
  • Skew summaries require a complete expert set and a defined time window.
  • Connect count imbalance to measured rank work, bytes, memory, and critical-path cost.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.