Hyperflare MoE Offload Predictors
Learned lookahead predictors (ShadowRecurDepthAttn with early-layer Embed-Reshapers) and
non-uniform per-layer knapsack partitions for 3-tier (VRAM / host RAM / NVMe) Mixture-of-Experts
weight offloading in Hyperflare (hyperflare-recipes + Helios AsyncTransfer ABI v1).
Repository Layout
Each model subdirectory holds a self-contained checkpoint package adhering to schema
hyperflare.shadow_recur_depth_attn.v1:
| Directory | Target Model | MoE Geometry (L x E, H, top-k) |
Router | Horizons (k_dma, k_nvme) |
Predictor Width (d_model, r_in, e_dim) |
Learned Params | model.safetensors |
|---|---|---|---|---|---|---|---|
glm53/ |
GLM-5.3-Flash (lukealonso/GLM-5.3-Flash-NVFP4) |
42 x 288, H=4096, top-8 | Sigmoid + bias | k_dma=1, k_nvme=4 |
d=1024, r=256, e=256 |
112,576,864 | 214.8 MiB |
qwen38/ |
Qwen3.8-Flash-Next (local-inference-lab/Qwen3.8-Flash-Next-NVFP4) |
48 x 512, H=2560, top-10 | Softmax | k_dma=2, k_nvme=4 |
d=512, r=128, e=128 |
56,289,792 | 107.5 MiB |
Files inside each model directory:
model.safetensors: Full predictor weights (BF16), per-layer calibration metadata (FP32), Embed-Reshaper weights for layers0..3, and non-uniform knapsack allocation tables with safetensors__metadata__headers.knapsack.safetensors: Standalone 4-tensor knapsack and horizon file (knapsack.layer_weights,knapsack.priority_order,predictor.k_dma,predictor.k_nvme) for demand-only (--offload-predictor none) or zero-weight direct projection (--offload-predictor direct) deployments.config.json: Structured geometry, architecture dimensions, base model references, and aggregate held-out decode metrics.knapsack_profile.json: Empirical per-layer expert reuse profile and non-uniform slot weights.metrics.json: Per-layer held-out autoregressive decode evaluation metrics.
Predictor Architecture (ShadowRecurDepthAttn)
At each MoE layer l in [0, L - 2], the predictor runs concurrently on an auxiliary CUDA stream
during layer l's routed-expert execution to score future experts at two lookahead horizons:
RAM-to-VRAM DMA prefetch (l + k_dma, clamping to l + 1 at the last source layer) and
NVMe-to-RAM warm staging (l + k_nvme when l + k_nvme < L).
- Shared input encoder with per-layer adaptation: A shared canonical hidden-state projection
shared.p_in([D, H]), per-layer low-rank adapterL{l}.lora_a([R_in, H], with inverse hidden-state scale pre-folded) andL{l}.lora_b([D, R_in]), and routing-weighted per-layer expert embeddingsL{l}.e_emb([E, E_dim]) projected throughshared.e_up([D, E_dim]). - Cross-layer recurrent state: A shared Pre-RMSNorm GRU (
shared.gru_*) maintains a continuous state vectors_l in R^Dacross MoE depth (s_0 = u_0). - Causal depth-axis self-attention: Four-head causal scaled dot-product attention
(
d_attn = 256, head dimension 64) over[s_0, ..., s_l](shared.da_*). - FiLM-modulated shared trunk: Four shared Pre-RMSNorm SwiGLU blocks (
shared.b0..b3.*) modulated by per-layer scale and shift tensors (L{l}.film_g,L{l}.film_bof shape[4, D]), plus one shared NVMe-horizon FiLM-SwiGLU block (shared.nv.*withL{l}.nv_film_g/b). - Folded dual-horizon router scoring and calibration: Dense hidden-state distillation heads
are algebraically folded into per-layer
L{l}.q_dma_w/bandL{l}.q_nvme_w/bmatrices and scored as residuals against the target layer's frozen router weights (gamma * h_l @ W_tgt^T + feat @ Q^T + b). Scores are converted to row-relative top-kmargins (score - 0.5 * (s_(k) + s_(k+1))) and Platt-calibrated (L{l}.meta) for union probability gating across speculative draft tokens. - Early-layer Embed-Reshapers (
embed_L0..L3): Two-layer BF16 SiLU residual MLPs (R = 256) predicting MoE layers0..3immediately after the token embedding lookup.
Held-Out Autoregressive Decode Metrics
Evaluated on held-out autoregressive decode trajectories in exact runtime BF16 inference,
comparing ShadowRecurDepthAttn against zero-parameter direct router projection (h_l @ W_tgt^T).
W=4 Cov @ 5% / 10% FP measures 4-token speculative draft-window union VRAM-miss coverage at
5% and 10% false-positive transfer overhead relative to true VRAM misses:
| Model & Horizon | Direct Top-16 Recall | Learned Top-16 Recall | Direct VRAM-Miss PR-AUC | Learned VRAM-Miss PR-AUC | Direct W=4 Cov @ 5% / 10% FP | Learned W=4 Cov @ 5% / 10% FP |
|---|---|---|---|---|---|---|
GLM-5.3 DMA (k=1, 41 layers) |
0.8776 | 0.9245 | 0.7597 | 0.8280 | 0.4183 / 0.5401 | 0.4974 / 0.6343 |
GLM-5.3 NVMe (k=4, 38 layers) |
0.6743 | 0.8155 | 0.4927 | 0.6654 | 0.2348 / 0.3147 | 0.3560 / 0.4683 |
Qwen3.8 DMA (k=2, 47 layers) |
0.6741 | 0.9153 | 0.5063 | 0.8326 | 0.2074 / 0.2803 | 0.4812 / 0.5891 |
Qwen3.8 NVMe (k=4, 44 layers) |
0.6029 | 0.8811 | 0.4208 | 0.7775 | 0.1669 / 0.2282 | 0.4257 / 0.5320 |
Early-layer Embed-Reshaper held-out decode performance (top-16 recall / VRAM-miss PR-AUC):
- GLM-5.3:
L000.6976 / 0.6165,L010.4667 / 0.3770,L020.3778 / 0.2322,L030.4828 / 0.3455 - Qwen3.8:
L000.8480 / 0.7200,L010.6613 / 0.4268,L020.6540 / 0.4711,L030.5329 / 0.2651
Usage
Download a model folder from this repository and pass the local safetensors path to
ignition export:
hf download local-inference-lab/hyperflare-offload-predictors --include "glm53/*" --local-dir ./predictors
# Learned lookahead predictor + non-uniform knapsack partitioning
ignition export <MODEL_SNAPSHOT> \
--tiered-moe-offload \
--no-mixed-prefill \
--offload-predictor learned \
--offload-predictor-weights ./predictors/glm53/model.safetensors
# Demand-only offloading with non-uniform knapsack partitioning only
ignition export <MODEL_SNAPSHOT> \
--tiered-moe-offload \
--no-mixed-prefill \
--offload-predictor none \
--offload-predictor-weights ./predictors/glm53/knapsack.safetensors
Scope and Compatibility Constraints
- Each predictor checkpoint is coupled to the exact router weights and hidden-state geometry of its
target model (
num_moe_layers,num_experts,hidden_size,router_kind).TieredMoeRuntimevalidates all required tensor names and shapes at load time viavalidate_offload_checkpoint. - Hyperflare tiered MoE offload supports single-GPU (
TP=1) SM120/SM121 NVFP4 exports with--no-mixed-prefill; multi-GPU tensor parallelism and mixed prefill are unsupported. - Prefetching is advisory and never changes router outputs or expert arithmetic; numerical parity with fully resident execution is preserved independently of prediction accuracy.