Archived
spec: --draft-depth adaptive stops the MTP chain inside the step
A coupled serial chain stops as soon as the product of the head's own probabilities along it falls under --draft-depth-stop (default 0.85; top or path statistic, at most --draft-depth-max rounds, at least --draft-depth-min), and the next verify carries exactly the drafts made. The decision trails the chain by --draft-depth-lag rounds (default 1), so the host's readback of one state row and its issue of the next round hide behind the running round. The rule reads the draft's laws and the tokens drawn before the one a decision admits, never the target and never the admitted token, so the row-wise and the traversal verify stay exact; mtp_rrs_test checks it by chi-square with two rules that must fail (one reads the admitted draft's own mass, one the target). It excludes --draft-window adaptive, which picks the next step's window from earlier acceptance and step cost and so is a second controller on the same chain. The recorded-pass cache holds 48 passes instead of 24: every row count is its own pass shape and the adaptive chain makes more of them than 24 hold. On Flash-Next IQR-V4 (TP2) on our branch, against chain 3 with coupling and traversal: +3.0% tok/s [+1.0, +5.0] over 117 paired requests; the 48-entry cache is +1.7% [+1.1, +2.3] of that for this mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d0fd4aa1bb
commit
e78d484e60
13 files changed
+1054
-4
No files matched your search
@@ -588,6 +588,9 @@ 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-depth", { "adaptive" } }, { "--draft-depth-max", { "5" } },
|
||||
{ "--draft-depth-min", { "2" } }, { "--draft-depth-stop", { "0.7" } },
|
||||
{ "--draft-depth-lag", { "0" } }, { "--draft-depth-stat", { "path" } },
|
||||
{ "--host", { "127.0.0.1" } }, { "--port", { "8001" } }, { "--api-key", { "k" } },
|
||||
{ "--api-key-env", { "RAD_KEY_ENV_INVENTORY" } },
|
||||
{ "--allow-host", { "box" } },
|
||||
@@ -1037,6 +1040,49 @@ TEST(the_draft_window_is_fixed_or_adaptive) {
|
||||
CHECK_EQ(std::string(draft_window_name(DraftWindow::Fixed)), std::string("fixed"));
|
||||
}
|
||||
|
||||
/* --draft-depth is fixed unless asked for. adaptive switches the coupled drafting on (its rule reads
|
||||
* the draft's laws), excludes the fixed block verify and --draft-window adaptive, and takes its knobs
|
||||
* in range. */
|
||||
TEST(draft_depth_adaptive_parses_and_needs_a_coupled_chain) {
|
||||
Config c;
|
||||
CHECK_EQ(parse({}, &c), RAD_OK);
|
||||
CHECK(!c.draft_depth_adaptive);
|
||||
CHECK_EQ(c.draft_depth_max, 0);
|
||||
CHECK_EQ(c.draft_depth_min, 1);
|
||||
CHECK_EQ(c.draft_depth_lag, 1);
|
||||
CHECK_EQ(c.draft_depth_stat, 0);
|
||||
CHECK(c.draft_depth_stop == 0.85);
|
||||
CHECK(!c.draft_coupling);
|
||||
Config a;
|
||||
CHECK_EQ(parse({ "--draft-depth", "adaptive", "--draft-depth-max", "6", "--draft-depth-stop", "0.6",
|
||||
"--draft-depth-lag", "0", "--draft-depth-stat", "path", "--draft-depth-min", "2" }, &a),
|
||||
RAD_OK);
|
||||
CHECK(a.draft_depth_adaptive);
|
||||
CHECK(a.draft_coupling);
|
||||
CHECK_EQ(a.draft_depth_max, 6);
|
||||
CHECK_EQ(a.draft_depth_min, 2);
|
||||
CHECK_EQ(a.draft_depth_lag, 0);
|
||||
CHECK_EQ(a.draft_depth_stat, 1);
|
||||
CHECK(a.draft_depth_stop == 0.6);
|
||||
CHECK_EQ(parse({ "--draft-depth", "fixed" }, &a), RAD_OK);
|
||||
CHECK(!a.draft_depth_adaptive);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-verify", "traversal" }), RAD_OK);
|
||||
for (const char* bad : { "on", "auto", "" }) CHECK_EQ(parse_fresh({ "--draft-depth", bad }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth" }), RAD_E_INVAL);
|
||||
for (const char* bad : { "-0.1", "1.5", "x" }) CHECK_EQ(parse_fresh({ "--draft-depth-stop", bad }), RAD_E_INVAL);
|
||||
for (const char* bad : { "2", "-1" }) CHECK_EQ(parse_fresh({ "--draft-depth-lag", bad }), RAD_E_INVAL);
|
||||
for (const char* bad : { "17", "-1" }) CHECK_EQ(parse_fresh({ "--draft-depth-max", bad }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth-min", "0" }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth-stat", "mean" }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-coupling", "off" }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-window", "adaptive" }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-window", "fixed" }), RAD_OK);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-verify", "block" }), RAD_E_INVAL);
|
||||
CHECK_EQ(parse_fresh({ "--draft-depth", "adaptive", "--draft-depth-min", "4", "--draft-depth-max", "3" }),
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user