Skip to content

0.2.20-poly.10

Choose a tag to compare

@VecSzn VecSzn released this 04 Dec 12:35

Full-platform Qwen4-35B-A3B (qwen4exp) support across CUDA, Apple Silicon Metal, and AMD HIP — with fused kernels up to 399.1 tok/s, opt-in BasinKV sparse long-context KV offload locking an 8 GB laptop flat at 6.1 GiB VRAM all the way to 256K, and zero diff to upstream strata core.

  • 8 GB Laptop @ Full 256K Context (0 OOM, +0 MiB VRAM growth): An 8 GB RTX 5060 laptop runs Qwen4-35B-A3B (UD-IQ2_XS) across 8K → 256K (255,999 tokens) with peak VRAM locked flat at 6.1 GiB, up to 4.63× faster prefill, 33.6 tok/s decode at 256K, and 5/5 NIAH recall — and even the 36.2 GB UD-Q4_K_XL quant passes 8K → 256K 5/5 NIAH in the exact same 6.1 GiB peak VRAM.
  • 399.1 tok/s on RTX 4090 D & 147.8 tok/s at 256K: Fused CUDA/HIP Qwen4 + DFlash2 kernels deliver +15.4%–33.5% faster decode (399.1 tok/s with DFlash2 Q8_0, 12/12 bit-exact), while --basinkv holds 147.8 tok/s MTP at 256K using just 84.1 MiB of GPU KV (sphere+wht_int4, 128.4 tok/s --no-draft).
  • Apple M5 Ultra @ 105.0 tok/s at Full 256K Context: Native Metal Qwen4 & native Metal DFlash2 kernels hold 105.0 tok/s MTP at 256K (UD-Q4_K_XL, native Metal FP16 KV, 5/5 NIAH PASS) and reach up to 295.7 tok/s on repetitive QSA prompts (UD-IQ2_XS, DFlash2 Q8_0).

Added

  • Full-platform Qwen4-35B-A3B (qwen4exp) support on strata-poly: end-to-end setup (--family qwen4), qwen4 tiktoken tokenizer (248,320 vocab), compact thinking (<think>...</think>), reasoning effort (xhigh/high/low/off), preserve_thinking, XML tool calling, vision (mmproj-BF16.gguf), embedded MTP (blk.40), and external DFlash2 speculative decoding (--drafter dflash2 / --draft-model) across OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages APIs.
    • Built and packaged for Windows x64 CUDA 13 (5-arch sm_75/80/86/89/120), Linux x64 CUDA 13 (5-arch), macOS arm64 Apple Silicon Metal (including native MSL Qwen4 kernels and native Metal DFlash2Drafter with graph capture and zero-copy LM-head reuse), and Windows / Linux AMD HIP (5 GPU families each under ROCm 10.2.0a20260930).
  • BasinKV opt-in sparse long-context KV offload (--basinkv, off by default): keeps a fixed FP16 hot slab in VRAM (2,048 tokens default) while offloading full KV history to pinned RAM (int8 or wht_int4) with GPU block summary scoring (quest INT8 or sphere WHT-INT4) and asynchronous lookahead prefetch for qwen35moe, clover_moe, and qwen4exp (compatible with embedded MTP and DFlash2; unchanged byte-identical default path when off). See docs/BASINKV.md.

8K → 256K Long-Context Benchmarks

Backends noted explicitly below: RTX 5060 and RTX 4090 D use CUDA --basinkv; Apple M5 Ultra uses Native Metal FP16 KV (not BasinKV). All runs are direct hardware measurements with greedy decoding.

RTX 5060 Laptop 8 GB / 32 GB RAM — CUDA 13 --basinkv --vram-pool (Qwen4 UD-IQ2_XS, 0 OOM, 5/5 NIAH PASS)

Context Tokens Prefill vs --kv-resident Decode Peak VRAM BasinKV GPU Pinned RAM NIAH
8K 7,983 976.7 tok/s 2.47× 50.0 tok/s 6,112 MiB 55.5 MiB 178.8 MiB PASS
32K 31,983 1,210.6 tok/s 4.63× 45.2 tok/s 6,122 MiB 66.8 MiB 357.5 MiB PASS
64K 63,999 976.9 tok/s 3.97× 40.8 tok/s 6,120 MiB 89.3 MiB 715.0 MiB PASS
128K 127,983 672.3 tok/s 2.94× 41.0 tok/s 6,112 MiB 134.4 MiB 1.40 GiB PASS
256K 255,999 405.5 tok/s — 33.6 tok/s 6,112 MiB 224.5 MiB 2.79 GiB PASS

Even the 36.2 GB UD-Q4_K_XL quant passes 8K → 256K 5/5 NIAH with 0 OOM in the exact same 6,118 MiB peak VRAM: 913.5 tok/s prefill at 32K (3.77×), 872.1 tok/s at 64K (3.80×), 636.9 tok/s at 128K (3.14×), and 403.5 tok/s prefill / 9.53 tok/s decode at 256K.

RTX 4090 D 24 GB — Linux CUDA 13 --basinkv (Qwen4 UD-IQ2_XS, 100% NIAH PASS)

Context BasinKV Config Prefill Decode (no-draft) Decode (MTP) BasinKV GPU Pinned RAM NIAH
8K sphere+wht_int4 / quest+int8 (MTP) 5,866.6 tok/s 136.2 tok/s 127.8 tok/s 41.6 MiB 41.2 MiB PASS
32K sphere+wht_int4 / quest+int8 (MTP) 5,303.9 tok/s 138.7 tok/s 127.0 tok/s 45.7 MiB 165.0 MiB PASS
64K quest+int8 3,653.8 tok/s 120.4 tok/s 182.8 tok/s 81.2 MiB 650.0 MiB PASS
128K sphere+wht_int4 / quest+int8 (MTP) 2,663.2 tok/s 133.3 tok/s 154.3 tok/s 62.1 MiB 660.0 MiB PASS
256K sphere+wht_int4 / quest+int8 (MTP) 1,603.0 tok/s 128.4 tok/s 147.8 tok/s 84.1 MiB 1,320 MiB PASS

GPU KV / Pinned RAM columns report the listed --no-draft mode (+16 to +42 MiB total peak VRAM over 8K: 13,281–13,307 → 13,323 MiB); quest+int8 MTP uses 49.9 → 224.5 MiB GPU KV (89.4 MiB → 2.79 GiB RAM). Under a simulated 7.5 GiB VRAM cap at 128K, --basinkv runs +56.6% (72.2 tok/s, --no-draft) to +72.1% (79.4 tok/s, MTP) faster than native FP16 (46.1 tok/s) with 0 OOM.

Apple M5 Ultra 256 GB — Native Metal FP16 KV (Qwen4 UD-Q4_K_XL, 5/5 NIAH PASS)

Context Prefill (MTP) Decode (no-draft) Decode (MTP) Unified Memory NIAH
8K 2,206.5 tok/s 63.8 tok/s 120.8 tok/s ~23.3 GiB PASS
32K 2,086.0 tok/s 77.7 tok/s 124.6 tok/s ~23.5 GiB PASS
64K 1,911.3 tok/s 92.0 tok/s 116.0 tok/s ~24.0 GiB PASS
128K 1,621.6 tok/s 87.1 tok/s 109.3 tok/s ~25.5 GiB PASS
256K 1,228.8 tok/s 75.3 tok/s 105.0 tok/s 23.3 GiB (+5.5 GiB KV) PASS

Faster

  • Fused CUDA/HIP Qwen4 decode & DFlash2 acceleration (+15.4%–33.5%, 12/12 greedy bit-exact): fused GR down+SiLU+Q8_1, 4-col/block GR up+gate+mean+Q8_1, MoE SwiGLU+clamp+Q8_1, MoE combine+GR tail write+DFlash2 tap, attention gate+Q8_1, BF16 router+shared-gate fusion, full-snapshot DFlash2 replay elimination, PDL compliance, and RAM-gated PLE page warmup.
    • RTX 4090 D 24 GB (Linux CUDA 13, Qwen4 UD-IQ2_XS, 12/12 bit-exact vs baseline): --no-draft 210.5–211.2 tok/s (+20.6–20.8%), embedded MTP 306.4–319.1 tok/s (+15.4–21.7%), DFlash2 Q8_0 314.0–399.1 tok/s (code 370.0, math 399.1 tok/s, long_qsa 281.8, +21.8–33.5%).
    • RTX 4090 D 24 GB (Linux CUDA 13, Qwen4 UD-Q4_K_XL, df2c3ff30): --no-draft 161.3–166.1 tok/s, embedded MTP 207.2–224.6 tok/s, DFlash2 Q8_0 245.4 tok/s (long_qsa 218.0 tok/s; +15%–40% vs pre-RC build).
    • RTX 5060 Laptop 8 GB (Windows CUDA 13, Qwen4 UD-IQ2_XS & UD-Q4_K_XL): UD-IQ2_XS out-of-the-box default MTP jumped +34% (48.9 → 65.7–68.2 tok/s), reaching up to 84.9 tok/s tuned (--vram-pool --kv q8_0 --expert-profile --tail-skip 4 --defer-rank 4); UD-Q4_K_XL with --cold-q2-lut --tail-skip 4 --defer-rank 4 (compressing cold experts 53.1%: 18.0 → 8.46 GiB) reaches 60.3–68.2 tok/s in 6,132 MiB peak VRAM.
  • Apple Silicon Metal Qwen4 optimization & native Metal DFlash2 (Apple M5 Ultra 256 GB, macOS 27.2.1):
    • UD-Q4_K_XL (8K code/short/2,943 QSA, 20.0–20.5 GiB unified memory, 256/256 bit-exact): --no-draft 101.3–109.1 tok/s (3,020.6 tok/s prefill), embedded MTP 124.0–148.3 tok/s, native Metal DFlash2 Q8_0 97.0–143.2 tok/s.
    • UD-IQ2_XS (64-tok decode, 40/40 golden match): --no-draft 107.3–107.8 tok/s (+73.6% vs initial port), embedded MTP 153.4–157.6 tok/s, native Metal DFlash2 Q8_0 144.4–146.7 tok/s (Q4_0 154.2–154.3 tok/s); 2,914-tok QSA repetitive prompt up to 205.4 tok/s (MTP) / 295.7 tok/s (DFlash2 Q8_0, 48/48 parity).
  • Single-NUMA default thread cap on multi-socket Linux (#428): caps default CPU threads to a single NUMA node when stay_near() is active, eliminating cross-socket memory stalls on offloaded MoE decode.

Fixed

  • Qwen4 --kv-resident ≥ 32K CUDA illegal memory access: allocated QSA idx_pool across full opt_.max_context / idx_block via seq_alloc under --kv-resident instead of capping it to opt_.kv_resident, verified live at 32,776 tokens (--kv q8_0 --kv-resident 4096) on RTX 4090 D (111.39 tok/s, zero errors).
  • 8 GB lent-prompt MTP corruption: chunked draft_input_q4 when prompt_lent_ || work_lent_ so lent expert-cache rows are never overwritten on 8 GB cards.
  • Docker overlayfs spill file creation (#427): falls back from Linux O_TMPFILE to unlinked mkostemp when the container filesystem does not support O_TMPFILE.
  • Cross-backend build & runtime fixes: fixed BasinKV cudaHostGetDevicePointer typing for AMD HIP (hipHostGetDevicePointer(void**, ...)), and kept Qwen4 sh_gate_inp FP32 on Apple Silicon Metal for q4_shexp_gate_mul.

Verification & Scope

  • Upstream boundary: 0 files modified in upstream strata core (engine/src/core, engine/src/program, engine/src/kernels, engine/include/strata/core, engine/include/strata/kernels); Red-Team Run 7 GO (0 P0 / 0 P1, 60/60 adversarial gate checks PASS on release commit df2c3ff30).
  • Pre-release real install & live inference verification (all using the exact release archives below):
    • Windows x64 CUDA 13 (RTX 4070 Laptop 8 GB): setup.get_poly_prebuilt() matched and installed the zip with zero fallback compile; live server.py --engine strata streaming /v1/chat/completions PASS (13.5 s).
    • Linux x64 CUDA 13 (RTX 4090 D 24 GB): setup.get_poly_prebuilt() + poly_will_not_start() installed the tarball with zero fallback compile; live server.py --engine strata Qwen4 UD-IQ2_XS streaming /v1/chat/completions PASS bit-identically across MTP, DFlash2, and --basinkv.
    • macOS arm64 Metal (Apple M5 Ultra 256 GB): unpacked to an isolated path with the build source tree hidden (all 12 .metal shaders + strata-quant-common.h loaded from metal/; otool -L Apple system libraries only; 8/8 Metal ctest parity PASS); live server.py --engine strata Qwen4 UD-Q4_K_XL streaming /v1/chat/completions PASS bit-identically across MTP and DFlash2.
    • AMD HIP (10 family packages: Windows ×5, Linux ×5, ROCm 10.2.0a20260930): all 10 archives compiled, linked, and passed setup.get_poly_prebuilt_hip(), BUILD.json, and strata-poly(.exe) --help standalone startup contract checks (Linux packages include hipblaslt_version=100500, staged tuning/*.txt, and standalone $ORIGIN RUNPATH). Not yet tested on physical AMD GPU hardware.

Ready-made engines (SHA-256)

Source commit: df2c3ff3002cd8af4c914c7fe4ee21379a5210d3 (ENGINE+VISION: ba2ae79b8a871167, ENGINE_ONLY: da0e075dee237a14, VISION_ONLY: ff10911c24d92e04).

Asset Bytes SHA-256
strata-poly-windows-x64-ba2ae79b8a871167.zip 90,092,451 3ed2d4f8dc88f79df1463c501801c6beba810071da4f5a6e63fc3d56982d5914
strata-poly-linux-x64-cuda13-ba2ae79b8a871167.tar.gz 91,051,204 69a297b4cd44f4220faf582af410f9caf4d2f206c5daefffeb5054bb28362b8b
strata-poly-macos-arm64-ba2ae79b8a871167.tar.gz 1,586,637 8fbcf85ea9579d1fe3b72f9574d00fefa5597735578718bbd30a79918f18275f
strata-poly-windows-x64-hip-rdna4-da0e075dee237a14.zip 531,635,286 8e250f8427dc490d22251b7733743b5c3825c1abb3479ca660c3d150bc604760
strata-poly-windows-x64-hip-rdna3-da0e075dee237a14.zip 207,698,035 3e1e137b59da721f2058ead3c674443e745d2f7a7a11e0deb0f1d1b914cdc99e
strata-poly-windows-x64-hip-igpu-da0e075dee237a14.zip 152,557,637 9038f22fbabfa532d74af26b65255a1e08941ee94e49422d3ca777c6fadbb58b
strata-poly-windows-x64-hip-rdna2-da0e075dee237a14.zip 161,660,556 82a424c331e1254b553cfd35c90bd0a0ad47f0a20294b389e558ad5a5c648902
strata-poly-windows-x64-hip-rdna1-da0e075dee237a14.zip 137,169,811 e63bd013365ec2bce1d35d5f1251c91dd76ee693d726743dd05f12c64d8994fd
strata-poly-linux-x64-hip-rdna4-da0e075dee237a14.tar.gz 549,350,398 090dce19a2a9786f520a735c2428e7644fa3089ab1b97032d69d5894d9266afa
strata-poly-linux-x64-hip-rdna3-da0e075dee237a14.tar.gz 225,311,230 bd08740d3016a5fd3fd35ff4162a458e5878c1ef7d0e06a1b7e33fbf452957f5
strata-poly-linux-x64-hip-igpu-da0e075dee237a14.tar.gz 170,803,121 0ee905b712585d843a107be45981e3e5279a01acba986a300a6b430a8913c150
strata-poly-linux-x64-hip-rdna2-da0e075dee237a14.tar.gz 179,709,258 36fc737d21fb2ec8878188aad591b878426b8a3498d8d38f4507a85ab73a3e74
strata-poly-linux-x64-hip-rdna1-da0e075dee237a14.tar.gz 155,419,326 004c8cc956e2be86d907eb5adafa8b862a145ffedc01e0b74cadb25a94959607