sched: --draft-suffix on, SuffixDecoding as a step selector on the MTP chain

After each commit the scheduler looks in the sequence's own prompt and output
for the latest earlier occurrence of its last --draft-suffix-min-match tokens;
the next step then verifies what followed it (up to --draft-suffix-max rows,
cut where the product of the follower frequencies falls under
--draft-suffix-min-score) in place of the head's draft. The verify window
becomes the larger of the two while the head keeps its own rounds. A sequence
whose history ended in a recurring pattern is not issued ahead, since the step
is built after the commit where the lookup can read the committed end.

It works with the fixed MTP chain, with --draft-depth adaptive and with
--draft-verify traversal. A suffix chain carries no coupled row
(Request::draft_suffix): the sampler binds none of the head's staged states to
its rows, so each row is the target's plain draw and the rows are leaves of the
traversal walk; mtp_rrs_test checks the law with a negative control that fails.
--draft-verify block is refused. The window is at most 7 rows on Flash-Next (the
delta-net fold's register window).

On Flash-Next IQR-V4 (TP2) on our branch, window 7 on chain 3 with coupling:
+1.4% overall, +2.9% on repetitive tasks, +11% on quoting, free chat unchanged;
beside adaptive depth +0.2% [-1.0, +1.5] overall, code +1.0%. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Code000andClaude Opus 5.5 committed 2026-11-17 22:11:30 +01:00
1 parent e78d484e60
commit b8bca7885a
22 files changed
+1112 -9

No files matched your search

+19
View File
@@ -743,6 +743,10 @@ struct Request {
/* A tree drafter's parents for `draft` (StepEntry::draft_parent): draft[j]'s parent node,
* 0 the bonus token. Null for a chain. The sampler reads each row's ancestors from it. */
const int32_t* draft_parent = nullptr;
/* The draft is a SuffixDecoding chain (--draft-suffix, sched/suffix.h): copied from the
* sequence's own history, not drawn from the head's law. The coupled sampler binds no state to
* its rows, whatever stale states the head's own draft for the same positions left. */
bool draft_suffix = false;
int32_t n_accepted = 0; /* from the previous verify */
/* Whether this request may be speculated on. Written by the engine after every step, read by
@@ -1062,6 +1066,21 @@ struct Config {
int draft_depth_lag = 1;
int draft_depth_stat = 0;
double draft_depth_stop = 0.85;
/* --draft-suffix on (core/sched/suffix.h): SuffixDecoding as a step SELECTOR on a serial head's
* chain. On a host-built step, when the sequence's own history (prompt ++ output) ends in a
* pattern of at least `draft_suffix_min_match` tokens that occurred before, the step verifies
* that earlier occurrence's continuation (a chain of at most `draft_suffix_max` rows (7: the
* delta-net fold's register window serves 8 query rows, so a Flash-Next verify window past 7
* drafts leaves its kernels unsupported), cut where the path score falls under
* `draft_suffix_min_score`) in place of the head's draft. Lossless: the proposal's rows are never
* coupled. Off (default) is the engine as it was, bit for bit. */
bool draft_suffix = false;
int draft_suffix_min_match = 6;
int draft_suffix_max = 7;
float draft_suffix_min_score = 0.3f;
/* The head's own rounds when --draft-suffix raised `n_spec` (the verify window) past them; 0 =
* `n_spec` (set by the engine, not a flag). */
int n_spec_head = 0;
/* ---------------- KL DIVERGENCE AGAINST A REFERENCE (core/kld.h) ----------------
*