gxunda/Whittle-Next-26B-A3B-MTP
Whittle-Next-26B-A3B upgraded with BOTH a trained 180-Expert MoE Multi-Token Prediction (mtp.*) speculative drafter AND a trained Qwen Sparse Attention (QSA) Indexer ("indexer_budget": 2048, "indexer_compress_ratio": 4, matching Qwen3.8-Flash-Next / qwen4_exp).
All 945 non-indexer trunk tensors (4-stream Hyper-Connections, 30 Sigmoid-gated GatedDeltaNet layers, 10 Gated GQA full-attention projections, 180-Expert Sparse MoE, and Layer-2 1B Hashed N-Gram PLE) remain 100% frozen and bit-for-bit identical to whittleOrg/Whittle-Next-26B-A3B (bf16/).
Key Highlights
1. Trained QSA Indexer (indexer_budget = 2048, indexer_compress_ratio = 4)
In upstream Whittle-Next-26B-A3B, the 30 self_attn.indexer.* tensors across the 10 full-attention layers (3, 7, 11, ..., 39) were all-zero placeholders (norm = 0.0) bypassed via indexer_budget = 262144. Simply changing indexer_budget to 2048 without training causes severe long-context collapse beyond 2,048 tokens.
We distilled all 10 layers' Qwen4ExpTextQSAIndexer modules (13.11M params / 25.008 MiB BF16) using two-phase Lightning-Indexer alignment (sum_h ReLU(q_h @ k_block^T) / sqrt(128), matching Hugging Face transformers and llama.cpp qwen4exp.cpp):
| Metric | Dense Full Attention (budget=262144) | Untrained Zero-Indexer (budget=2048) | Trained QSA Indexer (budget=2048, ratio=4) |
|---|---|---|---|
8K Long-Context CE (2K..8K, 25% KV budget) | 0.90168 | 2.00866 | 0.90162 (-0.00006 nats) |
16K Long-Context CE (2K..16K, 12.5% KV budget) | 0.59559 | 1.52183 | 0.5945 (-0.00110 nats) |
Attention Mass Recall @ budget=2048 (8K / 16K) | 100.0% | ~25% / ~12.5% | 96.98% / 93.77% |
Passkey Needle Retrieval (4K / 8K / 12K tokens) | 12/12 (100.0%) | 4/12 (33.3%) | 12/12 (100.0%) |
2. Trained 180-Expert MoE Multi-Token Prediction (mtp.*)
Warm-started from Qwen/Qwen3.6-35B-A3B's 256-expert MTP via REAP gate-weighted activation-mass pruning (98.38% routed mass retained) and trained with 4-step unrolled (k = 1..4) online self-distillation:
| Benchmark | Acceptance / Accuracy | Mean Accepted Tok/Step | Wall-Clock Speedup |
|---|---|---|---|
Lossless Serving Sampler (T=0.7, top_p=0.8, top_k=20) | k=1..4: 82.3% / 63.9% / 51.3% / 38.3% | 3.3587 | 1.898× (36.19 → 19.06 ms/tok) |
Greedy Speculative Decoding (T=0.0) | k=1..4: 89.8% / 77.3% / 63.9% / 51.0% | 3.8196 | 2.155× (36.12 → 16.76 ms/tok) |
Long-Context (>3866 tok, QSA budget=2048 active) | Greedy / T=0.7 | 3.2437 / 3.3478 | Verified lossless QSA + MTP rewind (measured on 40GB A100 w/ 26-layer CPU offload) |
GSM8K (50-problem lossless speculative T=0.7) | 88.0% (12/12 EOS stop probe) | 4.0917 | 65.46 tok/s single-stream |
Standalone & Add-On Artifacts
- Full 14-Shard BF16 Model (
model-00001-of-00014.safetensors..model-00014-of-00014.safetensors): Drop-in compatible withAutoModelForCausalLM.from_pretrained("gxunda/Whittle-Next-26B-A3B-MTP", trust_remote_code=True, dtype=torch.bfloat16)as well asqwen4_expruntimes (llama.cpp/vLLM). mtp_only.safetensors(1.13 GiBBF16): Standalone 19-tensormtp.*drafter weights.qsa_indexer_only.safetensors(25.008 MiBBF16): Standalone 30-tensormodel.layers.*.self_attn.indexer.*patch forWhittle-Next-26B-A3B.
Quickstart (transformers Speculative Decoding + QSA)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "gxunda/Whittle-Next-26B-A3B-MTP"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
repo_id,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="cuda:0",
).eval()
messages = [{"role": "user", "content": "Derive the time complexity of building a binary heap in O(N) time."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
out_ids, stats = model.speculative_generate(
input_ids,
max_new_tokens=256,
draft_depth=4,
do_sample=True,
temperature=0.7,
top_p=0.8,
top_k=20,
)
print(tokenizer.decode(out_ids[0, input_ids.shape[1]:], skip_special_tokens=True))
print("Speculative stats:", stats)