mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 16:29:04 +00:00
`--kv auto` (the default) now stores the K/V cache as FP8 wherever the backend can (CUDA, HIP; SYCL stays FP16 by default until its A750 / B70 numbers are in, Metal takes FP8 only in the M5 Max set) and FP16 where it cannot. K8V8 and K8V4 are only chosen when asked for (--kv k8v8, --kv k8v4). An explicit --kv always wins. Before, every backend had its own rule (CUDA: FP16 unless 16+ slots, a card of 13 GB or less with the K/V offload off, sm_89+ with a context over 16K, three RTX 50 rows; HIP: FP16 below 16 slots; SYCL: FP16). - engine/include/strata/core/ink_kv_rule.hpp: the one rule (host only) and the one start-up line, "[kv] cuda: K/V cache fp8 (auto: default)"; the CUDA, HIP, SYCL and Metal backends call it. Test: engine/tests/core/ink_kv_rule_test.cpp. - CUDA: plan_vram_reserve() takes the type from the rule; STRATA_INK_ELASTIC_1M + STRATA_INK_KV_K8V4 remains the tester's way to K8V4. HIP: the old small-card switch STRATA_HIP_KV_FP8_SMALL is retired (register entry marked retired in 0.2.24). - ink_main --help: the --kv line says what auto is. - --dump-ref / --kld-eval: a row-selected form for long documents (INK_KLD_TAIL=N INK_KLD_STRIDE=s keep the logits of every s-th of the last N positions; the file then starts with -n_tokens; INK_KLD_CHUNK / INK_KLD_CHUNK_TAIL set the prompt chunk of the head and of the scored part). The old file format and behaviour are unchanged; the --kld-eval line gains refPPL and dNLL at its end. - terminal: the memory plan (inkling_fit.auto_fp8_kv) sizes FP8 for every backend except SYCL and Metal; compute_unified and recommend take fp8_kv like compute does. Tests that pinned the FP16 numbers now pin them with fp8_kv=False; test_inkling_kv_auto.py covers the new rule, the launcher's k8v8 / k8v4 clamp and that every backend calls the one rule. docs/INKLING_KV.md; docs/SETTINGS.md regenerated. Measurements (phaseA-tests/rel0224/ink-kv/RESULTS.md): teacher-forced KL of FP8 against FP16 K/V 0.005-0.007 and top-1 95-98% on 4K / 32K / 128K documents on RTX A6000 (SQ-20 v2), RTX A4000 (SQ-15), R9700 (SQ-15), Arc A750 (SQ-10, 4K), RTX 5070; the needle misses are the same with FP16.