Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Engine 0.1.20: a checkpoint at the end of the system prompt (PR #65 on top of #62); setup requires it
Niko1221bcd62942f182
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 1219d4bea..929d6a6d2 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -8,7 +8,7 @@# written against sm_120 (RTX 5000 / Blackwell) and silently building for an older arch would produce a# binary that runs and is wrong about its own performance, which is the worst of both outcomes.cmake_minimum_required(VERSION 3.24)-project(strata VERSION 0.1.19 LANGUAGES CXX)+project(strata VERSION 0.1.20 LANGUAGES CXX)add_compile_definitions(STRATA_VERSION="${PROJECT_VERSION}")# issue #31: release builds keep a PDB beside the exe (not shipped in it), so a minidump from a stalled engine can# be read back to the exact source linediff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex 641aabaed..1a6e02033 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -313,8 +313,10 @@ live session, or one of the checkpoints it keeps in RAM (up to 6, ~118 MB each,assistant turn and every 16K prompt tokens). A checkpoint is used only when the prompt starts with exactly its tokensand pictures. The oldest checkpoint - in practice the end of the system prompt, which every chat of the same clientshares - is kept for good while the rest rotates by least recent use, so a NEW chat that shares that prefix starts-reading after it instead of from token 0. Engine options: `--prompt-cache N` (0 = off), `--prompt-cache-every N`,-`--turn-token ID`.+reading after it instead of from token 0. A prompt read from the start is also checkpointed at the end of its system+prompt when that is 2,048 tokens or more (engine 0.1.20; PR #62 + #65), so that root exists for agent clients with long+system prompts and tool lists. Engine options: `--prompt-cache N` (0 = off), `--prompt-cache-every N`,+`--prompt-cache-root N` (0 = no system-prompt checkpoint), `--turn-token ID`.**Current limits (v1):** one request at a time, and one conversation's history in the KV cache at a time (switchingbetween two chats re-reads the part where they diverge; the shared prefix, such as the system prompt, is reused); imagesdiff --git a/setup.py b/setup.pyindex 6d8af4a99..e24da5339 100644--- a/setup.py+++ b/setup.py@@ -57,7 +57,7 @@ PREBUILT_ASSET = "strata-windows-x64.zip" if WIN else "strata-linux-x64.zip"# the CUDA libraries the ready-made engine loads (the same CUDA 13.0 it is built with), from NVIDIA's pip packagesCUDA_WHEELS = ["nvidia-cublas==13.0.2.14", "nvidia-cuda-runtime==13.0.96"]MIN_DRIVER = 580 # CUDA 13.0-MIN_ENGINE = (0, 1, 19) # v0.1.19: penalties on every drafted token; v0.1.17: one penalties stage (#53)+MIN_ENGINE = (0, 1, 20) # v0.1.20: system-prompt checkpoint, PCIe probe, hit rate; v0.1.19: penaltiesPY_PACKAGES = ["numpy", "jinja2", "regex", "pyyaml", "tqdm", "requests", "cmake", "ninja", "pillow", "psutil"]MODELS = {diff --git a/src/program/generate.cpp b/src/program/generate.cppindex be7402c8c..6e979d6a4 100644--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@ -264,6 +264,9 @@ struct Options {int prompt_cache = 6;/// --serve: also keep a checkpoint every N freshly read prompt tokens (0 = only at the last turn boundary)int64_t prompt_cache_every = 16384;+ /// --serve: a prompt read from token 0 is also checkpointed at its first turn boundary - the end of the system+ /// prompt, which every chat of the same client shares - when that is at least N tokens (0 = never)+ int64_t prompt_cache_root = 2048;/// --serve: the token that opens a chat turn (<|im_start|>). The last one in a prompt is where the chat's/// history ends and the new assistant turn begins, which is the checkpoint the next request can reuse.int64_t turn_token = 248045;@@ -919,6 +922,7 @@ int main(int argc, char** argv) {else if (a == "--vision") o.vision = true;else if (a == "--prompt-cache") o.prompt_cache = std::max(0, std::atoi(next("--prompt-cache")));else if (a == "--prompt-cache-every") o.prompt_cache_every = std::max(0LL, std::atoll(next("--prompt-cache-every")));+ else if (a == "--prompt-cache-root") o.prompt_cache_root = std::max(0LL, std::atoll(next("--prompt-cache-root")));else if (a == "--turn-token") o.turn_token = std::atoll(next("--turn-token"));else if (a == "--short-read") o.short_read = std::max(0LL, std::atoll(next("--short-read")));else if (a == "--suffix-draft") o.suffix_draft = std::max(0, std::atoi(next("--suffix-draft")));@@ -3088,8 +3092,20 @@ int main(int argc, char** argv) {if (o.prompt_cache > 0 && o.turn_token >= 0)for (int64_t i = n - 1; i > resume; --i)if (ids[(size_t) i] == o.turn_token) { turn_at = i; break; }+ // A prompt read from token 0 also stops at its FIRST turn boundary: the end of the system prompt (with+ // the tools), which every new chat of the same client shares. That checkpoint becomes the chain's root,+ // which the retention policy pins (conv_cache.hpp), so the next new chat reads only what comes after it.+ // (PR #65, code-martin.) Only for a system prompt of --prompt-cache-root tokens or more: a small one+ // is cheaper to read again than the extra part costs (~0.3 s).+ int64_t root_at = -1;+ if (o.prompt_cache > 0 && o.turn_token >= 0 && o.prompt_cache_root > 0 && read_from == 0)+ for (int64_t i = 1; i < turn_at; ++i)+ if (ids[(size_t) i] == o.turn_token) {+ if (i >= o.prompt_cache_root) root_at = i;+ break;+ }int64_t at = read_from;- for (const int64_t to : {reread_to, turn_at, n - 1}) {+ for (const int64_t to : {reread_to, root_at, turn_at, n - 1}) {if (to <= at) continue;const bool win = windows_ok(at, to);if (win && !refill(err)) {@@ -3118,7 +3134,7 @@ int main(int argc, char** argv) {break;}at = to;- if (to == turn_at && !checkpoint_at(to)) {+ if ((to == turn_at || to == root_at) && !checkpoint_at(to)) {std::printf("ERR saving a conversation checkpoint failed\n");return 1;}