RankCast: Phase-Aware Rank Balancing in MoE Serving (SGLang)

RankCast (arXiv:2611.33542) solves Expert Parallelism (EP) straggler bottlenecks in disaggregated MoE serving by matching each inference phase's true hardware limit: dual rank-price token steering during compute-bound prefill and active-expert shedding during memory-bound decode. Integrated into SGLang 0.5.12 + DeepEP 1.2.1, it boosts prefill up to +19.4% and decode 1/TPOT up to +11.1%.
RankCast: Phase-Aware Rank Balancing in MoE Serving (SGLang): RankCast (arXiv:2611.33542) solves Expert Parallelism (EP) straggler bottlenecks in disaggregated MoE serving by matching each inference phase's true hardware limit: dual rank-price token steering during compute-bound prefill and active-expert shedding during memory-bound decode. Integrated into SGLang 0.5.12 + DeepEP 1.2.1, it boosts prefill up to +19.4% and decode 1/TPOT up to +11.1%. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Phase-Specific Objectives: Minimizes max tokens per EP rank during compute-bound prefill and max active experts per rank during memory-bound decode.
- 76–95% Excess Load Removal: Lowers prefill max/mean rank imbalance from 1.75 down to 1.03–1.16 on Qwen3-235B (EP=8) and Qwen3.5-397B (EP=16).
- +19.4% Prefill & +11.1% Decode Speedup: Outperforms DeepSeek online EPLB by 2.7–6.8 points with zero redundant expert memory overhead.
- Zero-Collective Side-Stream Overlap: Shared cross-layer router predictor and 9–58 us solver piggyback on DeepEP metadata (<0.9% step overhead).
- Protected Top-p Quality Guarantee: Locks every token's top p=2 experts and selects k-p from Top-L candidates, keeping accuracy delta under 1 point.
import { createAgent } from "@smoke-monkey/harness";const moeServingAgent = createAgent({agentId: "rankcast-ep-cluster-tuner",provider: "anthropic",model: "claude-sonnet-4-5",workspacePath: process.cwd(),permissions: {read_file: "allow",write_file: "allow",run_command: "ask",},});async function configurePhaseAwareMoEServing() {const result = await moeServingAgent.run("Inspect SGLang 0.5.12 + DeepEP 1.2.1 EP deployment config for Qwen3-235B (EP=8) " +"and Qwen3.5-397B (EP=16), enable RankCast protected prefix p=2 (L=16/20), and " +"verify prefill imbalance <= 1.15 and decode active-expert reduction.");console.log("[RankCast Cluster Agent] Status:", result.summary);}configurePhaseAwareMoEServing().catch(console.error);
Watch: Related Video Guides
DeepInfer, Explained: How DeepSeek Serves a Giant Model to Millions (vLLM -> SGLang -> DeepInfer)
What is vLLM? Efficient AI Inference for Large Language Models
Why MoE Serving Needs Phase-Aware Rank Balancing (Prefill vs. Decode)
RankCast (arXiv:2611.33542, UIUC & Meituan) addresses instantaneous physical-rank stragglers in Expert Parallelism (EP) MoE deployments. Even when training uses auxiliary load-balancing loss, inference batches experience rapid domain drift where one EP rank stalls the entire collective barrier.
Crucially, prefill and decode fail for opposite hardware reasons: prefill is compute-bound, so latency tracks the maximum token count on the busiest rank; moderate-batch decode is memory-bound, so latency tracks the maximum active expert weight matrices loaded on the busiest rank. RankCast protects each token's Top-p (p = 2) experts and redistributes the remaining k - p choices within Top-L (L = 16 or 20) using a dual rank-price LP relaxation in prefill and active-expert shedding in decode.
SGLang + DeepEP Benchmarks on Qwen3-235B (EP=8) & Qwen3.5-397B (EP=16)
Tested on two 8x H800 nodes over RoCE running SGLang 0.5.12, DeepEP 1.2.1, and DeepGEMM, RankCast beats native Top-k routing and online EPLB / EPLB-R (redundant experts) while preserving MMLU-Redux, MATH-500, RULER, and GPQA-Diamond within <1 percentage point:
| Model & Workload | Phase & Metric | Native Baseline | Online EPLB | RankCast | Key Operational Gain |
|---|---|---|---|---|---|
| Qwen3-235B (ShareGPT 8K) | Prefill Throughput / Imbal. | 1.75x imbal. | +13.8% (1.11x) | +19.4% (1.08x) | Cuts excess prefill load 76–95% |
| Qwen3-235B (CodeContests 8K) | Prefill Throughput / Imbal. | 1.66x imbal. | +14.2% (1.06x) | +19.3% (1.04x) | Beats EPLB-R (+7.5%) with 0 extra VRAM |
| Qwen3-235B (LongBench 32K) | Prefill Throughput / Imbal. | 1.66x imbal. | -0.4% (1.60x) | +7.3% (1.16x) | Per-batch prices adapt to long-context drift |
| Qwen3.5-397B (CodeContests 8K) | Prefill Throughput / Imbal. | 1.55x imbal. | +9.9% (1.06x) | +14.6% (1.03x) | Scales cleanly to 512 experts, EP=16 |
| Qwen3-235B (CodeContests 3.5K) | Decode Median TPOT (ms) | 27.41 ms | — | 25.33 ms (+8.2%) | Cuts busiest rank active experts 14.4 → 9.7 |
| Qwen3.5-397B (CodeContests 3.5K) | Decode Median TPOT (ms) | 52.19 ms | — | 46.97 ms (+11.1%) | +10.8% on WildChat, +9.9% on ShareGPT |
Standing cross-batch bias offsets (eta alone) fail on dynamic workloads like LongBench v2 (1.65x imbalance, -0.8% throughput), proving the need for per-batch rank pricing.
Cross-Layer Prediction, Side-Stream Overlap & Deployment Knobs
RankCast avoids adding any new collective communication by predicting next-layer router logits on a side CUDA stream and packing balancing metadata into the existing DeepEP dispatch payload:
# Reference RankCast evaluation topology (2x 8x H800 RoCE cluster)
# Qwen3-235B-A22B (94 MoE layers, 128 experts, k=8): TP=8, EP=8, p=2, L=16, B=256 bins
# Qwen3.5-397B-A17B (60 layers, 512 experts, k=10): DP=16 attention, EP=16, p=2, L=20, B=64 bins
# Key runtime overheads measured in SGLang 0.5.12 + DeepEP 1.2.1:
# - Prefill dual price solver: ~0.5% of prefill step time
# - Decode shedding kernel (9-17 us on 235B, 58 us on 397B): ~0.7-0.9% of decode step time
# - Offline scaling check: removes 51-70% excess load even at EP=64 (5.30x) and EP=128 (9.34x)Because each active expert on the busiest decode rank adds 0.52 ms to median TPOT (R^2 = 0.99 across 11 runs above the 20.1 ms baseline intercept), shedding unused tail experts directly translates into lower per-token latency.
Routing Disaggregated MoE Workloads from Smoke Monkey Harness
Teams running large open-weight coding models (Qwen3-235B, Qwen3.5-397B, DeepSeek-V3/V4) on SGLang EP clusters can expose disaggregated prefill and decode endpoints directly to Smoke Monkey Harness via OpenAI-compatible provider configs.
In high-concurrency CI/CD agent swarms—where 96 to 128 parallel agent threads stream tool calls simultaneously—RankCast's 8.2%–11.1% decode TPOT speedup and 19.4% prefill gain prevent long repository prompts from starving active decode loops.
Avoid Redundant Experts When HBM Concurrency Is Tight
Unlike EPLB-R (which replicates 8–16 hot experts in GPU memory and lowers max concurrent batch size), RankCast balances rank loads without consuming extra HBM.
Frequently Asked Questions
Q:Why does RankCast use different algorithms for prefill and decode?
Prefill is compute-bound, so RankCast uses a dual rank-price solver to equalize token counts across EP ranks. Moderate-batch decode is memory-bound, so RankCast sheds tail active experts on the busiest ranks to minimize loaded expert weights.
Q:How does RankCast preserve model accuracy while rerouting experts?
RankCast strictly protects each token's Top-p (p=2) highest-scoring experts and restricts flexible substitutions to the Top-L candidates (L=16 or 20), keeping accuracy changes under 1 percentage point across MMLU-Redux, MATH-500, and GPQA-Diamond.
Q:What throughput and latency gains does RankCast achieve in SGLang?
On SGLang 0.5.12 + DeepEP 1.2.1, RankCast increases prefill throughput up to +19.4% on Qwen3-235B (EP=8) and +14.6% on Qwen3.5-397B (EP=16), while improving decode 1/TPOT by 6.1-11.1%.
Q:Does RankCast add new network collectives to Expert Parallelism?
No. RankCast predicts next-layer router scores on a side CUDA stream and reuses DeepEP's existing communication channel for metadata, adding only 0.5-0.9% step overhead.
Q:How does RankCast compare to DeepSeek online EPLB and EPLB-R?
RankCast outperforms online EPLB by 2.7-6.8 percentage points on ShareGPT and CodeContests prefill, handles dynamic 32K LongBench shifts where EPLB stalls (+7.3% vs -0.4%), and uses zero extra VRAM for redundant experts.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.