From 979e16ba64429e4d7cad0665c48bbd1cdb96efde Mon Sep 17 00:00:00 2001 From: Robert Karl Date: Fri, 23 Oct 2026 20:39:03 -0700 Subject: [PATCH] DeepSeek-V4.1: UPSTREAM.md, docs/DEEPSEEK41.md and README for the imported engine UPSTREAM.md gets the two new source rows and a section on what was taken from Strata v0.2.4 and what was not; docs/DEEPSEEK41.md is rewritten for this fork (files, pack recipe, run line, what is and is not there) in place of upstream's installer-centred text; the README lists the third engine and its run line. Co-Authored-By: Claude Fable 5.1 --- README.md | 14 ++- UPSTREAM.md | 33 +++++++ docs/DEEPSEEK41.md | 230 ++++++++++++++++++++------------------------- 3 files changed, 146 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index cd4169e..e71d03f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Pascal or newer, CUDA 12.x, Linux x86-64, on a machine that may have no network ``` git clone && cd UnbiasedStrata git submodule update --init # shallow, third_party/llama.cpp @ robertkarl/llama.cpp UnbiasedStrata (a6de9af3) -make build # build/bin/{strata,strata-poly,libstrata_kq.so,unbiased-strata} +make build # build/bin/{strata,strata-poly,strata-dsv41,libstrata_kq.so,unbiased-strata} make test # the front end against a fake engine; no GPU, no model ``` @@ -90,7 +90,7 @@ make build CUDA_ARCHS=89 # 6m40 on 16 cor ## Run ``` -unbiased-strata --engine -m [llama-server options] -- +unbiased-strata --engine -m [llama-server options] -- ``` `-m` names the GGUF the vocabulary and chat template are read from; no tensors are loaded from it by the front end. @@ -133,6 +133,16 @@ build/bin/unbiased-strata --engine build/bin/strata \ ``` +**DeepSeek-V4.1-Flash-1017, ISTA-DASLab IQ2_XXS** (`strata-dsv41`, Strata v0.2.4's third engine; the four shards, +the shared Engram file, Unsloth's DSpark drafter and a pack directory made from them): [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md). + +``` +build/bin/unbiased-strata --engine build/bin/strata-dsv41 \ + -m /models/dsv41/IQ2_XXS/DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00004.gguf \ + --host 127.0.0.1 --port 11434 --alias deepseek-v4.1-flash-1017-ista-iq2_xxs --sse-ping-interval 10 \ + -- --pack /models/dsv41/IQ2_XXS/maya-ds4 --max-context 131072 --dspark auto --gpus 0 +``` + ### Preparing a Flash-Next pack `strata-poly` reads a GGUF as it is. `strata` needs a pack directory and an MTP draft directory made once, offline diff --git a/UPSTREAM.md b/UPSTREAM.md index 9bdbafd..be99e6c 100644 --- a/UPSTREAM.md +++ b/UPSTREAM.md @@ -6,6 +6,8 @@ | --- | --- | --- | | Engines (`strata`, `strata-poly`), tools, docs | https://github.com/VecSzn/PolyStrata | tag `v0.1.45-poly.1`, commit `d0cd84dc6bd009d1d9e2191e4e28cc76b80f1ee3` | | ggml, llama, common, mtmd, cpp-httplib | https://github.com/robertkarl/llama.cpp, branch `UnbiasedStrata`, as the submodule `third_party/llama.cpp` | commit `385445fad49e42fa718b5e1f71668f35b7a08559`: ggml-org `3cf03257f219afbe7334045ff7c6a06ac68c627d` (the commit upstream pins) plus the six parser commits below | +| DeepSeek-V4.1 engine (`strata-dsv41`: `src/dsv41`, `include/strata/dsv41`, `tests/dsv41`, `tools/dsv41`, `data/dsv41`, `tools/trellis/tqenc.*`), the trellis and `iq*x_rows` CPU kernels it needs | https://github.com/Niko1221/Strata | tag `v0.2.4`, commit `96ca4383` (2026-10-24); see "DeepSeek-V4.1 engine" below | +| llama.cpp's DeepSeek V4.1 chat template detection and DSML parser | https://github.com/ggml-org/llama.cpp pull 30817, head `b72050d0` | the `common/chat.cpp`, `common/chat.h`, `common/parsers/deepseek.cpp` hunks only, as commit `44072a1` on the submodule branch `deepseek41-parser` (on `385445f`) | Commit `0197ae86` ("Import PolyStrata v0.1.45-poly.1 (d0cd84dc) unmodified") is the upstream tree, every tracked file, with the same tree hash as upstream's commit. `git diff 0197ae86 HEAD` is the whole story of this fork; @@ -139,6 +141,37 @@ One test-only hunk since (2026-10-19, correctness checks of DeepSeek V4 Flash an list is over Linux's 128 KiB single-argument limit. `tools/qwen35/q36_llama_dump.cpp` (upstream's llama.cpp-side parity program, not part of the build) takes the same `@FILE` for `--tokens` and `--force`. Nothing on the serve path changes. +## DeepSeek-V4.1 engine (`src/dsv41`, from Strata v0.2.4) + +Added 2026-10-24 to run DeepSeek-V4.1-Flash-1017 (ISTA-DASLab's GSQ-RCO GGUF sets) on the A6000 VM. Neither engine of +this fork reads a `deepseek41` GGUF (`strata-poly` knows `deepseek4`, V4 Flash), and the pinned llama.cpp predates the +architecture, so the engine is upstream Strata's third one, `strata-dsv41` - itself a port of Project Maya's `maya-ds4` +(MIT; `third_party/project-maya/NOTICE.md`, the vendored EXL3 / sampler / window kernels under `src/dsv41/vendor/`). + +- **Taken unmodified from Niko1221/Strata `v0.2.4` (96ca4383):** `src/dsv41/`, `include/strata/dsv41/`, `tests/dsv41/`, + `tools/dsv41/{pack_gguf,smoke,tune}.py`, `data/dsv41/` (the shipped hot-expert profiles), `tools/trellis/tqenc.{cpp,hpp}` + (the tests' encoder), `third_party/project-maya/`, `third_party/ggml/ggml-common-tq.h`, and upstream's `docs/DEEPSEEK41.md` + (rewritten for this fork afterwards). `diff -r` against the tag's tree is the check. +- **`src/kernels/cpu` and `include/strata/kernels/cpu`:** upstream's `iq_avx2.{cpp,hpp}`, `iq_avx2_rows.inl`, + `iq_avx512.{cpp,hpp}` replace this fork's v0.1.45-poly.1 copies - they add the engine's CPU lane rows `iq256x_rows` / + `iq512x_rows` (ggml's float order, so a token's dot is ggml-cpu's bit for bit) and, upstream states, leave `iq256_*` / + `iq512_*` as they were (`iq_avx2_parity` is the check here) - and the trellis CPU lane `tq_cpu.{hpp,cpp}`, + `tq_avx2.cpp`, `tq_avx512.cpp`, `tq_states.hpp`, `tq_computed.hpp` is new in `strata_kernels_cpu`. `expert_layout.hpp` + stays at layout version 4: upstream's 5 only adds Hadamard-folded packs, which nothing here makes or reads. + `iq_avx512.cpp` is built with `-mavx512vpopcntdq -mbmi2` as upstream does (`iq512x_rows` uses them). +- **`CMakeLists.txt`:** upstream's `strata-dsv41` block as it is, but ggml.h / ggml-cpu.h come through + `strata_kernels_cpu`'s `ggml-cpu` link from the submodule (no FetchContent, rule 1), and the option is turned on by the + `Makefile` (`STRATA_BUILD_DSV41=ON`; `strata-dsv41` is in `TARGETS`). The engine is compiled with + `STRATA_DSV41_TQ_CPU=1`, the ggml-cpu lane the IST-DAS sets' experts beyond VRAM run on. +- **Not taken:** upstream's `setup.py` / `strata launch` plumbing (rules 1 and 2), the signed engine-package feed, the + Python server's `serve/dsml.py` (this fork's front end parses DSML with llama.cpp's `common/parsers/deepseek.cpp`, + below) and the fixture template `serve/fixtures/deepseek41/chat_template.jinja` (the GGUF's own template is used). +- **Serving:** the front end starts it like the other two, `--engine strata-dsv41 -m ... -- --pack + --max-context N --dspark auto`; `--serve` is added. Its line protocol is the one `frontend/engine.hpp` speaks + (`READY`, `INFO`, `T`, `DONE`, `ERR`); its extra `STAT` and `NOTE` lines are ignored as `OTHER`. The front end's + vocabulary load falls back to the `general.architecture` override (USTRAT-6's path) because the pinned llama.cpp + does not know `deepseek41`. + ## Removed Each entry names the rule above that it satisfies. diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.md index e3ad46c..7ffd07e 100644 --- a/docs/DEEPSEEK41.md +++ b/docs/DEEPSEEK41.md @@ -1,142 +1,114 @@ -# DeepSeek-V4.1-Flash +# DeepSeek-V4.1-Flash-1017 (`strata-dsv41`) -DeepSeek-V4.1-Flash is a large mixture-of-experts model: 40 layers, 384 experts in each (6 are used for every word), and a 203 GB -n-gram table next to them. Strata runs it with its own engine, `strata-dsv41` (`src/dsv41`, ported from Project Maya's -`maya-ds4`, MIT; the notice is in `third_party/project-maya`). The file is Unsloth's UD-Q8_K_XL, pinned in `setup.py`: nine -shards, 508.4 GB, the experts as MXFP4 and the rest in BF16. The two official 2-bit sets (below) are what a normal PC runs. +DeepSeek-V4.1-Flash-1017 is llama.cpp's architecture `deepseek41`: 40 layers, 384 routed experts in each (6 a token), +an n-gram table (Engram) read for every token, and a small draft model (DSpark). Neither of this fork's two engines reads +it (`strata-poly` knows `deepseek4`, the V4 Flash of [DEEPSEEK.md](DEEPSEEK.md)), so it runs on a third, upstream +Strata's `strata-dsv41` (`src/dsv41`, a port of Project Maya's `maya-ds4`, MIT; `third_party/project-maya/NOTICE.md`), +imported unmodified from Strata v0.2.4 ([UPSTREAM.md](../UPSTREAM.md#deepseek-v41-engine-srcdsv41-from-strata-v024)). +The server, the API and the fork's rules are the README's: no installer, no download at start, the front end in front. -The 508 GB set is for a computer with several graphics cards and a lot of RAM. It was run on four Radeon AI PRO R9700 (32 GB each) with -251 GB of RAM. Strata does not refuse a smaller computer; it tells you what to expect first. +It is early. The fork has run it on one machine (below) with the ISTA-DASLab 2.00 bpw set. + +## The files + +ISTA-DASLab's GSQ-RCO sets, [ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF), +revision `cb02422c900df489cea5833e8a92171224059b3c` (the one upstream v0.2.4 pins). Three sets share one Engram file; the +drafter is Unsloth's. + +| File | Size | What it is | +| --- | ---: | --- | +| `DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-0000{1..4}-of-00004.gguf` | 120.7 GB | the model at 1.75 bpw | +| `DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-0000{1..4}-of-00004.gguf` | 138.2 GB | the model at 2.00 bpw, the set this fork runs | +| `DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-0000{1..4}-of-00004.gguf` | 155.2 GB | the model at 2.25 bpw | +| `DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf` | 110.6 GB | the 4-bit Engram table, one file for all three sets; a few rows are read from it for every token, so it lives on NVMe | +| `unsloth/DeepSeek-V4.1-Flash-1017-GGUF` `DSpark/dspark-DeepSeek-V4.1-Flash-1017-Q8_0.gguf` | 8.0 GB | the DSpark drafter | +| `unsloth/DeepSeek-V4.1-Flash-1017-GGUF` `UD-Q8_K_XL/...-00001-of-00009.gguf` | 5.8 MB | metadata only: `pack_gguf.py --engram-meta` reads the Engram tensor shapes from it (its first shard is the header and nothing else) | + +2.00 bpw: 138 + 111 + 8 = 257 GB on the disk the engine reads from. Upstream's quality numbers for the sets, from +its own measurement (4,995 positions): 2.00 bpw KL 0.170, perplexity +15.5%; 2.25 bpw KL 0.107, +7.3%; 1.75 bpw KL 0.217, ++21%, weaker on prose. ISTA-DASLab's card: 98.7% of the base model's task average kept at 2.00. + +SHA-256 of every file is in the repository's `SHA256SUMS`-style listing in the Hugging Face tree; this fork checks each +file with `sha256sum -c` before packing (the homelab's copies: `/mnt/ds4/dsv41/{IQ2_XXS,engram}/SHA256SUMS`). + +## Preparing the pack + +`strata-dsv41` reads a pack directory, not the shards: metadata files that point into the shards, the Engram and the +drafter. `tools/dsv41/pack_gguf.py` writes it from the files in place (stdlib Python, no copy of the tensors), the plain +recipe upstream's installer runs for these sets. Do not add `--skip-tensors` or `--dense-override`: upstream says that +packs without an error and answers garbage. + +``` +python3 tools/dsv41/pack_gguf.py --model /mnt/ds4/dsv41/IQ2_XXS \ + --shards DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-0000{1,2,3,4}-of-00004.gguf \ + --engram /mnt/ds4/dsv41/engram \ + --engram-meta /mnt/ds4/dsv41/meta/DeepSeek-V4.1-Flash-1017-UD-Q8_K_XL-00001-of-00009.gguf \ + --dspark-gguf /mnt/ds4/dsv41/dspark/dspark-DeepSeek-V4.1-Flash-1017-Q8_0.gguf \ + --dspark-noise-token 128799 --dspark-markov-rank 256 \ + --out /mnt/ds4/dsv41/IQ2_XXS/maya-ds4 +cp data/dsv41/profile-2.00.bin /mnt/ds4/dsv41/IQ2_XXS/maya-ds4/expert-profile.bin # profile-2.25.bin for IQ2_XS +build/bin/strata-dsv41 --pack /mnt/ds4/dsv41/IQ2_XXS/maya-ds4 --pack-info # every file present +python3 tools/dsv41/smoke.py --exe build/bin/strata-dsv41 --pack /mnt/ds4/dsv41/IQ2_XXS/maya-ds4 # 16 tokens; must name Paris +``` + +The hot-expert profile upstream ships (`data/dsv41/profile-2.00.bin`, sha256 beside it) decides which experts are loaded +into VRAM first; the engine updates it as it runs. + +## Run + +``` +build/bin/unbiased-strata --engine build/bin/strata-dsv41 \ + -m /mnt/ds4/dsv41/IQ2_XXS/DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00004.gguf \ + --host 0.0.0.0 --port 11434 --alias deepseek-v4.1-flash-1017-ista-iq2_xxs --sse-ping-interval 10 \ + -- --pack /mnt/ds4/dsv41/IQ2_XXS/maya-ds4 --max-context 131072 --dspark auto --gpus 0 +``` + +- `-m` is shard 1: the front end reads the vocabulary and the chat template from it and no tensors. The pinned + llama.cpp does not know `deepseek41`, so the vocabulary load takes the front end's `general.architecture` override path + (USTRAT-6), as for any architecture it has not met. +- Engine options are upstream's (`strata-dsv41 --help`): `--max-context`, `--dspark auto|on|off|none` (`auto`, never + `off`: `off` still loads the drafter and its experts take VRAM), `--gpus`, `--vram-experts N` (how many experts to keep + on the card; the engine sizes it from free VRAM by default), `--ssd-cache` (the RAM store for the experts beyond VRAM, + sized by itself), `--expert-profile`, `--threads`. The latent KV cache is FP4 in the engine; there is no `--kv` type flag + as `strata` has. +- Thinking is on by default, from the template. `reasoning_effort` takes `low`, `medium`, `high` (the default), `max` or a + number 1 to 100; `chat_template_kwargs.enable_thinking: false` turns it off. Tool calls are DSML + (`<|DSML| calls>` ... `<|DSML| invoke name="...">`); the front end parses them with llama.cpp's + `common/parsers/deepseek.cpp`, which carries PR 30817's V4.1 hunks ([UPSTREAM.md](../UPSTREAM.md)), and emits OpenAI + `tool_calls`. The front end caps `top_k` at 64 (USTRAT-5); DeepSeek's recommended `top_k 0` is not reachable. +- Not in this engine version: several requests at once and pictures (both ignored with a warning). The engine's `STAT` and + `NOTE` lines are ignored by the front end. ## Where it goes | | size | where | -|---|---|---| -| routed experts (15,360 of 18.8 MB) | 288.8 GB | as many as fit in graphics memory; the rest are computed on the CPU, read in place from the model files | -| attention and other dense weights | 16.8 GB | graphics memory, one block of layers on each card (about 3.9 GB a card on four) | -| n-gram table (Engram) | 202.8 GB | the SSD. A few rows are read for each word it writes. It is not counted in RAM, but a slow disk slows every word, so keep the model files on an NVMe drive | - -Measured on the four R9700 cards: 6,197 experts (116.5 GB) in graphics memory, 9,163 (172.3 GB) on the CPU, which needs about that -much free RAM to stay cached. `strata launch --plan` and `setup.py --check` work this out for your cards and RAM -(`strata_control/dsv41_fit.py`; it predicted 6,240 experts on the R9700 box). - -With less memory than that, part of the CPU's experts are read from the SSD while the model answers. It runs, slowly. A card -that cannot hold its share of the dense weights (about 4 GB each on four cards, 16 GB on one) can make the engine stop at the start -with an out-of-memory message. Both are said before anything is downloaded. - -## The official 2-bit versions (the ones for a normal PC) - -Setup offers three official sets (ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF, pinned): **IQ1_M, 1.75 bpw** (`ist-das-1.75bpw`, 121 GB, slightly lower quality; setup recommends it where 2.00 is tight in memory or disk), **IQ2_XXS, 2.00 bpw** (138 GB) and **IQ2_XS, 2.25 bpw** (155 GB). All use the -same 111 GB n-gram table (downloaded once into `models/deepseek-v4.1-flash-shared`) and the 8 GB DSpark drafter: 257 GB of disk for -2.00, 274 GB for 2.25, 239 GB for 1.75, 533 GB for all three. Quality against the original model (4,995 positions, the final files): 2.00 has KL 0.170 and perplexity +15.5% (code +8.6%, agent work +5.3%); 2.25 has KL 0.107 and -perplexity +7.3% (code +3.2%, agent work +2.2%). IQ1_M: perplexity +21% (KL 0.217, top-1 82.5%); code +8.9%, agent work +10.2%, multilingual +14%, docs +24%, plain English prose +53%, so it is weaker on prose. ISTA-DASLab's model card says it keeps 98.7% of the base model's task average (AIME25, GPQA-Diamond, LiveCodeBench v6). - -| File | Size | What it is | | --- | ---: | --- | -| IQ1_M shards (1.75 bpw), 4 files | 121 GB | the model, smallest set | -| IQ2_XXS shards (2.00 bpw), 4 files | 138 GB | the model, middle set | -| IQ2_XS shards (2.25 bpw), 4 files | 155 GB | the model, largest set | -| IQ4_NL: `DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf` | 111 GB | the 4-bit Engram lookup table the model reads from RAM or SSD. Not a model to pick: all three sets use this one file, and it is already in their download sizes | -| DSpark drafter (Q8_0) | 8 GB | the small draft model (Unsloth) | +| routed experts (15,360) | ~110 GB at 2.00 bpw | as many as fit in VRAM after the dense weights and the context; the rest on the CPU lane (`STRATA_DSV41_TQ_CPU=1`, ggml-cpu's i-quant dots on AVX2 or AVX-512), read from the RAM store or the model files | +| attention and other dense weights | 16.8 GB | VRAM | +| Engram | 110.6 GB | the SSD; a few rows a token | -121 + 111 + 8 = 239 GB for 1.75; 138 + 111 + 8 = 257 GB for 2.00; 155 + 111 + 8 = 274 GB for 2.25. +The experts the card does not hold are read from the files while the model answers, so the OS file cache wants as much of +them as the RAM allows. Upstream's measurements: RTX 5070 (12 GB) with 64 GB RAM 4.7 tokens/s; RTX 3060 (12 GB) with 46 GB +RAM 7.2 tokens/s; four R9700 (32 GB each) 31 tokens/s; "under about 40 GB of RAM it is untested and slow". -Measured: an RTX 5070 (12 GB) with 64 GB of RAM and a 3.6 GB/s NVMe drive answers at about 4.7 tokens/s and reads prompts at 121 -tokens/s (4K) to 231 tokens/s (8K, layer-major path); an RTX 3060 (12 GB) with 46 GB of RAM about 7.2 tokens/s; four R9700 about 31 -tokens/s. Under about 40 GB of RAM it is untested and slow; setup says so and still installs. +## What it was measured on -Setup downloads with resume and SHA-256, packs the model with the plain recipe (`pack_gguf.py --model SET --shards ... --engram -engram-IQ4_NL.gguf --engram-meta --dspark-gguf dspark-...-Q8_0.gguf`; do not add `--skip-tensors` or `--dense-override`: -that packs without an error and gives garbage text), copies the shipped hot-expert profile (`data/dsv41/profile-2.00.bin` or `-2.25.bin`) -into the pack as `expert-profile.bin`, checks `strata-dsv41 --pack-info` (every file present) and answers a 16-token test question -(`tools/dsv41/smoke.py`, the text must name Paris). The start script passes `--dspark auto` (never `off`: `off` still loads the drafter -and its 7 GB of experts take the graphics memory); the RAM store sizes itself. Long prompts use the engine's fast chunked path on its own (no flag is written: the engine picks the chunk size for your cards). +| | | +| --- | --- | +| Graphics card | RTX A6000, 48 GB (Proxmox VM 220, passthrough) | +| CPU | 6 vCPU of a Ryzen 7 1700 (AVX2, no AVX-512) | +| RAM | 52 GiB | +| Disk | 420 GB NVMe (thin volume) for the shards, Engram, drafter and pack | +| Built with | CUDA 12.x, `make build` (`STRATA_BUILD_DSV41=ON`, `CUDA_ARCHS` for sm_86), 0 warnings | +| Model | IQ2_XXS set above, 2.00 bpw | +| Context | 128K (`--max-context 131072`) | -## Install +Results: to be filled in at first light (decode and prefill tokens/s, VRAM split, load time). -``` -./setup.sh --family deepseek41 --model IST-DAS-2.00bpw # 257 GB: the official 2.00 set + Engram + drafter (resumable, SHA-256 checked) -./setup.sh --family deepseek41 --model IST-DAS-2.25bpw # 274 GB (the Engram is shared with 2.00) -./setup.sh --family deepseek41 --model IST-DAS-1.75bpw # 239 GB, the smallest -./setup.sh --family deepseek41 --model UD-Q8_K_XL # Unsloth's 508 GB set, for hundreds of GB of RAM or several cards -./setup.sh --family deepseek41 --gguf-dir DIR # files you already have: the shards (or the folder with 2.00bpw / 2.25bpw / UD-Q8_K_XL inside); the Engram and drafter are looked for beside them -strata launch --model ist-das-2.00bpw --plan # where it would go on this computer, nothing changed -strata launch --model-path DIR --model ist-das-2.00bpw # start from files you already have -``` +## Tests -Setup needs `strata-dsv41` next to the engine (or `STRATA_DSV41_EXE`) and says so before it downloads anything. Build it with -`cmake -DSTRATA_BUILD_DSV41=ON`. The default context is 8192 tokens, the size it was checked at; `--context` asks for more. -Loading takes a few minutes (the config sets `"engine_ready_s": 3600`). - -## Through the API - -The server speaks to the engine as it does for the other models, so `/v1/chat/completions`, `/v1/messages`, streaming, stop and -`/metrics` work as usual (the answer speed is the tokens the model produced over the engine's decode time). - -- Thinking is on by default, as the model's template has it. `reasoning_effort: "none"` or `chat_template_kwargs.enable_thinking: false` turns it off. - Effort words: `low` (50), `medium` (62), `high` (75, the default), `max` (100), or a whole number 1 to 100. -- Prompts are the GGUF's own chat template, the same bytes as DeepSeek's `encoding.py` on the cases checked. Project Maya's own template lost the - tool associations and later system instructions (their issue #299); Strata does not use it. -- Tool calls: the model writes DSML (`<|DSML| calls>` ... `<|DSML| invoke name="...">` ... `<|DSML| parameter name="..." string="true">`). The - server turns them into OpenAI `tool_calls` and Anthropic `tool_use`, including `tool_choice`, streamed arguments and calls written inside the thinking. - A value marked `string="true"` stays a string. -- Defaults when a request names none: temperature 1.0, top_p 1.0. -- Agents and sub-agents that take turns can skip reading their prompts again (off in this version, a switch for testing). With - `STRATA_DS4_SLOT_KEEP=1` the engine sets a conversation aside when another request takes the model (about 17 MB per 6.5K tokens) and takes it - back when the next prompt continues it, also after a restart. Slots live in `ds4-slots` next to the run log, are capped at 2 GB - (`STRATA_DS4_SLOT_GB`) and are removed after a week. `STRATA_DS4_AUTO_PIN=1` also keeps the system prompt and tools shared by an agent - and its sub-agents as a checkpoint. - -Not in this version: several requests at once (`--parallel` is ignored with a warning) and pictures (`--vision` is ignored with a warning). - -## Tuning - -`strata launch --tune quick` (or `thorough`, or the Tuning screen) works for DeepSeek with its own short tuner, `tools/dsv41/tune.py`. It starts -the engine a few times on a fixed short question and measures the answer speed: the standard settings first, then the DSpark drafter forced on, -then a shorter draft block (3), then one CPU thread for each physical core (thorough also tries every logical thread). A setting is kept only for a -gain of more than 5%, and the result is written into the launch's settings. Expect about 5 to 10 minutes (each run loads the model, which takes -1 to 3 minutes); close other heavy programs first. If a run fails or the computer is too busy to tell, the standard settings stay and one plain line -says so. The RAM store (`--ssd-cache`) sizes itself when the model starts, so the tuner does not touch it, and the context stays what you chose. - -## The engine package - -DeepSeek's engine, `strata-dsv41`, is a separate download from the Strata engine: when you choose DeepSeek, setup (or `strata launch`) fetches the -package for your computer from the signed update feed (resumable, signature and every file checked) and installs it in `engine-dsv41/` beside -`engine/`. The Qwen engine's files are never changed. If the feed has no package for your graphics card, setup says so in plain words and stops before -anything big is downloaded. - -### Getting the engine by hand - -If the automatic download does not work for you (no access to the update feed, or an offline computer), download the engine package yourself from -the release page: the file is named `strata-dsv41----.tar.gz` (Windows and Linux; pick the one for your system and -graphics card). Check it against `SHA256SUMS.txt` on the release page if you like. Then give it to Strata in either of two ways: - -``` -strata launch --model ist-das-2.00bpw --dsv41-package PATH-TO-THE-FILE -python setup.py --family deepseek41 --dsv41-package PATH-TO-THE-FILE -``` - -or put the file in the `engine-dsv41/` folder (setup tells you its exact place when it cannot find the engine) and run the same command again. -Strata checks the package before it uses it: it must be the DeepSeek engine (not the Strata engine) for your system, its manifest must be signed by a key -Strata trusts, and every file must match the hash in the manifest. A damaged or foreign file is refused with a plain line and nothing is installed. -The unpacked folder works as well as the archive. The Strata (Qwen) engine is not touched either way. - -## Compressed experts (trellis), for testing - -`strata-dsv41` reads the routed experts in the trellis types as well as the source MXFP4: TQK6 and TQK7 (agentionai's files), and the -experimental TQK5X / TQK4X (computed codebook) and TQK5T / TQK4T (table codebook), see `tools/trellis/README.md`. A layer may be converted -while the others stay MXFP4. On the GPU they run on the tensor cores of gfx12 (and in plain FMAs elsewhere), on the CPU lane on Strata's -AVX-512 / AVX2 kernels; the build needs `-DSTRATA_NATIVE_EXPERTS=ON` for the CPU lane. - -``` -# 1. the pack of the source model (also takes the DSpark and mmproj files that sit beside the model folder) -python tools/dsv41/pack_gguf.py --model DIR/UD-Q8_K_XL --out PACK -# 2. re-encode some layers (HIP encoder; one layer at K5 is 2.3 GB, the whole model 93 GB) -python tools/dsv41/tq_convert.py --pack PACK --out CONV --layers 1,7,14 --type K5 # K4 K5 K4T K5T K6 K7 -# 3. the pack that reads them -python tools/dsv41/pack_gguf.py --model DIR/UD-Q8_K_XL --out PACK2 --tq-experts CONV -strata-dsv41 --pack PACK2 --score data/quant_quality/v1/set.ids.json --score-out RUN.tsv # teacher-forced top-64 rows -``` - -The encode is plain error (no rotation, no activation weights). The tests are `ds4_tq_test` (device and CPU lane against a double -reference, needs one GPU) and `tqw_hip_test`. +- `make test` (the front end against the fake engine) passes unchanged with the engine built in. +- `iq_avx2_parity`: 0 failures after the swap to upstream's `iq_avx2.cpp` / `iq_avx512.cpp`, so `strata`'s and + `strata-poly`'s CPU i-quant rows are what they were. +- Upstream's engine tests (`ds4_tq_test`, `ds4_iq_test`, `ds4_slot_test`, `ds4_gg_bench`) build with + `STRATA_BUILD_DSV41=ON`; they are not part of `make test` (they need a GPU, and `ds4_slot_test` a pack).