mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4353] [Engine] Opt-in reusable prefill workspaces and decoded-weight caches for near-1M DeepSeek prompts #1922
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1922
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @moniljo on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4353
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
Would you welcome opt-in prefill workspace reuse, compaction/rearm and bounded decoded-weight caches for near-1M DeepSeek prompts? Strata already supports the context length; this proposal concerns how quickly it processes a large fresh prompt and how much transient workspace can return to the expert cache afterward. I am requesting scope agreement before preparing incremental PRs, with no default change proposed.
This is the prefill/memory counterpart to #4351. That issue covers GPU execution of expert misses and its cancellation recovery. Here the goal is to make both the first and a later unrelated long prompt efficient, while retaining all model state and accounting for resize/rearm time inside the request. The two features should share one reviewed lifecycle/ownership mechanism rather than create competing registration managers.
What do you do today instead?
I run a custom build on one Windows RTX PRO 6000 Blackwell Max-Q 96 GB / 300 W, Ryzen 9 7950X3D, nominal 256 GiB RAM (255.2 GiB reported) and NVMe. The model is the exact OrcaRouter DeepSeek-V4.1-Flash-1017 abliterated Mix-256G originals plus lossless compatibility sidecars, all six trunk experts, 1,048,576 total context, CPU 16 and DSpark on/block 3/confidence 0.65. No smaller trunk quantization or expert reduction was used.
The source-only recipe, setup and reproduction commands, experiment history, and receipt catalog are pinned. Source overlays/controllers, compact results and raw receipt hashes are available; weights, binaries, keys and private conversations are omitted. The current custom port is based on v0.2.7 / engine 0.1.52, upstream
5e8a4cca7d690ac60ca37eb09e7d0e010099ad6d. This work used Codex assistance; source review and actual execution results are kept distinct.Proposed incremental scope
The current implementation is a larger prototype, not a proposed single upstream diff. The first patch could be just phase ownership/retirement/rearm with counters and guards. Attention/router/indexer/GGML fast paths should remain separate until isolated measurements justify them; some enabled paths are inherited upstream functionality.
Measured near-1M results and their scope
The long-context campaign records these historical whole-configuration observations on the same model and machine:
The catalog identifies comparator report
f037d22df554…and custom report87a4c15cc03c…. Code/dependencies, C/A/AI geometry, reserve and copy settings changed together. These results do not isolate a particular cache, establish a pure version regression, or measure stock v0.2.7. The historical c677 build reused retained Opt17 objects/libraries; it was not the later fresh portable build.Both custom seeds reused zero prompt tokens, with an unrelated interlude between the waves. Natural followup EOS, exact shared-prefix reuse, phase/rearm, source protection and owned native-zero cleanup were checked. Zero KV reuse does not mean a purged process, expert cache, OS page cache or cold SSD. Decode counts actual emitted token-ID intervals over the original twelve tasks, including reasoning/control/EOS IDs; it is not HTTP chunk rate. Outputs differ in length.
The retained custom report
87a4c15cc03c…and local architecture readback also observed 41 GPU work buffers shrinking from 15.529 to 0.581 GiB, six host buffers from 13.996 to 0.220 GiB, and an expert pool growing from about 63.93 to 83.7 decimal GB. Wave 2 paid 9.215 s of rearm inside TTFT, with new dense/Engram cache work and physical registration retirement to zero. These are selected allocations/mechanism observations, not a complete VRAM accounting or a per-cache causal speed measurement. Detailed private logs are not presented as public raw data.A separately controlled interactive probe lowered only the repeated-prefill threshold to 32,768. After a short warmup, the same unrelated 85,366-token synthetic prompt changed from 256.248 to 78.796 s TTFT, including maintenance. Its later near-1M seed was 327.217 s with a limited followup set; that subset is not another full two-wave qualification.
Failures, validation limits and proposed acceptance
Related work and maintainer questions
I searched open and closed discussions and inspected current main at the commit above. Related work includes #4351 (our GPU-miss/recovery scope), #4123 (CPU-lane/DSpark streaming), #4286 (registered-store allocation), #4199 (batching), and #4219 (Windows prompt-performance reports). Main already has attention slab/store/cache handling; absence of these exact custom controls does not prove there is no equivalent upstream mechanism. I am asking how best to integrate with the current design.
Would you prefer workspace phase ownership and repeat-request rearm first, then one bounded cache per PR? Which existing worker/store interface should own the transition, and what 1M-specific quality, reuse and backend gates would you want before accepting those patches?
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.
@moniljo commented on GitHub (Nov 7, 2026):
/reopen
What happened
I retested on 0.2.11 on November 6 as requested, then repeated the comparison on 0.2.12 on November 7. The goal is to process a fresh near-1M-token DeepSeek prompt quickly, then return unused prefill workspace to the GPU expert cache. A later long prompt must be able to rebuild that workspace, including after a request is stopped.
The 0.2.11 build with only the Q6 compatibility patch was slower than my custom 0.2.7 baseline. After porting the larger workspace, prompt shortcut, and GPU expert-miss path, my custom 0.2.12 build matched cold first-output latency and improved cached decode. Repeat prefill after a STOP exposed a workspace ownership bug in my port. The repair passed the functional checks, and the first-response speed after interrupted prefill remains unresolved.
Strata version
Source builds from tags
v0.2.7(5e8a4cca, engine 0.1.52),v0.2.11(c3b3f503, engine 0.1.57), andv0.2.12(146df3c4, engine 0.1.58). The first 0.2.11 comparison used only the grouped-Q6 CUDA compatibility change needed for this pack. The other builds carried local optimizations. Stock binaries were outside this timing comparison. 0.2.11 release · 0.2.12 releaseGraphics card, memory and system
Windows 11 x64 build 26300, one RTX PRO 6000 Blackwell Max-Q with 96 GB VRAM, Ryzen 9 7950X3D, 256 GiB system RAM, and NVMe. CUDA 13.2 and MSVC 19.44, targeting SM120a. The first comparison used NVIDIA 617.14. The subsequent comparisons used 621.14, with the same driver on both sides of each comparison.
Steps used to reproduce
--mmap-experts off, and DSpark on with block 3 and confidence 0.65. The full port requests 65,280-token prefill chunks, compacts them to 1,024 for decode, and copies nonresident experts directly from registered system RAM to the GPU. The public recipe builds custom 0.2.7 and provides a portable two-wave benchmark. The exact later source overlays, seven-request harness, and raw logs remain local. Baseline setup · Public baseline benchmarkSTOPwhile it is still reading. The observed progress was 43,691 tokens with zero generated. Drain the cancellation, run a standalone 168-token coding prompt, then submit the 131,072-token input again with a one-token output cap to force workspace rearm. Run a cached coding follow-up, then repeat the same standalone coding prompt. Expected behavior is a valid STOP, completed coding responses, successful rebuild and compaction, and working prefix reuse.Retest results
The compatibility-only 0.2.11 build passed all seven answer checks, capped the requested 65,280-token chunk at 32,768, and ran with its optional PCIe expert streaming off. That comparison changes several engine settings together. In the full 0.2.11 port, restoring the checkpoint-safe YOCO shortcut with its 2,668-row full tail reduced cold trunk expert selections from 239.96M to 120.31M. The corrected port still missed the latency gate. The repaired 0.2.12 run passed the near-1M timing and answer checks, gaining 10.9–11.5% cached decode against the two same-day references. Cached first-output medians were 1.92 s and 4.63 s versus 1.86–1.95 s and 4.59–4.64 s on the references.
Cancellation results. The first 0.2.12 port failed step 3 with
repeat prefill rearm: workspace regrow: allocation/initialization/ownership transaction: invalid/aliased/unowned old regrow buffer. Its regrow code expected two inter-GPU handoff buffers that the one-GPU allocation skips. The repaired port rebuilt the actual 41 device and four pinned host buffers, compacted with 3,401 MiB of VRAM free, and passed coding, reuse, and cleanup. It also passed a separate STOP during near-1M decode, with the next coding response at 52.84 tok/s.The first response after prefill STOP ran at 31.83 tok/s versus 51.11 tok/s for the later standalone response with the same input IDs. That missed our preset 95% gate. A fresh uncancelled run of the same coding input ran at 24.80 tok/s. Generated continuations and expert-cache state differed, so the speed penalty attributable to STOP remains unresolved. The full live 0.2.12 frontend qualification was held at that gate.
Proposed next step
Would you prefer an opt-in patch that derives the resize plan from the buffers actually allocated, with single- and multi-group fixtures, before reviewing the larger prefill and GPU expert-miss changes? For the remaining speed question, I would pair fresh processes with the same starting profile and matched prompt work, then compare the same emitted token prefix or replay fixed token IDs. I would record recovery time, first-token latency, expert residency and direct transfer bytes per token separately from decode throughput. The registration lifecycle overlaps with #4351.
I used Codex to help run and document these tests.
@github-actions[bot] commented on GitHub (Nov 7, 2026):
Reopened, thank you. A maintainer will pick it up from here.