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

+62
View File
@@ -779,4 +779,66 @@ TEST(a_block_drafter_step_on_the_card_continues_where_the_verify_left_off) {
}
}
/* ================================================================== a suffix step (--draft-suffix) */
/* A suffix step is a host-built verify of up to 8 proposals behind the bonus token while the head
* drafts 3 rounds. The card's side of it: the acceptance walks all 8 drafts (a prefix of them, up to
* the end-of-generation cut), the head's history pass covers all 9 positions with round 1 on the
* last committed one and the rejected rows repeating it, and the 3 rounds publish the next verify's
* 3 proposals into tok[1..3] without touching what lies past them. */
TEST(a_host_built_nine_row_verify_is_accepted_caught_up_and_followed_by_three_rounds) {
for (int acc_want = 0; acc_want <= 8; ++acc_want) {
const int ctx = 200, n = 9;
/* the verify: the bonus token and 8 proposals, a host row (no device row) */
Slab a(ADV_ACCEPT);
a.row(0, false, 0, n, ctx, /*card=*/3, /*rtok=*/0, /*rout=*/0, /*aux=*/8);
for (int j = 0; j < n; ++j) a.w[Slab::TOK + j] = 500 + j;
for (int j = 0; j <= 8; ++j) a.src[j] = j < acc_want ? 500 + j + 1 : 9000 + j;
a.run();
const StepSlot& S = a.st[3];
CHECK_EQ(S.acc, acc_want);
CHECK_EQ(S.tok[0], 9000 + acc_want);
CHECK_EQ(S.head, ctx + acc_want);
CHECK_EQ(S.ctx, ctx + acc_want + 1);
CHECK_EQ(S.n_acc, acc_want + 1);
CHECK_EQ(S.npath, 0);
/* the head's history pass over all nine rows: positions up to the last committed one, the
* rest repeating it, so no rejected proposal's hidden state reaches the head's cache */
Slab h(ADV_HIST);
h.st[3] = S;
h.row(0, true, 0, n, ctx, 3, 0, 0, /*aux=*/0);
for (int j = 0; j < n; ++j) h.src[j] = a.src[j];
h.run();
for (int j = 0; j < n; ++j) {
const int up = std::min(j, acc_want);
CHECK_EQ(h.w[Slab::POS + j], ctx + up);
CHECK_EQ(h.slot(0, j), ctx + up);
CHECK_EQ(h.w[Slab::OUT + j], up);
}
CHECK_EQ(h.used(0, 0), ctx + acc_want + 1);
/* the head's own rounds: 3 of the 8 the verify window allows */
for (int round = 2; round <= 3; ++round) {
Slab r(ADV_ROUND);
r.a.round = round;
r.st[3] = h.st[3];
r.row(0, true, 0, 1, 0, 3, 0, 0, 0);
r.src[0] = 7100 + round;
r.run();
h.st[3] = r.st[3];
}
Slab t(ADV_TAKE);
t.a.round = 3;
t.st[3] = h.st[3];
t.row(0, true, 0, 1, 0, 3, 0, 0, 0);
t.src[0] = 7200;
t.run();
const StepSlot& N = t.st[3];
CHECK_EQ(N.tok[0], 9000 + acc_want);
CHECK_EQ(N.tok[3], 7200);
for (int j = 4; j <= RAD_SCHED_MAX_SPEC; ++j) CHECK_EQ(N.tok[j], (int32_t)0x7f7f7f7f); /* untouched */
}
}
RAD_TEST_MAIN()