diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 3a78a7c9..2389b56b 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1576,7 +1576,7 @@ in VRAM (nothing is missed), with `--batch` / `parallel` slots (a window then mi tokens: kept off until measured), with a peer-expert tier or a helper GPU, on HIP and SYCL builds, and (0.1.42.1, #1884) when 90% or more of all the experts are in the GPU cache: the few misses are cheap there and the skip costs more draft acceptance than it saves (a Tesla V100 32 GB with Coder IQ1_M, 94.8% of the experts cached, 99.9% decode hits: draft acceptance 70.1% to 68.2%, decode 1-2% slower than 0.1.41). A start-up line -says so; `STRATA_ROUTE_TAIL_SKIP=7` turns it on anyway, and `STRATA_TAIL_SKIP_MAX_CACHED=` moves the line (101 = never). The request log gets +says so; `STRATA_ROUTE_TAIL_SKIP=7` turns it on anyway, and `STRATA_TAIL_SKIP_MAX_CACHED=` moves the line (101 = never). On an AMD layer split the line is 70% (2x R9700 at 16 GB-equivalent: Q2_0 with 73% cached lost 6.1% story decode with the skip, IQ3_S with 45% cached gained 7-10%). The request log gets `route tail skip: N missed experts skipped` (cumulative) while it is active. **Answers differ slightly from 0.1.41** (`STRATA_ROUTE_TAIL_SKIP=0` brings them back). Teacher-forced KL of the decode path (the default's own greedy text and the default sampled at T=0.8, 28 chat prompts of code, diff --git a/src/program/generate.cpp b/src/program/generate.cpp index bc7d1c2d..7ee17a27 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -8184,9 +8184,15 @@ int main(int argc, char** argv) { // misses are cheap and the skip costs more draft acceptance (70.1% -> 68.2%) than it saves: -1..2% decode. No default then. size_t cached_experts = 0; for (int32_t r : host_res) cached_experts += r >= 0 ? 1 : 0; - // (STRATA_TAIL_SKIP_MAX_CACHED=, default 90, moves the line; 101 = never) + // (STRATA_TAIL_SKIP_MAX_CACHED=, default 90, moves the line; 101 = never). 0.1.43: 70 on a HIP layer split, where + // 2x R9700 at 16 GB-eq with Q2_0 (73% cached) lost 6.1% story decode with the skip and 2x IQ3_S (45%) gained 7-10%. +#if defined(STRATA_USE_HIP) + const double max_cached_default = n_stages > 1 ? 0.70 : 0.90; +#else + const double max_cached_default = 0.90; +#endif const char* mcs = std::getenv("STRATA_TAIL_SKIP_MAX_CACHED"); - const double max_cached = mcs != nullptr && mcs[0] != 0 ? std::atof(mcs) / 100.0 : 0.90; + const double max_cached = mcs != nullptr && mcs[0] != 0 ? std::atof(mcs) / 100.0 : max_cached_default; const bool nearly_all_cached = !host_res.empty() && !all_experts_resident && (double) cached_experts >= max_cached * (double) host_res.size(); const bool tail_default_ok = tse == nullptr && !all_experts_resident && !nearly_all_cached && o.batch == 0 &&