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

+41
View File
@@ -588,6 +588,8 @@ const std::map<std::string, std::vector<std::string>>& legal_values() {
{ "--spec-ngram-min", { "1" } }, { "--spec-ngram-max", { "6" } },
{ "--draft-window", { "fixed" } }, { "--draft-short-from", { "4" } },
{ "--draft-coupling", { "on" } }, { "--draft-verify", { "block" } },
{ "--draft-suffix", { "on" } }, { "--draft-suffix-min-match", { "5" } },
{ "--draft-suffix-max", { "6" } }, { "--draft-suffix-min-score", { "0.4" } },
{ "--draft-depth", { "adaptive" } }, { "--draft-depth-max", { "5" } },
{ "--draft-depth-min", { "2" } }, { "--draft-depth-stop", { "0.7" } },
{ "--draft-depth-lag", { "0" } }, { "--draft-depth-stat", { "path" } },
@@ -1083,6 +1085,30 @@ TEST(draft_depth_adaptive_parses_and_needs_a_coupled_chain) {
}
/* The SuffixDecoding selector: off by default (bit-identical engine), min match 1..12, rows 1..32,
* a score in [0, 1]. */
TEST(the_draft_suffix_flags_default_off_and_parse) {
Config c;
CHECK(!c.draft_suffix);
CHECK_EQ(c.draft_suffix_min_match, 6);
CHECK_EQ(c.draft_suffix_max, 7);
CHECK_NEAR(c.draft_suffix_min_score, 0.3, 1e-6);
CHECK_EQ(c.n_spec_head, 0);
CHECK_EQ(parse({ "--draft-suffix", "on", "--draft-suffix-min-match", "5", "--draft-suffix-max", "6",
"--draft-suffix-min-score", "0.45" }, &c), RAD_OK);
CHECK(c.draft_suffix);
CHECK_EQ(c.draft_suffix_min_match, 5);
CHECK_EQ(c.draft_suffix_max, 6);
CHECK_NEAR(c.draft_suffix_min_score, 0.45, 1e-6);
CHECK_EQ(parse({ "--draft-suffix", "off" }, &c), RAD_OK);
CHECK(!c.draft_suffix);
for (const char* bad : { "yes", "1", "" }) CHECK_EQ(parse_fresh({ "--draft-suffix", bad }), RAD_E_INVAL);
for (const char* bad : { "0", "13", "x", "" }) CHECK_EQ(parse_fresh({ "--draft-suffix-min-match", bad }), RAD_E_INVAL);
for (const char* bad : { "0", "33", "x", "" }) CHECK_EQ(parse_fresh({ "--draft-suffix-max", bad }), RAD_E_INVAL);
for (const char* bad : { "-0.1", "1.5", "x", "" }) CHECK_EQ(parse_fresh({ "--draft-suffix-min-score", bad }), RAD_E_INVAL);
}
/* --draft-verify is token (alias rowwise) unless asked for; block and traversal parse. block
* implies the coupled drafting and refuses coupling off; traversal needs the coupling and says so. */
TEST(the_draft_verify_is_token_block_or_traversal) {
@@ -1746,4 +1772,19 @@ TEST(rope_scaling_takes_yarn_with_a_factor_above_one_or_none) {
CHECK(d.rope_scaling.empty());
}
/* The suffix selector and the adaptive chain depth are served together, with traversal verification
* (bring-up refuses what the model cannot do; the parse and the shown rows say what was asked). */
TEST(the_suffix_selector_parses_beside_adaptive_depth_and_traversal) {
Config c;
CHECK_EQ(parse({ "--draft-suffix", "on", "--draft-depth", "adaptive", "--draft-coupling", "on",
"--draft-verify", "traversal", "--num-speculative-tokens", "5" }, &c), RAD_OK);
CHECK(c.draft_suffix);
CHECK(c.draft_depth_adaptive);
CHECK(c.draft_coupling);
CHECK(c.draft_verify_traversal);
CHECK(!c.draft_verify_block);
CHECK_EQ(c.n_spec, 5);
CHECK_EQ(c.draft_suffix_max, 7);
}
RAD_TEST_MAIN()