feat(qwen4_exp): stream the PLE n-gram table from disk - #311
Open
jason-fxz wants to merge 5 commits into
Open
Conversation
… disk) disk is now the default PLE backend: rows stream in place from the checkpoint shards via io_uring (pread-pool fallback), -2.6% decode vs pinned for 47.7 GiB less host RAM. Stateless stage/flush store, in-graph WAIT/signal sync, forward_host_ctx engine seam.
…ing, log io/sync choice
This was referenced Aug 31, 2026
Collaborator
|
@jason-fxz Great work! On single RTX 5090:
|
|
Was excited to see this PR so I tested on my box: Hardware: RTX 5080 16 GB, Ryzen 9 9900X, 96 GB DDR5 (dual channel), checkpoint on a gen5 NVMe (Samsung 9100 PRO, ext4). Arch, driver 610.57, CUDA 13.3, this branch @ ccddade, Config that's serving right now, with an 80K window: Numbers:
Running Pi agent at 32-35 tok/s with basic computer use tests. Two things I hit on the way that might save others time:
Happy to run more tests on this config if useful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Qwen3.8-Flash-Next has a huge PLE n-gram table (47.7 GiB as fp8 in the -FP8/-NVFP4 checkpoints). Instead of preloading it into pinned host RAM, this PR reads the needed rows from disk on each forward.
--ple-backend diskis the new default;pinnedkeeps the old behavior.Data path
checkpoint shards → TableFile → BatchReader → dedup → pinned staging → GPURow ids are hashed on the host from the request's token history, so prefix hits, restores and forks need no bookkeeping. The C++ store is stateless:
stage(token run)+flush(signal).Sync
Fast path: the decode graph launches first and waits on a
cuStreamWaitValue64flag right before consuming the rows; the host fills staging while the GPU runs embedding + layer 0, then sets the flag. Fallback: fill before launch. The engine hook is one context manager on the model (forward_host_ctx), a no-op for other models.Decode / prefill costs
Performance
H100 (80 GB), -NVFP4 checkpoint. Decode: AIME problems. Prefill: real mixed text (tech report, blog, distinct GSM8K problems).
RTX PRO 6000 Blackwell (sm_120), VRAM held to 32 GiB to model a consumer card, bare NVMe. Same workloads, except the prefill filler is unique tokens (rows dedup 1.00:1, the worst case); the MoE cache holds ~11% of the experts here, so every step already waits on expert traffic and the round trip hides completely.
Fallbacks
O_DIRECT → buffered; io_uring (Linux ≥ 5.6) → 16-thread pread pool; stream memops → launch gating;
disk→pinned. Windows is planned — the OS-specific parts sit behind these seams.