XYZNOT

Papers · arXiv 2609.18063

The Other Half of the Memory Wall: Serving 35B MoEs from SSD with Trained Routing Prediction

Published cs.AI arXivPDF

Read with translation and AI

Summary in three lines

  1. 🎯 35B-class MoEs require ~19.5 GB even at int4, exceeding consumer RAM, while naive SSD offloading stalls on disk latency because layer routing depends on the prior layer's output.
  2. 🔧 Edge0 streams MoE experts from SSD using a per-layer prerouter that predicts routing one token ahead, adopting 'prediction as routing', paired with an unmerged parallel recovery LoRA distilled on the student path.
  3. 📈 Serves a 35B MoE at ~20.4 tok/s within 2.9 GiB peak memory on a 24 GB Mac mini M4 Pro, within 3.9 average benchmark points of the fp16 teacher.

Abstract

Mixture-of-experts (MoE) inference on consumer hardware is bounded by weight memory: a 35B-class model is 19.5GB at 4-bit, and sparsity shrinks the compute per token, not the bytes that must be held. Naive offloading to SSD does not help on its own, because layer N+1's experts must be chosen before layer N's output exists, so the reads cannot start early enough to hide behind compute. We present Edge0, a streaming MoE inference engine that closes the gap with a prerouter: a per-layer head predicts the next layer's routing one token ahead, and the prediction is consumed as the routing itself, so the staged expert set equals the routed set and nothing is dropped. An unmerged recovery LoRA, trained on the student path, pays back the quality lost to int4 quantization and routing replacement. On a single 24GB machine, Edge0 serves a 35B MoE at 20tok/s inside 3GiB of peak active memory, within a few points of its fp16 teacher on average across five public benchmarks. An 8B tier runs on the same framework, and the framework, checkpoints, and adapters are open source.

Reading guide

Problem and motivation

Mixture-of-Experts (MoE) models scale total parameters while keeping active parameters low per token (e.g., activating ~3B parameters per token in a 35B model). However, inference on consumer hardware remains constrained by static weight memory: a 35B MoE requires roughly 19.5 GB even when quantized to int4. On a 24 GB machine, this completely crowds out the operating system and KV cache, leading to severe memory paging and degraded decode throughput (e.g., 3.9 tok/s for a resident model on an M4 Pro Mac mini).

Offloading expert weights to SSD reduces memory footprint, but naive on-demand loading introduces a hard serialization bottleneck: expert selection for layer depends on the output of layer . The SSD reads cannot start early enough to hide behind compute, stalling execution on disk latency once per layer per token.

Key ideas

  • SSD as the Weight Tier: MoE expert weights stay on SSD in int4 format and are memory-mapped (mmap) into a compact streaming pool. Peak memory is determined by the active working set rather than total model parameter size.
  • Prediction as Routing: Instead of waiting for layer to complete, a per-layer prerouter predicts layer 's routing a full token in advance. Crucially, the model treats the prediction as the routing itself at decode time. This eliminates dropped tokens or fallback loads by construction because the staged set identically equals the routed set.
  • Unmerged Recovery LoRA: 4-bit quantization and approximate routing incur quality loss. Edge0 trains a low-rank adapter on the student routing path via distillation. Because merging the LoRA into the int4 base and re-quantizing erases most of the delta (only 18% logits-level retention survives), Edge0 serves the adapter as a parallel unmerged delta at negligible overhead.

Method

Prerouter Head Architecture

Each prerouter head owned by layer runs at token on the post-attention layer norm output and predicts routing for layer at token . The input features concatenate the hidden state with two top- one-hot routing vectors (current and previous token):

For the 35B tier, this is . The head computes:

where is a linear residual path warm-started from the next layer's router weights.

Unmerged Adapter Execution

The served MoE layer preserves the quantized base bytes and runs the parallel LoRA delta:

Three-Phase Training

  1. Head Distillation: Prerouter heads are trained to imitate the teacher's next-layer true router decisions while keeping the rest of the network frozen.
  2. Student-Path SFT: Recovery LoRA adapters (attached to attention, linear-attention, and shared-expert projections, but not streaming experts) are trained using teacher-generated text while forcing routing through the prerouter.
  3. On-Policy Distillation: The student generates text under prerouted execution, the fp16 base teacher scores the generations, and the LoRA parameters are optimized via reverse Kullback–Leibler divergence with a tail-aware top- probability objective.

Results

  • Throughput & Memory (Mac mini M4 Pro, 24 GB):
    • edge0-35b (): Achieves 20.4 tok/s decode using only 2.9 GiB peak active memory from a 19.5 GB int4 checkpoint (compared to 3.9 tok/s and 18.2 GiB when fully resident).
    • edge0-8b (): Achieves 28.0 tok/s decode inside 1.5 GiB peak memory.
  • Prefetching Speedup (MacBook M2, 16 GB):
    • Compared to purely reactive on-demand streaming, the 1-token prerouter prefetch increases decode speed by +80% to +84% across routing widths (: 4.8 to 8.6 tok/s; : 3.5 to 6.4 tok/s; : 1.8 to 3.3 tok/s).
    • Main-thread blocked load time falls dramatically (e.g., from 244.0 ms to 101.9 ms per step at ).
  • Model Quality (OpenCompass):
    • Across five benchmarks (AIME 2026, HumanEval, GPQA-Diamond, MMLU-Pro, IFBench), edge0-35b scores an average of 79.2 vs. 83.2 for the fp16 Qwen3.6 base (3.9-point gap).
    • edge0-8b achieves 69.9 vs. 72.7 for the Ling 3.0 tiny fp16 base (2.8-point gap).

Limitations and open questions

  • Serving Concurrency: Edge0 operates FIFO-serialized for single requests; batching changes the expert working set and caching dynamics in ways not addressed by the single-stream profiles.
  • CPU Graph-Building Overhead: Decode speed is bounded by CPU-side framework overhead (~44 ms/step in MLX graph building across 40 layers), which SSD optimizations cannot alleviate.
  • Quality Drop on Reasoning: Performance degradation is concentrated on complex reasoning benchmarks (e.g., a 6.1-point drop on AIME for 35B and 10.0 points for 8B).
  • Hardware Dependency: The prerouter's relative throughput gains depend on disk latency and shrink when weight caches are warm or when running on ultra-fast storage tiers.

Key terms

Edge0
A streaming MoE inference engine that serves models from SSD by overlapping reads with compute via routing prediction and compensating quality loss with an unmerged recovery LoRA.
prerouter
A lightweight per-layer neural head that predicts the routing decisions of layer N+1 one token in advance using layer N's hidden state and recent routing history.
prediction-as-routing
The design principle where the prerouter's predicted expert set is directly executed as the actual layer routing at decode time, eliminating runtime token dropping or miss penalties.
recovery LoRA
A low-rank adapter trained via distillation on the student prerouted path and executed as an unmerged parallel branch to compensate for int4 quantization and routing approximation errors.
staged decode
An expert execution mode using fixed-slot double buffering where expert indices are mapped through a slot table on the GPU to avoid per-step allocation.
incremental sticky-slot stack (incr_stack)
A mechanism that updates persistent stacked expert tensors in place, rewriting only the changed expert slots per step rather than reassembling all expert tensors.
unmerged delta
Executing a LoRA adapter in parallel with quantized base weights rather than fusing them into the weights, preventing the loss of fine-grained adaptation during re-quantization.
memory wall
The disparity between processor throughput and DRAM bandwidth/capacity, which in local LLM serving is split between dynamic KV-cache state and static model weight storage.

Questions

Why does Edge0 use prediction as routing instead of treating predictions as hints?

Treating predictions as hints requires runtime fallbacks or dropping tokens when predictions miss. Consuming the prediction directly as the routing ensures the staged expert set always matches the routed set, shifting the approximation cost into offline training where distillation recovers the quality.

Why is the recovery LoRA served unmerged instead of fused into the 4-bit weights?

LoRA weight deltas have an RMS of around 10^-3, which is smaller than the step size of 4-bit quantization. Merging and re-quantizing wipes out most of the adapter's effect, leaving only 18% retention at the logits level, whereas a parallel unmerged delta retains 100% fidelity.

Why does Edge0 predict one token ahead rather than within the same token?

Predicting within the same token requires per-layer GPU pipeline flushes that take 30 to 100 ms per step—longer than the load time it attempts to hide. Leading by a full token allows all staged layers to be predicted in a single batch flush, providing an entire decode step of compute time to hide SSD I/O.

How does Edge0 decode faster than a fully in-memory baseline on a 24 GB machine?

A fully resident 19.5 GB model consumes 18.2 GiB of RAM, leaving almost no room for the operating system and KV cache, which causes severe OS memory paging and drops decode to 3.9 tok/s. Edge0 streams experts from SSD inside ~2.9 GiB peak active memory, avoiding OS memory pressure entirely and running at 20.4 tok/s.

The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.

Read with translation and AI