SmallTide v0.3.1: Qwen4-35B-A3B-NVFP4 (256K ctx + Vision) on 16 GB GPUs with zero paging loss — why I'm building a custom engine + full quality/VRAM benchmarks
SmallTide now supports Qwen4-35B-A3B (35B total / 3B active, text + vision + XML tools, native up to 1M ctx) in addition to Inkling-2-Mini, with native NVIDIA CUDA (sm_120/89/86/80 — RTX 50/40/30 & RTX PRO) and AMD RDNA 4 HIP (gfx1201/gfx1200 — RX 9070 XT / 9060 XT) kernels on Windows and Linux.
This time I want to explain why I'm building my own inference engine from scratch instead of PR'ing an existing one, and share full VRAM vs. quality benchmarks from v0.3.1.
First, when you don't need this
If you have 32 GB+ of VRAM, Strata and other engines already fit the model in VRAM and run fine — there isn't much difference between well-tuned engines since everyone hits the memory-bandwidth ceiling.
Worth trying if any of these apply to you
- You want to run NVFP4-level quantization (
RadixArk/Qwen4-35B-A3B-NVFP4, ~16.9 GiB of experts + dense/KV/drafter = ~23.2 GiB total) on a 16–24 GB GPU. - At that size it doesn't fit in 16 GB, so you assume your only options are slow CPU/RAM offloading, or dropping down to a 2–3 bit quant (
IQ2/IQ3) that degrades quality. - Or another app (browser, desktop compositor, IDE, etc.) needs a little VRAM, pushing the model just over the edge into OOM or silent system-RAM spillover.
In cases like these, SmallTide is far more flexible than existing engines. With Adaptive Expert Loading (3-tier VRAM -> Pinned Host RAM -> NVMe with async promotion, an inline GPU Rescue Ring, and Elastic 32K -> 256K KV), it keeps speed high while keeping quality loss at zero (or bare minimum when host RAM is tight). Because streaming optimizations touch every layer of the engine — routing, paged KV, pinned DMA overlapped with shared MLP, speculative draft/verify — it's beyond what can be bolted onto existing engines as a PR.
Real GPU Decode Speeds (bench/bench.py, Qwen4-35B-A3B-NVFP4 + DFlash 2)
| Engine | GPU / Setup | prose | code | edit | thinking | random (8K) | angry-birds | mario |
|---|---|---|---|---|---|---|---|---|
| qwen4 | RTX PRO 6000 (96 GB, CUDA, 1M ctx) | 181.7 | 337.3 | 645.0 | 248.7 | 259.6 | 471.8 | 449.4 |
| qwen4 | RTX 5070 Ti (16 GB, CUDA, 256K, headless) | 108.8 | 136.4 | 267.8 | 154.7 | 86.0 | 155.8 | 181.6 |
| qwen4 | RX 9070 XT (16 GB, HIP, 256K, 16G RAM, monitor) | 61.5 | 91.0 | 216.3 | — | 54.1 | 147.6 | 156.3 |
| inkling2 | RTX PRO 6000 (96 GB, CUDA, BF16 dense) | 155.9 | 176.1 | 302.8 | 266.1 | 136.6 | 290.5 | 266.6 |
| inkling2 | RTX 3090 (24 GB, CUDA, Linux, community) | 98.6 | 136.8 | — | — | — | — | — |
| inkling2 | RX 9070 XT (16 GB, HIP, headless) | 87.0 | 91.0 | 109.1 | 115.2 | 68.8 (95.0 DSpark) | 114.4 | 126.2 |
| inkling2 | RX 9060 XT (16 GB, HIP, monitor, community) | 48.4 | 50.3 | 50.9 | — | 39.5 | 63.9 | 70.9 |
Quality & Speed vs. Real VRAM Scaling (Qwen4-35B-A3B, v0.3.1)
Measured via exact full-vocabulary (248,320) f64 KL divergence, Top-1 / Top-5 agreement, and Perplexity over 1,558 teacher-forced tokens across 4 domains (Rust code, math, prose, JSON), alongside greedy DFlash 2 tok/s (emulated VRAM/RAM caps on RTX PRO 6000):
Reference = official Qwen/Qwen4-35B-A3B-FP8 (100% VRAM resident FP8 experts + native BF16 dense & lm_head, 36.92 GiB)
| Config | Real VRAM | VRAM Experts | Top-1 | Top-5 | KL Mean | PPL | Skipped Wt | DFlash 2 |
|---|---|---|---|---|---|---|---|---|
| Ref: FP8 + BF16 dense (100% VRAM) | 36.92 GiB | 10,240/10,240 | 100.00% | 100.00% | 0.00000 | 3.265 | 0.00% | 155.7 tok/s |
| FP8 + FP8 dense (100% VRAM) | 34.62 GiB | 10,240/10,240 | 93.58% | 99.74% | 0.02785 | 3.260 | 0.00% | 234.9 tok/s |
| NVFP4 + BF16 dense (100% VRAM) | 25.29 GiB | 10,240/10,240 | 93.52% | 100.00% | 0.04120 | 3.256 | 0.00% | 151.0 tok/s |
| NVFP4 + FP8 dense (100% VRAM) | 23.19 GiB | 10,240/10,240 | 92.30% | 99.61% | 0.04638 | 3.267 | 0.00% | 251.3 tok/s |
| 16 GB Headless (15.5G, 6G RAM) | 15.47 GiB | 6,928/10,240 | 92.30% | 99.61% | 0.04638 | 3.267 | 0.00% | 168.8 tok/s |
| 16 GB Safe (15.0G, 6G RAM) | 15.00 GiB | 6,632/10,240 | 92.30% | 99.61% | 0.04638 | 3.267 | 0.00% | 170.5 tok/s |
| 16 GB Mid (14.5G, 6G RAM) | 14.54 GiB | 6,337/10,240 | 91.91% | 99.68% | 0.05191 | 3.262 | 0.44% | 143.1 tok/s |
| 16 GB Monitor (14.3G, 7G RAM) | 14.27 GiB | 6,100/10,240 | 92.30% | 99.61% | 0.04638 | 3.267 | 0.00% | 153.3 tok/s |
| 16 GB Monitor (14.2G, 6G RAM) | 14.23 GiB | 6,100/10,240 | 91.01% | 99.68% | 0.07167 | 3.291 | 1.36% | 137.2 tok/s |
| 13.6 GiB (6G RAM) | 13.60 GiB | 5,760/10,240 | 90.24% | 99.23% | 0.11025 | 3.389 | 2.91% | 116.0 tok/s |
| 13.1 GiB (6G RAM) | 13.11 GiB | 5,457/10,240 | 87.93% | 98.78% | 0.16120 | 3.541 | 4.70% | 100.4 tok/s |
Full study + 12 GB GPU curve + --kl-eval reproduction commands: https://github.com/raspy135/SmallTide/blob/main/docs/qwen4-vram-quality-scaling.md
New in v0.3.1
- Zero paging loss on 16 GB: Fast Tier-1 Pinned RAM DMA rescues are always executed while only slow NVMe reads are threshold-gated. At 15.0–15.5 GiB headless (even on a 16 GB system RAM PC), output logits match 23.19 GiB 100%-resident NVFP4 down to the 5th decimal place (
92.30%Top-1,0.04638KL,3.267PPL). With 24–32 GB+ host RAM (7–11 GBpinned pool), it holds zero paging loss all the way down to 12 GB VRAM (10.2 GiB,115.5 tok/s). - Elastic 32K -> 256K KV: Starts compact at 32K (
0.32 GiB) so normal turns keep maximum resident experts, dynamically borrows tail expert slots up to 256K on long prompts, and shrinks back on idle. - OS VRAM-Pressure Shrink & Regrow (CUDA + ROCm): Watches real OS VRAM headroom (
DXGI/D3DKMTQueryStatisticson Windows,amdgpusysfs on Linux), voluntarily yields cold tail experts to Pinned RAM when another app takes VRAM, and regrows back to your configured cap once it closes. - Native Qwen4-35B-A3B-FP8 support: Also runs official
[128, 128]block-FP8 checkpoints directly on 48–96 GB cards. - Single binary, zero SDK install: Pre-compiled
.cubin+.hsacokernels are embedded insidesmalltide-cli(no Rust, CUDA Toolkit, ROCm SDK, or Python required).
Repo & v0.3.1 release (MIT): https://github.com/raspy135/SmallTide
About this post
- Posted
- Archived
- Score
- 1 · 100% up
- Kind
- Text
- ID
- 1yd7kxb