Adaptive tier: --adapt-decay
--adapt-decay F sets the factor the routing counts are multiplied by after each adaptation (0.7, as before; the same float, so the default is bit for bit 0.1.37's). #477's routing heat is added before the decay, as before. From #407; its --adapt-tuned (opt-in re-ranking every 2 rounds, 192 swaps, x0.92 for caches holding 20-60% of the experts) is left out of this release.
This commit is contained in:
1 parent
e4ed23fc17
commit
c791d32934
1 file changed
+7
-4
@@ -362,6 +362,7 @@ struct Options {
|
||||
/// Plan v0.3 P6: every `adapt_every` rounds, swap up to `adapt_swaps` of the most-routed missing experts into
|
||||
/// the VRAM tier in place of the least-routed resident ones (decayed counts). 0 = static residency.
|
||||
int adapt_every = 4;
|
||||
float adapt_decay = 0.7f; ///< the usage counts are multiplied by this after each adaptation (--adapt-decay)
|
||||
/// Plan v0.3 P6: a draft enters the verify window only while every draft before it (and itself) has at least
|
||||
/// this probability under the draft layer; 0 = always --spec-1 drafts.
|
||||
double spec_min_p = 0.0;
|
||||
@@ -1192,6 +1193,7 @@ int main(int argc, char** argv) {
|
||||
else if (a == "--mtp-window") o.mtp_window = std::atoll(next("--mtp-window"));
|
||||
else if (a == "--pcie-frac") o.pcie_frac = std::atof(next("--pcie-frac"));
|
||||
else if (a == "--adapt-every") o.adapt_every = std::atoi(next("--adapt-every"));
|
||||
else if (a == "--adapt-decay") o.adapt_decay = (float) std::atof(next("--adapt-decay"));
|
||||
else if (a == "--spec-min-p") o.spec_min_p = std::atof(next("--spec-min-p"));
|
||||
else if (a == "--stop-eos") o.stop_eos = true;
|
||||
else if (a == "--spec-split") o.spec_split = true;
|
||||
@@ -4651,10 +4653,11 @@ int main(int argc, char** argv) {
|
||||
const strata::core::OnDevice on(st->dev);
|
||||
cudaEventRecord(st->adapt_ev, st->adapt_stream);
|
||||
}
|
||||
// #477: the routing counted since the start (each count adds up to 1 / (1 - 0.7) over its decays: the
|
||||
// sum is proportional to the routing itself) - only with --expert-profile-save, else `heat` is empty
|
||||
// #477: the routing counted since the start (each count adds up to 1 / (1 - --adapt-decay) over its
|
||||
// decays: the sum is proportional to the routing itself) - only with --expert-profile-save, else `heat`
|
||||
// is empty
|
||||
for (size_t i = 0; i < heat.size(); ++i) heat[i] += (double) drive.d.usage[i];
|
||||
for (float& v : drive.d.usage) v *= 0.7f;
|
||||
for (float& v : drive.d.usage) v *= o.adapt_decay;
|
||||
return true;
|
||||
};
|
||||
// #477: write the learned profile (between requests and at QUIT: a prompt's lent slots are back by then).
|
||||
@@ -6306,7 +6309,7 @@ int main(int argc, char** argv) {
|
||||
if (trace_adapt)
|
||||
std::fprintf(stderr, "strata: ADAPT round=%lld swapped %zu of %d slots, usage decayed\n",
|
||||
(long long) adapt_rounds, swaps.size(), o.adapt_swaps);
|
||||
for (float& v : drive.d.usage) v *= 0.7f;
|
||||
for (float& v : drive.d.usage) v *= o.adapt_decay;
|
||||
swaps_total += (int64_t) swaps.size();
|
||||
ms_adapt += std::chrono::duration<double, std::milli>(Clock::now() - ta).count();
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user