mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
spec: a learning stretch times window sizes past its proposals with filler rows
Sizes 5 and 6 of the Radeon 780M and 4 and 5 of the M5 Max were never reached by a lookup proposal in a prose learning stretch, so their table entries were filled in (780M: 174.9 and 206.1 ms against 160 and 178 measured by live costs; the lookup of 5 rows was then priced out and the frozen table lost 1.9-2.5 % on code and JSON to live costs). - choose() takes pad_cap: during learning, when the caller allows it (a deterministic proposal, never a probabilistic window), the window of the smallest size with under 30 samples is run even when the proposal is shorter; the rows past the proposal repeat its last token, which the verifier rejects. Pick::pad says how many rows are filler. - A window run this way goes to the learner and to the cost of its size (observe_forced) and to no lookup or MTP statistic. - The forced-round budget is 200 per stretch (40 per size). - Unit test draft_policy_test: 108 of 108 (5 new: padded window, filler count, forced round feeds no statistic, pad_cap of one draft).
This commit is contained in:
1 parent
1e50a146ed
commit
c43347d094
4 files changed
+59
-13
No files matched your search
@@ -19485,6 +19485,7 @@ int main(int argc, char** argv) {
|
||||
policy.set_context(p);
|
||||
const bool merged = first_window && merge_T > 0; // the prompt's last tokens and the first token
|
||||
bool from_sfx = false;
|
||||
int sfx_pad = 0; // a learning stretch's lookup window longer than the proposal: the filler rows (DraftPolicy::Pick::pad)
|
||||
int sfx_match = 0;
|
||||
bool dfr_lookup = false;
|
||||
int dfr_T = 0, dfr_match = 0;
|
||||
@@ -19540,9 +19541,17 @@ int main(int argc, char** argv) {
|
||||
// chooses, and the lookup is taken without asking whether the MTP's first guess agrees
|
||||
const bool probabilistic = use_mtp && !req_df2 && mtp.prob(); // DFlash2's candidates are not draws from the MTP's q
|
||||
if (k > 0 && (probabilistic || !draft_on || sbuf[0] == drafts[0])) {
|
||||
// a learning stretch may run a longer window than the proposal to time that size: the extra rows repeat the proposal's last
|
||||
// token, which the verifier rejects (a deterministic proposal only: a probabilistic window keeps its own draws)
|
||||
const strata::spec::DraftPolicy::Pick pk = probabilistic
|
||||
? source_policy.choose(S_mtp, k, sfx_match) : policy.choose(T, k, sfx_match);
|
||||
if (pk.lookup && !trace_nopick) { T = pk.t; from_sfx = true; }
|
||||
? source_policy.choose(S_mtp, k, sfx_match) : policy.choose(T, k, sfx_match, dc_learning ? S_look - 1 : 0);
|
||||
if (pk.lookup && !trace_nopick && pk.t - 1 <= (int) sbuf.size()) {
|
||||
T = pk.t; from_sfx = true;
|
||||
if (pk.pad > 0) {
|
||||
sfx_pad = pk.pad;
|
||||
for (int i = k; i < k + pk.pad; ++i) sbuf[(size_t) i] = sbuf[(size_t) k - 1];
|
||||
}
|
||||
}
|
||||
if (pk.lookup && !trace_nopick && o.lookup_max_t > 0) { // --lookup-max-t: a size whose window graph fits
|
||||
const int t = graph_fits(T);
|
||||
if (t < 0) { std::printf("ERR %s\n", err.c_str()); return 1; }
|
||||
@@ -19987,7 +19996,9 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
if (spec_cost && use_mtp && timed_round && !from_sfx) policy.observe_probs(dwin_s.data(), T_mtp - 1, a);
|
||||
if (dc_learning) policy.set_busy_age(std::chrono::duration<double>(Clock::now() - dc_busy_since).count());
|
||||
if (timed_round && !eos && chain_n == 0)
|
||||
if (timed_round && !eos && chain_n == 0 && sfx_pad > 0 && from_sfx) // a window run for its size's sake: its time only
|
||||
policy.observe_forced(T, std::chrono::duration<double, std::milli>(Clock::now() - round0).count());
|
||||
else if (timed_round && !eos && chain_n == 0)
|
||||
policy.observe(from_sfx, T, a, sfx_match,
|
||||
std::chrono::duration<double, std::milli>(Clock::now() - round0).count());
|
||||
else if (timed_round && !eos) // a chained window: its MTP part, its chain, its cost
|
||||
|
||||
Reference in new issue
Block a user