Repository navigation
Description
Question
On main the two constants that fold a norm's gain into the following weights are literals that are right only for width 5,120 and head dimension 128 (weight_sums/weight_sums.py lines 148 to 151; prover/weights_commitment/fold_weights.cuh lines 175 to 186; prover/weights_commitment/fold_source.cuh line 136 refuses any other shape). Qwen3.8-27B has width 5,120 but head dimension 256, so the query constant does not apply to it. Can both constants be computed from the rule scales/README.md already states (line 542: the conversion folds sqrt(d) / 64 into every matrix that reads a norm's output and 1 / sqrt(dh) into the query; lines 594 to 600: t the largest integer with 4^t <= d, c = sqrt(d / 4^t)) for any width and head size, with byte-identical output at 5,120 / 128? Since Qwen's width is also 5,120, only the query constant should change.
Why this is on the shortest path
Committing Qwen weights (M3 in docs/qwen-port.md) goes through weight_sums and the weight reader; with the literals, a Qwen commit is either refused by the shape gate or, if the gate is lifted, folds the query weights with the wrong constant. A public fork made the same change for TinyLlama (width 2,048, head 64) and reports unchanged values at 5,120 / 128 and new values at 2,048 / 64 (marcellobardus/FlashProve-TinyLlama1.1B, commit c0eb59e, "fold constants by the general rule for any width (T4.1)", test weight_sums/tests/fold_constants_test.py; from public source, not verified by us). We need our own derivation and test for dh = 256; this is not a copy of their code.
One milestone (about 2.5 hours)
- PREREG first, alone: the rule (t the largest integer with 4^t <= d, c = sqrt(d) / 2^t, c_0 = RN32(c), c_q = RN32(c / sqrt(dh))) quoted from
scales/README.mdlines 542 and 594 to 600 on main, a check of whethersqrt(d) / 64there is only the t = 6 case ofc, the expected words at (5,120, 128) equal to the current literals, and the pass rule. - A
fold_constants(width, head)inweight_sums/weight_sums.pyand the C++ twin, the CUDA reader taking d and dh, the shape gate relaxed only to "positive whole shape that matches the policy". - Tests: the current literals reproduced exactly at 5,120 / 128; byte-identical
weight_sumsoutput againstweight_sums/tests/oracle.pyfor every seed the suite already uses; the values at 5,120 / 256 recorded with an independent float64 / mpmath computation.
Out of scope
Partial rotary, the dh = 256 no-wrap barrier and every other Qwen admission gate (they stay closed), any GPU build or run, any weights.
What a negative result looks like
The rule in scales/README.md does not reproduce the current literals, or the suite rows change at 5,120 / 128: stop and report the difference.
Cost
CPU only, minutes, under 2 GB.
Activity
research(#214): PREREG fold constants by the rule (first commit, alone)
research(#214): PREREG amendment A1 (before registered runs)
research(#214): fold_constants(width, head) in weight_sums.py and wei…
research(#214): registered runs (run_tests base/head, base-vs-head su…
research(#214): RESULTS (P1-P4 PASS), results.yaml row, regenerated R…
wakesync commentedon Nov 29, 2026
Draft PR #234 (#234), CPU part of this issue. Head
472b409ad0f20fc3d995cf0d2d47efa681c918e4.fold_constants(5120, 128)= (0x3F8F1BBD, 0x3DCA62C2) in bothweight_sums.pyandbin/weight_sums.sqrt(d) / 64inscales/README.mdis the t = 6 case of c = sqrt(d) / 2^t.run_tests.shpasses every step (26 at base, 27 at head).weight_sumsalso stay at 5,120 / 128, so no admission gate is opened. No Qwen commit, no weights.research(#214): PREREG amendment A2 (review of 111b104: a citation sa…
research(#214): cite the docs for what they state; name the general r…
research(#214): RESULTS open item 3, the gguf_source.cuh gate is at l…