Repository navigation
qwen35 rules: one table for the computed-part refusals, a column per backend (#2460 item 4) - #2563
Conversation
|
Thanks, @jschmied. I checked the table against main entry by entry, and each backend's column matches what main read: which keys, whether a missing key refuses, and 0/1 on HIP only. No config is admitted or refused differently. The host test that runs main's four rules beside the new entry points is the right proof. Two things:
Please also refresh the body's CI line. |
|
Thanks, @ashhart. The CHANGELOG line is in ac1efde, a plain commit on 6695ccb: your wording, under Unreleased. The body's CI line now names the run on 6695ccb, where all seven jobs passed; the new head adds only that line. Agreed on the refusal words: one word per part, and with several wrong keys the first in table order. |
|
Thanks @jschmied. The line and the CI refresh are what we asked for. This is on the landing queue now. |
…backend CUDA, Metal's 27B and 2B readers and HIP each checked hidden_act, the attention gate and bias and the recurrent state dtype with their own rules and words. core/qwen35_rules.zig holds one row per key with its refusal word and each backend's column (skip, optional, required), wired like qwen35_layers. Columns are main's rules: every backend admits what it admitted; only the words of refused configs change to the row's. Refs ashhart#2460 (item 4), ashhart#2118.
ac1efde to
a0504a0
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @jschmied! This is in TensorFold 1.2.6, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.6
|
What this changes
The first config block of #2460 item 4, for the case #2118 names: Qwen 3.5/3.8, read by four config entry points. Each
checks the parts the kernels compute (activation, attention gate, attention bias, recurrent state dtype) with its own
rules and its own words. On main:
cuda_geometry.zig:274-276)UnsupportedQwenConfigqwen27/config.zig:292-295)UnsupportedAttentionGate; the restUnsupportedActivation(also a wrong state dtype)qwen3_5/config.zig:104-107)BadQwenConfigabsent,UnsupportedQwenConfigwrongconfig_checks.zig:55-64)UnsupportedActivation,UnsupportedAttentionGate,UnsupportedStateTypeAfter:
core/qwen35_rules.zigholds one row per key: the value the kernels compute, its refusal word (HIP's three,which already named the part), and a column per backend:
skip,optionalorrequired. Each entry point callsrules.check(tower, .<backend>)where its lines were. The columns are main's rules, so every backend admits exactlywhat it admitted on main; only the word of an already-refused config changes, to the row's. The module is std-only and
wired into every module the same way as
qwen35_layers(#1863):build/qwen35_layers.zignow wires both.What a refusal now says, for the same config, on every backend that checks the row:
hidden_actnot silu, or absent where requiredUnsupportedQwenConfigUnsupportedActivationUnsupportedQwenConfig/BadQwenConfigUnsupportedActivationoutput_gate_typenot swishUnsupportedActivationUnsupportedAttentionGateattn_output_gatenot true,attention_biasnot falseUnsupportedQwenConfigUnsupportedAttentionGate; bias not checkedUnsupportedQwenConfig/BadQwenConfigUnsupportedAttentionGatelinear_attn_state_dtype/mamba_ssm_dtypenot float32UnsupportedActivation/ not checkedUnsupportedQwenConfig/BadQwenConfigUnsupportedStateTypeA config with several wrong keys now reports the first in table order, which is HIP's order.
Kept as on main, for you to decide (each would change what a backend admits)
Missing checks. Metal 27B never reads
attention_bias: a config withtrueloads and drops the bias, which lookslike a bug. CUDA never reads
output_gate_typeor a state dtype, and Metal 27B never readsmamba_ssm_dtype. Each isa
skipin the table, so a fix is one cell.Absent keys. CUDA and Metal 2B refuse a tower without hidden_act, the gate or the bias; HIP and Metal 27B pass it.
0 and 1 for a flag. Only HIP takes them.
Not in this PR (CONFIG survey, other divergences of the same model):
tie_word_embeddingsloads with a tied head; CUDA and transformers load it untied #2561; the fix is one rowhere, in the next PR.
core.rope_yarn. Metal 27B, Metal 2B and HIP refuse it with three different words(
UnsupportedRopeScaling,UnsupportedQwenRotary,InvalidRotary). With A config that asks for YaRN loads and runs plain RoPE (Flash Next Metal/HIP, LFM2, Kolibri-1) #2562 (scaled RoPE run as plain RoPE inthree other families), this is the case for a shared RoPE-config reader.
num_experts_per_tok: up to 31 on CUDA, 15 on Metal 27B, up to the expert count on HIP (its launcherstops at 31). This is the "top_k 31 vs 15" of RFC: one host package per family, backends bind the kernels (Drama 3's codec first) #2118: it is the router's top_k, not the sampler's.
Each would be one more table in the same module, if you agree on the rule.
Checks on this head
qwen27/config_test.zignow expects the row's words,UnsupportedAttentionGateforoutput_gate_typeand a newUnsupportedStateTypecase forlinear_attn_state_dtype)python3 tools/zig/lean_check.py, on the base and on this head: 116 on the base (5874551), 116 on thishead, identical problem lists, 0 new.
zig build test test-golden -Dnvcc=/usr/local/cuda/bin/nvcc(aarch64 host): green.zig build test-cuda-host: green (includes the newtest-qwen35-rules-host).zig build check-native-cuda-host compile-cuda-tests -Dtarget=x86_64-linux-gnu: green.zig build check-native-hip-host -Dhip=true: green.zig build test-kernel-contract test-server-security test-pull-security fuzz-cortheon: green.python3 tools/pr_check.py: 0 errors (1 advisory warning: the CHANGELOG line needs--pr).zig fmt --check build.zig zigandgit diff --check: clean. Merge-tree against the 21 open PRs that touch these files: no new conflict.New tests:
core/qwen35_rules.zig(zig build test-qwen35-rules): every backend admits the wanted values. Each row it readsrefuses a wrong value with the row's word. Each row it requires refuses an absent key, and each row it skips passes.
0 and 1 count as flags on HIP only.
zig/qwen35_rules_host.zig(zig build test-qwen35-rules-host, intest-cuda-host): main's four rules, portedverbatim as in Host fp32→bf16 copies: 59 panic on negative NaNs in Debug; Qwen3.5's layer pattern is read four ways across backends #1863's host test, against the new entry points. On every real Qwen 3.5 config in the repo (the ones
qwen35_layers_host.zigscans), the table admits exactly what main's rule admitted: 44 (config, backend) pairs. Onthe 2B and 27B bases, through each backend's actual entry point (
cuda_geometry.parse,qwen27/config.parse, the2B
parse, HIP'sConfig.parse), every row is tried with ten values (each wanted value, another string, true,false, 0, 1, null, absent). That is 360 cases, and each admits as main did, and each refusal is the row's word.
attention_bias): the host row test fails. Every refusal given one word: both core tests and the host row test fail. 0/1 taken as flags beyond HIP: the core flag test and the host row test fail. CUDA treating required rows as optional: all four tests fail.zig build test765/765 steps on this head (all 11,752 tests ran ond636d74, where the one stale
qwen27test above failed; the head only changes that test),test-qwen2746/46,test-golden5/5, lean 0 new.xpu/qwen27_config.zig) readsnone of these keys and is untouched.
Receipt
Main against branch, Metal (M3 Pro), served greedy, 64 tokens,
--parallel 1 --context 4096 --prompt-cache-gib 0,token sha256 (first 12 hex digits), drafts off and on:
5515f210e483×25515f210e483×2ca45330e98d2×2ca45330e98d2×2390865d39853×2390865d39853×2c4939a9c2377×2c4939a9c2377×2f1329786ce3c×2f1329786ce3c×297669da82ab5×297669da82ab5×2A 27B config with
rope_scalingYaRN ×4, and one withtie_word_embeddings: true, are refused on main and on thebranch with the same text.
CUDA: no served A/B. On an admitted config,
checkreturns void and sets nothing. Above, admission isshown equal to main's for every row, every value and every backend, so tokens can't change. The real checkpoints
here (Qwen3.8-27B NVFP4 Unsloth head, Qwen3.8-27B MLX 4-bit, Qwen3.6-35B-A3B MLX 4-bit MTP) declare
hidden_actsilu,
attn_output_gatetrue,attention_biasfalse andmamba_ssm_dtypefloat32. The 27B also declaresoutput_gate_typeswish. All three pass every column.Boxes it reaches: Qwen 3.5/3.8 config admission on CUDA, Metal (27B and 2B) and HIP; the build's shared-module walk.
New switch? None.
Environment: TensorFold 6695ccb on main 5874551; Zig 0.17.0; aarch64 host (GB10) for host tests, x86_64 cross
compile for
compile-cuda-tests.Paths and platforms the change reaches, which I ran and which I could not: host tests for all four readers (ran);
CUDA build and x86 compile (ran); Metal build, tests and served hashes (ran, on the Mac); HIP:
check-native-hip-hostcompiles; no HIP device run.Exactness: admission equality above; no kernel or served path changes.
Decode speed before and after: n/a (load-time check, six map lookups).
Prompt speed before and after: n/a.
Licence of any new weights or drafter: n/a.