32 Commits
Author SHA1 Message Date
lotherk cb1861e0a5 Merge remote-tracking branch 'upstream/main' 2026-11-17 09:03:29 +00:00
Robert KarlandClaude Fable 5.1 ff19037a1c [2/2] 35b-a3b perf -- consolidate mmq launches (#29)
* strata-poly: --mmq-tab, a layer's cached experts in pointer-table launches of 16 wherever their slots lie

Once follow() has traded slots, a layer's cached experts lie in many short runs and a decode window's
experts with rows went one MMQ launch each (205K launches in a 512-token decode on the 1060).  The
pointer-table MMQ the prompt path already has (src/prefill/moe_mmq_tab.cuh) takes up to 16 matrices by
address; Mmq::mul_tab wraps it for strata-poly and moe_rows() takes it for a class when that is fewer
launches than its runs.  Built under STRATA_POLY_MMQ_TAB (off by default, like STRATA_MMQ_TAB; same
fingerprint of mmq.cuh, now a CMake function both options use).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 1a3b9a42f39132f6b02e0c8f9082a39ef9b898c2)

* strata-poly: make pointer-table MMQ opt-in at runtime

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-05 16:39:38 -08:00
lotherk 847aa7da5f build: pick the oldest tensor-core arch (sm_70) for strata-dsv41; configure green at CUDA_ARCHS=61 2026-11-05 05:59:03 +00:00
lotherk 910648f2bf build: fix the sm_70 pick (no CMake IN operator) for the tensor-core engine 2026-11-05 05:02:04 +00:00
lotherk 827b5cbf0b build: strata-dsv41 needs tensor cores (sm_70+); keep Pascal archs for strata/strata-poly 2026-11-05 04:06:54 +00:00
Robert KarlandClaude Fable 5.1 bd2dbb92f1 Import Strata v0.2.4's DeepSeek-V4.1 engine (strata-dsv41) and the CPU kernels it needs
From Niko1221/Strata tag v0.2.4 (commit 96ca4383, 2026-10-24), unmodified: src/dsv41/ (the engine and its vendored
EXL3 / sampler / window kernels), 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/ (the MIT notice: the engine is a port of Project Maya's maya-ds4),
third_party/ggml/ggml-common-tq.h, docs/DEEPSEEK41.md (upstream's text, to be rewritten for this fork).

src/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 and leave the main engine's
iq256_* / iq512_* as they were (upstream's statement; iq_avx2_parity is the check) - and the trellis CPU lane
tq_cpu.{hpp,cpp}, tq_avx2.cpp, tq_avx512.cpp, tq_states.hpp, tq_computed.hpp is new.  expert_layout.hpp stays at
layout version 4 (upstream's 5 adds Hadamard-folded packs this fork has no use for yet).

CMakeLists.txt: upstream's strata-dsv41 block, with ggml.h / ggml-cpu.h coming through strata_kernels_cpu's ggml-cpu
link from the submodule (no FetchContent), the tq sources and flags in strata_kernels_cpu, and iq_avx512.cpp built
with -mavx512vpopcntdq -mbmi2 as upstream does (iq512x_rows uses them).  Makefile: STRATA_BUILD_DSV41=ON and
strata-dsv41 among the targets `make build` produces.

Target: ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF (IQ1_M / IQ2_XXS + the IQ4_NL Engram) on the A6000 VM.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-23 20:14:35 -07:00
Robert KarlandClaude Fable 5.1 698b02e1a2 frontend: a picture encoded once is a picture encoded once (USTRAT-15)
A chat client resends the whole conversation every turn, pictures included, and the vision encoder is the slow part
of a request: 6 s a screenshot on 16 CPU threads, 18 s on 6, every turn, while the engine reuses the prompt's KV
prefix in a fraction of a second. Upstream's Python server kept the encoder's output per picture in an LRU of 64
files keyed by the SHA-256 of the picture's bytes (serve/server.py, class Vision); this is that cache for the C++
front end, in memory.

frontend/picture_cache.hpp (header-only, no llama.cpp): PictureCache keeps PictureRows (the projector's output,
n_tok rows of the embedding width) under mtmd's chunk id, which is the SHA-256 of the bitmap's bytes. Shared
pointers, so a request keeps the rows it is writing when the cache lets go of them; two limits, entries and bytes,
the newest entry always kept. engine_key() turns the id into the 64-bit key the engine's conversation cache takes
(img_keys= on the GENI line, #2228), so a picture encoded again with other bits still matches its KV prefix.

encode_pictures is now six short functions: open the file, fill it, find the chunk, its id, its rows (cache or
encoder), its grid, write the record. --picture-cache N (default 64, 1 GiB) sets the size; 0 turns it off.

frontend/tests/picture_cache_test.cpp: hit/miss and counters, LRU order and the entry limit, the byte limit and the
oversize newest entry, a held entry outliving its eviction and a key replaced, off and an empty key, the engine
keys, eight threads at once. In make test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 10:33:30 -07:00
Robert KarlandClaude Fable 5.1 cd3be94f42 frontend: a control token's text inside a message is text (USTRAT-14)
The rendered prompt was tokenized whole with specials parsed, so "<|image_pad|>" in a
document an agent read became the image pad token and the engine refused the request
("the prompt has more images than the embeddings file"); "<|im_end|>" in a tool
result ended a turn. Upstream's Python server marked these literals before the template
rendered (#537, #554); the C++ front end lost that with the server's removal.

frontend/literals.hpp: the texts of the vocabulary's control tokens and marker-like
added tokens (<think>, <tool_call>, [gMASK]) are swapped for private-use marks in the
messages and tools before oaicompat_chat_params_parse renders the template, swapped
back after, and the spans they covered are tokenized as text: parse_special off, and an
added token the tokenizer matches regardless is split until none is left. Media parts
are not scanned. An assistant message keeps a leading whole <think>...</think> block
as the model's markers (clients that send reasoning inline), as upstream did. A mark
that a template's tojson(ensure_ascii=True) escaped as a surrogate pair is read too.
A request without literals renders and tokenizes exactly as before.

mtmd's logger wrote every level to stderr, its debug line add_text() among them: the
whole rendered prompt once per request into the journal. It now goes through the
common log, where debug lines need the server's verbosity raised.

Tests: frontend/tests/literals_test.cpp (no model; nlohmann json, the interface
common_json copies) in make test; e2e.sh runs a third fake-engine server with upstream's
Qwen3 template (frontend/tests/data/qwen3-chat-template.jinja) and checks
usage.prompt_tokens against the prompt tokenized by hand with the literals as text, for
user content, a tool description and an assistant history message.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 23:35:32 -07:00
Robert KarlandClaude Fable 5.1 7551f13877 llama.cpp as a fork: submodule -> robertkarl/llama.cpp branch UnbiasedStrata (3cf03257 + the two parser commits); no configure-time patching
The two tool-call parser changes that CMake applied to the submodule's working tree at every configure are now
commits 9547d8d and a6de9af on the fork's branch, and the submodule pins that branch's tip. The pinned commit alone
names the sources compiled, the submodule is clean after a build, and a bump of the pin that breaks the parser
changes fails in git, not in configure. patches/ and the CMake loop are removed; README, UPSTREAM.md, PLAN.md and
docs/CORRECTNESS-PLAN.md say where the changes live now. make test passes on the CUDA-free front-end build.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 18:46:04 -07:00
Robert KarlandClaude Fable 5.1 4c25aa6f6a Front end: llama.cpp's server files with the Strata engine behind them (design C), with fake-engine tests
frontend/strata_context.cpp replaces tools/server/server-context.cpp. The other seven server files
(server-http, -queue, -task, -common, -chat, -schema, -stream) compile unmodified from the submodule into
the static library strata_llama_server; frontend/ui_stub/ supplies the empty web-UI asset table that
server-http.cpp references. The context runs one slot: the engine is a child process spoken to over its
line protocol (docs/BACKENDS.md), a vocab-only llama_model provides tokenizing, the chat template and the
reasoning and tool-call parsers, and the server's own task and result types carry the OpenAI JSON, SSE
framing and client-disconnect cancel. Routes kept: /health, /v1/models, /v1/chat/completions, /tokenize,
/detokenize. The strata engine's 8-token reserve is kept out of max_new. A supervisor thread ends the
process with exit code 1 when the engine dies, for a unit with Restart=on-failure.

frontend/engine.hpp is the child adapter: fork+exec, READY/INFO, GEN/GENI, T/PP/RESUME/DONE/ERR/FATAL,
STOP with drain to DONE, non-blocking reap. quit() and the supervisor's reap_exit() share the pid through
an atomic that quit() takes over by exchange, and only a positive local copy ever reaches kill(). The
first draft kept a plain pid_t and the supervisor set it to -1 on reaping, so a SIGTERM during shutdown
raced into kill(-1, SIGKILL), which killed every process of the user; it did so twice on 2026-10-17.

Build: STRATA_FRONTEND (default on) gates the llama.cpp libraries and the front end, not CUDA, so they
build on a machine without a GPU. Makefile: unbiased-strata joins `make build`; `make frontend` builds it
alone without CUDA into build-frontend/; `make test` builds engine_test there and runs it and
frontend/tests/e2e.sh against a fake engine (frontend/tests/fake-engine.py). The nvcc probes run only
when there is an nvcc and only the build and configure goals demand one. UPSTREAM.md records all of it.

Verified on macOS arm64 without CUDA: `make frontend` and `make test` pass. engine_test, 7 cases: READY,
a request, STOP mid-request with drain and a clean next request, a 100k-token burst the caller abandons,
ERR leaves the adapter usable, the engine dying mid-request is diagnosed, a DONE with the wrong prompt
size is visible. e2e.sh, 12 checks: /health, /v1/models, a non-streaming chat with content, finish and
usage, a stream whose deltas join to the content and end with finish_reason and [DONE], a client that
disconnects mid-stream (the server logs the cancel and the next request completes), an oversize prompt
refused with 400, a tokenize/detokenize round trip. Zero new patch lines to llama.cpp, so the step-4
gate of PLAN.md section 5 passes and design C stands. Not yet run against a real engine.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-17 21:31:05 -07:00
Robert Karl 7e683af1bb Build: llama.cpp as a shallow submodule at 3cf03257; patches at configure; Makefile
ggml now comes from third_party/llama.cpp, the commit upstream pins, instead of
a FetchContent clone at configure time; the configure stops with the submodule
command if the checkout is missing. patches/*.patch are applied to the submodule
at configure time, idempotently (checked in reverse first); the one patch is the
Qwen3-Coder any-argument-order parser fix carried from UnbiasedStrata 1. A second
add_subdirectory builds llama.cpp's llama, common, cpp-httplib and mtmd for the
coming C++ front end with every download switch off. Makefile: make build
configures once and builds strata, strata-poly, strata_kq, llama-common and
mtmd into build/bin for CUDA archs 61;75;86;89 (SM60 flag added for 61), finds
nvcc on PATH or in /usr/local/cuda/bin, and probes for the newest GCC nvcc
accepts, passing it as the C, C++ and CUDA host compiler so one libstdc++ is
linked (a GCC 14 / GCC 13 mix failed to link strata on __cxa_call_terminate).
PLAN.md and UPSTREAM.md added.

Verified: a fresh clone and 'git submodule update --init' on a networked box
checks out the shallow pin in 37 s. On VM 220 (Debian 13, GCC 13/14, CUDA 12.4,
no outbound internet) 'unshare -rn make build JOBS=6' inside a network namespace
with no interfaces built strata, strata-poly and libstrata_kq.so for 61;75;86;89
in 24 min with zero network errors in the log; strata --version prints 0.1.45.
2026-10-17 20:37:04 -07:00
Robert Karl 0197ae86eb Import PolyStrata v0.1.45-poly.1 (d0cd84dc) unmodified
The upstream release tree, every tracked file byte for byte, from
https://github.com/VecSzn/PolyStrata at tag v0.1.45-poly.1, commit
d0cd84dc6bd009d1d9e2191e4e28cc76b80f1ee3. Nothing added, removed or edited;
git diff against this commit is the whole story of the fork.

Verified: the commit's tree hash equals the upstream commit's tree hash.
2026-10-17 19:34:32 -07:00
Robert Karl d1022a66f0 Empty the tree: UnbiasedStrata 2 starts over from PolyStrata
Every tracked file, .gitignore, .gitmodules and both submodules (llama.cpp at
3cf03257, llama-muse at 335916a) are removed so the next commit can import
PolyStrata v0.1.45-poly.1 unmodified and be the diff baseline of the fork.
UnbiasedStrata 1 remains at tags unbiasedstrata-1 (main, b124b59) and
unbiasedstrata-1-muse-spark-native (4c824e6).

Verified: git ls-files is empty; the working directory holds only .git.
2026-10-17 19:34:05 -07:00
Robert KarlandClaude Fable 5.1 22d72e69e7 pool: the native-pack rows at the layer's widths, not the canonical FF / H; the served model's name from its file
Every verify window with an expert miss computed on the CPU decoded to
token 0 ("!!!!") on both Qwen3.6 files: the first serve of the Q4_K_XL
pack at 262,144 context (9,980 of 10,240 experts resident) and IQ3_XXS
under any --vram-cap.  Found by elimination on the 4090: all-resident runs
were correct at every context and KV format, --pcie-frac 1.0 (misses by
DMA, computed on the GPU) was correct, --pcie-frac 0 (misses on the CPU)
was wrong with ggml's plain dot products, with one pool worker and on the
IQ3 file alike.

ExpertPool::run_split_multi_native split its gate/up and down phases over
FF (640) and H (2560) rows per expert, the canonical Q2_0 pack's widths
compiled into expert.hpp, while a native layer's NativeFmt carries its own
n_ff / n_embd (512 / 2048 here): the down phase wrote 512 rows past every
output row into the next token's, the gate/up phase read 128 rows past
each expert's block.  The phases now take the layer's widths; native_fmt
refuses a layer wider than the pool's SplitBufMulti buffers (H x FF).

tests/core/pool_native_widths_test: three Q8_0 experts at 2048 x 512, four
tokens, the pool's rows against the kernels called directly, bitwise
equal, and a guard after every output row.  It fails on the old row
counts (the guard) and passes now.  After the fix on VM 221: Q4 at 8K with
forced CPU misses 328 tok/s correct, Q4 at 262,144 by default 322 tok/s
correct, IQ3 at 262,144 under --vram-cap 11264 (5,762 slots, 56%) correct
at 169 tok/s; the Qwen3.6 and native-expert ctest subset 32 of 32.

The front end reported every model as "qwen3.8-flash-next-iq3_xxs"; the
id is now the GGUF's base name without a shard suffix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-12 19:42:41 -07:00
Robert KarlandClaude Fable 5.1 e73adc6624 build: the chat-parser patch applied at configure time; make build turns STRATA_MMQ_KQUANTS on
REGINA-104 (a Qwen3.6 tool call dropped when its required parameter is not
written first) was upstream's required-first rule running unpatched: the
any-argument-order patch was applied only by `make build`, and every VM tree
of the port was configured with cmake directly, on a copied submodule.
Qwen3.6's template routes to the Qwen3-Coder parser the patch covers, so
CMake now applies it when third_party/llama.cpp is configured (patch -p1 -N,
a reverse dry run first so an applied tree is a no-op; a tree the patch does
not fit fails the configure instead of building the wrong parser).  Verified:
a fresh submodule checkout reports the patch applied and a second configure
says nothing; on VM 221 the rebuilt libllama-common parses `limit offset
path`, `offset path limit`, `path limit offset` and `path` on
Qwen3.6-35B-A3B-UD-IQ3_XXS.gguf (make test-chat-parser PASS).

`make build` also passes -DSTRATA_MMQ_KQUANTS=ON: the Q4_K_XL file's Q6_K
down experts take the MMQ prompt path (docs/qwen36-port/step3-experts.md),
which that option builds.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-12 18:45:33 -07:00
Robert KarlandClaude Fable 5.1 bc0b297069 tests: the verify window and the streaming runner on a Qwen3.6 native pack
qwen36_runner_fixture.py writes the synthetic model at the real per-layer
geometry (the prefill harness's full4) as a file a native pack is built from,
builds the pack with iq_pack.py and a 4 x 16 profile, and dumps the oracle for
the 8/11/40-token cases, faithfully and with --act-quant q8.

qwen36_verify_test.cpp drives Verifier on that pack as generate does (the load
order, check_all, the decode config layer_verify_compatible requires, the cache
holding every expert) - the step-3 review's HIGH finding that no test drove the
window on qwen35moe.  The 8-token window's residual after every layer and its
head logits per row against the oracle; the same rows from one-token windows bit
for bit; 8 + 3 with a commit; 40 one per window (base_ar).  The reference is the
Q8 oracle, the engine rounding activations as ggml does.

qwen36_runner_check.py drives the strata binary end to end: the 40-token
sequence teacher-forced in three chunkings (base_c7, one chunk, base_ar), the
logits dumped per position, and the 4 KB mutation-sensitivity gate.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-12 18:30:29 -07:00
Robert KarlandClaude Fable 5.1 bbc3532108 qwen36_mtp_test: the drafter held to the oracle's --mtp dumps, position by position
The fixture is the prompt-path trunk plus the nextn block (Q8_0 projections, experts, head and embedding) on 76
tokens, with the pack cut from it.  Every seam at every position against the Q8 oracle, the router's picks identical,
the argmax identical but near ties; the negatives (the hidden state first in the concat, hnorm skipped, the pairing
with position k) more than 5 % away; the captured round graph against the uncaptured forward; the prompt-side pass
for 64 cells and the forward after it.  --real: the real file against llama.cpp's own MTP arm.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 14:36:13 -07:00
Robert KarlandClaude Fable 5.1 8fc3b20763 pack_load_check: a native pack loaded as generate loads it, through check_all, the head and the embedding
The step-2 gate fires before the arena, the native projections, the head and the embedding load, so a run to the
gate proves nothing about the pack; this binary does those loads in generate.cpp's order with its skip set, then
check_all (which generate.cpp never calls), the expert profile, and prints every weight the step-3 sites read with
its engine form or native type.  CTest: skipped (77) without STRATA_QWEN36_GGUF / STRATA_QWEN36_PACK or a card.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:55:23 -07:00
Robert KarlandClaude Fable 5.1 5b50b23ffa qsa_attn_bench is a target, not a CTest entry: it asserts nothing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:50:45 -07:00
Robert KarlandClaude Fable 5.1 3144f22dc7 Prefill: dense attention through the attention branch's kernels; the Qwen3.6 harness and its fixtures
The attention layer of a model without an indexer takes the cherry-picked
kernels as the attention branch defines them: the shapes zero the three indexer
widths (qsa_dense), the capacity is qsa_selection_cap (every cell), no ids are
carved or passed (a null is the identity), the group G comes from the geometry
and any other ratio is refused by name before a launch.  The own dense_ids
kernel goes (qsa_identity_ids is the explicit form).  A model with no attention
layer at all (the harness's gdn3 fixture) has no primary attention state: the
reads of it are guarded.  STRATA_PREFILL_ALLOC_TRACE=1 names the allocation
that did not fit.

tests/python/qwen36_prefill_fixture.py writes the synthetic model at the real
per-layer widths (gdn3: three DeltaNet layers; full4: plus the attention layer;
Q8_0 projections and experts, BF16-exact routers) and the oracle's dumps for 40
tokens, faithful, --act-quant q8, and the rival readings.
tests/cuda/prefill_qwen36_test.cpp runs the prompt path on them as one chunk
and in chunks of 7 with every layer's input teacher-forced to the oracle's
l_out, holds each seam to the dumps, checks the router's top-k, the negative
controls and the geometry refusals; CTest: prefill_qwen36_fixtures,
prefill_qwen36_test, prefill_qwen36_attn_test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:03:25 -07:00
Robert KarlandClaude Fable 5.1 4f3edf9229 gdn_rec_parity: both geometries, the engine's launches against a host reference, the negative controls
The copied kernel variants become templates on <HV, HK, C>; the bit checks run
at 48/16/10240 and 32/16/8192.  New: a double-precision transcription of the
recurrence (decay before the rank-1 update, v-head h paired with k-head h % HK,
the gated RMS-normed output) that the engine's own gdn_recurrence and gdn_conv
are held to (FP16 output 2e-3, FP32 state 1e-4 relative L1), with the rival
readings the oracle names - the other model's gate, the interleaved pairing -
required to sit more than 5 % away; and the geometry refusals (a third value
head per key head on 32 heads, 4 per key head).  Links strata_prefill.

4090 (sm_89): 0 failures; the rivals 0.86 to 1.33 relative L1 away.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:03:25 -07:00
Robert KarlandClaude Fable 5.1 994d0dcbe8 Qwen3.6 step 3: qsa_dense_parity (host reference in four KV formats, the oracle's attention seams at G 8/12/2, the negatives) and qsa_attn_bench
The fixtures (cmake/qwen36_attn_fixtures.cmake) are the synthetic qwen35moe GGUFs at head_dim 256 for 16/2, 24/2 and 4/2 with ref/qwen36.py's dumps on 40 tokens; the test runs the dumped q/k/v through the engine's norm, RoPE table, fp16 append, decode kernel and gate and holds them to Qcur-3, Kcur-3#2, kq_soft_max-3, kqv-3, attn_gated-3. Negatives: the gate skipped, adjacent-pair RoPE, the GQA map h % n_kv, G = 12 on 16 heads, the sparse width 2,051 on 3,000 cells. qsa_attn_bench uses only the pre-step-3 entry points so it builds against the old kernel too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 0d13f41287 native experts: IQ3_XXS, Q5_K and Q6_K down projections, Q6_K gate/up (Qwen3.6-35B-A3B's expert formats)
The grouped down kernels were generic in Fmt<T> but STRATA_D_FMTS listed only the 32- and 64-value types plus IQ4_XS,
so native_expert_supported refused every layer of both Qwen3.6 files: UD-IQ3_XXS's IQ3_XXS down (37 layers) and
UD-Q4_K_XL's Q5_K (37) and Q6_K (34, 38, 39).  IQ3_XXS and Q5_K join the down list; Q6_K gets llama.cpp's
vec_dot_q6_K_q8_1 (VDR 1, dp4a) and dequantize_q6_K transcribed, Fmt<14>, and a place on all three lists plus is_iq
and iq_row_bytes (the prompt path's fp16 dequantizer).  A 256-value down type needs n_ff % 256 == 0, which
native_expert_supported already checks: Qwen3.6's 512 passes, Flash-Next's 640 is still refused.

Harness: native_expert_parity takes --geom HxFF and gains the negative control (e): the sign byte of one block's fp16
scale flipped in one down row must move that row's GPU output by more than 1e-2 relative and no other row by any
bit, and the same in one gate row must move the output by more than 1e-4.  Five Qwen3.6 pairs run as ctests at
2048x512, q6_K/q8_0 at 2560x640, and q4_K/q6_K at 2560x640 is the refusal (WILL_FAIL).  native_grouped_parity adds
Q6_K and the three down types to its bitwise v1 sweep, the five pairs at 2048x512, and --bench-down (the down kernel
alone per expert, the step-5 budget).  iq_multi_parity adds the IQ3_XXS down pair at 1024x512.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:27:10 -07:00
Robert KarlandClaude Fable 5.1 a4e6269bba [shared] prefill MMQ: Q6_K under STRATA_MMQ_KQUANTS (Qwen3.6 UD-Q4_K_XL's down on layers 34, 38, 39)
llama.cpp's MMQ has a Q6_K tile (mmq-instance-q6_k.cu); it joins the K-quant list beside Q4_K, Q5_K and Q5_1 so a
prompt through the Q4_K_XL file's three Q6_K layers takes the int8 tiles rather than the fp16 GEMM over
dequantized weights.  The screen test adds Q5_K and Q6_K down products at the model's 2048 x 512; its "not covered"
negative moves from Q6_K to Q3_K.  Type tables only; the prefill geometry is the prefill agent's.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:27:10 -07:00
Robert KarlandClaude Fable 5.1 e63b61e10c qwen36_seam_parity: the decode GDN, router and shared-expert kernels held to the oracle's seams
cmake/qwen36_oracle_dumps.cmake writes k.gguf (2 k-heads / 4 v-heads of 128, 256 experts
top-8, shared expert 512 in Q8_0, BF16-exact gate weights) and runs ref/qwen36.py on the
11-token "hello world" sequence in F32 and --act-quant q8 modes; qwen36_seam_parity reads the
fixture and the dumps and holds, by llama.cpp's cb() names:

- conv_output_silu-0, new_state-0, final_output-0 through the legacy, pinned native and
  fused decode paths token by token with the state carried, and through the verify window's
  multi-token kernels over two windows (8 + 3) with commits; the fused path also at
  q/k_conv_predelta-0, gate-0, beta_sigmoid-0.  Worst 2.3e-7 against 8e-5 (gdn_out class).
- ffn_moe_topk-0 identical and ffn_moe_weights_norm-0 at 6e-8 from the oracle's logits.
- ffn_shexp_gated-0 on the native Q8_0 path with the 1-D BF16 scalar gate at 3.5e-7 against
  the Q8 oracle (1.2e-2 against the F32 oracle: the activation rounding); shared_expert_multi
  bitwise the per-token call.
Negatives through the kernels: the sigmoid gate (126% at final_output-0), the un-normalised
router weights (24%), the shared gate skipped (52%).  Exits 77 without the fixture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:18:08 -07:00
Robert KarlandClaude Fable 5.1 12784ae104 Qwen3.6 step 3: qwen36_block_test - the plain block through the engine against the oracle's dumps
Maya's layer composition shape on the synthetic fixture: a pack the test writes (the F32 norms, the BF16
router and shexp gate) loaded by WeightTable, then block_layer_pre stage 0 / half 2, the residual add,
block_layer_post and lm_head_mix held to attn_norm-N, attn_residual-N, attn_post_norm-N, ffn_moe_topk-N,
ffn_moe_weights_norm-N, ffn_out-N, l_out-N, result_norm and result_output per layer and token, with the
mixer and expert outputs teacher-forced from the dumps (the fixture's projections are F32, which the engine
has no kernel for: the mixer seams are reported with the engine's own error until the sibling branches and
the step-4 pack).  The window's row arithmetic: the T-row helpers and native_moe_combine_multi bitwise the
one-row calls, and the 8-token sequence carried through the four layers against l_out-N per position.
Negative cases: the GR read at hc = 1 with identity bottleneck weights, the post-attention norm skipped and
unweighted, top-10 on the 8-expert file, a missing norm, the Flash-Next compatibility still demanding the
fused read.  cmake/qwen36_block_fixtures.cmake runs ref/qwen36.py on 8 tokens; the CTest entries depend on
step 2's qwen36_synth_data fixture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:54:24 -07:00
Robert KarlandClaude Fable 5.1 b85bbb2e55 Qwen3.6 step 2: the VRAM planner as a pure function, checked against the study's ladder
strata/plan/vram_plan.hpp: the 4.2 rule with no GPU in it - the fixed set at the requested context
(weights, drafter, KV per token, session, CUDA context, reserve, prompt buffers unless prefill
borrows), the context lowered toward 131,072 in steps of 4,096 when it does not fit, a refusal with
every number and the smaller file's name below the floor, the remainder as expert slots at the mean
blob, the RAM tier from the available RAM minus a headroom, the rest mapped from the file.

tests/core/vram_plan_test.cpp reproduces table 4.3 of docs/QWEN36-35B-A3B.md for 6, 8, 11 (decimal
and the 1080 Ti's 11,264 MiB), 12, 16, 24 and 32 GB at Q4 and IQ3, with and without borrowing: every
row equals floor((budget - fixed) / blob) exactly and is within the table's rounding of the printed
figure; the 24 GB spare (~1,090 MiB), the RAM tier at 9.5 GB (~4,950 / ~8,760), the disk tier on the
1080 Ti (~1,740 / ~2,780), the lowering branch, the refusal at 6 GB Q4 without borrowing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:51:46 -07:00
Robert KarlandClaude Fable 5.1 1417ba9e18 Qwen3.6 step 2: ModelGeometry from the model file's own metadata, for qwen4exp and qwen35moe
ModelGeometry gains the architecture, the draft block count, n_rot / rope sections / base / eps, the
shared-expert width, the router k and has_ple; derive() computes the conv channels and the value dim
from the head counts instead of storing Flash-Next's.  strata/core/model_geometry.hpp reads every
field from the <arch>.* keys (hc = 1, no PLE, no indexer for qwen35moe), checks the derived quantities
against the file's own (ssm.inner_size), refuses the fused ffn_gate_up_exps and attention attn_qkv
forms by tensor name, and carries the step 2 gate message.  check_architecture accepts qwen35moe with
the key set llama.cpp's loader requires (presence only; the file is the authority on sizes).

tests/core/model_geometry_test.cpp: every field of the toy geometry from tools/qwen36_synth_gguf.py,
the nextn block subtracted, both fused forms refused by name, a qwen4exp file keeping hc 4 and PLE,
'llama' refused by name, a contradictory ssm.inner_size refused; --real FILE asserts the real
Qwen3.6-35B-A3B values (checked on the IQ3_XXS and Q4_K_XL files).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:45:37 -07:00
Robert KarlandClaude Fable 5.1 46c46ecfc1 Front end: image input through the model's vision encoder; engine child supervision; tests
Images: --mmproj PATH loads the Qwen3.8 Flash-Next projector through llama.cpp's mtmd
library and encodes image_url parts on the CPU (frontend/vision.hpp). The embeddings go to
the engine as a GENI request, its existing vision path, with the prompt's <|image_pad|>
runs standing in for each image. --vision-tokens caps the tokens per image. GET /v1/models
lists "image" under input_modalities when the encoder is loaded. Checked on an RTX 4090:
screenshots, photos, several images in one message, and pi's file attachments and
clipboard paste.

Engine process: the engine is started and watched from frontend/engine.hpp; when it exits
or its stall watchdog fires, the front end exits too, for a supervisor to restart. Stall
reports add the current stage and thread wait channels. Reasoning streams; content and
tool calls are sent once the whole message is parsed, so partial JSON never changes
arguments already sent.

Tests: make test-frontend (child exit, protocol, backpressure; no model needed) and
make test-chat-parser MODEL=<gguf> (template and tool-call parsing against the real GGUF).

The image path and the supervision were written by a Codex session; this commit finishes,
documents and checks them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 15:54:53 -07:00
Robert KarlandClaude Fable 5.1 1db37aaa75 Add the C++ front end: one binary serves an OpenAI-style chat API
unbiased-strata is the engine plus a front end. Started normally it runs
the front end, which starts a copy of itself as the engine (--engine) and
talks to it over a pipe in the engine's own line protocol, as upstream's
Python server does. The engine source is included unchanged; only its
entry point is renamed at compile time.

Tokenizer, Jinja chat template and HTTP library come from the pinned
llama.cpp submodule. Endpoints: POST /v1/chat/completions (with
streaming and reasoning_content), GET /v1/models, GET /health.

Builds on the RTX 3090 pod. Not yet verified end to end.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 14:28:08 -07:00
Robert KarlandClaude Fable 5.1 1b59e5e106 Build from a pinned llama.cpp submodule; add Makefile and README
ggml now comes from third_party/llama.cpp (commit 3cf03257, the one upstream
pins) instead of a clone made during the build. 'make build' configures and
builds the engine for RTX 30/40/50 cards with an AVX2 CPU baseline.

Not yet verified on a CUDA machine.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 12:57:44 -07:00
Robert KarlandClaude Fable 5.1 12a7825605 Import Strata at 6f32ec0 (upstream snapshot, unmodified)
Source: https://github.com/Niko1221/Strata, commit 6f32ec070f23ced9f50e704d854d775da52591ab
(engine 0.1.39, MIT). Every file is as upstream published it; later commits
show exactly what this fork changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 12:55:44 -07:00