Skip to content

Qwen3.5 family: the geometry comes from the checkpoint, and Qwen3.8-27B is served - #520

Closed
BobClawblaw wants to merge 2 commits into
ashhart:mainfrom
BobClawblaw:qwen3_5-27b
Closed

BobClawblaw wants to merge 2 commits into
ashhart:mainfrom
BobClawblaw:qwen3_5-27b

Conversation

@BobClawblaw

Copy link
Copy Markdown
Contributor

Help-list item 5, a new checkpoint for the native server: Qwen3.8-27B (TensorFold/Qwen3.8-27B-MLX-4bit) through the existing Qwen3.5 family. It is the same architecture as the pinned 2B (qwen3_5_text, linear attention three layers in four, affine 4-bit group 64), only wider: hidden 5,120, 64 layers, 48 DeltaNet value heads over 16 key heads, 24 query heads over 4, and a separate output head. The family had the 2B's shape as comptime constants and as constexpr lines in each kernel; this makes the geometry a checkpoint property, with a two-entry admission table so nothing else is let in unqualified.

What changes

  • zig/kernels/metal/qwen3_5/: the kernels become geometry-free templates. The constexpr dimension lines come out, and the family prepends them as macros when it compiles each template (Metal has no program-scope constexpr). The seven generated projection files were one body with different constants (diffed), so one qmm.metal replaces them; the loader compiles it once per distinct (outputs, inputs) shape of the checkpoint, with the row decoder's split-K and tile rules (splits, tiles) kept as code. The layout kernels' literal 2048/4096/8/2 become HID, QIN, QH, KVH, HD; the merge kernel's w * 8 becomes w * QH.
  • config.zig: Geometry (hidden, intermediate, layers, the four head counts, tied) with the derived rows (convDim, kInner, vInner, qInner, kvInner, deltaBytes, convBytes); geometries lists the 2B and the 27B; parse matches the config's dimensions against that table and checks tie_word_embeddings against the entry. The fixture test now builds both configs and keeps the rejection cases.
  • kernels.zig: compiles the fixed templates and the shape list at load; projection(n, k) is a runtime lookup.
  • weights.zig: blocks sized by the geometry, lm_head when untied, and A_log materialized as f32 for the kernel (the 2B stores it f32, the 27B bf16; mlx-lm keeps it out of its dtype cast too).
  • state.zig, forward.zig, qualify.zig, backend.zig: buffer sizes, strides, grids and thread counts from the geometry. Two of those mattered for the 27B and were invisible on the 2B, where hidden, the DeltaNet value rows and the attention rows all happen to be 2,048: the query buffer must hold the wider of the DeltaNet and attention rows, and the attention partial kernel needs a simdgroup per query head of a group (six for the 27B, four for the 2B).
  • tools/zig/qwen35_fidelity.py: its third corpus came from the Python engine's prefill_cold, which left the tree in 1.0.0; it now falls back to this repository's docs when that import is missing. (The operation-capture tool still imports the removed gen_qwen35_kernels.py; the forward and fidelity checks below do not need it.)

Checks

The 2B is unchanged, bit for bit. tf-qwen35-forward logits from main's binary and this branch's are byte-identical on 300- and 777-token fixtures; tf-qwen35-exact passes its 49 forward and cache checks; tf-qwen35-check loads the same 20 pipelines plus the shared tied head.

The 27B (M5 Ultra, 256 GB, macOS 27.0.1, Zig 0.17.0, Metal Toolchain 27A266a, revision 22d8d538):

  • tf-qwen35-check: loads, 22 pipelines, separate head.
  • tf-qwen35-exact: 49 of 49 forward and cache checks (windows of 1 to 32 rows at six prefixes against one-row execution, committed logits, recurrent state and attention caches, partial keeps, unequal streams).
  • tools/zig/qwen35_fidelity.py against stock mlx-lm 0.32.0 (mlx 0.32.3):
Fixture Tokens NLL: native / mlx-lm one row / 32-row chunks / full Top-1 agreement: native vs one row native vs chunks mlx-lm chunks vs one row
fibonacci-raw 14 2.731 / 2.715 / 2.734 / 2.734 1.000 0.929 0.929
gpu-chat-no-think 31 5.746 / 5.749 / 5.702 / 5.702 1.000 1.000 1.000
public-contribution-guide-512 512 2.996 / 2.997 / 2.992 / 2.994 0.975 0.979 0.980
repo-docs-2048 2,048 1.905 / 1.906 / 1.907 / 1.907 0.985 0.983 0.985
  • Server (--parallel 8 --context 32768), tools/bench_concurrent.py --alone --serial at 1, 2, 4 and 8 streams, sampled and greedy, 128 tokens: 120 of 120 concurrent replies equal their solo runs and 72 of 72 solo runs equal "draft": false; aggregate 36 tok/s at one stream, 53-54 at two, 79-81 at four, 104-108 at eight.
  • Decode, tools/bench_openai.py --tokens 64 --reps 5 --temperatures 1.0,0: 36.0-36.2 tok/s medians on the code and chat prompts, sampled and greedy, first token in 0.05-0.08 s. No drafter: this checkpoint carries no MTP weights and the native server has no DFlash2, so the lanes carry context copies only.
  • zig build test: passes (the geometry table, the 2B's shape list, the sampler); lean checker 512, the baseline.

Memory

A stream's attention cache is 64 KiB a token (16 attention layers, 4 heads of 256, keys and values), so --context sizes memory per stream; the forward's scratch for attention partials is 24 query heads wide. The server came up in 2.6-3 s and held 15.9-16.1 GiB RSS at --parallel 8 --context 32768.

Docs

README and ZIG-PREVIEW model tables, the 2B recipe's scope paragraph, and a "Native Metal" section in the Qwen3.8-27B recipe with the run command, scope and these measurements.

Independent of #497, #499, #502, #518 and #519: nothing outside the Qwen3.5 family, its kernels, its tests and these docs.

🤖 Generated with Claude Code

BobClawblaw and others added 2 commits October 8, 2026 07:31
…7B is served

The family had the 2B's shape as comptime constants and as constexpr lines in each kernel. The kernels are now
templates whose dimensions the loader prepends as macros when it compiles them; the seven generated projection files
were one body with different constants and become one, compiled once per distinct shape of the checkpoint with the row
decoder's split-K and tile rules kept as code. config.zig reads the dimensions and matches them against a two-entry
table, the pinned 2B and Qwen3.8-27B (hidden 5,120, 64 layers, 48 DeltaNet value heads over 16 key heads, 24 query
heads over 4, a separate output head, bf16 A_log). Buffers, strides, grids and thread counts come from that geometry;
two were invisible on the 2B, where hidden and both mixers' rows are all 2,048: the query buffer takes the wider of the
DeltaNet and attention rows, and the attention partial kernel gets a simdgroup per query head of a group.

The 2B is bit-identical to main (tf-qwen35-forward logits on 300- and 777-token fixtures), passes its 49 exactness
checks and loads the same pipelines. The 27B passes the same 49 checks; against stock mlx-lm its top-1 agreement
matches mlx-lm's own one-row versus chunked agreement at every length (NLL within 0.002); behind the server 120 of 120
concurrent replies equal solo and 72 of 72 solo equal plain, 36 tok/s a stream and 104-108 at eight, 16 GiB RSS.
The fidelity tool falls back to the repository's docs for its third corpus now that the Python engine's left the tree.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@jkuepker

jkuepker commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Receipt from an M5 Max (Mac17,6, 128 GB, macOS 27.0), Zig 0.17.0, Metal Toolchain 27A266a, 094cbaa7, TensorFold/Qwen3.8-27B-MLX-4bit at 22d8d538. The GPU had nothing else running; an idle MLX server stayed resident.

Checks

  • zig build test test-golden: 95/95 steps, 386/388 tests passed (2 skipped).
  • tf-qwen35-check: loads, 22 native pipelines, separate head.
  • tf-qwen35-exact: 49 of 49 forward and cache checks, 0 failed, 0 skipped.
  • tools/zig/qwen35_fidelity.py: not run (no mlx-lm 0.32.0 env on this machine).

Server (--parallel 8 --context 32768 --no-thinking), up in 6 s (loaded in 4.1 s), 15.9 GiB RSS idle, 19.5 GiB after the runs.

  • tools/bench_concurrent.py --levels 1,2,4,8 --tokens 128 --temperatures 1.0,0 --alone --serial: 180 of 180 concurrent replies equal their solo runs, 72 of 72 solo runs equal "draft": false, 0 failed. Aggregate tok/s, code and chat, sampled and greedy:
Streams 1 2 4 8
aggregate 19.9-20.9 34.7-35.7 58.0-59.6 81.7-85.6
steady 35.6-36.6 60.1-61.3 89.1-90.4
  • tools/bench_openai.py --tokens 64 --reps 5 --temperatures 1.0,0: 20.5-21.2 tok/s medians on both prompts, sampled and greedy, first token in 0.09-0.16 s.

One data point on tuning. On this machine the Python engine's one-row target forward took 37 ms, about 27 tok/s (0.6.0; 29 tok/s end-to-end serial on 0.2.0), on Vontra/Qwen3.8-27B-MLX-4bit, the same 4-bit group-64 quantization. The native path is roughly 20% behind here. Split-K is not the cause: varying splits() for the 5,120-output projections (8/16/32) and the wider ones (4/8/16), --reps 3, greedy, gave 21.7-22.9 tok/s against 22.4-22.5 for the shipped 16/8. Run-to-run drift was about 7% (the same binary gave 20.5-21.2 in the 5-rep run above, right after the concurrency runs), so that spread is no signal. That leaves tile width and the eight-slice partials as the place to look, which matches the 32-wide A/B from #196.

Small thing seen at startup, also on main: server.zig:105 prints the family's 128-token prefill step as prompt chunks of up to 0,128 tokens (the {d},{d:0>3} format assumes 1,000+).

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

Thanks for the receipt. The exactness picture matches the M5 Ultra runs, and the fidelity script needing an mlx-lm 0.32.0 environment is expected; the Ultra rows in the description cover that one.

The 0,128 line is real and predates this PR: the format split the step into thousands and a zero-padded remainder, which held for the Nemotron and GLM steps of 1,000 or more and not for this family's 128. Fixed on main in #526, separate from this PR, which stays inside the Qwen3.5 family.

The tuning data point is useful. Split-K ruled out with the drift you measured, and the Python engine's one-row forward at about 27 tok/s on the same quantization, leaves the row decoder's tile width and the eight-slice partials as the candidates, as you say. That is the same lever #196 pulled for one-stream servers, so a 32-wide A/B on the 27B's 5,120-output projections is the natural follow-up for the family after this lands. I will track it separately rather than widen this PR.

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

Following up on the tuning data point: the tile-width A/B is on #527 and the result is that the lever was elsewhere. Each step ended with a host memcpy of every DeltaNet layer's recurrent state into the stream's cache, 151 MB a stream on the 27B. #528, stacked on this PR, copies it on the GPU inside the step's command buffer: one-stream decode 36.0-36.3 to 38.5-38.9 tok/s and eight streams 106-110 to 131-138 aggregate on the M5 Ultra, with the 2B and 27B logits byte-identical to this PR's binary and all 49 exactness checks passing. The tf-qwen35-bench tool there prints the step breakdown, so a run on the M5 Max would say whether its gap is the same split.

@jkuepker

jkuepker commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to my receipt above, with a correction: tile width is not where the M5 Max time goes.

Tile width. qwen35_qmm at 8, 16, 32 and 64 columns a threadgroup (NT 1/2/4/8, two alternating passes, bench_openai --reps 5, greedy) gave 21.1-21.5, 22.3-22.6, 20.9-22.6 (shipped) and 19.3-19.4 tok/s. Logits on a 300-token fixture and a 200-token greedy reply were byte-identical at every width. The shipped 32 is already the right choice.

Where a one-row step goes (1,000-token context, each kernel label timed alone with the others left out of the forward, medians): GPU 41.0 ms, wall 44.4 ms. Projections are 40 ms of it:

Projection ms GB/s
MLP gate + up 16.47 390
MLP down 8.44 380
DeltaNet qkv / z / out 3.73 / 2.48 / 2.35 380 / 342 / 362
head 1.90 377
attention q / out 1.87 / 1.08 303 / 262
attention k, v 0.75 126
DeltaNet a, b (48 × 5,120, 96 dispatches) 1.00 13

All other kernels together take about 2.3 ms (attn_partial 0.47 ms here, 1.8 ms at 8k context). A forward with every dispatch left out still costs 2.4 ms of wall time, and served decode adds about 2.5 ms a token on top of that.

So on this chip the large projections run at about 385 GB/s, and the time beyond that is in the small projections (a and b alone are about 1 ms for 13 MB of weights) and in per-step host time. For comparison, the Python engine's one-row target forward was 37.2 ms here, against 41.0 ms of GPU time now. Joining a and b into one 96-output projection would change splits() from 32 to 16 and with it the sum order, so it would need to keep 32 chunks to stay bit-identical.

One thing to avoid: cutting the forward into several command buffers looked 12% faster, but the buffers are untracked, so the pieces overlapped on the GPU and the logits changed from run to run. Ordered with an MTLEvent, the bits match again and no split size is faster.

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

@jkuepker, if you want to run the follow-ups on the M5 Max, two branches on the fork, both on top of this PR's head:

  1. BobClawblaw:qwen3_5-gpu-commit (Qwen3.5 family: the committed DeltaNet state is copied on the GPU (+7% one-stream, +25% eight-stream decode on the 27B) #528): the DeltaNet state commit moved onto the GPU, same bytes. On the Ultra it was 36 to 38.7 tok/s at one stream and 106-110 to 131-138 aggregate at eight. Your bench_openai.py and bench_concurrent.py runs from the receipt are the comparison.

  2. BobClawblaw:qwen3_5-fp32-decode: the FP32 projection family on top of that, behind an environment flag, parked for now. The question your machine can answer is whether the Max's one-stream gap has the same shape as the Ultra's.

For either:

git fetch https://github.com/BobClawblaw/TensorFold qwen3_5-fp32-decode
git checkout FETCH_HEAD
zig build tf-qwen35-bench native

The bench prints each projection shape at 1 to 32 rows, the FP32 path beside the matrix kernel with its numeric distance and a row-independence check, then the one-row step:

zig-out/bin/tf-qwen35-bench <model dir> 30

The server runs the matrix family by default; TF_QWEN_QMV=1 in its environment switches every decode width to the FP32 family. The qualifier should admit wider lanes without a warning either way:

TF_QWEN_QMV=1 zig-out/native/bin/tensorfold-native serve <model dir> --name bench --port 8090 --parallel 8 --no-thinking

The two numbers that matter: the one-row step line from the bench with and without the flag, and bench_openai.py --tokens 64 --reps 5 --temperatures 1.0,0 against the server with and without. The bench_concurrent.py --levels 1,2,4,8 run says whether the Max's multi-stream slope matches the Ultra's. Two cautions from the Ultra: a cell measured right after a CPU-side compile runs at a low GPU clock, so the first line of a shape can read high, and the 44 MB shapes fit the system-level cache when re-read, so the step time is the number to trust over the per-call ones.

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

Thanks, that breakdown settles the Max side, and it reconciles with the Ultra in a way that matters for what to do next.

The two dies are bound by different things. On your Max the large projections run at about 385 of 460 GB/s, 84% of the chip: memory-bound. On the Ultra the same kernel reaches about 700 of 1,200, 58%, and removing the matrix multiplies halves its time: tensor-unit bound (the nibble decomposition issues 32 accumulates a kilobyte of weights, and one row uses an eighth of each). That is why the FP32 family on qwen3_5-fp32-decode is +27% at one stream on the Ultra and why I would not expect much from it on the Max, where there is only 16% of bandwidth left to take. It stays parked; the message above still stands if you are curious, but your numbers already answer the question it was for.

Your 2.4 ms with every dispatch left out is the host memcpy. Cache.commit copied every DeltaNet layer's recurrent state from the scratch snapshot into the stream's cache after the command buffer completed, 151 MB a stream on the 27B, and eight times that at eight streams. #528 copies it on the GPU inside the step's encoder (not a second command buffer, for exactly the reason you found: the buffers are untracked). On the Ultra that was 2.3 ms of a 27.5 ms step; on the Max it should be most of your 3.4 ms of wall over GPU. bench_openai on that branch against your receipt is the measurement.

The small projections are the bit-exact lever you have left on the Max, and your table says where. Two fusions keep the bytes: the attention k and v (1,024 outputs each, 32 threadgroups apiece on a 40-core die) as one 2,048-output projection, which splits() and tiles() already give the same 16 chunks and 32 columns, so the sum order is unchanged; and a and b as one 96-output projection, which as you say needs its 32 chunks kept (a splits() rule of 32 up to 128 outputs touches no other shape). The consumers' strides change, nothing in the arithmetic. That is 64 fewer dispatches a step and the 13 GB/s and 126 GB/s rows mostly gone, worth perhaps 1-1.5 ms of your 41. Not opened yet; it is small enough to do if the maintainer wants it.

The command-buffer split warning is a good one to have on the record.

ashhart pushed a commit that referenced this pull request Oct 9, 2026
…tep as 128, not 0,128

The startup line split the prefill step into thousands and a zero-padded
remainder, which assumed a step of 1,000 or more. Nemotron and GLM meet
that; the Qwen3.5 family's 128-token step printed as "0,128". The status
line's comma grouping in live.zig becomes a public `commas` for integers
of any size, and the startup line uses it. Seen in the receipt on #520.
@jkuepker

jkuepker commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to my profile above: the 27B's prefill is held back by its projections, and two commits on top of this PR's head (094cbaa) roughly triple it on an M5 Max. Branch: jkuepker/TensorFold@094cbaa...jkuepker:TensorFold:qwen35-nax-prefill

Why prefill was slow. A GPU profile of one 1,024-row prompt forward (tf-qwen35-prof, 27B 4-bit): 3,992 ms, of which the 4-bit projections are 3,737 ms (94%). Time scales linearly with rows (128 rows: 484 ms), because Encoder.projection sends prompt rows through the family's row decoder, which reads each weight once per row. That works out to about 14 TFLOPS. The DeltaNet chain is 91 ms (2%) and attention 78 ms. Widening the prompt chunk alone (128 → 512 → 1024) changed prefill by under 5%.

The change.

  1. fa3fb35b routes projections of more than batch_rows rows (prompt chunks only) to MLX's affine_qmm_t_nax from the prompt-chunk library Nemotron already compiles. Only the unsplit form is used. The library compiles while the weights load; if it fails or nax.h's layout check fails, every projection keeps the row decoder. Decode and draft windows can't reach it: backend.zig:118 caps a window batch at batch_rows (32) rows.
  2. 2dae6084 uses 512-row prompt chunks when the NAX kernels are present and the window is ≤ 32K (attention's partials grow with rows × context), otherwise 128, and logs a warning when the prompt kernels are unavailable.

Speed (localeval, drafts off, ~/models/qwen38-27b 4-bit, M5 Max; prompt tok/s at ~1k / 4k / 16.7k):

Build Prefill Decode
094cbaa 240 / 239 / 206 22.0 / 21.9 / 20.9
+ fa3fb35 (128-row chunks) 638 / 549 / 395 22.2 / 21.3 / 19.0
+ 2dae608 (512-row chunks) 698 / 615 / 416 20.7 / 20.2 / 19.0
2dae608, interleaved re-run vs 128 660–709 / 647–649 20.9–21.1 (same as 128)

The decode dip in the third row was run order: run alternately, 128 and 512 both decode at 20.9–21.1. For reference, Python 0.6.0 on the same checkpoint prefills 739 / 846 / 826, so 16K is still about half.

Correctness.

  • A 5,031-token greedy prompt gives the same 64-token reply (sha 8cffa918cbdc) on 094cbaa and on both commits, at 32K (512-row chunks) and 64K (128-row chunks).
  • Prompt rows in wide chunks now use MLX's accumulation order, as Nemotron's prompt path already does. tf-qwen35-prompt (added) fills a 2,048-token prompt in 512-row vs 32-row chunks: last-row logits within 0.0625 (one bf16 step at |logit| 10.5), same argmax, 130,283 of 248,320 bit-equal; greedy continuations agree for 33 of 64 tokens.
  • HumanEval (164, temperature 0, drafts on): 158/164 vs 159/164 on 094cbaa. The two new failures (93, 127) are finished wrong answers; 83 now passes. Median TTFT 0.77 → 0.34 s.

Not addressed: decode on code with drafts on is 47 tok/s here against Python's 333 with DFlash2, and I haven't looked at the drafter yet.

@jkuepker

jkuepker commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Update to the prefill comment above: a third commit on the same branch moves prompt-chunk attention onto the tensor units, and 16K prefill goes from 401 to about 620 tok/s. Branch: jkuepker/TensorFold@094cbaa...jkuepker:TensorFold:qwen35-nax-prefill

Why. With the projections on NAX, a 512-row prompt chunk at 16K context took 1,695 ms on the GPU profile, of which per-row attention was 1,056 ms (62%).

The change (69bd50ba).

  • Prompt segments wider than batch_rows run causal attention through tf_q35_attn_nax (prefill/q35_attn.metal). It is Flash Next's tf_attn256_nax at Qwen's layouts: head size 256, 32-key cache blocks, fp32 online softmax, output written for qwen35_attention_gate.
  • Decode and draft windows keep the per-row partials and merge, so their bits don't change.
  • The kernel compiles with the prompt kernels while the weights load. A failed compile logs a warning and keeps the per-row attention.
  • The per-row partial buffers are sized for batch_rows rows when the prompt attention is present (at 32K with 512-row chunks: 3.2 GB → 0.2 GB). 512-row chunks therefore no longer stop at 32K windows.

Speed (localeval, drafts off, 27B 4-bit, M5 Max; prompt tok/s at ~1k / 4k / 16.7k; the second and third rows were run alternately in one session, the 094cbaa row is from the earlier comment):

Build Prefill Decode
094cbaa 240 / 239 / 206 22.0 / 21.9 / 20.9
+ fa3fb35 + 2dae608 (NAX qmm, 512-row chunks) 622 / 594 / 401 19.8 / 19.7 / 18.7
+ 69bd50b (NAX attention) 645 / 676–705 / 619–627 19.5–21.4 / 19.6–20.0 / 18.4–19.0
Python 0.6.0, same checkpoint 739 / 846 / 826

1024-row chunks were 1–2% faster than 512 and are not taken. Decode is unchanged within run-to-run noise.

Correctness.

  • tf-qwen35-prompt, 512-row vs 32-row fills: at 2,000 tokens the last-row logits differ by at most 0.12 (|logit| up to 10.6); at 8,192 tokens by at most 0.08. Argmax is the same in both, and greedy continuations agree for 64 of 64 tokens.
  • The 5,031-token greedy probe gives the same 64-token reply as 094cbaa at 32K and 128K windows.
  • HumanEval (164, temperature 0, drafts on): 159/164, the same as 094cbaa (the NAX qmm commits alone gave 158). Median TTFT 0.31 s (094cbaa: 0.77 s).

Next: drafting. Code decode is still about 45 tok/s here against Python's 333 with DFlash2. A read of the lane core suggests three engine gaps before any drafter port:

  1. enter_match (8) gates suffix copies, and qwen3_5 doesn't override it.
  2. facts() gives the planner no window_costs, and drafts stays at 1.
  3. Cache.commit copies about 151 MB of DeltaNet state on the CPU every forward.

I'm looking at (3) first.

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

@jkuepker, before you start on (3): it is already done. #528 (BobClawblaw:qwen3_5-gpu-commit, two commits on this PR's head) replaces the host memcpy in Cache.commit with a qwen35_copy dispatch inside the step's serial encoder, same bytes (tf-qwen35-exact 49/49, concurrent equals solo). On the Ultra it was +7% at one stream and +25% at eight; your 2.4 ms no-dispatch wall is the time it removes on the Max.

I tried merging it onto qwen35-nax-prefill here: two conflicts, both adjacent insertions where both sides belong (the tf-qwen35-prompt and tf-qwen35-bench entries in build.zig, and your nax next to commitStates in forward.zig). Nothing overlaps in substance, so stacking the prefill work on #528 should be a few minutes.

On (1) and (2), a note from the code as it stands: drafts and window_costs feed the depth rule for head drafts, which the Qwen backend refuses today (QwenCheckpointHasNoDraftHead), and copy proposals take their width from the qualified exact width, not from those fields. enter_match is an engine constant no family overrides. So (2) becomes real once a drafter is ported, not before, and the porting is the gap. The prefill branch is a big result either way; that is ashhart's call to take.

@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @BobClawblaw, and thanks to @jkuepker for the M5 Max receipt and the profiling in this thread. Turning the family's comptime geometry into a checked table, with the 2B's logits byte-identical and 49 of 49 cache checks on the 27B, is solid work.

1.0.3 shipped Qwen3.8-27B on its own engine (34c4424, https://github.com/ashhart/TensorFold/releases/tag/v1.0.3), with DFlash2 drafts and prompt reuse, qualified on an M5 Max and an M3 Ultra. A qwen3_5 checkpoint with the 27B's geometry opens that engine (zig/src/native/metal.zig), so this PR would add a second route for the same checkpoint through the 2B's row decoder. We'd rather keep one path per model, so we're closing it.

Two things from this thread carry over to the 27B engine, with your names on them: concurrent streams (1.0.3 serves the 27B one request at a time, and your runs show eight streams equal to their solo runs) and the small-projection fusions you two worked out. If you'd like to take either to the 27B family, a PR against main is very welcome. Reopen this if we've misread it.

@ashhart ashhart closed this Oct 10, 2026
@BobClawblaw
BobClawblaw deleted the qwen3_5-27b branch October 15, 2026 15:21
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…tep as 128, not 0,128

The startup line split the prefill step into thousands and a zero-padded
remainder, which assumed a step of 1,000 or more. Nemotron and GLM meet
that; the Qwen3.5 family's 128-token step printed as "0,128". The status
line's comma grouping in live.zig becomes a public `commas` for integers
of any size, and the startup line uses it. Seen in the receipt on ashhart#520.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants