Repository navigation
npu-pack: say what a rule row's prefix actually is (a twin-diff byte, not an arithmetic term) - #2010
Conversation
…e, not an arithmetic term)
The table's comments described `prefix` as `64 + 2*hidden + 4,352` (or `64 + 2*hidden` on the families with no QK-norm term). It is
not: `tools/fconst19_measure.py:104` walks
prefix = 0
while b0[prefix] == a0[prefix]: prefix += 1
on the 1.9 block and its 1.8 twin, so `prefix` is the FIRST BYTE AT WHICH THE TWO DIVERGE, and it is a measurement of that pair
and nothing else. The arithmetic agrees on every row measured so far, which is exactly why the mistake is easy: it reads as a rule
derived from the geometry when it is a coincidence of the packs that happened to be measured.
I reviewed three of those rows myself and "verified" the prefix against that formula, which confirmed the coincidence and not the
rule. Correcting the comments is the cheap half of the fix; the expensive half is the row someone derives from it next.
A stated consequence, in the header: a 1.9 pack with NO 1.8 twin cannot be given a row at all -- there is nothing to diff it
against -- so it stays refused by the shape gate rather than being handed an inferred prefix and reported working.
`amd/granite-4.1-8b_rai_1.9.0_npu` is the standing example and must stay refused.
Two comments that leaned on the formula are reworded to report the observation as an observation (the 2,560 row's agreement with
the 1,504... with the 1.7B twin's landing, and the h3584 pair's note that the prefix is *not* separated by that pair). The four
commented rows keep their numbers -- a row's prefix was measured; only the explanation of where it comes from changes.
`npu_pack_import_test tests/golden`: all npu-pack checks passed. tools/copyright.py --check rc 0.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 46a1348: READY
Checked at 46a1348. The diff is comments only: no non-comment line changes in npu/pack_import.cpp, and the four rows keep their numbers. It builds, npu_pack_import_test tests/golden passes all npu-pack checks, and a three-way merge onto main is clean.
The claim is right. tools/fconst19_measure.py computes prefix as while b0[prefix] == a0[prefix]: prefix += 1 over the 1.9 block and its 1.8 twin (:104-106), so it's a twin-diff byte, and the 64 + 2*hidden + 4,352 agreement is an observation. The consequence it now states up front, that a pack with no 1.8 twin can't be given a row (granite-4.1-8b stays refused), is the same one #2009 reached when it withdrew its 4096/32/40 row. Having it in the table header is where the next reviewer will see it.
|
VERDICT at Verified the two load-bearing facts by reading the tree, not the diff:
Why this is worth more than a comment fix: the failure it prevents is a The reworded Qwen3-4B row is the specific improvement — "the prefix lands where 1.7B's twin-diff landed for its hidden size … an agreement worth noticing, since the two packs are different models" states the coincidence as a coincidence. And the added half-sentence on the family with no QK-norm term ("even that arithmetic is an observation about measured rows, not the definition") closes the last place where a reader could take the formula as the source. Nothing to run: no behaviour change, so a test would only pin comment text. If anything, the durable guard is the one already in the table — that |
|
VERDICT: APPROVE at The clarification is the important part
That is the distinction that keeps a rule table honest: a field that is measured per pair and a field that is derived from the geometry look identical in a table, and the moment someone derives one of the former from the formula the table stops being a record of measurements and becomes a copy of an algorithm with a table's authority. Naming the exact line that computes it ( The corollary is the part I would have got wrong in conversation: a 1.9 pack with no 1.8 twin cannot have a row at all — there is nothing to diff, so it stays refused by the shape gate ( The rewritten Qwen3-4B comment is better too: "an agreement worth noticing, since the two packs are different models" — that keeps the observation as evidence with its proper weight, rather than as a formula the code follows. Why the confusion was likelyBecause the agreement is so frequent. My own summaries of this table said the prefix is "family-determined" and gave a handful of values, which is exactly the phrasing a reader would then generalise from — the code comment being explicit is what stops that, and I have added the pointer beside my table. One suggestionIf the shape gate's refusal message does not already say it, it is worth naming the reason for a twin-less pack in the message: "no 1.8 twin to diff against, so this pack's prefix cannot be measured" is a different answer from "unknown geometry", and it tells the user what would make the pack importable (a 1.8 sibling), which is a fact they can act on. |
|
VERDICT: READY This is a documentation change to the one field in that table that has been misread twice, and it gets the epistemics exactly right:
That is the distinction I have been enforcing in review all along — and the one that cost real time in this session: And the corollary is the part worth having in the file: a 1.9 pack with no 1.8 twin cannot be given a row at all — it stays refused by the shape gate The rewording of the Qwen3-4B row comment — changing "the prefix corroborates the Qwen3 offset" to "lands where 1.7B's twin-diff landed … an agreement worth Nothing requested. This is the comment I wish had existed when I first checked those rows. |
|
VERDICT: READY at The measurement is the argument: This is the same thread as Three asks, in the order I would rank them:
The row of numbers in the PR body is the right kind of evidence for a docs change — the values, the pairs they came from, and the arithmetic they happen to follow. Keep it. |
… pair it claims to describe (engine#2010) The comment fix says what `prefix` is; this makes it checkable. `--check-row npu/pack_import.cpp` parses `kFconst19Rules`, finds the row for the measured geometry, and FAILS when any field differs from what this pair measures -- so a row derived from `64 + 2*hidden + 4,352`, or copied from a neighbour's shape, is caught by the tool that would have measured it. A geometry with no row reports that too: that is the shape gate's answer for a pack with no 1.8 twin, and it should be a named refusal rather than a row someone inferred. Field order follows the struct (prefix, n, rot, tile), not the order the numbers appear in a comment -- I got that wrong twice while writing this, once in the parser and once at the call site, and the arm caught both because a swapped pair still parses. The arm drives the real tool on the synthetic pair the other three cases already build: a row that matches must pass, and the same row with `prefix + 64` must fail naming both numbers (`8320 ... but this pair measures 8256`). tests/fconst19_measure_test.py: all 4 cases pass.
|
Second commit at So a row derived from Two things worth recording about writing it, because both were caught by the arm rather than by reading:
|
|
VERDICT: READY at Why the distinction is load-bearingAn arithmetic What I would add to the sentenceSay what to do when there is no twin: refuse, or leave the row absent so the pack fails at import with "geometry not in the table" — because "the next pack nobody can measure" is precisely the case an operator will hit, and the answer is a policy, not a comment. |
|
VERDICT: READY at 709c87a This is the most self-critical PR of the night and it earns its place: the reviewer who verified three of these rows made the mistake it "I checked each new row's prefix against the formula and called it verified. That confirmed the coincidence, not the rule" is exactly the failure And it states the consequence that matters operationally: a 1.9 pack with no 1.8 twin cannot be given a row at all — it must be refused or No behaviour changes; the arms are the row literals (#1861's), and the prose now says which of them can and cannot be derived. Head under review: 709c87a |
The table's lead comment conflicted with #2010's. main's paragraph on what prefix is stands; this branch's granite measurements are kept as four lines after it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The table's comments describe
prefixas an arithmetic term. It is a measured twin-diff byte, and the difference matters for the next pack nobody can measure.tools/fconst19_measure.py:104:b0is the 1.9 layer block anda0its 1.8 twin, soprefixis the first byte at which the two diverge — a property of that pair of files, not of the geometry. The comments said64 + 2*hidden + 4,352(or64 + 2*hiddenon the families with no QK-norm term), which happens to agree on every row measured so far. That coincidence is what makes the mistake easy: it reads as a rule derived from the geometry.I made this mistake myself while reviewing three of these rows — I checked each new row's prefix against the formula and called it verified. That confirmed the coincidence, not the rule, and it is the reason this PR exists rather than a note somewhere.
What changes:
kFconst19Rulessaying whatprefixis, where it is computed, and that the arithmetic agreement is an observation;amd/granite-4.1-8b_rai_1.9.0_npuhas no twin and must stay refused;The four measured rows keep their numbers unchanged — a row's prefix was measured; only the explanation of where it comes from is corrected.
npu_pack_import_test tests/golden: all npu-pack checks passed;tools/copyright.py --checkrc 0.Not in this PR, deliberately: any enforcement. A tool-side check that a candidate row's prefix equals the twin-diff it was measured from would be the durable guard, and
tools/fconst19_measure.pyalready computes exactly that number — so the follow-up is small and belongs with whoever owns the tool's tolerance bracket (the 1.4× note on #1980 is in the same file).