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 <noreply@anthropic.com>
20 KiB
Relationship to upstream
Sources
| What | Where | Version |
|---|---|---|
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;
git diff 0197ae86 HEAD -- src include is every change to the engines.
The history before that commit is UnbiasedStrata 1, a fork of Niko1221/Strata 0.1.39, ended at the tags
unbiasedstrata-1 and unbiasedstrata-1-muse-spark-native.
Rules
A thing is removed only when it (1) reaches the network during setup, build or start-up, (2) puts Python between a request and a token, (3) breaks or complicates the one-command build, or (4) is marketing. Everything else stays, built or not. Engine changes are bug fixes for the target (Linux x86-64, one NVIDIA GPU, Pascal or newer, CUDA 12.x), each recorded below with the file, the reason and the measurement.
Build (CMakeLists.txt, Makefile, .gitmodules, .gitignore)
- ggml from the submodule, not a fetch.
STRATA_GGML_DIRdefaults tothird_party/llama.cppand the configure stops with thegit submodule update --initline ifggml/CMakeLists.txtis missing. Upstream'sFetchContentof llama.cpp (the only network access of its build) is deleted. The three laterif(STRATA_GGML_DIR)blocks are unchanged; theirelse()branches are now dead..gitignoreno longer ignores/third_party/llama.cpp*. - llama.cpp changes are commits on a fork, not configure-time patches. The submodule points at
robertkarl/llama.cpp, branch
UnbiasedStrata: ggml-org3cf03257plus the two commits under "Changes to llama.cpp" below. Until 2026-10-19 the same changes werepatches/*.patch, applied to the submodule's working tree by CMake at configure (UnbiasedStrata 1 did it inmakeand in CMake both), which left the submodule dirty after every build and meant the pinned commit alone did not name the sources compiled. The pin now does;git statusis clean after a build. - llama.cpp's libraries for the front end. A second
add_subdirectoryof the submodule withLLAMA_BUILD_COMMONandLLAMA_BUILD_MTMDon and tests, tools, examples, server, app, UI, prebuilt UI, OpenSSL and llguidance off. It reuses the ggml targets configured above. Gated bySTRATA_FRONTEND(default on), not by CUDA, so the front end also builds on a machine without a GPU. - The front end,
unbiased-strata. Seven of llama.cpp'stools/serverfiles are compiled unmodified from the submodule into a static library (server-http,server-queue,server-task,server-common,server-chat,server-schema,server-stream): the HTTP layer, the task queue, the OpenAI request and result types, SSE framing, the request schema. The eighth,server-context.cpp, is bound tollama_contextand is replaced byfrontend/strata_context.cpp, which runs the engine as a child process over its line protocol (docs/BACKENDS.md) and uses a vocab-onlyllama_modelfor tokenizing, the chat template and the output parsers.server-http.cppreferences the web UI's asset table (ui.h, generated bytools/uiat build time, which downloads);frontend/ ui_stub/provides an empty one. No patch to llama.cpp was needed for this; the undocumented internal API oftools/serveris used as it is at the pinned commit. Makefile.make buildconfigures once and buildsstrata,strata-poly,strata_kqandunbiased-strataintobuild/bin/, not upstream'sall, which also builds about 70 parity and bench programs.make frontendbuilds the front end alone without CUDA intobuild-frontend/;make testbuilds and runs the front end's tests there against a fake engine (frontend/tests/): the adapter's cases and the HTTP surface a coding agent touches. The nvcc check applies only to thebuildandconfiguregoals.CUDA_ARCHSdefaults to61;75;86;89; an arch below 75 adds upstream'sSTRATA_EXPERIMENTAL_SM60(upstream's default is120, which needs CUDA 13).PORTABLE=1gives the AVX2 baseline instead of-march=native. One GCC for the C, C++ and nvcc host sides: the Makefile probesg++-15,g++-14, ... withnvcc -ccbinand passes the newest accepted one asCMAKE_C_COMPILER,CMAKE_CXX_COMPILERandCMAKE_CUDA_HOST_COMPILER. Without that, on a box whose defaultg++is newer than nvcc accepts (Debian 13 with CUDA 12.4: GCC 14 against a GCC 13 limit), the C++ files were compiled by GCC 14 and the CUDA files by GCC 13, andstratafailed to link on__cxa_call_terminate(upstream's installer handles the same case, its #1645).HOSTCXX=/usr/bin/g++-13overrides the probe.
Front end behaviour (frontend/), where it differs from llama-server or from upstream's server
Recorded here because a client written for one of the two may notice.
/healthreturns llama.cpp's{"status": "ok", "busy": ...}plus upstream's"service": "strata","loaded": true,"model","max_context"(commit453d3015). Upstream'stools/strata_bench.pyrefuses a server without the first two; the first step-9 fork arm was lost to that (the step-9 record's README; records are in history at7551f138,bench/unbiased/).- Streams always end with a usage chunk (empty
choices,usage,timings), as upstream's server does, whether or not the client sentstream_options.include_usage; llama-server sends it only on request (96f4ef1f). Same reason: the bench client readsprompt_tokensfrom it. - One slot. Requests are served one at a time in arrival order, as upstream's server does with one engine.
- No constrained decoding.
response_formatand tool schemas are parsed and used for output parsing, not enforced at the sampler, because the engine samples; logged once per such request. - Pictures are encoded in the front end (
--mmproj FILE, commit71886db0and after): llama.cpp's mtmd runs the projector and the front end writes upstream'sSVE1record file and sendsGENI … image_pad=<id> <file>, the protocol upstream's Python server spoke tostrata-vision. Projector width is checked against the model's embedding width at start. The default row budget is upstream's installer's (300 on the CPU, 1024 on the GPU;--image-max-tokensoverrides). The encoder runs on the CPU: the front end's ggml is built without CUDA, and--mmproj-gpuis refused when ggml has no GPU device (17e27213). Measured in 2026-10-18 on the A6000 (record in history at7551f138). --sse-ping-intervalis llama-server's (default 30 s); the measured Flash-Next runs used 10.- SIGTERM exits 1, not 0, after stopping the engine: the engine child dies with the process group and the front end reports it as an engine death with an empty message. Open; matters only to a service manager.
- Default
min_pis llama-server's 0.05 when a request omits it; upstream's server sends none. pi sends 0.
Changes to llama.cpp (robertkarl/llama.cpp, branch UnbiasedStrata)
Six commits on top of ggml-org 3cf03257; git -C third_party/llama.cpp diff 3cf03257 HEAD is exactly these.
-
9547d8d(common/parsers/qwen3-coder.cpp): the Qwen3-Coder tool-call grammar accepts a call's arguments in any order. Upstream takes the required ones first and the optional ones after; Qwen3.8 Flash-Next often writes the optional ones first (limit,offset,path), and because the grammar's tool-call group is optional and has no end anchor, such a call was dropped silently: the client gotfinish_reason=stopand an empty answer (UnbiasedStrata 1, 2026-10-08, REGINA-104). Qwen3.6's template routes to the same parser. Carried over from UnbiasedStrata 1 unchanged. -
a6de9af(common/chat-auto-parser-generator.cpp,common/parsers/deepseek.cpp): the same for every template the auto-generated PEG grammar serves (DeepSeek V4 Flash's DSML, GLM 5.3 Flash's<arg_key>form, and the rest). Upstream accepts the required arguments only in the schema's order, which holds when its own sampler is constrained by the grammar; this engine samples unconstrained, and both models wrotecontentbeforepathfor awritetool that declarespathfirst, so a finished, well-formed call was reported to the client as "output does not match the expected peg-native format" (PLAN.md step 13, 2026-10-19, USTRAT-7). Whether every required argument is present is left to the tool, as upstream already leaves it for optional-only tools. -
1421694(tools/server/server-task.cpp): a partial re-parse that reports fewer tool calls than the previous one no longer throws (the request died with a 500 mid-stream, "Invalid diff: now finding less tool calls!"); the previous message is kept, nothing is emitted for that token, and the raw generated text is logged. A non-partial parse failure returns the raw text as content instead of failing the request (issue #17, 2026-10-20). -
638a7e2(common/parsers/qwen3-coder.cpp,tests/test-chat.cpp): the Qwen3-Coder grammar skips a stuttered</parameter>close tag. Qwen3.8 Flash-Next Coder IQ1_M, sampled without the grammar, wrote the tag twice before</function>in 7 of 673 requests of a BBW run (2026-10-20); each one failed the whole call and, through the diff check above, the request. The value still ends at the first close. Test in the Qwen3-Coder section of test-chat. -
4174b21(common/parsers/qwen3-coder.cpp,tools/server/server-task.cpp,tests/test-chat.cpp): the same shard also leaves a blank line between the last</parameter>and</function>(memcached-bisect-deep, 2026-10-21); the grammar now skips blank lines between arguments and before</function>and</tool_call>. And the final, non-partial parse gets the same guard as the partial one: when it finds fewer tool calls than were streamed, the streamed calls stand (arguments as last parsed) and the raw text is logged, instead of the diff check throwing and the request ending in a 500 after the hold-delta guard had kept it alive. Two blank-line cases in test-chat. -
385445f(common/parsers/qwen3-coder.cpp,tests/test-chat.cpp): the third shape (prime-frontend, 2026-10-21):</content>and</invoke>after the real</parameter>, a blank line,</parameter>again. The stuttered-close rule becomes general: any close tag that is not</function>or</tool_call>is skipped between arguments.
Engine source (src/, include/)
No changes: git diff 0197ae86 HEAD -- src include is empty (checked 2026-10-18). The engines measured in step 9 are
these sources built in this tree; their binaries differ from upstream's build of the same sources, and the step-9
record says so where it matters.
Step 12 (harness bench/correctness/; record in history at 7551f138, bench/unbiased/correctness/; 2026-10-18) checked these builds against llama.cpp 3cf03257: upstream's
parity programs that cover the kernels in use (38 pass, poly_expert_parity fails its own bound on one UD-Q3_K_M expert),
and teacher-forced per-step distributions on 16 sequences per model (within llama.cpp's own CPU-vs-GPU spread on every set
and arm). Two upstream claims did not hold and are not repeated here: the draft block is not bitwise inert above 4-token
windows, and strata's output is not reproducible across starts unless the expert cache is pinned. Tickets USTRAT-1 to 5.
One test-only hunk since (2026-10-19, correctness checks of DeepSeek V4 Flash and GLM 5.3 Flash): src/poly/main.cpp
--tokens, --eos-ids and --follow accept @FILE (the comma-separated ids read from that file), because a 31K-id
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'sdocs/DEEPSEEK41.md(rewritten for this fork afterwards).diff -ragainst the tag's tree is the check. src/kernels/cpuandinclude/strata/kernels/cpu: upstream'siq_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 rowsiq256x_rows/iq512x_rows(ggml's float order, so a token's dot is ggml-cpu's bit for bit) and, upstream states, leaveiq256_*/iq512_*as they were (iq_avx2_parityis the check here) - and the trellis CPU lanetq_cpu.{hpp,cpp},tq_avx2.cpp,tq_avx512.cpp,tq_states.hpp,tq_computed.hppis new instrata_kernels_cpu.expert_layout.hppstays at layout version 4: upstream's 5 only adds Hadamard-folded packs, which nothing here makes or reads.iq_avx512.cppis built with-mavx512vpopcntdq -mbmi2as upstream does (iq512x_rowsuses them).CMakeLists.txt: upstream'sstrata-dsv41block as it is, but ggml.h / ggml-cpu.h come throughstrata_kernels_cpu'sggml-cpulink from the submodule (no FetchContent, rule 1), and the option is turned on by theMakefile(STRATA_BUILD_DSV41=ON;strata-dsv41is inTARGETS). The engine is compiled withSTRATA_DSV41_TQ_CPU=1, the ggml-cpu lane the IST-DAS sets' experts beyond VRAM run on.- Not taken: upstream's
setup.py/strata launchplumbing (rules 1 and 2), the signed engine-package feed, the Python server'sserve/dsml.py(this fork's front end parses DSML with llama.cpp'scommon/parsers/deepseek.cpp, below) and the fixture templateserve/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 <shard 1> ... -- --pack <pack> --max-context N --dspark auto;--serveis added. Its line protocol is the onefrontend/engine.hppspeaks (READY,INFO,T,DONE,ERR); its extraSTATandNOTElines are ignored asOTHER. The front end's vocabulary load falls back to thegeneral.architectureoverride (USTRAT-6's path) because the pinned llama.cpp does not knowdeepseek41.
Removed
Each entry names the rule above that it satisfies.
- Rule 1, installers and downloaders:
setup.py(8,223 lines: hardware detection, pip, CUDA, llama.cpp zips, prebuilt engines from GitHub releases, model files from Hugging Face or ModelScope, pack and MTP orchestration, run-config JSON, start),setup.sh,SETUP.bat,START-HERE.bat,UPDATE.bat,update.sh,Dockerfile,docker-entrypoint.sh,.dockerignore,flake.nix,flake.lock,requirements.txt(replaced bytools/requirements.txt: numpy and regex, for the offline tools only),conftest.py(pytest root forsetup.py's tests),tools/strata_mcp.py(an installer driven over MCP),tools/image/(stable-diffusion.cpp, Vulkan SDK and model downloads),tools/hip/package_windows.py(AMD nightly wheels), and their tests (tools/test_setup_*.pywith two golden JSONs,test_strata_mcp.py,test_qimage.py,test_docker_entrypoint.py,test_poly_prebuilt.py). The jobs ofsetup.pythat were not downloads (choosing engine flags per card, RAM and context) become documented flags inREADME.md. - Rule 2, Python in the serving path:
serve/(92 files, 33.9k lines: the HTTP server with the OpenAI, Anthropic and Responses dialects, the jinja2 chat templating, the Python tokenizer path, the per-family reasoning and tool-call parsers, MCP, structured output, replicas, Prometheus, the hardware monitor, the web UI and 58 test files) andpolystrata.py(the terminal front end, which importsserve/). Replaced by the C++ front end infrontend/, built from the pinned llama.cpp'scommon,mtmd,cpp-httpliband the engine-agnostic files oftools/server. The engines' stdin/stdout protocol is unchanged. - Rule 4, marketing: the six translated READMEs (383 KB),
docs/media/(12 MB: a 9.6 MB demo video still, a 1.8 MB GIF, the figure SVGs and their generator),.github/(issue and PR templates),SECURITY.md(the upstream project's advisory process) andAGENTS.md(contributor notes for upstream's tests and installers).README.mdis rewritten for this fork (PLAN.md step 10); the fork's model-file record isdocs/MODEL-FILES.md, its measurements are the "Measured" section ofREADME.md(records in history at7551f138). - Documents only removed components (decided 2026-10-17):
docs/INSTALL.md,AI_SETUP.md,MCP_SERVER.md,IMAGES.md,LLAMA_SWAP.md,COMMUNITY_BENCHMARKS.md,FAQ.md;chat.py(a terminal client) andtools/calibrate.py(importssetupandserve.server), with their tests. - Scripts that imported removed modules (decided 2026-10-17): the engine gate scripts that drove the engine
through the Python server's
StrataEngineclass (tools/batch_groups_cache_test.py,cancel_park_test.py,conversation_cache_*.py,conversation_restore_speed.py,logit_bias_english_example.py,logit_bias_http_probe.py,session_pressure_test.py),tools/strata_bench.pywithbench.shandBENCH.bat(one helper fromsetup),tools/make_poly_release.py, and the tests that importedsetuporserve(test_mtp_fetch.py,test_shards.py,test_strata_tokenizer.py,test_effort_end_args.py,test_research_run.py,test_benchmark_prompt.py,test_dll_closure.py,test_windows_amd_gpu.py, thetest_conversation_cache_*andtest_strata_bench.py). Upstream's copies run against upstream. - Per-machine results and logs (decided 2026-10-19): upstream's
bench/results/(23 MB, one directory per community machine) and the fork's ownbench/unbiased/run directories (57 MB). A result from one machine is a record, not source; the numbers that matter are inREADME.md"Measured", and the directories are in history at7551f138.bench/keeps what is reusable:bench_vs_llama.pywithprofile_corpus.json, the kernel probes, andbench/correctness/(the step-12 harness, moved frombench/unbiased/correctness/scripts/).