feat(qwen4-exp): mmap PLE tables from disc - #279
Conversation
|
Confirmed: PR #279's SSD-backed PLE mmap path works for Tested setup
All 192 NVFP4 expert parts loaded, Balanced measurementFixed seed
The 50K pool has 50,048 total KV tokens and the full pool has 262,208; FreeToken reserves one 64-token dummy page in each. Full context was about 6.8–7.2% slower in decode because fewer experts fit in the GPU cache. Across the measured cases, peak whole-system RAM was 91.2 GiB, peak whole-GPU VRAM was 31.1 GiB, and whole-D-drive read samples reached 3.28 GB/s. These are device/system counters rather than per-process counters. Reproducible launcher, method, limitations, troubleshooting, and request-level JSON: Important Windows delivery limitation: this is not a standalone Windows CLI package. The source checkout reuses the Python runtime, DLLs, CUDA sources, and libraries installed by FreeToken Desktop. Desktop itself does not need to be open or modified, but this server cannot be selected or configured in the Desktop UI. I am therefore not opening a follow-up upstream PR for the Windows bridge at this stage; the fork is an unofficial reproducibility path for users with similar hardware and Desktop already installed. The compatibility bridge also credits and adapts relevant prior Windows approaches from closed PR #232 by MaxKerkula and contributors. |
…combination Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lyub5epQAePQfTXPjhwoh3
|
Tested on the exact configuration this PR targets — a 128 GB box that cannot run the pinned-PLE path. It works. Machine: Ubuntu 24.04 bare metal (no WSL2), 128 GB DDR4 (125.7 GiB visible), RTX 5070 Ti 16 GB, Before/after on the same machine — this is the pinned-vs-mmap comparison you asked for:
So the mmap path removes ~48 GiB of host residency, which lines up with the 47.68 GiB PLE table almost exactly. My earlier report in #214 said this checkpoint was simply out of reach at 125.7 GiB — this PR makes that report obsolete, which is the best kind of obsolete. One practical note for 16 GB cards. My first two attempts failed fast (~76 s) with: That is a VRAM-budget failure, not a RAM one, and it happens before any of the mmap work is exercised — easy to misread as "the PR doesn't help me". Freeing the GPU (I had a ComfyUI instance holding ~560 MB) and raising Might be worth a line in the PR description that the minimum plan needs ~3 GB of cache budget on top of the weights, since 16 GB is exactly the class of card this feature rescues. The 18.7 vs your 44.75 tok/s gap tracks VRAM (16 GB vs 32 GB) rather than the PLE path — on this box each ~3 GB of experts moved onto the GPU is worth roughly +1 tok/s, so the residency difference alone accounts for it. PLE lives on ext4 NVMe here. Happy to run further variants (larger contexts, |
|
Opened #311 — same idea, different implementation. Instead of mmap page faults it reads rows straight from the checkpoint shards with O_DIRECT + io_uring (one batched round per step), uses no cache (fixed ~21 MiB staging), and on decode the graph launches first and waits on a stream flag, so the disk round trip hides behind embedding + layer 0. |
closes #79 offload PLE to Disk
Adds
--ple-backend mmap, demand-paging Qwen3.8-Flash-Next’s 47.7 GiB PLE table from NVMeUsage:
set ple-backend
pinned(default) ormmapPerformance tests:
Fits into 128GB of total RAM + VRAM space with 250K FP16 context.
Tests under RTX 5090, 96 GB RAM:
looks sweet, but appreciate tests with pinned PLE to avoid negative regression, don't have enough RAM for that