mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 16:29:04 +00:00
converter: Q4S_ROT=1 writes the dense matrices that the prepared-activation GEMMs read (GDN qkv / z / out, attention q / k / v / o, indexer, shared expert, and the router, the shared gate and alpha / beta rotated as plain floats) as W H128 on K, the file's integer codes and group scales as Q8_0 blocks (the scale rounded to fp16; qwen4_strata_reader.decode_sk_parts), with the same head / row / 128-block permutations as before, and the GGUF key qwen4exp.dense_rot = 1. engine: with the key, q4m_act_rot FWHT-128 rotates every prepared activation those GEMMs read in place (XA_ after the attention read, XY_, XQ_, XF_; the shared expert's input by q4m_swiglu_rot, swiglu_prep and the rotation in one dispatch); the experts' own FWHT is skipped (plane 0 of XF_ already is FWHT(x)); the prompt chain de-rotates the fp16 weights per chunk (q4m_unrot_f16 after dq_f16). The Loop adapter refuses such a file (it reads the raw activations). The hyper-connection matrices, the PLE projections, the embedding and the head stay as they were (BF16 / Q8_0 un-rotated). Weights, rel RMS error against the file's exact un-rotated values (layer 0 qkv, a q_proj, a shared gate: the same on all three): the old BF16 route 1.6e-3 (fp16 in the chain), this route's chain path 3.4e-4 (fp16, FWHT, fp16), decode path 1.8e-4 (the fp16 scale only). Ultra on M5 Max: probe decode 79.2 -> 93.2 tok/s (Q8_0 classes of the un-rotated route 95.8); prefill p20 1.17-1.24 s as BF16. Golden KL: prompts through decode windows (fp32 path) 0.013724 (+2.6 %) against BF16's 0.013581 (+1.5 %), the 34 shorter probes 0.013468 against 0.013356; prompts through the prompt chain 0.014701 (+9.9 %) against 0.013819 (+3.3 %): the chain moves the golden by +-0.0007 with any change of numerics (BF16 with hi/lo activations 0.014225, the Q8_0 classes 0.014461) and p32 / p33 (6144 tokens) alone differ from the window path by KL 0.011-0.017 in every variant, so the chain's golden cannot tell these routes apart. Not the default: Q4S_ROT stays 0 until the coordinator decides.