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++
Stage buffers: pinned by default while the host has 3 GiB of RAM to spare (STRATA_STAGE_PIN=0 off, =1 always); docs: the 0.1.41 opt-in switches; DETAILS: several API keys, the frozen-engine check
Niko1221d2e3f1c9dd37
diff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex 13ad8c5b8..8da636545 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -836,7 +836,10 @@ print(r.choices[0].message.content)- **From the internet.** Put a tunnel in front of it, for example [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/):`cloudflared tunnel --url http://127.0.0.1:8080`. **Set a key first**, or anyone with the link can use your PC:add `"api_key": "some-long-secret"` to `strata-<model>.json` (or set the `STRATA_API_KEY` environment variable);- clients then send it as their API key. Streamed answers carry `X-Accel-Buffering: no`, so nginx-style proxies pass+ clients then send it as their API key. Several keys (one per client, so one can be withdrawn alone): separate them+ with commas, `--api-key key1,key2` or `"api_key": "key1,key2"` as llama.cpp does, or give a list,+ `"api_key": ["key1", "key2"]` (the way to use a key that contains a comma); a request passes with any one of them.+ Streamed answers carry `X-Accel-Buffering: no`, so nginx-style proxies passeach token on at once. The web app's settings and MCP tools only answer Strata's own page: when you open it througha proxy or tunnel whose address differs, add that address, e.g. `"trusted_origins": ["https://strata.example.com"]`.With the key set, any `Host` name reaches the server (see Host names below).@@ -1395,6 +1398,32 @@ Prompt time, medians of 10 interleaved pairs (off / auto, ms, `--expert-cache 15| RTX 3060, Core Ultra 7 265, IQ3_XXS | 1,620 / 1,159 (-28%) | 2,196 / 1,770 (-19%) | unchanged || Tesla P100, Xeon E5-2690 v4, IQ3_XXS | 4,805 / 3,126 (-35%) | 6,821 / 5,085 (-25%) | unchanged |+## More opt-in switches measured for 0.1.41 (all off unless you set them)++None of these changes the default answers; each was measured against the default with interleaved off/on pairs of whole+engine runs (a fresh engine per side, warmed, 200-token greedy answers on three fixed prompts, medians; "pairs faster" counts+the pairs in which the switched arm won). They are here so you can try them on your own card.++- **`STRATA_GDN_CHUNKED=1`: the DeltaNet recurrence of the prompt in chunks of 32 tokens** (sergiywith, #1372; WY form, FP32,+ other bits than the default: first-token KL against the default was 0.002-0.009 nats on average, the same top token in+ every prompt tried). The kernel needs 128 SMs in one wave, so by itself it runs only on a card with 128 or more+ (RTX 5090: 1.8x on the recurrence). On smaller cards `STRATA_GDN_CHUNKED=2` forces it for a measurement, and it is+ slower there: 0.73x on an RTX 3060 (28 SMs) and 0.87x on an RTX 5070 (48 SMs) at 2K-32K tokens (`gdn_rec_parity --bench`),+ and the prompt time did not move on the 5070 (2K 1.01x, 8K 1.00x).+- **`STRATA_FS_SLOTS=N`: the Foresight swap space** (q8atnight, #1348): N VRAM slots per layer, refilled on a copy stream+ with the experts that just missed and with the ones the next layer's router predicts (`STRATA_FS_AHEAD=0` for the+ misses only), so that an expert the cache lacks can be computed on the GPU instead of by the CPU. The model's own router+ decides everything; the slots only hold copies of the same bytes (`STRATA_FS_VERIFY=1` reads every landed slot back and+ compares it: 0 bad in 2,300+ reads on an RTX 5070). The slots are taken from the VRAM the expert cache would have+ (raise `--vram-reserve-mib` by about N x 80 MiB), and in every box measured the smaller cache cost more than the slots+ returned: decode 4 slots, median tok/s B/A (pairs faster): RTX 3060 0.95 (0/6) with misses only, 0.91 (0/6) with the+ look-ahead; Tesla P100 0.97 (2/6) and 1.00 (4/6); 16 slots on the P100 0.96 (0/6); RTX 5070 0.98 (1/6). The reporter+ measured the same on 2x RTX 3090 (the misses per layer are below one there, so the CPU round trip stays). Left off.+- **`STRATA_STAGE_PIN=1`: pinned stage buffers** (Zhong Uncle, #1237): where the experts are served from the GGUF in place+ (`--mmap-experts`, or too little RAM for the arena) the buffers the cache fill copies from are page-locked, so the+ copy no longer goes through the driver's bounce buffer (about 0.4-0.6 GiB of pinned RAM, falls back per buffer when the+ driver refuses).+---## Experimental speed projection (EXPERIMENTAL, off by default)@@ -1461,6 +1490,7 @@ the document, +0.4% on the chat. Details: `bench/results/2026-09-27-esp/`.| Generation stops mid-answer, GPU "100%", one CPU core busy | Fixed in engine 0.1.12 (issue #29, a race in the CPU expert pool on big-VRAM cards). Since then a request that stops moving ends with an error instead of hanging (after 2 minutes; 1 minute from 0.1.13): the log says `no progress for ... s ... (issue #29)` with where it stopped, and the next request starts the engine again. If you see that line, please open an issue with it. Engine 0.1.13 adds a stall report under it (what every expert-pool thread and the GPU handshake were doing, memory and page faults) and, on Windows, a `strata-stall-<pid>.dmp` file with every thread's stack: attach both. (`STRATA_WATCHDOG_S` sets the time in seconds; 0 turns it off.) Engine 0.1.14 fixes the stall those reports found (issue #31: with the IQ packs the host could wait forever inside the NVIDIA driver while copying experts in a verify window; the experts are now copied by a GPU kernel, `--pcie-mode dma` restores the old way). || `no progress for 60 s ... reading the prompt` on Linux, and the stall report says `threads waiting on the disk (state D): 16 ...` | The engine waits for the drive, not a deadlock: the n-gram table is read at random (`--ple-io direct`), which a rotational disk cannot keep up with (#605). The engine warns at start when the table is on one; `--ple-io ram` (Linux, needs RAM for the table) or the model on an SSD fixes it. Setup adds `--ple-io ram` itself on a rotational disk when the RAM holds the table (0.1.39). || `the engine said nothing for ... s during the request` or `... did not finish the request after it was stopped (STOP)` | Issue #481: the engine and the server lost step (the engine waits for its next command, the server for the request's end; GPU at 0 %, nothing in the log). The server ends the engine after 300 s without a line from it during a request (while a prompt is read: each chunk may take three times the previous one's time, the first one up to its tokens at 50 tok/s more), the request ends with an error and the next request starts the engine again. `"engine_silence_s": 600` in `strata-<model>.json` sets the time (0 = wait forever, as before). If you see it, please add the end of the engine log to #481. |+| `the engine said nothing for ... s and used no CPU or disk in that time (frozen ...)` | Issue #1317: a quicker version of the check above for an engine that is not slow but stopped (a deadlock inside a CUDA call, a driver stall): after 90 s without a line, if the engine process has also used no CPU time and moved no disk bytes in that time, the server ends it and the next request starts it again. An engine that is silent but still working is never ended by this check, the server prints one note (`... but is still working; it is not ended`) and leaves it to `engine_silence_s`. `STRATA_ENGINE_STALL_S=180` sets the time, `0` turns the check off (it needs `psutil`, which setup installs). || `out of memory: cudaFuncSetAttribute` in the log (IQ3_XXS, long prompt) | Fixed in engine 0.1.15: CUDA loaded a kernel's code when it was first needed, and mid-prompt there was no VRAM left for it. Run `START-HERE.bat` (Windows) or `./setup.sh` (Linux) once to update. || Anything else | The engine log is `strata-<model>.log` in this folder. |diff --git a/src/core/expert_source.cpp b/src/core/expert_source.cppindex f79d7cd65..1b8fb6a31 100644--- a/src/core/expert_source.cpp+++ b/src/core/expert_source.cpp@@ -1143,7 +1143,8 @@ bool FileExpertSource::copy_from_files(int64_t layer, int64_t expert, uint8_t* d}// Pinned stage buffers (PR 1237): whether they are the default is decided by the A/B in notes-141-cuda.md.-#define STAGE_PIN_DEFAULT 0+#define STAGE_PIN_DEFAULT 1+constexpr uint64_t kStagePinFloor = 3ull << 30; // RAM left available after a pinned stage buffervoid FileExpertSource::StageBufFree::operator()(uint8_t* p) const noexcept {if (pinned) (void) cudaFreeHost(p);else delete[] p;@@ -1180,8 +1181,15 @@ bool FileExpertSource::claim_stage(int64_t key, size_t& v, bool& fill, bool ahea// Pinned, where the driver allows: a stage buffer is the source of the cache fill's cudaMemcpyAsync,// and a pageable source is staged through the driver's bounce buffer - an extra copy at a fraction of// the transfer rate, on the calling thread. A failure falls back to pageable for this buffer.- // (STRATA_STAGE_PIN=0 keeps them pageable, as before.)- static const bool want_pin = [] { const char* v = std::getenv("STRATA_STAGE_PIN"); return STAGE_PIN_DEFAULT ? (v == nullptr || std::atoi(v) != 0) : (v != nullptr && std::atoi(v) != 0); }();+ // STRATA_STAGE_PIN: 0 keeps them pageable (as before 0.1.41), 1 always tries to pin, unset (the default) pins while+ // the host has kStagePinFloor of RAM to spare beside this buffer (the pool grows to ~257 buffers, 0.4-0.6 GiB):+ // a low-RAM box keeps pageable ones instead of paying for the pinning (recommend, never force).+ static const int pin_mode = [] { const char* v = std::getenv("STRATA_STAGE_PIN"); return v == nullptr ? -1 : (std::atoi(v) != 0 ? 1 : 0); }();+ bool want_pin = pin_mode != 0;+ if (pin_mode < 0) {+ uint64_t avail = 0;+ want_pin = STAGE_PIN_DEFAULT && available_memory_bytes(avail) && avail >= (uint64_t) stage_blob_ + kStagePinFloor;+ }void* p = nullptr;const cudaError_t pin_err = want_pin ? cudaHostAlloc(&p, (size_t) stage_blob_, cudaHostAllocDefault) : cudaErrorNotSupported;const bool pinned = pin_err == cudaSuccess && p != nullptr;