FreeBalance: Pre-Routing Online MoE Load Balancing via Residual Workload Prediction
Summary (Overview)
- Core contribution: FreeBalance is a lossless online load-balancing framework for Mixture-of-Experts (MoE) models that predicts expert workloads before routing decisions are made, enabling expert migration to overlap with computation-heavy pre-routing stages (e.g., attention) rather than sitting on the critical inference path.
- Key innovation: The framework exploits cross-layer residual similarity in hidden representations—since and are highly similar due to small residual updates—to invoke the same frozen router on the earlier hidden state, producing a lightweight workload prediction without any additional trainable parameters.
- Results: FreeBalance reduces the max-to-mean rank load ratio by 32.8% and end-to-end prefill latency by 13.1% across models and datasets, hiding balancing overhead for an average of 5.1 experts per layer (which would otherwise account for 8.5% of critical-path latency).
- Lossless guarantee: The predicted workload is used only for expert placement decisions; the actual router still determines final token-to-expert assignments, preserving model outputs exactly.
- Practical design: A cost model constrains the number of expert swaps to fit within the available attention-time window, and a deterministic greedy planner ensures all ranks agree on the swap plan without broadcast communication.
Introduction and Theoretical Foundation
Background: MoE and Expert Parallelism
Mixture-of-Experts (MoE) architectures have become dominant in modern LLMs by dramatically increasing parameter capacity without proportionally increasing per-token computational cost. Each MoE layer activates only a small subset of experts per token through a lightweight routing mechanism:
In distributed inference, expert parallelism (EP) shards experts across devices. Tokens routed to remote experts require all-to-all communication for dispatch and result combination, with global synchronization across the EP group.
The Load Imbalance Problem
Load imbalance arises from skewed routing distributions across ranks. Since MoE execution requires global synchronization, the most heavily loaded rank determines the critical path, forcing less-loaded ranks to idle. This problem is exacerbated in multi-task serving scenarios where routing distributions vary significantly across task types—the paper shows only 4.1% expert-activation overlap between two representative tasks (NarrativeQA and LCC) on Qwen3-30B.
The Sequential Dependency Bottleneck
The root cause of online balancing overhead is the sequential dependency between workload acquisition and expert-map modification:
- Routing can only begin after preceding computations (e.g., attention) complete
- Expert migration can only begin after routing decisions are available
- The migration window is therefore restricted to the narrow interval between routing and MoE computation—directly on the critical path
Key Insight
The paper observes that expert balancing does not need to wait for the current-layer router if the workload distribution can be predicted lightweightly and accurately before routing. This enables migration to overlap with preceding computation stages, particularly beneficial for long-sequence inference where attention dominates critical latency.
The residual network structure provides the theoretical foundation:
Because the residual update is small relative to hidden-state magnitude, the angle between and is small, and their cosine similarity is close to 1.
Methodology
Overview: Four Stages per MoE Layer
For each MoE layer , FreeBalance performs:
- Residual workload prediction: Estimate token counts for all experts before routing
- Budgeted expert-swap planning: Determine migration budget and select pairwise swaps
- Weight transfer: Exchange expert weights across EP ranks, overlapped with attention
- Lossless MoE computation: Execute with original routing decisions on migrated placement
Residual Workload Prediction
FreeBalance introduces no standalone predictor—it invokes the same frozen router twice:
For a linear router:
where and are the original router parameters. Applying the top-k rule to yields estimated assignments, aggregated into predicted expert workloads:
Key properties:
- No additional predictor weights, training procedure, or checkpoint state
- The early invocation produces only an E-element workload vector for placement planning
- The normal invocation on remains authoritative for final assignments
- Using creates an attention-length migration window while retaining sufficient task/token information
Budgeted Expert-Swap Planning
Pairwise swap formulation: Exchanging expert on rank with expert on rank changes only those two ranks' loads:
Load objective to minimize:
The first term targets the straggler rank; the second discourages moving the bottleneck elsewhere. The predicted benefit is .
Migration cost model:
where is the transferred representation size, is measured point-to-point bandwidth, and captures launch/protocol overhead.
Budget constraint:
where is a safety margin and is the profiled attention time (reused across layers with the same attention mechanism). The budget is enforced per link and per rank, not just as a global sum.
Deterministic greedy planning: All ranks receive the same globally aggregated count vector, enumerate candidate pairs, remove conflicts and non-positive-gain candidates, and sort by decreasing benefit-to-cost ratio. Ties are resolved lexicographically. This eliminates the need for a plan broadcast.
Empirical Validation / Results
Experimental Setup
- Models: Qwen3-30B-A3B-Instruct-2507 (128 experts, top-8, 16 experts/rank, 9 MB/expert) and Moonlight-16B-A3B-Instruct (64 experts, top-6, 8 experts/rank, 16.5 MB/expert)
- Hardware: 8× NVIDIA A800-SXM4 GPUs with NVLink, EP=8
- Benchmarks: 19 LongBench subsets plus a Mixed Tasks workload with step-to-step task shifts
- Default config: batch size 16, input length 8K tokens
End-to-End Effectiveness
Table 1 (excerpt) shows prefill latency improvements across LongBench subsets:
| Subset | Qwen Vanilla | Qwen +Ours | Qwen EPLB | Qwen EPLB+Ours | Moon Vanilla | Moon +Ours |
|---|---|---|---|---|---|---|
| NarrativeQA | 147.6 | 126.6 | 135.9 | 126.6 | 77.4 | 66.7 |
| TriviaQA | 175.9 | 112.1 | 122.6 | 110.7 | 65.7 | 64.4 |
| VCSUM | 138.1 | 115.8 | 125.6 | 112.9 | 73.7 | 62.6 |
| Mixed Tasks | 83.1 | 78.0 | 78.3 | 75.3 | 45.9 | 43.3 |
- Vanilla max/mean ratio up to 2.01 reduced to 1.35 (32.8% improvement)
- Average prefill latency reduction of 13.1% on Qwen3-30B
Prediction Quality
Table 2: Pre-routing quality metrics
| Model | Dataset | Hidden cos. | Logit cos. | Top-k hit |
|---|---|---|---|---|
| Qwen | PassageRetrieval | 0.7334 | 0.9952 | 0.7520 |
| Qwen | LSHT | 0.7242 | 0.9951 | 0.7578 |
| Qwen | TriviaQA | 0.7116 | 0.9947 | 0.7419 |
| Moonlight | PassageRetrieval | 0.9316 | 0.9900 | 0.8461 |
| Moonlight | LSHT | 0.9291 | 0.9896 | 0.8494 |
| Moonlight | TriviaQA | 0.9234 | 0.9910 | 0.8037 |
Despite hidden-state cosine similarity ranging from 0.7116 to 0.9316, logit cosine similarity remains between 0.9896 and 0.9952, with top-k hit rates of 0.7419–0.8494. This demonstrates that router logits remain strongly aligned across invocation points.
Overlap Analysis
- Expert migrations require approximately 3–4 ms per layer
- 95% of executed swap plans achieve a lower measured max-to-mean ratio
- Figure 4 shows speedup is not monotonic in fixed swaps per layer; adaptive FreeBalance (1.82–2.68 avg swaps) outperforms all fixed policies at 1K, 2K, and 4K token lengths
Sensitivity to Sequence Length
Table 3: Performance under batch size 16
| Length | Vanilla TTFT | Vanilla Max/Mean | Ours TTFT | Ours Max/Mean | Overlap (ms) |
|---|---|---|---|---|---|
| 1K | 3.08 | 2.00 | 2.74 | 1.33 | 12.55 |
| 2K | 4.99 | 2.02 | 4.43 | 1.34 | 17.35 |
| 4K | 8.98 | 2.03 | 7.78 | 1.35 | 31.30 |
| 8K | 20.45 | 2.04 | 15.68 | 1.37 | 36.80 |
TTFT reduction grows from 11.0% at 1K to 23.3% at 8K tokens (14.7% average), confirming that longer sequences provide larger windows for hiding migration overhead.
Theoretical and Practical Implications
Theoretical Significance
-
Breaking the sequential dependency: The paper demonstrates that online load balancing need not be reactive—workload prediction enables proactive placement, fundamentally changing the timing constraints of expert migration.
-
Residual similarity as a free prediction signal: The observation that frozen routers can be invoked on earlier hidden states (with logit cosine similarity > 0.99) provides a zero-cost prediction mechanism requiring no additional training or parameters.
-
Budget-constrained balancing: The cost model formalizes the trade-off between balancing benefit and migration overhead, showing that the overlap window (not the balancing potential) should determine migration aggressiveness.
Practical Implications
-
Lossless acceleration: FreeBalance preserves model outputs exactly, making it safe for production deployment without accuracy concerns.
-
Multi-task adaptability: Unlike offline methods (e.g., DeepSeek EPLB) that lag behind task shifts, FreeBalance adapts at layer granularity to each batch's routing distribution.
-
Scalability: The deterministic planner eliminates plan broadcast overhead, and the frontier-based candidate generation (considering only overloaded/underloaded ranks) keeps planning lightweight enough for layer-granularity execution.
-
Complementarity: FreeBalance works alongside existing methods (EPLB + FreeBalance consistently outperforms either alone), suggesting it can be integrated into existing serving stacks.
Conclusion
FreeBalance addresses dynamic load imbalance in distributed MoE inference by anticipating expert workloads before target-layer dispatch and initiating balancing proactively. Key takeaways:
- Residual workload prediction using the frozen router on earlier hidden states provides accurate, zero-cost workload estimates before routing.
- Budgeted expert-swap planning with a cost model ensures migration fits within the available attention-time window, hiding overhead from the critical path.
- Lossless execution preserves original routing decisions and model outputs exactly.
- Empirical results: 32.8% reduction in max-to-mean rank load ratio, 13.1% end-to-end prefill latency reduction, with balancing overhead for 5.1 experts per layer fully hidden.
Future directions suggested by this work include extending the approach to decode-phase inference, exploring prediction-based balancing for other parallelization strategies, and investigating whether residual similarity can enable other proactive optimizations in distributed inference systems.
Related papers
- EVOMAL: Self-Poisoning in Self-Evolving Coding Agents
Self-evolving LLM coding agents are vulnerable to self-poisoning, where agents unknowingly author and propagate malicious skills, achieving attack success rates up to 86.7% and forming self-sustaining worms.
- Recursive Experiential-Working Memory Evolution for Long-Horizon Agent Harnesses
Recuris improves long-horizon LLM agent performance across 35 of 37 model-benchmark pairs by coupling a verified working state with experiential memory, enabling component-level fault localization and targeted, gated memory evolution without modifying the base model.
- Automated Benchmark Auditing for AI Agents and Large Language Models
Auto Benchmark Audit finds major issues in 25.7% of 34,285 AI benchmark tasks across 168 benchmarks, and filtering these problematic tasks shifts model rankings by up to 10 percentage points.