mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2529] [CLOSED] spec: STRATA_MTP_ADAPTIVE=1, the MTP window's own size from the draft policy's learned expected-commits-per-ms #4098
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#4098
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/2529
Author: @MrKop-git
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:pr/mtp-adaptive📝 Commits (1)
931e1daspec: STRATA_MTP_ADAPTIVE=1, the MTP window's own size from the draft policy's learned expected-commits-per-ms📊 Changes
5 files changed (+82 additions, -0 deletions)
View changed files
📝
docs/DETAILS.md(+11 -0)📝
include/strata/spec/draft_policy.hpp(+7 -0)📝
src/program/generate.cpp(+9 -0)📝
src/spec/draft_policy.cpp(+21 -0)📝
src/spec/draft_policy_test.cpp(+34 -0)📄 Description
Summary
The draft policy already measures every window size it sees (the round's time, and how many tokens that size committed) to decide MTP-vs-lookup. This makes it also pick the MTP window's own size (
STRATA_MTP_ADAPTIVE=1, opt-in): among the sizes up to the drafter's own, the best expected-commits-per-ms, taking a smaller one only when it beats the full window by the policy's margin (3%).The rule that matters is the probe order: every size is measured before a guess can price one out - the full window first (the incumbent), then the smaller ones largest-first. My first cut measured only the smaller sizes, and the pinned-text bench below caught it locking T4 out forever on a machine whose window rows are cheaper than the prior cost shape assumes (T2:89 windows, 21.12 tok/s).
What it changes and what it leaves alone
DraftPolicy::choose_mtp(new), called from the one-shot and single-GPU serve decode loops only when the flag is set. Without the flag nothing asks the policy and every window is the drafter's own. The window only decides how many drafts one round checks - verification keeps the output whatever the window is.How it was checked
src/spec/draft_policy_test.cpp(7 new checks): the probe order (full 4→3→2→1), the margin rule picking the best expected-commits-per-ms size, and both extremes (a paying full window stays; a window whose drafts never land shrinks to 1).--spec 4 --spec-min-p 0.5, 192 tokens,--spec-followpins the text to the model's own greedy continuation of a 42x128 prompt - the repo's own mechanism for comparing speculation settings on the same text - ABBA interleaved):Same acceptance counts in every pair (123-124 of ~168 steady; 58-60 shifting). On the steady stream both adaptive runs beat both fixed runs (about 5%); on the shifting one the min-p gate already shrinks the windows and the policy stays level with it. The first cut's failure (never measuring the full window) is in the commit message as the counter-example the probe rule is for.
Not tested
Free-running (unpinned) runs cannot resolve this comparison: issue #152's text variance moved acceptance between 31% and 81% on the same synthetic prompts and tok/s by ±20% - noted so nobody quotes those. Also untested: HIP (no toolchain here), SYCL (separate engine tree),
--batchwindows, the layer-split pipeline's windows (the policy learns there but the hook is not added), and non-greedy draws (the window rule does not touch the draws;STRATA_IQ_MT_MIN=1remains the recipe for byte-stable greedy text). Two early flagged runs died at the expert-arena setup before any window - environmental (a 46 GiB arena on a memory-pressured box), the site precedes the flag's first use, not reproduced in a dozen later runs.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.