Commit Graph
70 Commits
Author SHA1 Message Date
Robert KarlandClaude Fable 5.1 f5ca866188 [shared] prefill_mmq_kquant_test: order the sentinel memset before the product; a probe mode; ggml_quantize_init
The screen memsets its 0xff sentinel on the legacy default stream and launches on a non-blocking stream, so the
memset could land after the product's writes: every row of the second product at 2048 x 512 read as unwritten on
the RTX 4090 (and passed under CUDA_LAUNCH_BLOCKING=1).  A cudaDeviceSynchronize after the inputs orders it.  The
failure message now says which rows were unwritten or non-finite.  Arguments TYPE,OUT_ROWS,COLS[,TRIAL] run single
products in one context (the probe that found the race), and ggml_quantize_init precedes the reference quantizer
(IQ3_XXS's lookup tables; a probe of it faulted without).

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 9f33a93a99 native_expert_parity: the negative control's gate scales with the block's share of the row; the blob restored after it
The sign flip of one 32-value block in a 640-wide down row moved the row by 8e-3 to 1.4e-2 relative on the RTX 4090
(one of 20 blocks), under the 1e-2 the brief states for Qwen3.6's 256-value blocks of a 512-wide row.  The gate is
now 1e-2 x (block values / 256) x (512 / n_ff), printed with the measurement; the locality half (no other row moves
by any bit) is unchanged.  The corrupted blob is copied back before the decode-once and dequantizer checks, which
read the device blob (they compared the corrupted gate row and failed every pair).

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 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 40f3cb96e2 Qwen3.6 step 3 gdn notes: the gate, the harnesses, the BF16 router measured at zero, both cards' numbers
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 4fd75b9a01 qwen36_router_bf16_flips.py: report the BF16-exact share of each layer's F32 router weight
Both shipped files store ffn_gate_inp, ffn_gate_inp_shexp, ssm_alpha, ssm_beta and
ssm_conv1d as F32 values whose low 16 bits are all zero, so the engine's BF16 reading is
lossless and the native-contract flip rate is zero by construction; the column makes the
table say so.  Measured: 0 of 320 top-8 slots with F32 x BF16(W), 6 of 320 sets (0.23%) with
both operands rounded (the legacy contract), on the first 8 tokens of the IQ3_XXS file.

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 40e4151488 qwen36_router_bf16_flips.py: the top-8 flip rate of the BF16-rounded F32 router, per layer, measured not asserted
Takes an oracle dump of the real file (--act-quant q8) and the file's F32 ffn_gate_inp, forms
each layer's logits as llama.cpp does (F32 x F32), as the engine's native MMVF does (F32 x
BF16(W)) and as the legacy bf16_gemv does (BF16(x) x BF16(W)), and reports per layer the
top-8 positions and sets that differ, the tokens affected, and the smallest logit gap at the
top-8 boundary.  Study 3.4: a number for the step-4 --compat-bf16 decision, no assertion.

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 ad2be2cc26 router_top10_parity at 256/8 and shared_expert_parity at 2048 x 512 on the native Q8_0 path
The router harness runs its five fixtures at both 512/10 and 256/8 (random, all-equal,
12-way tie wider than k, a tie of exactly k scattered through the range, dominant expert)
and asserts the 2^-14 clamp unreachable at both (8/256 is 512x the clamp).

The shared-expert harness adds Qwen3.6's shape: 2048 x 512, Q8_0 projections through
native_mmvq with Q8_1 activations and the native BF16 scalar gate, against a host reference
written from the block layouts (9.6e-8 relative); the silu-on-up reading and the skipped
gate as negatives (83%, 272%); shared_expert_multi bitwise the per-token call; and the
output moved by rounding the F32 gate weight to BF16 reported (2.5e-4), not asserted.

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 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 5ec7ff6619 [shared] qwen36_synth_gguf.py: --gdn, --experts, --shexp-ff, --quant-shexp, --bf16-exact for the kernel fixture
The engine's CUDA GDN kernels are pinned to state 128 and the toy fixture has 16, so the
kernel parity tests need a fixture of their own: --gdn K,V,S sets the GDN heads and state,
--experts E,K the router shape (256,8), --shexp-ff the shared expert's width (512),
--quant-shexp q8_0 writes the three shared-expert projections through gguf-py's quantizer
(bit-identical to ggml), and --bf16-exact rounds ssm_alpha, ssm_beta, ffn_gate_inp and
ffn_gate_inp_shexp to BF16-representable F32 (what the engine reads them as, and what the
pack rounds without --compat-bf16).  The default fixture is byte-identical to before.

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 ac14bacddf [shared] ModelGeometry::gdn_gate() and the seven GDN output call sites pass it
`ModelGeometry::gdn_gate()` is SiLU for qwen35moe and sigmoid for qwen4exp, decided by the
architecture like `hc` and the indexer.  layer.cpp's three output-norm calls and verify.cpp's
four `gdn_step_norm_multi` calls pass it; nothing else in either file changes.  The
parameter is required (no default) so a call site the block agent rewrites cannot silently
keep sigmoid for Qwen3.6.

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 5c6eb91ca8 GDN output gate selectable per model: SiLU(z) for qwen35moe, sigmoid(z) kept for qwen4exp
Qwen3.6 closes the GDN layer with rms_norm(o) * ssm_norm * SiLU(z) where Flash-Next uses
sigmoid(z) (study 3.2, inventory row 39; the oracle's negative control puts the two 1.07
relative L1 apart).  `kernels::GdnGate` names the choice and every decode output kernel
takes it as an argument: `gdn_out_norm` (legacy), `fused_gdn_step_norm` (the default native
decode), `native_gdn_out_norm` (pinned unfused), and the verify window's
`gdn_step_norm_multi`, which must stay bitwise the fused kernel.  The sigmoid arithmetic is
unchanged; SiLU is ggml's op_silu form z / (1 + exp(-z)).  No global: the layer passes
`ModelGeometry::gdn_gate()` (next commit).

gdn_parity now runs the recurrence at both geometries, 16/48 (VPK 3, sigmoid) and 16/32
(VPK 2, SiLU), through all four implementations, checks the verify kernel bitwise against
the fused one (verify, commit and split-commit paths), and makes the wrong gate a negative
case through each kernel itself (86-125% apart), beside the existing four traps.  The
harness uses a blocking stream: its first version raced its own pageable memcpy resets on
a non-blocking stream and reported the native kernels 7.5x off at one geometry.

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 4a76684a12 Qwen3.6 step 3 notes: the plain block - decisions, the harness, both cards' numbers, the hunks
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 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 328501fc9e Qwen3.6 step 3: the verify window at hc = 1 - plain reads and writes over the T rows, k from the file
Verifier::record_window branches on g.hc == 1 in pre (plain_norm_rows for attn_norm, the residual add then
plain_norm_rows for post_attention_norm over the group's rows), post (R += ffn out in place, then the control
vector) and the head (output_norm over the T rows; the canonical head goes through lm_head, which branches the
same way).  The hc_* tensors are resolved only at hc > 1, no pending write is folded, STRATA_FUSE_HEAD_GR
applies only there, and a wired PLE is refused.  The init refusal `ss.k == 10 && fused_gr_supported && ...`
becomes verify_geometry_supported(g, k, why): the fused GR shape only at hc > 1, k == expert_used_count from
the file (8 for Qwen3.6, 10 for Flash-Next), state 128 / conv 4; a free function so the negative case
(top-10 on an 8-expert file) is a unit test and the message names both numbers.  Rows 141, 142.

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 38953a707c [shared] layout.cpp: at hc = 1 the hc_* rows are not required and attn_norm / post_attention_norm (F32, n_embd) are
check_one demanded the eight hyper-connection tensors on every layer (row 22); a qwen35moe pack has none and
carries the two plain norms instead, which the block reads as const float* and so must be engine form F32.
At hc > 1 the two plain names are skipped.  The indexer rows are left to the attention branch.

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 d4976de9ef Qwen3.6 step 3: the plain block at hc = 1 in layer.cpp (norms, residual adds, head), the GR path untouched
`ModelGeometry::hc == 1` (qwen35moe) selects llama.cpp's pre-norm residual block in block_layer_pre /
block_layer_post / lm_head_mix: rms_norm(R) * attn_norm -> mixer -> R += out -> rms_norm(R) *
post_attention_norm -> MoE -> R += out, head rms_norm(R) * output_norm.  Two row-count helpers
(plain_norm_rows, plain_residual_rows) carry it, so the verify window's T-row calls are the single-token
kernels per row by construction.  No pending write: the add is applied where the reference adds it.  The
GR kernels are never entered at hc = 1 (one stream through gr_read is not a plain norm: the harness shows
it).  layer_verify_compatible gains a geometry overload that drops the fused-GR and indexer requirements
where the model has neither; the no-argument form keeps its Flash-Next meaning.

docs/QWEN36-35B-A3B.md section 3.5; geometry-inventory.md rows 4, 22, 23.

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 0e40d4e386 ModelGeometry::n_vocab from the file: output.weight, token_embd.weight and the token list must agree
read_model_geometry left n_vocab at Flash-Next's 248,320 on every file while generate.cpp samples over
output.weight's rows and loads the native embedding with g.n_vocab (the synthetic fixture has 128).  The reader
now takes the vocabulary from whichever of output.weight's ne1, token_embd.weight's ne1 and
tokenizer.ggml.tokens' length the metadata shard carries (the array's `count`: the reader caps `items` at 64),
refuses when two disagree naming both ("output.weight says 100 tokens but token_embd.weight says 128"), and
keeps the default only when none is present (the metadata-only fixtures).  model_geometry_text prints it.

model_geometry_test: toy.gguf reads 128; the real IQ3_XXS file 248,320 (so the default was right for the shipped
files; the Mac's Flash-Next Q2 file also 248,320); the disagreeing fixture is refused and output.weight alone sets it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:54:14 -07:00
Robert KarlandClaude Fable 5.1 b8c0b08eee Qwen3.6 step 2 notes: the gate reached on both files, the --vram-cap runs, the planner against table 4.3
pascal-build.md section 4 quotes the gate as it stands after 30e3add (the geometry, the plan, the missing
gate-up/down kernel pairs per layer, the qwen35moe_not_yet message; exit 2 in 0.36 s) for the IQ3_XXS and the
Q4_K_XL files, and the --vram-cap lines at 5722 / 7629 / 8192 / 10490 / 12288 after 2b4fcf1 (free = cap - 164
MiB within 1 MiB).  Section 3 answers what expert_multi_test's AVX-512 kernel is for and how the RAM tier is read
in the native-pack path (the CPU lane computes from it on AVX-2 / ggml-cpu, the staging path copies from it).
step2-notes.md section 5 gains the planner's figures at those caps beside the study's table 4.3, the table of the
review's fixes with their commits, the Flash-Next real-file result (the reader reads the Mac's MTP Q2 file; the
guard refuses it with block_count 49), and the rsync excludes the VM tree needs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:49:16 -07:00
Robert KarlandClaude Fable 5.1 7d0ada1769 model_geometry_test --real: also prints the architecture guard's verdict
So a real file's run says whether check_architecture passes it, next to the geometry; the gate line is printed
for qwen35moe files only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:24:37 -07:00
Robert KarlandClaude Fable 5.1 b2ccff0ebe test_iq_pack: --layout-only, the nextn exclusion and the fused ffn_gate_up_exps refusal
Three tests for step 2's additions to iq_pack.py (review finding 7): the layout-only run writes
native_experts.txt alone with the v3 header and prints the census; a file with nextn_predict_layers 1 keeps
its last block out of the layout and says so; the fused form is refused by name before anything is written.
26 tests pass on the Mac.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:24:00 -07:00
Robert KarlandClaude Fable 5.1 d01004055a expert_profile_save_test: a 48 x 512 profile is refused for a 40 x 256 model, naming both
The step 2 negative test the plan asked for (expert_cache.cpp's header check); CPU only, in ctest.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:24:00 -07:00
Robert KarlandClaude Fable 5.1 afec2f1aea model_geometry_test: a qwen4exp fixture with the real Flash-Next key set, equal to the defaults field by field
The qwen4exp reader's optional reads (ssm.*, key_length, the interval, the expert widths, rope dims / sections
/ base, the epsilon) and its four refusals ran only on the six-key fixture, so the one path that could refuse the
working model was untested (review finding 5).  The fixture writer gains f32 and u32-array values for it.
model_geometry_test --real on the Mac's Qwen3.8-Flash-Next-Q2.gguf reads it (48 trunk layers, 1 draft block,
every field the default).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:24:00 -07:00
Robert KarlandClaude Fable 5.1 30e3add968 The Qwen3.6 gate runs before the expert format whitelist, and names the formats step 3 lacks
On the 1080 Ti both real files never reached the step 2 gate: generate.cpp checked native_expert_supported()
per layer right after the layout load, and the grouped kernels' down types (STRATA_D_FMTS: IQ4_NL, IQ4_XS,
Q5_0, Q5_1, Q8_0) do not include IQ3_XXS (the IQ3_XXS file, 37 layers), Q5_K or Q6_K (the Q4_K_XL file):

    strata generate: layer 0's experts are IQ2_S/IQ3_XXS (ggml types 22/18), which this engine has no GPU kernels for

The gate now comes first for a qwen35moe file: the geometry, the VRAM plan, then one line per gate-up/down pair
without a kernel with its layers ("step 3 also needs GPU expert kernels for ..."), then qwen35moe_not_yet.  The
whitelist loop is unchanged and still runs before anything is allocated for every other file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:24:00 -07:00
Robert KarlandClaude Fable 5.1 db4da2f823 The routing trace's layer bound comes from the model's geometry
generate.cpp's two trace sites kept the literal 48 (outside 0..47) from Flash-Next; Drive carries the trunk
layer count from ModelGeometry now (review finding 6).  tools/make_profile.py's N_LAYER = 48 is step 4's
(docs/qwen36-port/step2-notes.md).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:23:07 -07:00
Robert KarlandClaude Fable 5.1 3035bef8f5 expert_source: say what "a 12 GiB machine" means for --ram-cap
The cap stands in for the AVAILABLE figure of the machine emulated, and VM 211's 12 GiB report ~10 GiB
available (review note 8).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:20:46 -07:00
Robert KarlandClaude Fable 5.1 128f7d4553 vram_plan_test: the Q4_K_XL census is 19,635,634,176 B
The same 524,288 B that expert_layout_test carried: tests/data/native_experts/qwen36-q4_k_xl.txt's header and
the sum of its 40 blobs x 256 experts are 19,635,634,176 (exactly 18,726 MiB, the study's figure); the
constant and the header comment were 19,636,158,464.  The mean blob and every ladder check are unchanged at
this rounding; all checks pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:20:46 -07:00
Robert KarlandClaude Fable 5.1 84794ce79b frontend: /health's last tier reading under its own mutex
last_stats was written under engine.mu and read without it on the busy branch; httplib serves /health from
several threads (review finding 4).  A dedicated mutex guards it and every reader takes a copy under it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:20:30 -07:00
Robert KarlandClaude Fable 5.1 76a437f096 --ram-cap: clamp only an explicit resident budget
With --ram-cap and the automatic --resident-experts the line set resident_budget = cap, which flipped
pin_cache_complement into explicit-budget mode (lending off, the file tier unbuffered, the budget warning on
every run; review finding 3).  The automatic path is bounded by set_host_ram_cap's clamp of
host_available_memory already; only a budget the user gave above the cap is lowered to it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:20:16 -07:00
Robert KarlandClaude Fable 5.1 4a998adf2c The VRAM plan: no CUDA-context term in the engine, where the budget is already net of it
in.budget_bytes is cudaMemGetInfo's free figure, read after this process's context exists, and the engine
subtracted a 300 MiB context on top of it: ~290 (IQ3) / ~160 (Q4) expert slots under table 4.3 (review
finding 2).  The engine passes 0; vram_plan_test keeps the study's 300 MiB because its budgets are the cards'
sizes.  Said in vram_plan.hpp's field comment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:20:16 -07:00
Robert KarlandClaude Fable 5.1 2b4fcf1f8f --vram-cap: the blocker is not "used by others"; the clamp subtracted it twice
vram_info computed used = total - free after the blocker of total - cap had been allocated, so the blocker
was in `used` AND already out of `free`: room = cap - used = 2*cap - total - used_other, negative at
--vram-cap 5722 on the 1080 Ti and ~4,800 instead of ~7,900 MiB at 8192 (review finding 1).  The blocker's
bytes are remembered and taken out of `used`.  The cap line now also prints what a card of the cap would show
free (cap - used_before), and the start refuses if the clamped figure is above it or more than 64 MiB below
(the driver rounds the blocker up by a few MiB).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:19:58 -07:00
Robert KarlandClaude Fable 5.1 fa3a819405 Qwen3.6 step 2: the Pascal build on VM 211 (pascal-build.md), the notes' section 5
The sm_61 build needed no guard: configure 4 s, the engine 173 s, every other target 43 s more, 0 errors,
cuobjdump shows sm_61 only; `make build CUDA_ARCHS=61` works end to end in 181 s.  ctest on the 1080 Ti: 69
pass, 4 fail (one Pascal-specific: kv_hybrid_parity's [5/5], the cc < 70 refusal of qsa_prompt_attn_batch
counted as a failure), 2 skip.  The gate is not reached: both real files are refused by the native expert
kernels' down-type whitelist (IQ3_XXS, Q5_K, Q6_K down projections have no grouped kernel) before the VRAM plan
and the qwen35moe_not_yet message.  The Q4_K_XL expert total corrected to 19,635,634,176 B.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:16:22 -07:00
Robert KarlandClaude Fable 5.1 5798a463a5 expert_layout_test: the Q4_K_XL total is the pack's own figure; 2560 x 640 is refused as "not whole blocks"
The test's Qwen3.6 section had never been built (expert_layout_test is CUDA-gated; the Mac has no binary).  On
the 1080 Ti build it failed three checks:

    qwen36-iq3_xxs.txt: at Flash-Next's 2560 x 640 refused by its numbers: native experts: expert geometry is not whole blocks FAIL
    qwen36-q4_k_xl.txt: per-layer formats and blobs (down 14 on 34/38/39, 2301952 B at layer 39, total 19636158464 B) FAIL
    qwen36-q4_k_xl.txt: at Flash-Next's 2560 x 640 refused by its numbers: native experts: expert geometry is not whole blocks FAIL

The total: tests/data/native_experts/qwen36-q4_k_xl.txt's header (and the sum of its 40 blobs x 256) is
19,635,634,176 B; the constant 19,636,158,464 was 524,288 B high.  The refusal: n_ff 640 is not whole
256-value blocks for Q4_K / IQ2_S rows, so native_fmt refuses before the blob comparison the test looked for;
the check now accepts either message, both a refusal.  All checks pass on the VM.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:13:43 -07:00
Robert KarlandClaude Fable 5.1 cd2a73c070 Qwen3.6 synth fixtures: set CMP0007 NEW so cmake < 4 keeps the empty flag of "toy.gguf;"
On VM 211 (cmake 3.31.6) the fixture test failed before the generator ran, so model_geometry_test was
"Not Run":

    CMake Error at cmake/qwen36_synth_fixtures.cmake:11 (list):
      list index: 1 out of range (-1, 0)

With CMP0007 unset, list(GET) drops the empty element of "toy.gguf;" and index 1 does not exist.  cmake 4.x
(the Mac) treats the policy as NEW.  With the policy set, qwen36_synth_fixtures writes its 4 files on the VM
(the vendored gguf-py, numpy 2.2.4) and model_geometry_test passes there.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:13:43 -07:00
Robert KarlandClaude Fable 5.1 8b7525e705 frontend: the Engine's STATS command covered by engine_test (reply by prefix, ERR as the error, the next request unharmed)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:59:41 -07:00
Robert KarlandClaude Fable 5.1 eb593179bb Qwen3.6 step 2 notes: decisions, the gate, the pack census, the commands
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:59:18 -07:00
Robert KarlandClaude Fable 5.1 1979fd99b4 Qwen3.6 plan: the RAM tier's headroom is --resident-experts' 4 GiB unless the resident mode set its own
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:57:51 -07:00
Robert KarlandClaude Fable 5.1 074679e5bc Makefile: the Pascal switch without a case statement (make's $(shell) ends at an unbalanced parenthesis)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:57:13 -07:00
Robert KarlandClaude Fable 5.1 a44b0953f2 Qwen3.6 step 2: --vram-cap / --ram-cap, the Qwen3.6 plan and gate, PLE optional at the CLI, the STATS command and /health tiers
generate.cpp: every cudaMemGetInfo the planners read goes through vram_info, which clamps the free
figure to cap - used under --vram-cap MIB; a blocker of total - cap is allocated before the weight
arena.  --ram-cap GIB bounds the RAM tier (host_available_memory is clamped, the resident budget
too) and the pinned arena.  A model whose architecture has no per-layer token embedding starts
without --ple-gguf (no PLE kernels selected, and session.cpp carves no PLE history for it).  For a
qwen35moe file the start reads the geometry, checks the pack's layout against it, makes the 4.2
plan from this card's free VRAM and the file's own census (non-expert weights, the draft block,
KV per token in the chosen format, the session, the reserve, the prompt buffers unless prefill
borrows), prints the three tiers, and stops at the step 2 gate naming the steps not done.  The
serve loop answers STATS with one JSON line: experts, VRAM slots and how many hold an expert, RAM
copies, mapped experts, tokens served, VRAM hits of lookups, RAM-copy and file reads, warm hints,
and the major page faults since start (the disk-read proxy); the same line is logged at start.

frontend: /health carries that line as "tiers" (the last reading, marked stale, during a request);
--vram-cap and --ram-cap pass through; a one-file model needs no second shard.  Makefile: any
CUDA_ARCHS entry below 75 switches STRATA_EXPERIMENTAL_SM60 on (make build CUDA_ARCHS=61).

Not compiled yet: the CUDA translation units need the VM (its sweep is running); this commit is
checked on the VM in the Pascal build commit that follows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:56:49 -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 1d2e400920 Qwen3.6 step 2: the native expert layout takes the model's widths; the engine reads the geometry before the layout
expert_layout_load(pack, n_layers, n_expert, n_embd, n_ff, err): each layer's NativeFmt is built with
the model file's widths instead of the compile-time 2560/640 (geometry-inventory.md row 108), and a
pack without native_experts.txt (the canonical Q2_0 form) is refused for any other geometry.
generate.cpp reads ModelGeometry from the --native file before the layout load, logs it for a
non-Flash-Next file, refuses the fused tensor forms by name, takes the router k and the embedding
dims from it, and reads the rope keys under the file's own architecture prefix.

tools/iq_pack.py: --layout-only writes native_experts.txt alone and prints the census; the draft
(nextn) block of an -MTP file is left out of the trunk layout; fused ffn_gate_up_exps refused;
FORM carries qwen35moe's attn_norm / post_attention_norm / output_norm (F32 as stored).

tests/data/native_experts/qwen36-{iq3_xxs,q4_k_xl}.txt from the real files (40 x 256; 10,594 and
18,726 MiB, mean blobs 1.035 and 1.829 MiB, as censused in docs/QWEN36-35B-A3B.md), and
expert_layout_test loads them at 2048 x 512 with every layer's types (IQ4_XS down on 34/38/39;
Q6_K down on 34/38/39, Q5_K gate/up on 39) and sees them refused at 2560 x 640.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:48:22 -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 Sonnet 5.5 44b0619169 Qwen3.6 port: cross-check doc gains the GQA case, the ggml dequant check and the real-file tolerance policy
Measured on the real UD-IQ3_XXS file, 12 tokens, expert choices and layer inputs forced from llama.cpp: the F32 oracle is
1.4e-2..4e-2 off per layer on quantized-weight seams, the Q8-activation oracle 7e-7..5e-3; dequantization is bit-identical to ggml.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:30:30 -07:00
Robert KarlandClaude Sonnet 5.5 0e5344d343 Qwen3.6 tests: allow the fp16 scale of Q8_0 in the activation rounding bound
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:29:56 -07:00
Robert KarlandClaude Sonnet 5.5 e452c5192e Qwen3.6 port: GQA fixture and rival, ggml dequant check, Q8-activation mode, per-layer teacher forcing
- synth --heads N,KV; cross-check case gqa4_2 (4 heads / 2 KV, seed 11): 211 seams and 50 nextn seams match; the
  h % n_head_kv rival (opts gqa_map=interleaved) fails at kq-3 and is a negative test; with one KV head it is invisible.
- tools/qwen36_dequant_ggml.cpp + qwen36_check_dequant.py: ref/load.py (gguf-py) against ggml's own to_float on the real
  file, bit-identical for Q6_K, IQ2_S, IQ3_XXS, IQ4_XS.
- ref/qwen36.py: --act-quant q8 (Q8_K / Q8_0 activation rounding as ggml's quantized matmul does), --force-topk,
  --force-inputs (start each layer from a llama.cpp dump), tools/qwen36_spread.py to tabulate the spread per seam class.
- qwen36_crosscheck.sh: LLAMA_CPP_DIR override so it runs from a separate worktree.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:29:45 -07:00
Robert KarlandClaude Sonnet 5.5 20949925f3 Qwen3.6 port: invariant tests for the oracle and the fixture (python3 -I)
21 tests: full-attention layers are 3 mod 4 (and 30 GDN + 10 attention at the real geometry, the nextn block outside the
trunk), top-k weights renormalise and a stray expert_weights_scale is ignored, GDN state/conv shapes and
chunked == token-by-token, the output gate is SiLU(z) (negative test against sigmoid), the attention output gate is
applied to the second half of each head's q slice, seven rival readings each move their seam by more than 5 percent,
IMRoPE rotates 25 percent with text positions and an e-sector stays fixed, dump format, causality, the nextn block.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:09:52 -07:00
Robert KarlandClaude Sonnet 5.5 0c850c35c9 Qwen3.6 port: oracle cross-check against llama.cpp's own graph, recorded
docs/qwen36-port/oracle-crosscheck.md: 9 trunk cases and 5 nextn cases (one batch, 40 tokens one at a time, chunks of 7,
fused gate_up, fused qkv, a stray expert_weights_scale key, a --like-real fixture) match every cb()-named tensor of the
pinned llama.cpp graph, worst absolute error 1.1e-4; llama-eval-callback's printed stats agree on 209 named nodes;
seven rival readings (SiLU vs sigmoid gate, head pairing, decay order, conv direction, attention gate, top-k
renormalisation, rope pairing) each fail at the layer that makes them. The formulas are pinned to file:line.
qwen36_crosscheck.sh reruns all of it; the eval-callback checker tolerates the tool's truncated log tail.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:09:52 -07:00
Robert KarlandClaude Sonnet 5.5 f1ef81d86c Qwen3.6 port: numpy oracle for qwen35moe, cb()-named dumps, and the llama.cpp cross-check tools
ref/qwen36.py is a teacher-forced forward pass written from the submodule's qwen35moe.cpp graph: embedding,
GDN layers (causal conv, L2-normed q/k, decay + delta-rule recurrence, SiLU-gated RMS norm), full-attention
layers (joint q+gate projection, IMRoPE on 25%, causal GQA, sigmoid output gate), softmax top-k MoE with
renormalised weights and the sigmoid-gated shared expert, output norm, lm head, and the nextn block of
graph_mtp. Every cb()-named tensor is dumped as <name>-<layer>.f32 plus manifest.txt. Each reading with a
plausible rival is a switch (Model.opts) so the fixture can be shown to tell them apart.
tools/qwen36_dump_llama.cpp dumps the same names, in full, from the real llama.cpp graph;
qwen36_compare_dumps.py, qwen36_check_eval_callback.py and qwen36_crosscheck.sh compare them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:03:43 -07:00
Robert KarlandClaude Sonnet 5.5 96305391f8 Qwen3.6 port: synthetic qwen35moe GGUF generator, real-file metadata dump, load.py knows the IQ types
tools/qwen36_synth_gguf.py writes a tiny F32 qwen35moe GGUF with the real tensor names and shape rules
(4 layers, one full-attention layer at index 3, 8 experts top-2, a nextn block), --like-real to take
rope/eps/interval/ratios and verify the tensor-name set against a real file, and options for the fused
gate_up / attn_qkv forms llama.cpp also accepts. docs/qwen36-port/gguf-metadata.md records every key and
tensor of the UD-IQ3_XXS file and the MTP build. ref/load.py gains the IQ2_S/IQ3_XXS/IQ3_S/... geometry the
real file uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:02:00 -07:00
Robert KarlandClaude Fable 5.1 d579aa8376 Plan: Phase 0 measurements and the replay result in Section 0
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 08:56:33 -07:00