mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4040] [Engine] --lookup-max-t: prompt-lookup windows up to 16 tokens while the MTP keeps --spec, bitwise, edits +19% decode #4889
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#4889
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4040
Author: @merbanan
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:pr/lookup-max-t📝 Commits (5)
ec14b55serve: --lookup-max-t N - prompt-lookup windows up to N tokens while the MTP keeps --spec999e504verify: one-conversation windows up to 16 tokens (--lookup-max-t 16)419efbbserve: --lookup-max-t - the prompt's verify windows take the allowed sizes too; a layer split stops at 8176d3e8verify: 16-token windows - the q8_1 scratch holds one token group, the GDN recurrence takes 16 tokens4dd7b48docs: --lookup-max-t and --lookup-sizes in DETAILS.md📊 Changes
11 files changed (+303 additions, -55 deletions)
View changed files
📝
docs/DETAILS.md(+6 -0)📝
include/strata/core/mtp.hpp(+6 -0)📝
include/strata/core/verify.hpp(+15 -9)📝
include/strata/kernels/verify_kernels.hpp(+5 -0)📝
include/strata/spec/draft_policy.hpp(+14 -1)📝
src/core/mtp.cpp(+21 -0)📝
src/core/verify.cpp(+77 -31)📝
src/kernels/cuda/verify_kernels.cu(+6 -3)📝
src/program/generate.cpp(+99 -5)📝
src/spec/draft_policy.cpp(+22 -6)📝
src/spec/draft_policy_test.cpp(+32 -0)📄 Description
Problem and result
On a copy-heavy turn (an edit that rewrites a file), almost every prompt-lookup draft is accepted (1477 of 1487 on a 142-line rename, RTX 2060 SUPER), so decode is bound by the window cap of
--spec+ 2 tokens. Raising--specto lift it makes the MTP's own windows longer too, which costs on ordinary turns.--lookup-max-t N(up to 16) lifts only the prompt-lookup windows to N tokens. The MTP keeps--spec. Edits decode faster with the same tokens.Approach
kVerifyLongT = 16for the serial (one-conversation) decode window. Batch, pipelined and layer-split windows stay atkVerifyMaxT = 8.--spec-splitlayout). Every per-group kernel (fused hyper-connection reads, GDN, QSA, the router and resident plan), the CPU experts and the drafter keep their 8 rows. Only the window-wide parts take more:MtpDrafter::draft_longcatches up the accepted rows past its window throughprefill()and drafts from the last one, so its K/V holds every accepted cell.--lookup-sizes A,B,...get one (default MTP+1, MTP+2 and N). A lookup window's graph is captured before its round; one that finds no VRAM is dropped for good (DraftPolicy::disable), and the round takes the next smaller allowed size instead of the engine exiting onverify: instantiate: out of memory.Without
--lookup-max-tnothing changes. Documented in docs/DETAILS.md; draft_policy_test covers the new size rules.Validation
Environment: RTX 2060 SUPER 8 GB (sm_75), Ryzen 9 3900X, 92 GB RAM, Linux 7.0, CUDA build with gcc-13, Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS native pack,
--kv k8v4 --spec 3 --mtp ... --expert-cache auto --prefill auto --max-context 131072. Baseline: main7dd5cf18, built and run the same way.Passed:
--lookup-max-t 16 --lookup-sizes 8,16: the same six outputs, byte-identical to main (2 loads).Failed: none observed.
Not run:
Limits
It helps turns where lookup drafts are long and mostly accepted (edits, rewrites, repeated text). Each extra window size costs a graph's VRAM, which is why
--lookup-sizesexists; on a card with no room left, the larger sizes are dropped at run time and decode falls back to the smaller ones.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.