From 9b8e61d13e71e4ef81627dc95e8b6983307ada4f Mon Sep 17 00:00:00 2001 From: t Date: Tue, 10 Nov 2026 13:25:01 -0400 Subject: [PATCH] npu-pack info: report the section offsets it computes, so a comparison does not have to re-derive them (refs #1934) `npu-pack info` computed every section offset and printed none of them: `attn_tiles`, `o_off`, `o_k`, `knorm_off`, `qnorm_off`, `mlp_off`. Anyone comparing a container against a pack -- the folded-q/k-gains question (#1889), a diff against the HF source, a hand decode -- had to derive them from `hidden`/`head_dim`/tile arithmetic, and a derived offset reads plausible data from the wrong place. That is not hypothetical: deriving them cost **three** wrong measurements in one night -- a "bias slot" sample, the "640 B of per-head QK norms" gap that #1928 was built on, and a `k_proj` decode that came out at `corr +0.001` against the source model's own `k_proj` over 4.2 M values (a correct decode cannot be uncorrelated at that size; the offset was 576 B off). ``` $ 1bit npu-pack info "sections": {"attn_tiles": 96, "knorm_off": 13795456, "mlp_off": 22995712, "o_k": 4096, "o_off": 13796032, "qnorm_off": 13795776} ``` Those values are self-consistent with the pack's own sizes (`o_off + 64*143,616 + 8,256 == mlp_off`) and they put the attention payload at 7,680, not at the 8,256 I had been assuming -- which is exactly the 576 B that made a decode of the wrong bytes look like a decode of the right ones. `info` reports the measurement, not the plan (engine#734's lesson); an offset nothing prints is the thing that gets re-derived wrong. No behaviour change: the fields were always computed, this only prints them. Verified: `npu_pack_import_test tests/golden` -> `all npu-pack checks passed`; `info` on the reference pack prints the six values above; `tools/copyright.py --check` rc 0. Refs #1934, #1889, #1928. --- npu/pack_import.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/npu/pack_import.cpp b/npu/pack_import.cpp index 29b1decb6..a5b7d9f89 100644 --- a/npu/pack_import.cpp +++ b/npu/pack_import.cpp @@ -2499,6 +2499,17 @@ std::string Plan::manifest() const { j["mlp_section"] = {{"gate_up_units_measured", mlp_gu_units}, {"down_groups_measured", mlp_down_groups}, {"note", mlp_note}}; + // engine#1934: the section offsets, in bytes, measured from the fconst's start. They were computed all along and + // never printed, so anyone comparing a container against the pack (the folded-q/k-gains question, an HF diff, a + // hand decode) had to derive them -- and a derived offset reads plausible data from the wrong place, which cost + // three wrong measurements in one night. `info` reports the measurement, not the plan (engine#734's lesson), and a + // byte offset nothing prints is exactly the thing that gets re-derived wrong. + j["sections"] = {{"attn_tiles", attn_tiles}, + {"o_off", o_off}, + {"o_k", o_k}, + {"knorm_off", knorm_off}, + {"qnorm_off", qnorm_off}, + {"mlp_off", mlp_off}}; j["incomplete"] = refused(); const TextArtifacts text = scan_text_artifacts(dir); j["text_artifacts"] = {{"present", text.present},