draft: an adaptive draft window per sequence (RADIANCE_DRAFT_ADAPT)

One depth for every request is too shallow for code and JSON and too deep
for prose. With RADIANCE_DRAFT_ADAPT=1, --num-speculative-tokens becomes
the ceiling and each sequence drafts into the window d that maximises
E(d)/T(d): the tokens a step is expected to emit from the sequence's own
smoothed acceptance at each position, over the step's cost
(RADIANCE_DRAFT_COST, depth:ms pairs). The serial head runs as many rounds
as the deepest window in the step. A window moves only past a hysteresis
and a hold, since a new window is a new pass shape. Acceptance is
unchanged. /metrics gains radiance:draft_depth_adaptive and
radiance:draft_verify_depth_total{depth} while it is on. Unset, nothing
changes. Greedy at up to 6 against fixed 3: code +7.7 %, JSON +16.3 %.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-10-07 11:10:19 +02:00
1 parent 73691a1189
commit 82da8eab69
11 files changed
+830 -10

No files matched your search

+7
View File
@@ -280,6 +280,13 @@ public:
o.draft_pos_reached [j] = m.draft_pos_reached [j];
o.draft_pos_accepted[j] = m.draft_pos_accepted[j];
}
o.draft_adaptive = m.draft_adaptive;
o.draft_depth_adaptive = m.draft_depth_adaptive;
{
const int ka = (int)(sizeof m.draft_verify_depth / sizeof m.draft_verify_depth[0]);
const int kb = (int)(sizeof o.draft_verify_depth / sizeof o.draft_verify_depth[0]);
for (int d = 0; d < ka && d < kb; ++d) o.draft_verify_depth[d] = m.draft_verify_depth[d];
}
o.preemptions = m.preemptions;
o.total_requests = m.admitted;
o.steps = m.steps;