Skip to content

fconst19_measure: tolerate, report and skip a 1.9 tail that is LARGER than its 1.8 twin's (refs #1740) - #1755

Merged
bong-water-water-bong merged 1 commit into
mainfrom
fix/1740-tail-surplus
Nov 9, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
fix/1740-tail-surplus

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The tool refused any pair whose tails differ in length, and on the 1.9 line that happens whenever the pack carries more in its tail than its 1.8 twin — which is the hidden 1536 geometry (engine#1740):

Qwen-2.5_1.5B_Instruct        1.9 tail 262,147,136 B   vs   1.8 tail 134,314,560 B
Qwen2.5-Coder-1.5B-Instruct   1.9 tail same shape, same ~15 % content residual

and the 1.8 figure is exactly attn_payload_off(1536) 3,136 + 2374 × attn_tile_bytes(1536) 56,576 — i.e. the twin's tail is the head, while the 1.9 tail is the head plus more.

The rule the tool measures describes the layer blocks, so a larger tail is not a layout disagreement. The surplus is now reported and excluded from the comparison instead of aborting the run before anything is measured. A 1.9 tail shorter than its twin's is still refused — that direction means the files genuinely disagree.

No change for the pairs that already verify

On the 0.5B pair the surplus is 0 and the row is unchanged, measured with this patch in place:

{896, 14, 24, 1856, 8, 1, 69632},

What it buys

A diagnosable failure instead of a bare refusal. With it, both hidden 1536 pairs report a ~131.5 MB residual (15.2 %) that is invariant across every candidate — 130× above the mildest wrong rule the tool probes — which is the evidence #1740 now rests on: those 1.9 builds are not header-only repacks of their twins, so no rule can be derived from the pair and the rotation cannot be inferred here.

Verified: 0.5B pair still produces its row; both 1536 pairs now report residuals instead of aborting; tools/copyright.py --check rc 0 with the tree staged; git add <paths> only; host-side, no device.

… than its 1.8 twin's (refs #1740)

The tool refused any pair whose tails differ in length -- and on the 1.9 line that happens whenever the pack carries more in its tail than
its 1.8 twin does, which is the `hidden 1536` geometry (engine#1740):

    Qwen-2.5_1.5B_Instruct      1.9 tail 262,147,136 B  vs 1.8 tail 134,314,560 B
    Qwen2.5-Coder-1.5B-Instruct 1.9 tail same shape, same ~15 % content residual

and the 1.8 figure there is exactly `attn_payload_off(1536) 3,136 + 2374 x attn_tile_bytes(1536) 56,576`, i.e. the twin's tail **is** the
head while the 1.9 tail is the head plus more. The rule the tool measures describes the LAYER BLOCKS, so a larger tail is not a layout
disagreement: the surplus is now reported and left out of the comparison instead of aborting the run before anything is measured. A 1.9 tail
*shorter* than its twin's is still refused -- that direction means the files genuinely disagree.

No change for the pairs that already verify: on the 0.5B pair the surplus is 0 and the row is unchanged

    {896, 14, 24, 1856, 8, 1, 69632},

measured with this patch in place. What the patch buys is a diagnosable failure instead of a bare refusal: with it, both `hidden 1536` pairs
report a ~131.5 MB residual (15.2 %) that is invariant across every candidate, which is the evidence #1740 now rests on -- those 1.9 builds
are not header-only repacks of their twins.

Verified: the 0.5B pair still produces its row (above); the two 1536 pairs now report residuals instead of aborting; `tools/copyright.py
--check` rc 0 with the tree staged; `git add <paths>` only; host-side, no device.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY at 5b9fd32088111e175d600de3a395bf6069908157 — I ran it against the pair it names, and it clears the blocker I reported, but it does not make that pair measure. Both halves of that are worth having in the body.

It clears the right blocker. On (1.8 build already on this box, 1.9 pack's Token .fconst fetched), the old tool died with

the two files' tails differ in length

— which is what I hit on #1503 and why I could not produce a row for (1536, 12, 28). With this diff the run gets past it and enters the candidate loop, which is exactly the failure mode being fixed: the tail is not what the rule describes, so a surplus in it is not a layout disagreement.

But the pair still does not measure, and the numbers say why:

# candidate prefix=3136 n=7 tile=226304 rot=1: 131609117 bytes differ, trying next
…
no candidate reproduced the 1.8 file

The surplus this PR quotes for that pair is 262,147,136 − 134,314,560 = 127,832,576 B, and the residual is 131,609,117 B — 3,776,541 B more than the surplus, i.e. 13.2 % of the 1.9 file. So excluding the tail surplus does not rescue this pair: its layer blocks differ too. That matters for the write-up, because "the 1.5B's 1.9 tail is larger, and a surplus is not a layout disagreement" is true and is the right fix, but a reader will reasonably read it as "the 1.5B pair now measures", and it does not. Saying so — one sentence, with the 131.6 MB figure — closes the loop #1503 left open, where the missing (1536,12,28) row was blocked on exactly this tool refusing the pair.

Two smaller notes:

  1. surplus uses the 1.9's own header offset for the 1.8 side (len(a) - layers * (_s9 - hdr_len)), which is correct only because stride8 == stride9 - hdr_len by construction — worth one clause, since that is the invariant a future edit could break without the numbers visibly changing.
  2. This does not touch the tolerance issue I raised on npu-pack: the 1.9 Token fconst rule for hidden 3072 / 32 heads / 32 layers (2 packs run OOB) #1658 (26145 / 2,036,067,648 = 1.284e-5 against TOL = 1e-5, so the Phi-3.5 row is still refused by the tool that measured it). Different hunk, different cause; flagging so the two are tracked together and neither is assumed to have fixed the other.

Scope of my check, stated: fetched the 1.9 pack's .fconst (949.6 MiB) plus configs, ran this PR's version of the tool against the 1.8 build on disk, and compared the residual against the surplus the PR itself quotes. No row was added from this run, deliberately: the numbers say this pair cannot produce one.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Corrected repost — the previous comment was mangled by an unquoted heredoc (a backticked pack name ran as a command), so one paragraph lost its text. The substance is unchanged; this is the readable version.

VERDICT: READY at 5b9fd32088111e175d600de3a395bf6069908157 — I ran it against the pair it names, and it clears the blocker I reported, but it does not make that pair measure. Both halves belong in the body.

It clears the right blocker. On Qwen-2.5-1.5B (1.8 build already on this box, 1.9 Token .fconst fetched), the old tool died with:

the two files' tails differ in length

— which is what I hit on #1503 and why I could not produce a row for (1536, 12, 28). With this diff the run gets past it and enters the candidate loop, which is exactly the failure mode being fixed: the tail is not what the rule describes, so a surplus in it is not a layout disagreement.

But the pair still does not measure, and the numbers say why:

# candidate prefix=3136 n=7 tile=226304 rot=1: 131609117 bytes differ, trying next
…
no candidate reproduced the 1.8 file

The surplus this PR quotes for that pair is 262,147,136 − 134,314,560 = 127,832,576 B, and the residual is 131,609,117 B — 3,776,541 B more than the surplus, 13.2 % of the 1.9 file. So excluding the tail surplus does not rescue this pair: its layer blocks differ too. That matters for the write-up, because "the 1.5B's 1.9 tail is larger, and a surplus is not a layout disagreement" is true and is the right fix, but a reader will reasonably read it as "the 1.5B pair now measures", and it does not. One sentence with the 131.6 MB figure closes the loop #1503 left open, where the missing (1536,12,28) row was blocked on exactly this tool refusing the pair.

Two smaller notes:

  1. surplus uses the 1.9's own header offset for the 1.8 side (len(a) - layers * (_s9 - hdr_len)), correct only because stride8 == stride9 - hdr_len by construction — worth a clause, since that invariant is what a future edit could break without the numbers visibly changing.
  2. This does not touch the tolerance issue I raised on npu-pack: the 1.9 Token fconst rule for hidden 3072 / 32 heads / 32 layers (2 packs run OOB) #1658 (26145 / 2,036,067,648 = 1.284e-5 against TOL = 1e-5, so the Phi-3.5 row is still refused by the tool that measured it). Different hunk, different cause — flagging so the two are tracked together and neither is assumed to have fixed the other.

Scope of my check, stated: fetched the 1.9 pack's .fconst (949.6 MiB) plus configs, ran this PR's version of the tool against the 1.8 build on disk, and compared the residual against the surplus the PR itself quotes. No row was added from this run, deliberately: the numbers say this pair cannot produce one.

@bong-water-water-bong
bong-water-water-bong merged commit 7ea4fb1 into main Nov 9, 2026
8 of 9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/1740-tail-surplus branch November 9, 2026 23:28
bong-water-water-bong pushed a commit that referenced this pull request Nov 9, 2026
…ule, main's version wins

`tools/fconst19_measure.py` conflicted twice, and in both cases main's (#1755) side is strictly better than this branch's, so it is
taken:

* **the tail rule**: this branch tolerated a differing tail in either direction; main's refuses when the 1.9 tail is SHORTER than its
  twin's (`the files disagree`) and reports when it carries more. A shorter tail is a real disagreement, so main's direction-aware
  rule is the correct one.
* **the comparison**: main trims the 1.9 file to its twin's tail (`b_cmp`, with `surplus` reported in the note) and compares the whole
  trimmed file, which is simpler than this branch's `cmp_len` over the layer blocks. This branch's `cmp_len` spelling is removed
  accordingly. The residual output is unchanged for a byte-exact pair:
  `// verified: byte for byte (291653952 B)`.

Verified on the merged tree: `tools/fconst19_measure.py` reproduces the 0.5B row byte-for-byte, its own three cases pass, the importer
suite passes, and `npu-pack import` on the Coder pack still lands its 339 tensors.
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.

1 participant