From dc0205ddad2127096b41cb3b89514702e872dc37 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 30 Oct 2026 13:31:09 -0500 Subject: [PATCH 1/4] om/flint: gguf.om GGUF v3 header importer with gguf-py b11804 referee (Refs #834) --- .crumb | 8 +- om/flint/README.md | 52 +- om/flint/check.sh | 126 +++ om/flint/gguf.om | 935 +++++++++++++++++++ om/flint/test/gguf-report.txt | 1314 +++++++++++++++++++++++++++ om/flint/test/gguf-synth-report.txt | 38 + om/flint/test/ggufgen.py | 157 ++++ om/flint/test/ggufref.py | 124 +++ 8 files changed, 2749 insertions(+), 5 deletions(-) create mode 100644 om/flint/gguf.om create mode 100644 om/flint/test/gguf-report.txt create mode 100644 om/flint/test/gguf-synth-report.txt create mode 100755 om/flint/test/ggufgen.py create mode 100755 om/flint/test/ggufref.py diff --git a/.crumb b/.crumb index 10572c53..84995eff 100644 --- a/.crumb +++ b/.crumb @@ -125,14 +125,14 @@ } ], "children_root": "sha256:05d34c0deec7c4a6cd3aa12640dca0c20bd8b2d4a4df809b234090822f422b4f", - "compiled_at": "2026-10-30T16:46:15Z", + "compiled_at": "2026-10-30T18:31:03Z", "compiler": "crumb-compile/1", - "digest": "sha256:f7bffab666b963252920028ec0aa62f7ed209ee39a7d4792fcb689a1fde8f90c", + "digest": "sha256:94b6783f638710770517c352b5995e8a7f0e2df4fc7b5565bc39b985d273633a", "evidence_files": 3602, "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b", "files": 8111, - "generated_at_commit": "b748f0cd7694101709923c2d198ed8db4c40b553", - "source_tree": "sha256:f09454b9ef15573b58941295c81726f7f78d0c7b43464d0d3c73e08ade28a655" + "generated_at_commit": "fceadf514f8421e9119762f6723f872696dd12bd", + "source_tree": "sha256:a2564e3a8ac47b85b5be5a7c9ff16bc2e5eec221ba96ccfab43a18c46db98969" } }, "history": [], diff --git a/om/flint/README.md b/om/flint/README.md index 11687ac2..8971614e 100644 --- a/om/flint/README.md +++ b/om/flint/README.md @@ -208,7 +208,57 @@ layer, expert index permuted (255 - e), and window 514. - per-expert layout checks before fusing; - tokenizer and control-token identity, and a load report. -This unit has no GPU arm. A GGUF importer, if added, will be a separate optional unit. +This unit has no GPU arm. The GGUF header importer is the separate unit `gguf.om` below. + +## GGUF importer: `gguf.om` (Core #834) + +`flint-gguf report GGUF` admits the header of the serving artifact +`~/models/flint-nvfp4-gguf/flint-nvfp4.gguf` (22863084160 bytes, sha256 `97cc8009…6b8bde`) the +way ggml's reader at llama.cpp tag b11804 (commit c7fc5094) does: magic, version 3, every key and +value of all 13 value types (arrays included, nested arrays refused), empty or duplicate keys +refused, `general.alignment` a nonzero power-of-two u32 (default 32), at most 4 dims per tensor +with the element count at most INT64_MAX, a known ggml type whose block divides ne0, unique +names, and a data section where each tensor starts at the padded end of the one before it. +It reads the file from disk only, one bounded pread of at most 16 MiB of header. Stricter than +ggml: names and keys must be printable tokens (names at most 63 bytes, keys at most 255), +bytes past the last padded tensor are refused, and arrays hold at most 999999 elements. + +On success stdout is the report and stderr `flint-gguf ok tensors T kvs K bytes F`. The report +format is in the docstring of `test/ggufref.py`, the referee, which writes the same report with +the b11804 `gguf-py` (0.19.0; it checks the sha256 of `gguf_reader.py` and `constants.py`). +The referee's reports are frozen as `test/gguf-synth-report.txt` (the synthetic file from +`test/ggufgen.py`) and `test/gguf-report.txt` (the serving file); `check.sh` pins both and +requires `gguf.om`'s output to equal them byte for byte. The serving report shows 1264 +tensors: 485 NVFP4 (type 40, 22192275456 bytes), 48 BF16 (type 30: `token_embd` and the 47 +routers), 731 F32 (type 0: norms, sinks and the 485 NVFP4 `.scale` tensors). + +| code | reason | cause | +|---|---|---| +| 2 | usage | not `report GGUF` | +| 3 | io | open, stat, read or close failed | +| 4 | not-regular-file | directory, symlink (O_NOFOLLOW) or device | +| 60 | gguf-truncated | the header ends before a field it declares | +| 61 | gguf-magic | not `GGUF` | +| 62 | gguf-version | version other than 3 | +| 63 | gguf-kv | unknown value type, array of arrays, empty or non-printable key | +| 64 | gguf-kv-duplicate | a key appears twice | +| 65 | gguf-alignment | `general.alignment` not a u32, zero or not a power of two | +| 66 | tensor-shape | 0 or more than 4 dims, element count over INT64_MAX, ne0 not a multiple of the block | +| 67 | ggml-type | type id 43 or above, or a removed id (4, 5, 31..33, 36..38) | +| 68 | tensor-name | empty, longer than 63 bytes, non-printable or duplicate name | +| 69 | tensor-misaligned | offset not a multiple of the alignment | +| 70 | tensor-past-eof | tensor bytes end past the end of the file | +| 71 | tensor-tiling | offset not the padded end of the previous tensor, or bytes after the last | +| 72 | header-capacity | header over 16 MiB, more than 4096 tensors, 1024 keys or 999999 array elements | +| 73 | output-capacity | report over 4 MiB | + +Gate arm 6 of `check.sh`: the synthetic report equals the referee's; usage, absent file, +directory and symlink refusals; 20 refusal fixtures; 13 guard mutants (each `gg_die N` removed +must stop its fixture producing N) and an O_NOFOLLOW mutant. `FLINT_GGUF=file` compares the +serving report with the frozen one; `FLINT_GGUF_PY=cmd` reruns the referee on both files. +Each is NOT_RUN when unset. NOT_RUN for this unit: the name map and shape cross-check against +the safetensors inventory, the totals reconciliation, NVFP4 block dequantization against the +BF16 shards, and any serving or GPU evidence. ## Complete bounded host forward diff --git a/om/flint/check.sh b/om/flint/check.sh index 0c2b585a..528754a9 100755 --- a/om/flint/check.sh +++ b/om/flint/check.sh @@ -290,5 +290,131 @@ else echo "NOT_RUN chained forward (set FLINT_FORWARD=1)" fi +# 6. GGUF importer (Core #834): gguf.om admits the serving GGUF header the way ggml's reader at +# llama.cpp b11804 does and writes a report that must equal, byte for byte, the report +# test/ggufref.py writes with that tag's gguf-py. test/ggufgen.py builds a valid synthetic GGUF +# (every value type) and one fixture per refusal; each guard is removed in turn and its fixture +# must stop producing its code. Frozen referee reports: test/gguf-synth-report.txt (synthetic) +# and test/gguf-report.txt (the serving file, sha256 97cc8009...). Optional, NOT_RUN when unset: +# FLINT_GGUF=file the serving GGUF (read only), its report compared with the frozen one; +# FLINT_GGUF_PY=cmd an interpreter importing gguf-py b11804: the referee is rerun and its +# reports must equal the frozen ones. +GG_SYN_PIN=6a1f3670e45718338c82551237e0b1fc7a0c922a0c92ee52d4c0bb91342b6baa +GG_REP_PIN=cbd3becec35ff580cb16db5789bf5a73cd56b775109cb193ce8ad3ffd00b3851 +GG_SUM='flint-gguf ok tensors 4 kvs 27 bytes 2080' +GG_REAL_SUM='flint-gguf ok tensors 1264 kvs 43 bytes 22863084160' +ggen() { python3 "$here/test/ggufgen.py" "$b/g.gguf" "$1" < /dev/null; } +grun() { # binary [file]; sets rc, leaves g.out and g.err + timeout 120 "$1" report "${2:-$b/g.gguf}" > "$b/g.out" 2> "$b/g.err" < /dev/null + rc=$? +} +gmut() { # name want fixture; reads $b/gmut.om + build "$b/gmut" "$b/gmut.om" || { bad "gguf mutant $1: does not compile"; return; } + ggen "$3" || { bad "gguf mutant $1: fixture generator failed"; return; } + grun "$b/gmut" + if [ "$rc" = "$2" ]; then bad "gguf mutant $1: still exits $2 on $3, so the guard is not what refuses it"; else ok "gguf mutant $1: $3 now exits $rc, not $2"; fi +} +if [ "$(sha "$here/test/gguf-synth-report.txt")" != "$GG_SYN_PIN" ] || [ "$(sha "$here/test/gguf-report.txt")" != "$GG_REP_PIN" ]; then + bad "gguf: frozen referee reports do not match their pins" +elif ! build "$b/gg" "$here/gguf.om"; then + bad "gguf: gguf.om does not compile" +else + ggen base || bad "gguf: fixture generator failed" + grun "$b/gg" + if [ "$rc" = 0 ] && cmp -s "$b/g.out" "$here/test/gguf-synth-report.txt" && [ "$(cat "$b/g.err")" = "$GG_SUM" ]; then + ok "gguf base: report equals the gguf-py b11804 referee, summary exact" + else + bad "gguf base: rc $rc, $(head -c 200 "$b/g.err") $(cmp "$b/g.out" "$here/test/gguf-synth-report.txt" 2>&1 | head -c 200)" + fi + for args in "" "report" "report a b" "frob $b/g.gguf" "report $b/g.gguf x y z"; do + # shellcheck disable=SC2086 + "$b/gg" $args > "$b/u.out" 2> /dev/null < /dev/null + r=$? + if [ "$r" = 2 ] && [ ! -s "$b/u.out" ]; then ok "gguf usage ($args): 2"; else bad "gguf usage ($args): $r"; fi + done + grun "$b/gg" "$b/absent.gguf" + if [ "$rc" = 3 ] && [ ! -s "$b/g.out" ]; then ok "gguf absent file: 3"; else bad "gguf absent file: $rc"; fi + grun "$b/gg" "$b" + if [ "$rc" = 4 ] && [ ! -s "$b/g.out" ]; then ok "gguf directory: 4"; else bad "gguf directory: $rc"; fi + ln -s "$b/g.gguf" "$b/g.link" + grun "$b/gg" "$b/g.link" + if [ "$rc" = 4 ] && [ ! -s "$b/g.out" ]; then ok "gguf symlink: 4"; else bad "gguf symlink: $rc"; fi + GFIX='truncated 60 +magic 61 +version 62 +kv-type 63 +kv-nested 63 +kv-empty-key 63 +kv-dup 64 +align-pow2 65 +align-type 65 +ndims 66 +row-block 66 +ggml-type 67 +ggml-removed 67 +tensor-dup 68 +misaligned 69 +past-eof 70 +short-data 70 +gap 71 +trailing 71 +cap-tensors 72' + while read -r m want; do + ggen "$m" || { bad "gguf $m: fixture generator failed"; continue; } + grun "$b/gg" + if [ "$rc" = "$want" ] && [ ! -s "$b/g.out" ] && grep -q "^refused $want " "$b/g.err"; then + ok "gguf $m: $want" + else + bad "gguf $m: want $want, got $rc ($(head -c 120 "$b/g.err"))" + fi + done <<< "$GFIX" + gs=$(cat "$here/gguf.om") + while read -r code fx; do + t=${gs//"gg_die $code tg$code$nl"/"put gst 30 get gst 30$nl"} + [ "$t" != "$gs" ] || { bad "gguf mutant die-$code: no guard text found"; continue; } + printf '%s\n' "$t" > "$b/gmut.om" + gmut "die-$code" "$code" "$fx" + done <<'GGUF_GUARDS' +60 truncated +61 magic +62 version +63 kv-type +64 kv-dup +65 align-pow2 +66 ndims +67 ggml-type +68 tensor-dup +69 misaligned +70 past-eof +71 gap +72 cap-tensors +GGUF_GUARDS + t=${gs//"fopen gpth 0 n 557056 0"/"fopen gpth 0 n 524288 0"} + printf '%s\n' "$t" > "$b/gmut.om" + build "$b/gmut" "$b/gmut.om" && grun "$b/gmut" "$b/g.link" + if [ "$rc" != 4 ]; then ok "gguf mutant no-nofollow: symlink now exits $rc, not 4"; else bad "gguf mutant no-nofollow: symlink still refused"; fi + if [ -n "${FLINT_GGUF:-}" ]; then + grun "$b/gg" "$FLINT_GGUF" + if [ "$rc" = 0 ] && cmp -s "$b/g.out" "$here/test/gguf-report.txt" && [ "$(cat "$b/g.err")" = "$GG_REAL_SUM" ]; then + ok "FLINT_GGUF: report equals the frozen referee report (sha $GG_REP_PIN)" + else + bad "FLINT_GGUF: rc $rc, $(head -c 200 "$b/g.err") $(cmp "$b/g.out" "$here/test/gguf-report.txt" 2>&1 | head -c 200)" + fi + else + echo "NOT_RUN FLINT_GGUF (the serving GGUF ~/models/flint-nvfp4-gguf/flint-nvfp4.gguf, sha256 97cc8009...)" + fi + if [ -n "${FLINT_GGUF_PY:-}" ]; then + ggen base + $FLINT_GGUF_PY "$here/test/ggufref.py" report "$b/g.gguf" > "$b/gref.out" 2>&1 < /dev/null + if cmp -s "$b/gref.out" "$here/test/gguf-synth-report.txt"; then ok "gguf referee rerun: synthetic report reproduced"; else bad "gguf referee rerun (synthetic): $(head -c 200 "$b/gref.out")"; fi + if [ -n "${FLINT_GGUF:-}" ]; then + $FLINT_GGUF_PY "$here/test/ggufref.py" report "$FLINT_GGUF" > "$b/gref.out" 2>&1 < /dev/null + if cmp -s "$b/gref.out" "$here/test/gguf-report.txt"; then ok "gguf referee rerun: serving report reproduced"; else bad "gguf referee rerun (serving): $(head -c 200 "$b/gref.out")"; fi + fi + else + echo "NOT_RUN FLINT_GGUF_PY (interpreter with llama.cpp b11804 gguf-py; frozen reports used)" + fi +fi + n=$((pass + fail)) if [ "$fail" = 0 ]; then echo "OM-FLINT-MANIFEST PASS ($n)"; else echo "OM-FLINT-MANIFEST FAIL ($fail of $n)"; exit 1; fi diff --git a/om/flint/gguf.om b/om/flint/gguf.om new file mode 100644 index 00000000..65170652 --- /dev/null +++ b/om/flint/gguf.om @@ -0,0 +1,935 @@ +note flint-gguf: bounded reader for the Flint serving artifact (GGUF v3, Core #834). +note Usage: flint-gguf report GGUF. It admits the GGUF header the way ggml's own reader at +note llama.cpp b11804 does (magic, version 3, every key/value of every value type, tensor infos, +note general.alignment, a data section tiled in order with each tensor padded to the alignment) +note and refuses anything else. On success stdout is the report (format in om/flint/README.md, +note referee test/ggufref.py) and stderr carries one summary line. On refusal nothing is written +note to stdout, stderr carries "refused N reason" and the exit status is N. +note Compose: { printf 'om2\n'; cat om/vendor/json.om om/flint/gguf.om; } | omc +note The header is read with one bounded pread into gh; a header longer than gh is refused (72). + +const GMX ulong 999999 +const GHC ulong 16777216 +const GTM ulong 4096 +const GKM ulong 1024 +global ga uchar 16384 +global gas ulong 8 +global gal ulong 8 +global gpth uchar 4352 +global gh uchar 16777216 +global gst ulong 64 +global gstb uchar 128 +global geb uchar 512 +global gdg uchar 24 +global gob uchar 4194304 +global gtno ulong 4096 +global gtnl ulong 4096 +global gtnd ulong 4096 +global gtdm ulong 16384 +global gtty ulong 4096 +global gtof ulong 4096 +global gtnb ulong 4096 +global gtne ulong 4096 +global gkko ulong 1024 +global gkkl ulong 1024 +global gkty ulong 1024 +global gkvo ulong 1024 +global gbe ulong 64 +global gbb ulong 64 +global gtyc ulong 192 + +note gst slots: 0 header cursor, 1 header bytes loaded, 2 file size, 3 tensor count, 4 kv count, +note 5 stdout length, 6 alignment, 7 data section start, 8 version, 9 st_size from gg_open, +note 10 tensor bytes used, 11 tensor bytes padded, 14 stderr length, 30 guard-mutant scratch + +text tref "refused " +text tg2 "usage: flint-gguf report GGUF" +text tg3 "io" +text tg4 "not-regular-file" +text tg60 "gguf-truncated" +text tg61 "gguf-magic" +text tg62 "gguf-version" +text tg63 "gguf-kv" +text tg64 "gguf-kv-duplicate" +text tg65 "gguf-alignment" +text tg66 "tensor-shape" +text tg67 "ggml-type" +text tg68 "tensor-name" +text tg69 "tensor-misaligned" +text tg70 "tensor-past-eof" +text tg71 "tensor-tiling" +text tg72 "header-capacity" +text tg73 "output-capacity" +text tmagic "GGUF" +text trep "report" +text talign "general.alignment" +text tkft "general.file_type" +text tkqv "general.quantization_version" +text tkbos "tokenizer.ggml.bos_token_id" +text tkeos "tokenizer.ggml.eos_token_id" +text tn0 "u8" +text tn1 "i8" +text tn2 "u16" +text tn3 "i16" +text tn4 "u32" +text tn5 "i32" +text tn6 "f32" +text tn7 "bool" +text tn8 "string" +text tn9 "array" +text tn10 "u64" +text tn11 "i64" +text tn12 "f64" +text tgv "gguf version " +text ttn " tensors " +text tkn " kvs " +text tal " alignment " +text tdat " data " +text tbyt " bytes " +text tkv "kv " +text tbits "bits " +text tsum " sum " +text tvals " values" +text tten "tensor " +text ttyp "type " +text tels " elements " +text tused "data used " +text tpad " padded " +text tq1 "quant file_type " +text tq2 " quantization_version " +text tt1 "tokenizer bos " +text tt2 " eos " +text tnone "none" +text tok "flint-gguf ok tensors " + +note ======== output buffers ======== + +fn gg_eput c uchar to void +p = get gst 14 +if lt p 512 +put geb p c +put gst 14 add p 1 +end +end + +fn gg_etx t view uchar * to void +for i ulong len t +gg_eput get t i +end +end + +note gg_dec: decimal digits of v into gdg, least significant first; returns the digit count +fn gg_dec v ulong to ulong +n = ulong 0 +x = v +while true bound 25 +put gdg n add 48 uchar rem x 10 +n = add n 1 +x = div x 10 +if eq x 0 +break +end +end +ret n +end + +fn gg_eu v ulong to void +n = gg_dec v +for i ulong n +gg_eput get gdg sub sub n i 1 +end +end + +fn gg_eflush to void +o = ulong 0 +m = get gst 14 +while lt o m bound 1024 +w = write 2 geb o sub m o +if le w 0 +exit 3 +end +o = add o ulong w +end +put gst 14 0 +end + +fn gg_die c ulong t view uchar * to void +put gst 14 0 +gg_etx tref +gg_eu c +gg_eput 32 +gg_etx t +gg_eput 10 +gg_eflush +exit int c +end + +fn gg_ob c uchar to void +p = get gst 5 +if ge p len gob +gg_die 73 tg73 +end +put gob p c +put gst 5 add p 1 +end + +fn gg_otx t view uchar * to void +for i ulong len t +gg_ob get t i +end +end + +fn gg_ou v ulong to void +n = gg_dec v +for i ulong n +gg_ob get gdg sub sub n i 1 +end +end + +note gg_os: v is a two's complement 64-bit value +fn gg_os v ulong to void +if ge v 9223372036854775808 +gg_ob 45 +gg_ou neg v +else +gg_ou v +end +end + +note gg_oh: header bytes gh[p .. p + n) +fn gg_oh p ulong n ulong to void +for i ulong n +gg_ob get gh add p i +end +end + +fn gg_oflush to void +o = ulong 0 +m = get gst 5 +while lt o m bound 999999 +w = write 1 gob o sub m o +if le w 0 +gg_die 3 tg3 +end +o = add o ulong w +end +end + +note ======== file access ======== + +note gg_open: open gpth[0 .. n) with O_RDONLY | O_CLOEXEC | O_NOFOLLOW (arm64 557056), require a +note regular file (st_mode & S_IFMT 61440 == S_IFREG 32768), leave st_size in gst 9 +fn gg_open n ulong to long +fd = fopen gpth 0 n 557056 0 +if lt fd 0 +if eq fd -40 +gg_die 4 tg4 +end +gg_die 3 tg3 +end +r = fstat int fd gstb 0 128 +if ne r 0 +gg_die 3 tg3 +end +md = or ulong get gstb 16 shl ulong get gstb 17 8 +if ne and md 61440 32768 +gg_die 4 tg4 +end +v = ulong 0 +for i ulong 8 +v = or v shl ulong get gstb add 48 i mul 8 i +end +put gst 9 v +ret fd +end + +fn gg_argp a ulong to ulong +n = get gal a +if or eq n 0 gt n 4095 +gg_die 2 tg2 +end +o = get gas a +for i ulong n +put gpth i get ga add o i +end +ret n +end + +fn gg_isarg a ulong t view uchar * to bool +if ne get gal a len t +ret false +end +o = get gas a +for i ulong len t +if ne get ga add o i get t i +ret false +end +end +ret true +end + +fn gg_load fd long n ulong to void +o = ulong 0 +while lt o n bound 999999 +r = pread int fd gh o sub n o long o +if le r 0 +gg_die 3 tg3 +end +o = add o ulong r +end +end + +fn gg_close fd long to void +r = fclose int fd +if ne r 0 +gg_die 3 tg3 +end +end + +note ======== header cursor ======== + +note gg_need: claim k header bytes at the cursor; past the loaded bytes is a truncated file, or a +note header longer than gh when the file goes on +fn gg_need k ulong to ulong +p = get gst 0 +m = get gst 1 +if gt k sub m p +if lt m get gst 2 +gg_die 72 tg72 +end +gg_die 60 tg60 +end +put gst 0 add p k +ret p +end + +note gg_rd: little-endian unsigned value of k (at most 8) bytes at the cursor +fn gg_rd k ulong to ulong +p = gg_need k +v = ulong 0 +for i ulong k +v = or v shl ulong get gh add p i mul 8 i +end +ret v +end + +fn gg_heq a ulong b ulong n ulong to bool +for i ulong n +if ne get gh add a i get gh add b i +ret false +end +end +ret true +end + +fn gg_htx o ulong t view uchar * to bool +for i ulong len t +if ne get gh add o i get t i +ret false +end +end +ret true +end + +note gg_prt: gh[p .. p + n) is 1..mx bytes, each lo..126 (lo 33: one token on a report line) +fn gg_prt p ulong n ulong lo uchar mx ulong to bool +if or eq n 0 gt n mx +ret false +end +for i ulong n +c = get gh add p i +if or lt c lo gt c 126 +ret false +end +end +ret true +end + +note ======== value types ======== + +note gg_vsz: bytes of one scalar of GGUF value type t; 0 for string, array and unknown types +fn gg_vsz t ulong to ulong +if or or eq t 0 eq t 1 eq t 7 +ret ulong 1 +end +if or eq t 2 eq t 3 +ret ulong 2 +end +if and ge t 4 le t 6 +ret ulong 4 +end +if and ge t 10 le t 12 +ret ulong 8 +end +ret ulong 0 +end + +fn gg_sgn t ulong to bool +ret or or eq t 1 eq t 3 or eq t 5 eq t 11 +end + +note gg_sx: sign-extend an i8, i16 or i32 value to two's complement 64 bits +fn gg_sx t ulong v ulong to ulong +if and eq t 1 ge v 128 +ret sub v 256 +end +if and eq t 3 ge v 32768 +ret sub v 65536 +end +if and eq t 5 ge v 2147483648 +ret sub v 4294967296 +end +ret v +end + +note gg_one: step over one value of scalar or string type t +fn gg_one t ulong to void +if eq t 8 +l = gg_rd 8 +p = gg_need l +else +z = gg_vsz t +if eq z 0 +gg_die 63 tg63 +end +p = gg_need z +end +end + +note gg_val: step over the value of a key; an array of arrays is refused like ggml refuses it +fn gg_val t ulong to void +if eq t 9 +et = gg_rd 4 +n = gg_rd 8 +if or eq et 9 gt et 12 +gg_die 63 tg63 +end +if gt n GMX +gg_die 72 tg72 +end +for i ulong n +gg_one et +end +else +gg_one t +end +end + +fn gg_kv i ulong to void +kl = gg_rd 8 +ko = gg_need kl +if not gg_prt ko kl 33 255 +gg_die 63 tg63 +end +for j ulong i +if eq get gkkl j kl +if gg_heq get gkko j ko kl +gg_die 64 tg64 +end +end +end +t = gg_rd 4 +put gkko i ko +put gkkl i kl +put gkty i t +put gkvo i get gst 0 +gg_val t +end + +note gg_kfind: index + 1 of the key equal to t, 0 when absent +fn gg_kfind t view uchar * to ulong +for i ulong get gst 4 +if eq get gkkl i len t +if gg_htx get gkko i t +ret add i 1 +end +end +end +ret ulong 0 +end + +note gg_align: general.alignment, when present, is a nonzero power-of-two u32 (default 32) +fn gg_align to void +c = get gst 0 +put gst 6 32 +k = gg_kfind talign +if gt k 0 +i = sub k 1 +if ne get gkty i 4 +gg_die 65 tg65 +end +put gst 0 get gkvo i +a = gg_rd 4 +if or eq a 0 ne and a sub a 1 0 +gg_die 65 tg65 +end +put gst 6 a +end +put gst 0 c +end + +note ======== ggml types (block elements, block bytes) at llama.cpp b11804 ======== + +fn gg_ts t ulong e ulong z ulong to void +put gbe t e +put gbb t z +end + +note ids 4, 5, 31..33 and 36..38 are removed types; they keep block 0 and are refused +fn gg_tinit to void +gg_ts 0 1 4 +gg_ts 1 1 2 +gg_ts 2 32 18 +gg_ts 3 32 20 +gg_ts 6 32 22 +gg_ts 7 32 24 +gg_ts 8 32 34 +gg_ts 9 32 36 +gg_ts 10 256 84 +gg_ts 11 256 110 +gg_ts 12 256 144 +gg_ts 13 256 176 +gg_ts 14 256 210 +gg_ts 15 256 292 +gg_ts 16 256 66 +gg_ts 17 256 74 +gg_ts 18 256 98 +gg_ts 19 256 50 +gg_ts 20 32 18 +gg_ts 21 256 110 +gg_ts 22 256 82 +gg_ts 23 256 136 +gg_ts 24 1 1 +gg_ts 25 1 2 +gg_ts 26 1 4 +gg_ts 27 1 8 +gg_ts 28 1 8 +gg_ts 29 256 56 +gg_ts 30 1 2 +gg_ts 34 256 54 +gg_ts 35 256 66 +gg_ts 39 32 17 +gg_ts 40 64 36 +gg_ts 41 128 18 +gg_ts 42 64 18 +end + +note ======== tensor infos ======== + +fn gg_tname i ulong to void +nl = gg_rd 8 +if or eq nl 0 gt nl 63 +gg_die 68 tg68 +end +no = gg_need nl +if not gg_prt no nl 33 63 +gg_die 68 tg68 +end +for j ulong i +if eq get gtnl j nl +if gg_heq get gtno j no nl +gg_die 68 tg68 +end +end +end +put gtno i no +put gtnl i nl +end + +note gg_tdim: 1..4 dims, each and their product at most INT64_MAX; returns the element count +fn gg_tdim i ulong to ulong +nd = gg_rd 4 +if or eq nd 0 gt nd 4 +gg_die 66 tg66 +end +put gtnd i nd +e = ulong 1 +for j ulong nd +d = gg_rd 8 +if gt d 9223372036854775807 +gg_die 66 tg66 +end +if gt d 0 +if gt e div 9223372036854775807 d +gg_die 66 tg66 +end +end +e = mul e d +put gtdm add mul i 4 j d +end +ret e +end + +fn gg_tinf i ulong to void +gg_tname i +e = gg_tdim i +t = gg_rd 4 +if ge t 43 +gg_die 67 tg67 +end +be = get gbe t +if eq be 0 +gg_die 67 tg67 +end +if ne rem get gtdm mul i 4 be 0 +gg_die 66 tg66 +end +put gtty i t +put gtof i gg_rd 8 +put gtne i e +put gtnb i mul div e be get gbb t +end + +fn gg_pad n ulong to ulong +a = get gst 6 +ret mul div add n sub a 1 a a +end + +note gg_eof: tensor bytes [o, o + nb) of the data section lie inside the file +fn gg_eof o ulong nb ulong to void +s = get gst 2 +d = get gst 7 +if gt d s +gg_die 70 tg70 +end +r = sub s d +if gt o r +gg_die 70 tg70 +end +if gt nb sub r o +gg_die 70 tg70 +end +end + +note gg_tile: every offset aligned, inside the file, and equal to the padded end of the tensor +note before it (ggml's own layout); nothing after the last padded tensor +fn gg_tile to void +a = get gst 6 +x = ulong 0 +for i ulong get gst 3 +o = get gtof i +nb = get gtnb i +if ne rem o a 0 +gg_die 69 tg69 +end +gg_eof o nb +if ne o x +gg_die 71 tg71 +end +x = add o gg_pad nb +put gst 10 add get gst 10 nb +end +put gst 11 x +if gt get gst 2 add get gst 7 x +gg_die 71 tg71 +end +end + +fn gg_head to void +p = gg_need 4 +if not gg_htx p tmagic +gg_die 61 tg61 +end +v = gg_rd 4 +if ne v 3 +gg_die 62 tg62 +end +put gst 8 v +nt = gg_rd 8 +nk = gg_rd 8 +if or gt nt GTM gt nk GKM +gg_die 72 tg72 +end +put gst 3 nt +put gst 4 nk +for i ulong nk +gg_kv i +end +gg_align +for i ulong nt +gg_tinf i +end +put gst 7 gg_pad get gst 0 +gg_tile +end + +note ======== report ======== + +fn gg_otn t ulong to void +if eq t 0 +gg_otx tn0 +end +if eq t 1 +gg_otx tn1 +end +if eq t 2 +gg_otx tn2 +end +if eq t 3 +gg_otx tn3 +end +if eq t 4 +gg_otx tn4 +end +if eq t 5 +gg_otx tn5 +end +if eq t 6 +gg_otx tn6 +end +if eq t 7 +gg_otx tn7 +end +if eq t 8 +gg_otx tn8 +end +if eq t 9 +gg_otx tn9 +end +if eq t 10 +gg_otx tn10 +end +if eq t 11 +gg_otx tn11 +end +if eq t 12 +gg_otx tn12 +end +end + +fn gg_onum t ulong v ulong to void +if gg_sgn t +gg_os gg_sx t v +else +gg_ou v +end +end + +note gg_oval: a scalar or string value at the cursor (floats as their bits) +fn gg_oval t ulong to void +if eq t 8 +l = gg_rd 8 +p = gg_need l +gg_ou l +if gg_prt p l 32 64 +gg_ob 32 +gg_oh p l +end +else +if or eq t 6 eq t 12 +gg_otx tbits +end +gg_onum t gg_rd gg_vsz t +end +end + +fn gg_sbyt n ulong to ulong +s = ulong 0 +for i ulong n +l = gg_rd 8 +p = gg_need l +s = add s l +end +ret s +end + +fn gg_oarr to void +et = gg_rd 4 +n = gg_rd 8 +gg_otn et +gg_ob 32 +gg_ou n +if eq et 8 +gg_otx tbyt +gg_ou gg_sbyt n +else +p = get gst 0 +z = gg_vsz et +s = ulong 0 +for i ulong n +s = add s gg_sx et gg_rd z +end +gg_otx tsum +if gg_sgn et +gg_os s +else +gg_ou s +end +if and gt n 0 le n 8 +gg_otx tvals +put gst 0 p +for i ulong n +gg_ob 32 +gg_onum et gg_rd z +end +end +end +end + +fn gg_okv i ulong to void +gg_otx tkv +gg_oh get gkko i get gkkl i +gg_ob 32 +put gst 0 get gkvo i +t = get gkty i +gg_otn t +gg_ob 32 +if eq t 9 +gg_oarr +else +gg_oval t +end +gg_ob 10 +end + +fn gg_oten i ulong to void +gg_otx tten +gg_oh get gtno i get gtnl i +gg_ob 32 +gg_ou get gtty i +gg_ob 32 +for j ulong get gtnd i +if gt j 0 +gg_ob 120 +end +gg_ou get gtdm add mul i 4 j +end +gg_ob 32 +gg_ou get gtof i +gg_ob 32 +gg_ou get gtnb i +gg_ob 10 +end + +fn gg_otyp to void +for i ulong get gst 3 +t = mul get gtty i 3 +put gtyc t add get gtyc t 1 +put gtyc add t 1 add get gtyc add t 1 get gtne i +put gtyc add t 2 add get gtyc add t 2 get gtnb i +end +for t ulong 43 +k = mul t 3 +if gt get gtyc k 0 +gg_otx ttyp +gg_ou t +gg_otx ttn +gg_ou get gtyc k +gg_otx tels +gg_ou get gtyc add k 1 +gg_otx tbyt +gg_ou get gtyc add k 2 +gg_ob 10 +end +end +end + +note gg_okey: the scalar value of key t, or none when absent or a string or array +fn gg_okey t view uchar * to void +k = gg_kfind t +if eq k 0 +gg_otx tnone +else +i = sub k 1 +y = get gkty i +if or eq y 8 eq y 9 +gg_otx tnone +else +put gst 0 get gkvo i +gg_onum y gg_rd gg_vsz y +end +end +end + +fn gg_rep to void +gg_otx tgv +gg_ou get gst 8 +gg_otx ttn +gg_ou get gst 3 +gg_otx tkn +gg_ou get gst 4 +gg_otx tal +gg_ou get gst 6 +gg_otx tdat +gg_ou get gst 7 +gg_otx tbyt +gg_ou get gst 2 +gg_ob 10 +for i ulong get gst 4 +gg_okv i +end +for i ulong get gst 3 +gg_oten i +end +gg_otyp +gg_otx tused +gg_ou get gst 10 +gg_otx tpad +gg_ou get gst 11 +gg_ob 10 +gg_otx tq1 +gg_okey tkft +gg_otx tq2 +gg_okey tkqv +gg_ob 10 +gg_otx tt1 +gg_okey tkbos +gg_otx tt2 +gg_okey tkeos +gg_ob 10 +end + +fn gg_sum to void +put gst 14 0 +gg_etx tok +gg_eu get gst 3 +gg_etx tkn +gg_eu get gst 4 +gg_etx tbyt +gg_eu get gst 2 +gg_eput 10 +gg_eflush +end + +note gg_read: open argument a, load at most GHC header bytes into gh, admit the header +fn gg_read a ulong to void +n = gg_argp a +fd = gg_open n +s = get gst 9 +put gst 2 s +h = s +if gt h GHC +h = GHC +end +gg_load fd h +put gst 1 h +gg_close fd +gg_head +end + +fn main to int +c = argcnt +if or lt c 3 gt c 5 +gg_die 2 tg2 +end +o = ulong 0 +for i ulong ulong c +r = argread i ga o sub len ga o +if lt r 0 +gg_die 2 tg2 +end +put gas i o +put gal i ulong r +o = add o ulong r +end +gg_tinit +if and eq c 3 gg_isarg 1 trep +gg_read 2 +gg_rep +gg_oflush +gg_sum +ret 0 +end +gg_die 2 tg2 +ret 1 +end diff --git a/om/flint/test/gguf-report.txt b/om/flint/test/gguf-report.txt new file mode 100644 index 00000000..1d52974e --- /dev/null +++ b/om/flint/test/gguf-report.txt @@ -0,0 +1,1314 @@ +gguf version 3 tensors 1264 kvs 43 alignment 32 data 5512960 bytes 22863084160 +kv general.architecture string 5 flint +kv general.type string 5 model +kv general.name string 19 Flint NVFP4 Preview +kv flint.block_count u32 49 +kv flint.context_length u32 262144 +kv flint.embedding_length u32 2048 +kv flint.feed_forward_length u32 6144 +kv flint.attention.head_count u32 32 +kv flint.attention.head_count_kv u32 4 +kv flint.rope.freq_base f32 bits 1176256512 +kv flint.attention.layer_norm_rms_epsilon f32 bits 897988541 +kv flint.expert_count u32 256 +kv flint.expert_used_count u32 6 +kv flint.expert_gating_func u32 2 +kv flint.attention.key_length u32 128 +kv flint.attention.value_length u32 128 +kv general.file_type u32 39 +kv flint.expert_feed_forward_length u32 512 +kv flint.expert_shared_feed_forward_length u32 1024 +kv flint.leading_dense_block_count u32 2 +kv flint.expert_shared_count u32 2 +kv flint.expert_weights_norm bool 1 +kv flint.expert_weights_scale f32 bits 1065353216 +kv flint.attention.sliding_window u32 513 +kv flint.attention.sliding_window_pattern array bool 49 sum 35 +kv flint.attention.rope_pattern array bool 49 sum 35 +kv general.quantization_version u32 2 +kv general.tensor_extra.name array string 485 bytes 11779 +kv general.tensor_extra.prec_a4 array bool 485 sum 0 +kv tokenizer.ggml.model string 4 gpt2 +kv tokenizer.ggml.pre string 5 flint +kv tokenizer.ggml.tokens array string 150144 bytes 1135052 +kv tokenizer.ggml.token_type array i32 150144 sum 150444 +kv tokenizer.ggml.merges array string 149744 bytes 1281786 +kv tokenizer.ggml.bos_token_id u32 150000 +kv tokenizer.ggml.eos_token_id u32 150001 +kv tokenizer.ggml.add_bos_token bool 0 +kv tokenizer.ggml.add_sep_token bool 0 +kv tokenizer.ggml.eog_token_ids array i32 4 sum 600027 values 150001 150003 150005 150018 +kv tokenizer.chat_template string 2328 +kv general.sampling.temp f32 bits 1065353216 +kv general.sampling.top_p f32 bits 1064514355 +kv general.sampling.top_k i32 20 +tensor output.weight 40 2048x150144 0 172965888 +tensor output.scale 0 1 172965888 4 +tensor blk.0.ffn_down.weight 40 6144x2048 172965920 7077888 +tensor blk.0.ffn_down.scale 0 1 180043808 4 +tensor blk.0.ffn_gate.weight 40 2048x6144 180043840 7077888 +tensor blk.0.ffn_gate.scale 0 1 187121728 4 +tensor blk.0.ffn_up.weight 40 2048x6144 187121760 7077888 +tensor blk.0.ffn_up.scale 0 1 194199648 4 +tensor blk.0.attn_k.weight 40 2048x512 194199680 589824 +tensor blk.0.attn_k.scale 0 1 194789504 4 +tensor blk.0.attn_output.weight 40 4096x2048 194789536 4718592 +tensor blk.0.attn_output.scale 0 1 199508128 4 +tensor blk.0.attn_q.weight 40 2048x4096 199508160 4718592 +tensor blk.0.attn_q.scale 0 1 204226752 4 +tensor blk.0.attn_v.weight 40 2048x512 204226784 589824 +tensor blk.0.attn_v.scale 0 1 204816608 4 +tensor blk.1.ffn_down.weight 40 6144x2048 204816640 7077888 +tensor blk.1.ffn_down.scale 0 1 211894528 4 +tensor blk.1.ffn_gate.weight 40 2048x6144 211894560 7077888 +tensor blk.1.ffn_gate.scale 0 1 218972448 4 +tensor blk.1.ffn_up.weight 40 2048x6144 218972480 7077888 +tensor blk.1.ffn_up.scale 0 1 226050368 4 +tensor blk.1.attn_k.weight 40 2048x512 226050400 589824 +tensor blk.1.attn_k.scale 0 1 226640224 4 +tensor blk.1.attn_output.weight 40 4096x2048 226640256 4718592 +tensor blk.1.attn_output.scale 0 1 231358848 4 +tensor blk.1.attn_q.weight 40 2048x4096 231358880 4718592 +tensor blk.1.attn_q.scale 0 1 236077472 4 +tensor blk.1.attn_v.weight 40 2048x512 236077504 589824 +tensor blk.1.attn_v.scale 0 1 236667328 4 +tensor blk.2.ffn_down_shexp.weight 40 1024x2048 236667360 1179648 +tensor blk.2.ffn_down_shexp.scale 0 1 237847008 4 +tensor blk.2.ffn_gate_shexp.weight 40 2048x1024 237847040 1179648 +tensor blk.2.ffn_gate_shexp.scale 0 1 239026688 4 +tensor blk.2.ffn_up_shexp.weight 40 2048x1024 239026720 1179648 +tensor blk.2.ffn_up_shexp.scale 0 1 240206368 4 +tensor blk.2.attn_k.weight 40 2048x512 240206400 589824 +tensor blk.2.attn_k.scale 0 1 240796224 4 +tensor blk.2.attn_output.weight 40 4096x2048 240796256 4718592 +tensor blk.2.attn_output.scale 0 1 245514848 4 +tensor blk.2.attn_q.weight 40 2048x4096 245514880 4718592 +tensor blk.2.attn_q.scale 0 1 250233472 4 +tensor blk.2.attn_v.weight 40 2048x512 250233504 589824 +tensor blk.2.attn_v.scale 0 1 250823328 4 +tensor blk.2.ffn_down_exps.weight 40 512x2048x256 250823360 150994944 +tensor blk.2.ffn_down_exps.scale 0 256 401818304 1024 +tensor blk.2.ffn_gate_exps.weight 40 2048x512x256 401819328 150994944 +tensor blk.2.ffn_gate_exps.scale 0 256 552814272 1024 +tensor blk.2.ffn_up_exps.weight 40 2048x512x256 552815296 150994944 +tensor blk.2.ffn_up_exps.scale 0 256 703810240 1024 +tensor blk.3.ffn_down_shexp.weight 40 1024x2048 703811264 1179648 +tensor blk.3.ffn_down_shexp.scale 0 1 704990912 4 +tensor blk.3.ffn_gate_shexp.weight 40 2048x1024 704990944 1179648 +tensor blk.3.ffn_gate_shexp.scale 0 1 706170592 4 +tensor blk.3.ffn_up_shexp.weight 40 2048x1024 706170624 1179648 +tensor blk.3.ffn_up_shexp.scale 0 1 707350272 4 +tensor blk.3.attn_k.weight 40 2048x512 707350304 589824 +tensor blk.3.attn_k.scale 0 1 707940128 4 +tensor blk.3.attn_output.weight 40 4096x2048 707940160 4718592 +tensor blk.3.attn_output.scale 0 1 712658752 4 +tensor blk.3.attn_q.weight 40 2048x4096 712658784 4718592 +tensor blk.3.attn_q.scale 0 1 717377376 4 +tensor blk.3.attn_v.weight 40 2048x512 717377408 589824 +tensor blk.3.attn_v.scale 0 1 717967232 4 +tensor blk.3.ffn_down_exps.weight 40 512x2048x256 717967264 150994944 +tensor blk.3.ffn_down_exps.scale 0 256 868962208 1024 +tensor blk.3.ffn_gate_exps.weight 40 2048x512x256 868963232 150994944 +tensor blk.3.ffn_gate_exps.scale 0 256 1019958176 1024 +tensor blk.3.ffn_up_exps.weight 40 2048x512x256 1019959200 150994944 +tensor blk.3.ffn_up_exps.scale 0 256 1170954144 1024 +tensor blk.4.ffn_down_shexp.weight 40 1024x2048 1170955168 1179648 +tensor blk.4.ffn_down_shexp.scale 0 1 1172134816 4 +tensor blk.4.ffn_gate_shexp.weight 40 2048x1024 1172134848 1179648 +tensor blk.4.ffn_gate_shexp.scale 0 1 1173314496 4 +tensor blk.4.ffn_up_shexp.weight 40 2048x1024 1173314528 1179648 +tensor blk.4.ffn_up_shexp.scale 0 1 1174494176 4 +tensor blk.4.attn_k.weight 40 2048x512 1174494208 589824 +tensor blk.4.attn_k.scale 0 1 1175084032 4 +tensor blk.4.attn_output.weight 40 4096x2048 1175084064 4718592 +tensor blk.4.attn_output.scale 0 1 1179802656 4 +tensor blk.4.attn_q.weight 40 2048x4096 1179802688 4718592 +tensor blk.4.attn_q.scale 0 1 1184521280 4 +tensor blk.4.attn_v.weight 40 2048x512 1184521312 589824 +tensor blk.4.attn_v.scale 0 1 1185111136 4 +tensor blk.4.ffn_down_exps.weight 40 512x2048x256 1185111168 150994944 +tensor blk.4.ffn_down_exps.scale 0 256 1336106112 1024 +tensor blk.4.ffn_gate_exps.weight 40 2048x512x256 1336107136 150994944 +tensor blk.4.ffn_gate_exps.scale 0 256 1487102080 1024 +tensor blk.4.ffn_up_exps.weight 40 2048x512x256 1487103104 150994944 +tensor blk.4.ffn_up_exps.scale 0 256 1638098048 1024 +tensor blk.5.ffn_down_shexp.weight 40 1024x2048 1638099072 1179648 +tensor blk.5.ffn_down_shexp.scale 0 1 1639278720 4 +tensor blk.5.ffn_gate_shexp.weight 40 2048x1024 1639278752 1179648 +tensor blk.5.ffn_gate_shexp.scale 0 1 1640458400 4 +tensor blk.5.ffn_up_shexp.weight 40 2048x1024 1640458432 1179648 +tensor blk.5.ffn_up_shexp.scale 0 1 1641638080 4 +tensor blk.5.attn_k.weight 40 2048x512 1641638112 589824 +tensor blk.5.attn_k.scale 0 1 1642227936 4 +tensor blk.5.attn_output.weight 40 4096x2048 1642227968 4718592 +tensor blk.5.attn_output.scale 0 1 1646946560 4 +tensor blk.5.attn_q.weight 40 2048x4096 1646946592 4718592 +tensor blk.5.attn_q.scale 0 1 1651665184 4 +tensor blk.5.attn_v.weight 40 2048x512 1651665216 589824 +tensor blk.5.attn_v.scale 0 1 1652255040 4 +tensor blk.5.ffn_down_exps.weight 40 512x2048x256 1652255072 150994944 +tensor blk.5.ffn_down_exps.scale 0 256 1803250016 1024 +tensor blk.5.ffn_gate_exps.weight 40 2048x512x256 1803251040 150994944 +tensor blk.5.ffn_gate_exps.scale 0 256 1954245984 1024 +tensor blk.5.ffn_up_exps.weight 40 2048x512x256 1954247008 150994944 +tensor blk.5.ffn_up_exps.scale 0 256 2105241952 1024 +tensor blk.6.ffn_down_shexp.weight 40 1024x2048 2105242976 1179648 +tensor blk.6.ffn_down_shexp.scale 0 1 2106422624 4 +tensor blk.6.ffn_gate_shexp.weight 40 2048x1024 2106422656 1179648 +tensor blk.6.ffn_gate_shexp.scale 0 1 2107602304 4 +tensor blk.6.ffn_up_shexp.weight 40 2048x1024 2107602336 1179648 +tensor blk.6.ffn_up_shexp.scale 0 1 2108781984 4 +tensor blk.6.attn_k.weight 40 2048x512 2108782016 589824 +tensor blk.6.attn_k.scale 0 1 2109371840 4 +tensor blk.6.attn_output.weight 40 4096x2048 2109371872 4718592 +tensor blk.6.attn_output.scale 0 1 2114090464 4 +tensor blk.6.attn_q.weight 40 2048x4096 2114090496 4718592 +tensor blk.6.attn_q.scale 0 1 2118809088 4 +tensor blk.6.attn_v.weight 40 2048x512 2118809120 589824 +tensor blk.6.attn_v.scale 0 1 2119398944 4 +tensor blk.6.ffn_down_exps.weight 40 512x2048x256 2119398976 150994944 +tensor blk.6.ffn_down_exps.scale 0 256 2270393920 1024 +tensor blk.6.ffn_gate_exps.weight 40 2048x512x256 2270394944 150994944 +tensor blk.6.ffn_gate_exps.scale 0 256 2421389888 1024 +tensor blk.6.ffn_up_exps.weight 40 2048x512x256 2421390912 150994944 +tensor blk.6.ffn_up_exps.scale 0 256 2572385856 1024 +tensor blk.7.ffn_down_shexp.weight 40 1024x2048 2572386880 1179648 +tensor blk.7.ffn_down_shexp.scale 0 1 2573566528 4 +tensor blk.7.ffn_gate_shexp.weight 40 2048x1024 2573566560 1179648 +tensor blk.7.ffn_gate_shexp.scale 0 1 2574746208 4 +tensor blk.7.ffn_up_shexp.weight 40 2048x1024 2574746240 1179648 +tensor blk.7.ffn_up_shexp.scale 0 1 2575925888 4 +tensor blk.7.attn_k.weight 40 2048x512 2575925920 589824 +tensor blk.7.attn_k.scale 0 1 2576515744 4 +tensor blk.7.attn_output.weight 40 4096x2048 2576515776 4718592 +tensor blk.7.attn_output.scale 0 1 2581234368 4 +tensor blk.7.attn_q.weight 40 2048x4096 2581234400 4718592 +tensor blk.7.attn_q.scale 0 1 2585952992 4 +tensor blk.7.attn_v.weight 40 2048x512 2585953024 589824 +tensor blk.7.attn_v.scale 0 1 2586542848 4 +tensor blk.7.ffn_down_exps.weight 40 512x2048x256 2586542880 150994944 +tensor blk.7.ffn_down_exps.scale 0 256 2737537824 1024 +tensor blk.7.ffn_gate_exps.weight 40 2048x512x256 2737538848 150994944 +tensor blk.7.ffn_gate_exps.scale 0 256 2888533792 1024 +tensor blk.7.ffn_up_exps.weight 40 2048x512x256 2888534816 150994944 +tensor blk.7.ffn_up_exps.scale 0 256 3039529760 1024 +tensor blk.8.ffn_down_shexp.weight 40 1024x2048 3039530784 1179648 +tensor blk.8.ffn_down_shexp.scale 0 1 3040710432 4 +tensor blk.8.ffn_gate_shexp.weight 40 2048x1024 3040710464 1179648 +tensor blk.8.ffn_gate_shexp.scale 0 1 3041890112 4 +tensor blk.8.ffn_up_shexp.weight 40 2048x1024 3041890144 1179648 +tensor blk.8.ffn_up_shexp.scale 0 1 3043069792 4 +tensor blk.8.attn_k.weight 40 2048x512 3043069824 589824 +tensor blk.8.attn_k.scale 0 1 3043659648 4 +tensor blk.8.attn_output.weight 40 4096x2048 3043659680 4718592 +tensor blk.8.attn_output.scale 0 1 3048378272 4 +tensor blk.8.attn_q.weight 40 2048x4096 3048378304 4718592 +tensor blk.8.attn_q.scale 0 1 3053096896 4 +tensor blk.8.attn_v.weight 40 2048x512 3053096928 589824 +tensor blk.8.attn_v.scale 0 1 3053686752 4 +tensor blk.8.ffn_down_exps.weight 40 512x2048x256 3053686784 150994944 +tensor blk.8.ffn_down_exps.scale 0 256 3204681728 1024 +tensor blk.8.ffn_gate_exps.weight 40 2048x512x256 3204682752 150994944 +tensor blk.8.ffn_gate_exps.scale 0 256 3355677696 1024 +tensor blk.8.ffn_up_exps.weight 40 2048x512x256 3355678720 150994944 +tensor blk.8.ffn_up_exps.scale 0 256 3506673664 1024 +tensor blk.9.ffn_down_shexp.weight 40 1024x2048 3506674688 1179648 +tensor blk.9.ffn_down_shexp.scale 0 1 3507854336 4 +tensor blk.9.ffn_gate_shexp.weight 40 2048x1024 3507854368 1179648 +tensor blk.9.ffn_gate_shexp.scale 0 1 3509034016 4 +tensor blk.9.ffn_up_shexp.weight 40 2048x1024 3509034048 1179648 +tensor blk.9.ffn_up_shexp.scale 0 1 3510213696 4 +tensor blk.9.attn_k.weight 40 2048x512 3510213728 589824 +tensor blk.9.attn_k.scale 0 1 3510803552 4 +tensor blk.9.attn_output.weight 40 4096x2048 3510803584 4718592 +tensor blk.9.attn_output.scale 0 1 3515522176 4 +tensor blk.9.attn_q.weight 40 2048x4096 3515522208 4718592 +tensor blk.9.attn_q.scale 0 1 3520240800 4 +tensor blk.9.attn_v.weight 40 2048x512 3520240832 589824 +tensor blk.9.attn_v.scale 0 1 3520830656 4 +tensor blk.9.ffn_down_exps.weight 40 512x2048x256 3520830688 150994944 +tensor blk.9.ffn_down_exps.scale 0 256 3671825632 1024 +tensor blk.9.ffn_gate_exps.weight 40 2048x512x256 3671826656 150994944 +tensor blk.9.ffn_gate_exps.scale 0 256 3822821600 1024 +tensor blk.9.ffn_up_exps.weight 40 2048x512x256 3822822624 150994944 +tensor blk.9.ffn_up_exps.scale 0 256 3973817568 1024 +tensor blk.10.ffn_down_shexp.weight 40 1024x2048 3973818592 1179648 +tensor blk.10.ffn_down_shexp.scale 0 1 3974998240 4 +tensor blk.10.ffn_gate_shexp.weight 40 2048x1024 3974998272 1179648 +tensor blk.10.ffn_gate_shexp.scale 0 1 3976177920 4 +tensor blk.10.ffn_up_shexp.weight 40 2048x1024 3976177952 1179648 +tensor blk.10.ffn_up_shexp.scale 0 1 3977357600 4 +tensor blk.10.attn_k.weight 40 2048x512 3977357632 589824 +tensor blk.10.attn_k.scale 0 1 3977947456 4 +tensor blk.10.attn_output.weight 40 4096x2048 3977947488 4718592 +tensor blk.10.attn_output.scale 0 1 3982666080 4 +tensor blk.10.attn_q.weight 40 2048x4096 3982666112 4718592 +tensor blk.10.attn_q.scale 0 1 3987384704 4 +tensor blk.10.attn_v.weight 40 2048x512 3987384736 589824 +tensor blk.10.attn_v.scale 0 1 3987974560 4 +tensor blk.10.ffn_down_exps.weight 40 512x2048x256 3987974592 150994944 +tensor blk.10.ffn_down_exps.scale 0 256 4138969536 1024 +tensor blk.10.ffn_gate_exps.weight 40 2048x512x256 4138970560 150994944 +tensor blk.10.ffn_gate_exps.scale 0 256 4289965504 1024 +tensor blk.10.ffn_up_exps.weight 40 2048x512x256 4289966528 150994944 +tensor blk.10.ffn_up_exps.scale 0 256 4440961472 1024 +tensor blk.11.ffn_down_shexp.weight 40 1024x2048 4440962496 1179648 +tensor blk.11.ffn_down_shexp.scale 0 1 4442142144 4 +tensor blk.11.ffn_gate_shexp.weight 40 2048x1024 4442142176 1179648 +tensor blk.11.ffn_gate_shexp.scale 0 1 4443321824 4 +tensor blk.11.ffn_up_shexp.weight 40 2048x1024 4443321856 1179648 +tensor blk.11.ffn_up_shexp.scale 0 1 4444501504 4 +tensor blk.11.attn_k.weight 40 2048x512 4444501536 589824 +tensor blk.11.attn_k.scale 0 1 4445091360 4 +tensor blk.11.attn_output.weight 40 4096x2048 4445091392 4718592 +tensor blk.11.attn_output.scale 0 1 4449809984 4 +tensor blk.11.attn_q.weight 40 2048x4096 4449810016 4718592 +tensor blk.11.attn_q.scale 0 1 4454528608 4 +tensor blk.11.attn_v.weight 40 2048x512 4454528640 589824 +tensor blk.11.attn_v.scale 0 1 4455118464 4 +tensor blk.11.ffn_down_exps.weight 40 512x2048x256 4455118496 150994944 +tensor blk.11.ffn_down_exps.scale 0 256 4606113440 1024 +tensor blk.11.ffn_gate_exps.weight 40 2048x512x256 4606114464 150994944 +tensor blk.11.ffn_gate_exps.scale 0 256 4757109408 1024 +tensor blk.11.ffn_up_exps.weight 40 2048x512x256 4757110432 150994944 +tensor blk.11.ffn_up_exps.scale 0 256 4908105376 1024 +tensor blk.12.ffn_down_shexp.weight 40 1024x2048 4908106400 1179648 +tensor blk.12.ffn_down_shexp.scale 0 1 4909286048 4 +tensor blk.12.ffn_gate_shexp.weight 40 2048x1024 4909286080 1179648 +tensor blk.12.ffn_gate_shexp.scale 0 1 4910465728 4 +tensor blk.12.ffn_up_shexp.weight 40 2048x1024 4910465760 1179648 +tensor blk.12.ffn_up_shexp.scale 0 1 4911645408 4 +tensor blk.12.attn_k.weight 40 2048x512 4911645440 589824 +tensor blk.12.attn_k.scale 0 1 4912235264 4 +tensor blk.12.attn_output.weight 40 4096x2048 4912235296 4718592 +tensor blk.12.attn_output.scale 0 1 4916953888 4 +tensor blk.12.attn_q.weight 40 2048x4096 4916953920 4718592 +tensor blk.12.attn_q.scale 0 1 4921672512 4 +tensor blk.12.attn_v.weight 40 2048x512 4921672544 589824 +tensor blk.12.attn_v.scale 0 1 4922262368 4 +tensor blk.12.ffn_down_exps.weight 40 512x2048x256 4922262400 150994944 +tensor blk.12.ffn_down_exps.scale 0 256 5073257344 1024 +tensor blk.12.ffn_gate_exps.weight 40 2048x512x256 5073258368 150994944 +tensor blk.12.ffn_gate_exps.scale 0 256 5224253312 1024 +tensor blk.12.ffn_up_exps.weight 40 2048x512x256 5224254336 150994944 +tensor blk.12.ffn_up_exps.scale 0 256 5375249280 1024 +tensor blk.13.ffn_down_shexp.weight 40 1024x2048 5375250304 1179648 +tensor blk.13.ffn_down_shexp.scale 0 1 5376429952 4 +tensor blk.13.ffn_gate_shexp.weight 40 2048x1024 5376429984 1179648 +tensor blk.13.ffn_gate_shexp.scale 0 1 5377609632 4 +tensor blk.13.ffn_up_shexp.weight 40 2048x1024 5377609664 1179648 +tensor blk.13.ffn_up_shexp.scale 0 1 5378789312 4 +tensor blk.13.attn_k.weight 40 2048x512 5378789344 589824 +tensor blk.13.attn_k.scale 0 1 5379379168 4 +tensor blk.13.attn_output.weight 40 4096x2048 5379379200 4718592 +tensor blk.13.attn_output.scale 0 1 5384097792 4 +tensor blk.13.attn_q.weight 40 2048x4096 5384097824 4718592 +tensor blk.13.attn_q.scale 0 1 5388816416 4 +tensor blk.13.attn_v.weight 40 2048x512 5388816448 589824 +tensor blk.13.attn_v.scale 0 1 5389406272 4 +tensor blk.13.ffn_down_exps.weight 40 512x2048x256 5389406304 150994944 +tensor blk.13.ffn_down_exps.scale 0 256 5540401248 1024 +tensor blk.13.ffn_gate_exps.weight 40 2048x512x256 5540402272 150994944 +tensor blk.13.ffn_gate_exps.scale 0 256 5691397216 1024 +tensor blk.13.ffn_up_exps.weight 40 2048x512x256 5691398240 150994944 +tensor blk.13.ffn_up_exps.scale 0 256 5842393184 1024 +tensor blk.14.ffn_down_shexp.weight 40 1024x2048 5842394208 1179648 +tensor blk.14.ffn_down_shexp.scale 0 1 5843573856 4 +tensor blk.14.ffn_gate_shexp.weight 40 2048x1024 5843573888 1179648 +tensor blk.14.ffn_gate_shexp.scale 0 1 5844753536 4 +tensor blk.14.ffn_up_shexp.weight 40 2048x1024 5844753568 1179648 +tensor blk.14.ffn_up_shexp.scale 0 1 5845933216 4 +tensor blk.14.attn_k.weight 40 2048x512 5845933248 589824 +tensor blk.14.attn_k.scale 0 1 5846523072 4 +tensor blk.14.attn_output.weight 40 4096x2048 5846523104 4718592 +tensor blk.14.attn_output.scale 0 1 5851241696 4 +tensor blk.14.attn_q.weight 40 2048x4096 5851241728 4718592 +tensor blk.14.attn_q.scale 0 1 5855960320 4 +tensor blk.14.attn_v.weight 40 2048x512 5855960352 589824 +tensor blk.14.attn_v.scale 0 1 5856550176 4 +tensor blk.14.ffn_down_exps.weight 40 512x2048x256 5856550208 150994944 +tensor blk.14.ffn_down_exps.scale 0 256 6007545152 1024 +tensor blk.14.ffn_gate_exps.weight 40 2048x512x256 6007546176 150994944 +tensor blk.14.ffn_gate_exps.scale 0 256 6158541120 1024 +tensor blk.14.ffn_up_exps.weight 40 2048x512x256 6158542144 150994944 +tensor blk.14.ffn_up_exps.scale 0 256 6309537088 1024 +tensor blk.15.ffn_down_shexp.weight 40 1024x2048 6309538112 1179648 +tensor blk.15.ffn_down_shexp.scale 0 1 6310717760 4 +tensor blk.15.ffn_gate_shexp.weight 40 2048x1024 6310717792 1179648 +tensor blk.15.ffn_gate_shexp.scale 0 1 6311897440 4 +tensor blk.15.ffn_up_shexp.weight 40 2048x1024 6311897472 1179648 +tensor blk.15.ffn_up_shexp.scale 0 1 6313077120 4 +tensor blk.15.attn_k.weight 40 2048x512 6313077152 589824 +tensor blk.15.attn_k.scale 0 1 6313666976 4 +tensor blk.15.attn_output.weight 40 4096x2048 6313667008 4718592 +tensor blk.15.attn_output.scale 0 1 6318385600 4 +tensor blk.15.attn_q.weight 40 2048x4096 6318385632 4718592 +tensor blk.15.attn_q.scale 0 1 6323104224 4 +tensor blk.15.attn_v.weight 40 2048x512 6323104256 589824 +tensor blk.15.attn_v.scale 0 1 6323694080 4 +tensor blk.15.ffn_down_exps.weight 40 512x2048x256 6323694112 150994944 +tensor blk.15.ffn_down_exps.scale 0 256 6474689056 1024 +tensor blk.15.ffn_gate_exps.weight 40 2048x512x256 6474690080 150994944 +tensor blk.15.ffn_gate_exps.scale 0 256 6625685024 1024 +tensor blk.15.ffn_up_exps.weight 40 2048x512x256 6625686048 150994944 +tensor blk.15.ffn_up_exps.scale 0 256 6776680992 1024 +tensor blk.16.ffn_down_shexp.weight 40 1024x2048 6776682016 1179648 +tensor blk.16.ffn_down_shexp.scale 0 1 6777861664 4 +tensor blk.16.ffn_gate_shexp.weight 40 2048x1024 6777861696 1179648 +tensor blk.16.ffn_gate_shexp.scale 0 1 6779041344 4 +tensor blk.16.ffn_up_shexp.weight 40 2048x1024 6779041376 1179648 +tensor blk.16.ffn_up_shexp.scale 0 1 6780221024 4 +tensor blk.16.attn_k.weight 40 2048x512 6780221056 589824 +tensor blk.16.attn_k.scale 0 1 6780810880 4 +tensor blk.16.attn_output.weight 40 4096x2048 6780810912 4718592 +tensor blk.16.attn_output.scale 0 1 6785529504 4 +tensor blk.16.attn_q.weight 40 2048x4096 6785529536 4718592 +tensor blk.16.attn_q.scale 0 1 6790248128 4 +tensor blk.16.attn_v.weight 40 2048x512 6790248160 589824 +tensor blk.16.attn_v.scale 0 1 6790837984 4 +tensor blk.16.ffn_down_exps.weight 40 512x2048x256 6790838016 150994944 +tensor blk.16.ffn_down_exps.scale 0 256 6941832960 1024 +tensor blk.16.ffn_gate_exps.weight 40 2048x512x256 6941833984 150994944 +tensor blk.16.ffn_gate_exps.scale 0 256 7092828928 1024 +tensor blk.16.ffn_up_exps.weight 40 2048x512x256 7092829952 150994944 +tensor blk.16.ffn_up_exps.scale 0 256 7243824896 1024 +tensor blk.17.ffn_down_shexp.weight 40 1024x2048 7243825920 1179648 +tensor blk.17.ffn_down_shexp.scale 0 1 7245005568 4 +tensor blk.17.ffn_gate_shexp.weight 40 2048x1024 7245005600 1179648 +tensor blk.17.ffn_gate_shexp.scale 0 1 7246185248 4 +tensor blk.17.ffn_up_shexp.weight 40 2048x1024 7246185280 1179648 +tensor blk.17.ffn_up_shexp.scale 0 1 7247364928 4 +tensor blk.17.attn_k.weight 40 2048x512 7247364960 589824 +tensor blk.17.attn_k.scale 0 1 7247954784 4 +tensor blk.17.attn_output.weight 40 4096x2048 7247954816 4718592 +tensor blk.17.attn_output.scale 0 1 7252673408 4 +tensor blk.17.attn_q.weight 40 2048x4096 7252673440 4718592 +tensor blk.17.attn_q.scale 0 1 7257392032 4 +tensor blk.17.attn_v.weight 40 2048x512 7257392064 589824 +tensor blk.17.attn_v.scale 0 1 7257981888 4 +tensor blk.17.ffn_down_exps.weight 40 512x2048x256 7257981920 150994944 +tensor blk.17.ffn_down_exps.scale 0 256 7408976864 1024 +tensor blk.17.ffn_gate_exps.weight 40 2048x512x256 7408977888 150994944 +tensor blk.17.ffn_gate_exps.scale 0 256 7559972832 1024 +tensor blk.17.ffn_up_exps.weight 40 2048x512x256 7559973856 150994944 +tensor blk.17.ffn_up_exps.scale 0 256 7710968800 1024 +tensor blk.18.ffn_down_shexp.weight 40 1024x2048 7710969824 1179648 +tensor blk.18.ffn_down_shexp.scale 0 1 7712149472 4 +tensor blk.18.ffn_gate_shexp.weight 40 2048x1024 7712149504 1179648 +tensor blk.18.ffn_gate_shexp.scale 0 1 7713329152 4 +tensor blk.18.ffn_up_shexp.weight 40 2048x1024 7713329184 1179648 +tensor blk.18.ffn_up_shexp.scale 0 1 7714508832 4 +tensor blk.18.attn_k.weight 40 2048x512 7714508864 589824 +tensor blk.18.attn_k.scale 0 1 7715098688 4 +tensor blk.18.attn_output.weight 40 4096x2048 7715098720 4718592 +tensor blk.18.attn_output.scale 0 1 7719817312 4 +tensor blk.18.attn_q.weight 40 2048x4096 7719817344 4718592 +tensor blk.18.attn_q.scale 0 1 7724535936 4 +tensor blk.18.attn_v.weight 40 2048x512 7724535968 589824 +tensor blk.18.attn_v.scale 0 1 7725125792 4 +tensor blk.18.ffn_down_exps.weight 40 512x2048x256 7725125824 150994944 +tensor blk.18.ffn_down_exps.scale 0 256 7876120768 1024 +tensor blk.18.ffn_gate_exps.weight 40 2048x512x256 7876121792 150994944 +tensor blk.18.ffn_gate_exps.scale 0 256 8027116736 1024 +tensor blk.18.ffn_up_exps.weight 40 2048x512x256 8027117760 150994944 +tensor blk.18.ffn_up_exps.scale 0 256 8178112704 1024 +tensor blk.19.ffn_down_shexp.weight 40 1024x2048 8178113728 1179648 +tensor blk.19.ffn_down_shexp.scale 0 1 8179293376 4 +tensor blk.19.ffn_gate_shexp.weight 40 2048x1024 8179293408 1179648 +tensor blk.19.ffn_gate_shexp.scale 0 1 8180473056 4 +tensor blk.19.ffn_up_shexp.weight 40 2048x1024 8180473088 1179648 +tensor blk.19.ffn_up_shexp.scale 0 1 8181652736 4 +tensor blk.19.attn_k.weight 40 2048x512 8181652768 589824 +tensor blk.19.attn_k.scale 0 1 8182242592 4 +tensor blk.19.attn_output.weight 40 4096x2048 8182242624 4718592 +tensor blk.19.attn_output.scale 0 1 8186961216 4 +tensor blk.19.attn_q.weight 40 2048x4096 8186961248 4718592 +tensor blk.19.attn_q.scale 0 1 8191679840 4 +tensor blk.19.attn_v.weight 40 2048x512 8191679872 589824 +tensor blk.19.attn_v.scale 0 1 8192269696 4 +tensor blk.19.ffn_down_exps.weight 40 512x2048x256 8192269728 150994944 +tensor blk.19.ffn_down_exps.scale 0 256 8343264672 1024 +tensor blk.19.ffn_gate_exps.weight 40 2048x512x256 8343265696 150994944 +tensor blk.19.ffn_gate_exps.scale 0 256 8494260640 1024 +tensor blk.19.ffn_up_exps.weight 40 2048x512x256 8494261664 150994944 +tensor blk.19.ffn_up_exps.scale 0 256 8645256608 1024 +tensor blk.20.ffn_down_shexp.weight 40 1024x2048 8645257632 1179648 +tensor blk.20.ffn_down_shexp.scale 0 1 8646437280 4 +tensor blk.20.ffn_gate_shexp.weight 40 2048x1024 8646437312 1179648 +tensor blk.20.ffn_gate_shexp.scale 0 1 8647616960 4 +tensor blk.20.ffn_up_shexp.weight 40 2048x1024 8647616992 1179648 +tensor blk.20.ffn_up_shexp.scale 0 1 8648796640 4 +tensor blk.20.attn_k.weight 40 2048x512 8648796672 589824 +tensor blk.20.attn_k.scale 0 1 8649386496 4 +tensor blk.20.attn_output.weight 40 4096x2048 8649386528 4718592 +tensor blk.20.attn_output.scale 0 1 8654105120 4 +tensor blk.20.attn_q.weight 40 2048x4096 8654105152 4718592 +tensor blk.20.attn_q.scale 0 1 8658823744 4 +tensor blk.20.attn_v.weight 40 2048x512 8658823776 589824 +tensor blk.20.attn_v.scale 0 1 8659413600 4 +tensor blk.20.ffn_down_exps.weight 40 512x2048x256 8659413632 150994944 +tensor blk.20.ffn_down_exps.scale 0 256 8810408576 1024 +tensor blk.20.ffn_gate_exps.weight 40 2048x512x256 8810409600 150994944 +tensor blk.20.ffn_gate_exps.scale 0 256 8961404544 1024 +tensor blk.20.ffn_up_exps.weight 40 2048x512x256 8961405568 150994944 +tensor blk.20.ffn_up_exps.scale 0 256 9112400512 1024 +tensor blk.21.ffn_down_shexp.weight 40 1024x2048 9112401536 1179648 +tensor blk.21.ffn_down_shexp.scale 0 1 9113581184 4 +tensor blk.21.ffn_gate_shexp.weight 40 2048x1024 9113581216 1179648 +tensor blk.21.ffn_gate_shexp.scale 0 1 9114760864 4 +tensor blk.21.ffn_up_shexp.weight 40 2048x1024 9114760896 1179648 +tensor blk.21.ffn_up_shexp.scale 0 1 9115940544 4 +tensor blk.21.attn_k.weight 40 2048x512 9115940576 589824 +tensor blk.21.attn_k.scale 0 1 9116530400 4 +tensor blk.21.attn_output.weight 40 4096x2048 9116530432 4718592 +tensor blk.21.attn_output.scale 0 1 9121249024 4 +tensor blk.21.attn_q.weight 40 2048x4096 9121249056 4718592 +tensor blk.21.attn_q.scale 0 1 9125967648 4 +tensor blk.21.attn_v.weight 40 2048x512 9125967680 589824 +tensor blk.21.attn_v.scale 0 1 9126557504 4 +tensor blk.21.ffn_down_exps.weight 40 512x2048x256 9126557536 150994944 +tensor blk.21.ffn_down_exps.scale 0 256 9277552480 1024 +tensor blk.21.ffn_gate_exps.weight 40 2048x512x256 9277553504 150994944 +tensor blk.21.ffn_gate_exps.scale 0 256 9428548448 1024 +tensor blk.21.ffn_up_exps.weight 40 2048x512x256 9428549472 150994944 +tensor blk.21.ffn_up_exps.scale 0 256 9579544416 1024 +tensor blk.22.ffn_down_shexp.weight 40 1024x2048 9579545440 1179648 +tensor blk.22.ffn_down_shexp.scale 0 1 9580725088 4 +tensor blk.22.ffn_gate_shexp.weight 40 2048x1024 9580725120 1179648 +tensor blk.22.ffn_gate_shexp.scale 0 1 9581904768 4 +tensor blk.22.ffn_up_shexp.weight 40 2048x1024 9581904800 1179648 +tensor blk.22.ffn_up_shexp.scale 0 1 9583084448 4 +tensor blk.22.attn_k.weight 40 2048x512 9583084480 589824 +tensor blk.22.attn_k.scale 0 1 9583674304 4 +tensor blk.22.attn_output.weight 40 4096x2048 9583674336 4718592 +tensor blk.22.attn_output.scale 0 1 9588392928 4 +tensor blk.22.attn_q.weight 40 2048x4096 9588392960 4718592 +tensor blk.22.attn_q.scale 0 1 9593111552 4 +tensor blk.22.attn_v.weight 40 2048x512 9593111584 589824 +tensor blk.22.attn_v.scale 0 1 9593701408 4 +tensor blk.22.ffn_down_exps.weight 40 512x2048x256 9593701440 150994944 +tensor blk.22.ffn_down_exps.scale 0 256 9744696384 1024 +tensor blk.22.ffn_gate_exps.weight 40 2048x512x256 9744697408 150994944 +tensor blk.22.ffn_gate_exps.scale 0 256 9895692352 1024 +tensor blk.22.ffn_up_exps.weight 40 2048x512x256 9895693376 150994944 +tensor blk.22.ffn_up_exps.scale 0 256 10046688320 1024 +tensor blk.23.ffn_down_shexp.weight 40 1024x2048 10046689344 1179648 +tensor blk.23.ffn_down_shexp.scale 0 1 10047868992 4 +tensor blk.23.ffn_gate_shexp.weight 40 2048x1024 10047869024 1179648 +tensor blk.23.ffn_gate_shexp.scale 0 1 10049048672 4 +tensor blk.23.ffn_up_shexp.weight 40 2048x1024 10049048704 1179648 +tensor blk.23.ffn_up_shexp.scale 0 1 10050228352 4 +tensor blk.23.attn_k.weight 40 2048x512 10050228384 589824 +tensor blk.23.attn_k.scale 0 1 10050818208 4 +tensor blk.23.attn_output.weight 40 4096x2048 10050818240 4718592 +tensor blk.23.attn_output.scale 0 1 10055536832 4 +tensor blk.23.attn_q.weight 40 2048x4096 10055536864 4718592 +tensor blk.23.attn_q.scale 0 1 10060255456 4 +tensor blk.23.attn_v.weight 40 2048x512 10060255488 589824 +tensor blk.23.attn_v.scale 0 1 10060845312 4 +tensor blk.23.ffn_down_exps.weight 40 512x2048x256 10060845344 150994944 +tensor blk.23.ffn_down_exps.scale 0 256 10211840288 1024 +tensor blk.23.ffn_gate_exps.weight 40 2048x512x256 10211841312 150994944 +tensor blk.23.ffn_gate_exps.scale 0 256 10362836256 1024 +tensor blk.23.ffn_up_exps.weight 40 2048x512x256 10362837280 150994944 +tensor blk.23.ffn_up_exps.scale 0 256 10513832224 1024 +tensor blk.24.ffn_down_shexp.weight 40 1024x2048 10513833248 1179648 +tensor blk.24.ffn_down_shexp.scale 0 1 10515012896 4 +tensor blk.24.ffn_gate_shexp.weight 40 2048x1024 10515012928 1179648 +tensor blk.24.ffn_gate_shexp.scale 0 1 10516192576 4 +tensor blk.24.ffn_up_shexp.weight 40 2048x1024 10516192608 1179648 +tensor blk.24.ffn_up_shexp.scale 0 1 10517372256 4 +tensor blk.24.attn_k.weight 40 2048x512 10517372288 589824 +tensor blk.24.attn_k.scale 0 1 10517962112 4 +tensor blk.24.attn_output.weight 40 4096x2048 10517962144 4718592 +tensor blk.24.attn_output.scale 0 1 10522680736 4 +tensor blk.24.attn_q.weight 40 2048x4096 10522680768 4718592 +tensor blk.24.attn_q.scale 0 1 10527399360 4 +tensor blk.24.attn_v.weight 40 2048x512 10527399392 589824 +tensor blk.24.attn_v.scale 0 1 10527989216 4 +tensor blk.24.ffn_down_exps.weight 40 512x2048x256 10527989248 150994944 +tensor blk.24.ffn_down_exps.scale 0 256 10678984192 1024 +tensor blk.24.ffn_gate_exps.weight 40 2048x512x256 10678985216 150994944 +tensor blk.24.ffn_gate_exps.scale 0 256 10829980160 1024 +tensor blk.24.ffn_up_exps.weight 40 2048x512x256 10829981184 150994944 +tensor blk.24.ffn_up_exps.scale 0 256 10980976128 1024 +tensor blk.25.ffn_down_shexp.weight 40 1024x2048 10980977152 1179648 +tensor blk.25.ffn_down_shexp.scale 0 1 10982156800 4 +tensor blk.25.ffn_gate_shexp.weight 40 2048x1024 10982156832 1179648 +tensor blk.25.ffn_gate_shexp.scale 0 1 10983336480 4 +tensor blk.25.ffn_up_shexp.weight 40 2048x1024 10983336512 1179648 +tensor blk.25.ffn_up_shexp.scale 0 1 10984516160 4 +tensor blk.25.attn_k.weight 40 2048x512 10984516192 589824 +tensor blk.25.attn_k.scale 0 1 10985106016 4 +tensor blk.25.attn_output.weight 40 4096x2048 10985106048 4718592 +tensor blk.25.attn_output.scale 0 1 10989824640 4 +tensor blk.25.attn_q.weight 40 2048x4096 10989824672 4718592 +tensor blk.25.attn_q.scale 0 1 10994543264 4 +tensor blk.25.attn_v.weight 40 2048x512 10994543296 589824 +tensor blk.25.attn_v.scale 0 1 10995133120 4 +tensor blk.25.ffn_down_exps.weight 40 512x2048x256 10995133152 150994944 +tensor blk.25.ffn_down_exps.scale 0 256 11146128096 1024 +tensor blk.25.ffn_gate_exps.weight 40 2048x512x256 11146129120 150994944 +tensor blk.25.ffn_gate_exps.scale 0 256 11297124064 1024 +tensor blk.25.ffn_up_exps.weight 40 2048x512x256 11297125088 150994944 +tensor blk.25.ffn_up_exps.scale 0 256 11448120032 1024 +tensor blk.26.ffn_down_shexp.weight 40 1024x2048 11448121056 1179648 +tensor blk.26.ffn_down_shexp.scale 0 1 11449300704 4 +tensor blk.26.ffn_gate_shexp.weight 40 2048x1024 11449300736 1179648 +tensor blk.26.ffn_gate_shexp.scale 0 1 11450480384 4 +tensor blk.26.ffn_up_shexp.weight 40 2048x1024 11450480416 1179648 +tensor blk.26.ffn_up_shexp.scale 0 1 11451660064 4 +tensor blk.26.attn_k.weight 40 2048x512 11451660096 589824 +tensor blk.26.attn_k.scale 0 1 11452249920 4 +tensor blk.26.attn_output.weight 40 4096x2048 11452249952 4718592 +tensor blk.26.attn_output.scale 0 1 11456968544 4 +tensor blk.26.attn_q.weight 40 2048x4096 11456968576 4718592 +tensor blk.26.attn_q.scale 0 1 11461687168 4 +tensor blk.26.attn_v.weight 40 2048x512 11461687200 589824 +tensor blk.26.attn_v.scale 0 1 11462277024 4 +tensor blk.26.ffn_down_exps.weight 40 512x2048x256 11462277056 150994944 +tensor blk.26.ffn_down_exps.scale 0 256 11613272000 1024 +tensor blk.26.ffn_gate_exps.weight 40 2048x512x256 11613273024 150994944 +tensor blk.26.ffn_gate_exps.scale 0 256 11764267968 1024 +tensor blk.26.ffn_up_exps.weight 40 2048x512x256 11764268992 150994944 +tensor blk.26.ffn_up_exps.scale 0 256 11915263936 1024 +tensor blk.27.ffn_down_shexp.weight 40 1024x2048 11915264960 1179648 +tensor blk.27.ffn_down_shexp.scale 0 1 11916444608 4 +tensor blk.27.ffn_gate_shexp.weight 40 2048x1024 11916444640 1179648 +tensor blk.27.ffn_gate_shexp.scale 0 1 11917624288 4 +tensor blk.27.ffn_up_shexp.weight 40 2048x1024 11917624320 1179648 +tensor blk.27.ffn_up_shexp.scale 0 1 11918803968 4 +tensor blk.27.attn_k.weight 40 2048x512 11918804000 589824 +tensor blk.27.attn_k.scale 0 1 11919393824 4 +tensor blk.27.attn_output.weight 40 4096x2048 11919393856 4718592 +tensor blk.27.attn_output.scale 0 1 11924112448 4 +tensor blk.27.attn_q.weight 40 2048x4096 11924112480 4718592 +tensor blk.27.attn_q.scale 0 1 11928831072 4 +tensor blk.27.attn_v.weight 40 2048x512 11928831104 589824 +tensor blk.27.attn_v.scale 0 1 11929420928 4 +tensor blk.27.ffn_down_exps.weight 40 512x2048x256 11929420960 150994944 +tensor blk.27.ffn_down_exps.scale 0 256 12080415904 1024 +tensor blk.27.ffn_gate_exps.weight 40 2048x512x256 12080416928 150994944 +tensor blk.27.ffn_gate_exps.scale 0 256 12231411872 1024 +tensor blk.27.ffn_up_exps.weight 40 2048x512x256 12231412896 150994944 +tensor blk.27.ffn_up_exps.scale 0 256 12382407840 1024 +tensor blk.28.ffn_down_shexp.weight 40 1024x2048 12382408864 1179648 +tensor blk.28.ffn_down_shexp.scale 0 1 12383588512 4 +tensor blk.28.ffn_gate_shexp.weight 40 2048x1024 12383588544 1179648 +tensor blk.28.ffn_gate_shexp.scale 0 1 12384768192 4 +tensor blk.28.ffn_up_shexp.weight 40 2048x1024 12384768224 1179648 +tensor blk.28.ffn_up_shexp.scale 0 1 12385947872 4 +tensor blk.28.attn_k.weight 40 2048x512 12385947904 589824 +tensor blk.28.attn_k.scale 0 1 12386537728 4 +tensor blk.28.attn_output.weight 40 4096x2048 12386537760 4718592 +tensor blk.28.attn_output.scale 0 1 12391256352 4 +tensor blk.28.attn_q.weight 40 2048x4096 12391256384 4718592 +tensor blk.28.attn_q.scale 0 1 12395974976 4 +tensor blk.28.attn_v.weight 40 2048x512 12395975008 589824 +tensor blk.28.attn_v.scale 0 1 12396564832 4 +tensor blk.28.ffn_down_exps.weight 40 512x2048x256 12396564864 150994944 +tensor blk.28.ffn_down_exps.scale 0 256 12547559808 1024 +tensor blk.28.ffn_gate_exps.weight 40 2048x512x256 12547560832 150994944 +tensor blk.28.ffn_gate_exps.scale 0 256 12698555776 1024 +tensor blk.28.ffn_up_exps.weight 40 2048x512x256 12698556800 150994944 +tensor blk.28.ffn_up_exps.scale 0 256 12849551744 1024 +tensor blk.29.ffn_down_shexp.weight 40 1024x2048 12849552768 1179648 +tensor blk.29.ffn_down_shexp.scale 0 1 12850732416 4 +tensor blk.29.ffn_gate_shexp.weight 40 2048x1024 12850732448 1179648 +tensor blk.29.ffn_gate_shexp.scale 0 1 12851912096 4 +tensor blk.29.ffn_up_shexp.weight 40 2048x1024 12851912128 1179648 +tensor blk.29.ffn_up_shexp.scale 0 1 12853091776 4 +tensor blk.29.attn_k.weight 40 2048x512 12853091808 589824 +tensor blk.29.attn_k.scale 0 1 12853681632 4 +tensor blk.29.attn_output.weight 40 4096x2048 12853681664 4718592 +tensor blk.29.attn_output.scale 0 1 12858400256 4 +tensor blk.29.attn_q.weight 40 2048x4096 12858400288 4718592 +tensor blk.29.attn_q.scale 0 1 12863118880 4 +tensor blk.29.attn_v.weight 40 2048x512 12863118912 589824 +tensor blk.29.attn_v.scale 0 1 12863708736 4 +tensor blk.29.ffn_down_exps.weight 40 512x2048x256 12863708768 150994944 +tensor blk.29.ffn_down_exps.scale 0 256 13014703712 1024 +tensor blk.29.ffn_gate_exps.weight 40 2048x512x256 13014704736 150994944 +tensor blk.29.ffn_gate_exps.scale 0 256 13165699680 1024 +tensor blk.29.ffn_up_exps.weight 40 2048x512x256 13165700704 150994944 +tensor blk.29.ffn_up_exps.scale 0 256 13316695648 1024 +tensor blk.30.ffn_down_shexp.weight 40 1024x2048 13316696672 1179648 +tensor blk.30.ffn_down_shexp.scale 0 1 13317876320 4 +tensor blk.30.ffn_gate_shexp.weight 40 2048x1024 13317876352 1179648 +tensor blk.30.ffn_gate_shexp.scale 0 1 13319056000 4 +tensor blk.30.ffn_up_shexp.weight 40 2048x1024 13319056032 1179648 +tensor blk.30.ffn_up_shexp.scale 0 1 13320235680 4 +tensor blk.30.attn_k.weight 40 2048x512 13320235712 589824 +tensor blk.30.attn_k.scale 0 1 13320825536 4 +tensor blk.30.attn_output.weight 40 4096x2048 13320825568 4718592 +tensor blk.30.attn_output.scale 0 1 13325544160 4 +tensor blk.30.attn_q.weight 40 2048x4096 13325544192 4718592 +tensor blk.30.attn_q.scale 0 1 13330262784 4 +tensor blk.30.attn_v.weight 40 2048x512 13330262816 589824 +tensor blk.30.attn_v.scale 0 1 13330852640 4 +tensor blk.30.ffn_down_exps.weight 40 512x2048x256 13330852672 150994944 +tensor blk.30.ffn_down_exps.scale 0 256 13481847616 1024 +tensor blk.30.ffn_gate_exps.weight 40 2048x512x256 13481848640 150994944 +tensor blk.30.ffn_gate_exps.scale 0 256 13632843584 1024 +tensor blk.30.ffn_up_exps.weight 40 2048x512x256 13632844608 150994944 +tensor blk.30.ffn_up_exps.scale 0 256 13783839552 1024 +tensor blk.31.ffn_down_shexp.weight 40 1024x2048 13783840576 1179648 +tensor blk.31.ffn_down_shexp.scale 0 1 13785020224 4 +tensor blk.31.ffn_gate_shexp.weight 40 2048x1024 13785020256 1179648 +tensor blk.31.ffn_gate_shexp.scale 0 1 13786199904 4 +tensor blk.31.ffn_up_shexp.weight 40 2048x1024 13786199936 1179648 +tensor blk.31.ffn_up_shexp.scale 0 1 13787379584 4 +tensor blk.31.attn_k.weight 40 2048x512 13787379616 589824 +tensor blk.31.attn_k.scale 0 1 13787969440 4 +tensor blk.31.attn_output.weight 40 4096x2048 13787969472 4718592 +tensor blk.31.attn_output.scale 0 1 13792688064 4 +tensor blk.31.attn_q.weight 40 2048x4096 13792688096 4718592 +tensor blk.31.attn_q.scale 0 1 13797406688 4 +tensor blk.31.attn_v.weight 40 2048x512 13797406720 589824 +tensor blk.31.attn_v.scale 0 1 13797996544 4 +tensor blk.31.ffn_down_exps.weight 40 512x2048x256 13797996576 150994944 +tensor blk.31.ffn_down_exps.scale 0 256 13948991520 1024 +tensor blk.31.ffn_gate_exps.weight 40 2048x512x256 13948992544 150994944 +tensor blk.31.ffn_gate_exps.scale 0 256 14099987488 1024 +tensor blk.31.ffn_up_exps.weight 40 2048x512x256 14099988512 150994944 +tensor blk.31.ffn_up_exps.scale 0 256 14250983456 1024 +tensor blk.32.ffn_down_shexp.weight 40 1024x2048 14250984480 1179648 +tensor blk.32.ffn_down_shexp.scale 0 1 14252164128 4 +tensor blk.32.ffn_gate_shexp.weight 40 2048x1024 14252164160 1179648 +tensor blk.32.ffn_gate_shexp.scale 0 1 14253343808 4 +tensor blk.32.ffn_up_shexp.weight 40 2048x1024 14253343840 1179648 +tensor blk.32.ffn_up_shexp.scale 0 1 14254523488 4 +tensor blk.32.attn_k.weight 40 2048x512 14254523520 589824 +tensor blk.32.attn_k.scale 0 1 14255113344 4 +tensor blk.32.attn_output.weight 40 4096x2048 14255113376 4718592 +tensor blk.32.attn_output.scale 0 1 14259831968 4 +tensor blk.32.attn_q.weight 40 2048x4096 14259832000 4718592 +tensor blk.32.attn_q.scale 0 1 14264550592 4 +tensor blk.32.attn_v.weight 40 2048x512 14264550624 589824 +tensor blk.32.attn_v.scale 0 1 14265140448 4 +tensor blk.32.ffn_down_exps.weight 40 512x2048x256 14265140480 150994944 +tensor blk.32.ffn_down_exps.scale 0 256 14416135424 1024 +tensor blk.32.ffn_gate_exps.weight 40 2048x512x256 14416136448 150994944 +tensor blk.32.ffn_gate_exps.scale 0 256 14567131392 1024 +tensor blk.32.ffn_up_exps.weight 40 2048x512x256 14567132416 150994944 +tensor blk.32.ffn_up_exps.scale 0 256 14718127360 1024 +tensor blk.33.ffn_down_shexp.weight 40 1024x2048 14718128384 1179648 +tensor blk.33.ffn_down_shexp.scale 0 1 14719308032 4 +tensor blk.33.ffn_gate_shexp.weight 40 2048x1024 14719308064 1179648 +tensor blk.33.ffn_gate_shexp.scale 0 1 14720487712 4 +tensor blk.33.ffn_up_shexp.weight 40 2048x1024 14720487744 1179648 +tensor blk.33.ffn_up_shexp.scale 0 1 14721667392 4 +tensor blk.33.attn_k.weight 40 2048x512 14721667424 589824 +tensor blk.33.attn_k.scale 0 1 14722257248 4 +tensor blk.33.attn_output.weight 40 4096x2048 14722257280 4718592 +tensor blk.33.attn_output.scale 0 1 14726975872 4 +tensor blk.33.attn_q.weight 40 2048x4096 14726975904 4718592 +tensor blk.33.attn_q.scale 0 1 14731694496 4 +tensor blk.33.attn_v.weight 40 2048x512 14731694528 589824 +tensor blk.33.attn_v.scale 0 1 14732284352 4 +tensor blk.33.ffn_down_exps.weight 40 512x2048x256 14732284384 150994944 +tensor blk.33.ffn_down_exps.scale 0 256 14883279328 1024 +tensor blk.33.ffn_gate_exps.weight 40 2048x512x256 14883280352 150994944 +tensor blk.33.ffn_gate_exps.scale 0 256 15034275296 1024 +tensor blk.33.ffn_up_exps.weight 40 2048x512x256 15034276320 150994944 +tensor blk.33.ffn_up_exps.scale 0 256 15185271264 1024 +tensor blk.34.ffn_down_shexp.weight 40 1024x2048 15185272288 1179648 +tensor blk.34.ffn_down_shexp.scale 0 1 15186451936 4 +tensor blk.34.ffn_gate_shexp.weight 40 2048x1024 15186451968 1179648 +tensor blk.34.ffn_gate_shexp.scale 0 1 15187631616 4 +tensor blk.34.ffn_up_shexp.weight 40 2048x1024 15187631648 1179648 +tensor blk.34.ffn_up_shexp.scale 0 1 15188811296 4 +tensor blk.34.attn_k.weight 40 2048x512 15188811328 589824 +tensor blk.34.attn_k.scale 0 1 15189401152 4 +tensor blk.34.attn_output.weight 40 4096x2048 15189401184 4718592 +tensor blk.34.attn_output.scale 0 1 15194119776 4 +tensor blk.34.attn_q.weight 40 2048x4096 15194119808 4718592 +tensor blk.34.attn_q.scale 0 1 15198838400 4 +tensor blk.34.attn_v.weight 40 2048x512 15198838432 589824 +tensor blk.34.attn_v.scale 0 1 15199428256 4 +tensor blk.34.ffn_down_exps.weight 40 512x2048x256 15199428288 150994944 +tensor blk.34.ffn_down_exps.scale 0 256 15350423232 1024 +tensor blk.34.ffn_gate_exps.weight 40 2048x512x256 15350424256 150994944 +tensor blk.34.ffn_gate_exps.scale 0 256 15501419200 1024 +tensor blk.34.ffn_up_exps.weight 40 2048x512x256 15501420224 150994944 +tensor blk.34.ffn_up_exps.scale 0 256 15652415168 1024 +tensor blk.35.ffn_down_shexp.weight 40 1024x2048 15652416192 1179648 +tensor blk.35.ffn_down_shexp.scale 0 1 15653595840 4 +tensor blk.35.ffn_gate_shexp.weight 40 2048x1024 15653595872 1179648 +tensor blk.35.ffn_gate_shexp.scale 0 1 15654775520 4 +tensor blk.35.ffn_up_shexp.weight 40 2048x1024 15654775552 1179648 +tensor blk.35.ffn_up_shexp.scale 0 1 15655955200 4 +tensor blk.35.attn_k.weight 40 2048x512 15655955232 589824 +tensor blk.35.attn_k.scale 0 1 15656545056 4 +tensor blk.35.attn_output.weight 40 4096x2048 15656545088 4718592 +tensor blk.35.attn_output.scale 0 1 15661263680 4 +tensor blk.35.attn_q.weight 40 2048x4096 15661263712 4718592 +tensor blk.35.attn_q.scale 0 1 15665982304 4 +tensor blk.35.attn_v.weight 40 2048x512 15665982336 589824 +tensor blk.35.attn_v.scale 0 1 15666572160 4 +tensor blk.35.ffn_down_exps.weight 40 512x2048x256 15666572192 150994944 +tensor blk.35.ffn_down_exps.scale 0 256 15817567136 1024 +tensor blk.35.ffn_gate_exps.weight 40 2048x512x256 15817568160 150994944 +tensor blk.35.ffn_gate_exps.scale 0 256 15968563104 1024 +tensor blk.35.ffn_up_exps.weight 40 2048x512x256 15968564128 150994944 +tensor blk.35.ffn_up_exps.scale 0 256 16119559072 1024 +tensor blk.36.ffn_down_shexp.weight 40 1024x2048 16119560096 1179648 +tensor blk.36.ffn_down_shexp.scale 0 1 16120739744 4 +tensor blk.36.ffn_gate_shexp.weight 40 2048x1024 16120739776 1179648 +tensor blk.36.ffn_gate_shexp.scale 0 1 16121919424 4 +tensor blk.36.ffn_up_shexp.weight 40 2048x1024 16121919456 1179648 +tensor blk.36.ffn_up_shexp.scale 0 1 16123099104 4 +tensor blk.36.attn_k.weight 40 2048x512 16123099136 589824 +tensor blk.36.attn_k.scale 0 1 16123688960 4 +tensor blk.36.attn_output.weight 40 4096x2048 16123688992 4718592 +tensor blk.36.attn_output.scale 0 1 16128407584 4 +tensor blk.36.attn_q.weight 40 2048x4096 16128407616 4718592 +tensor blk.36.attn_q.scale 0 1 16133126208 4 +tensor blk.36.attn_v.weight 40 2048x512 16133126240 589824 +tensor blk.36.attn_v.scale 0 1 16133716064 4 +tensor blk.36.ffn_down_exps.weight 40 512x2048x256 16133716096 150994944 +tensor blk.36.ffn_down_exps.scale 0 256 16284711040 1024 +tensor blk.36.ffn_gate_exps.weight 40 2048x512x256 16284712064 150994944 +tensor blk.36.ffn_gate_exps.scale 0 256 16435707008 1024 +tensor blk.36.ffn_up_exps.weight 40 2048x512x256 16435708032 150994944 +tensor blk.36.ffn_up_exps.scale 0 256 16586702976 1024 +tensor blk.37.ffn_down_shexp.weight 40 1024x2048 16586704000 1179648 +tensor blk.37.ffn_down_shexp.scale 0 1 16587883648 4 +tensor blk.37.ffn_gate_shexp.weight 40 2048x1024 16587883680 1179648 +tensor blk.37.ffn_gate_shexp.scale 0 1 16589063328 4 +tensor blk.37.ffn_up_shexp.weight 40 2048x1024 16589063360 1179648 +tensor blk.37.ffn_up_shexp.scale 0 1 16590243008 4 +tensor blk.37.attn_k.weight 40 2048x512 16590243040 589824 +tensor blk.37.attn_k.scale 0 1 16590832864 4 +tensor blk.37.attn_output.weight 40 4096x2048 16590832896 4718592 +tensor blk.37.attn_output.scale 0 1 16595551488 4 +tensor blk.37.attn_q.weight 40 2048x4096 16595551520 4718592 +tensor blk.37.attn_q.scale 0 1 16600270112 4 +tensor blk.37.attn_v.weight 40 2048x512 16600270144 589824 +tensor blk.37.attn_v.scale 0 1 16600859968 4 +tensor blk.37.ffn_down_exps.weight 40 512x2048x256 16600860000 150994944 +tensor blk.37.ffn_down_exps.scale 0 256 16751854944 1024 +tensor blk.37.ffn_gate_exps.weight 40 2048x512x256 16751855968 150994944 +tensor blk.37.ffn_gate_exps.scale 0 256 16902850912 1024 +tensor blk.37.ffn_up_exps.weight 40 2048x512x256 16902851936 150994944 +tensor blk.37.ffn_up_exps.scale 0 256 17053846880 1024 +tensor blk.38.ffn_down_shexp.weight 40 1024x2048 17053847904 1179648 +tensor blk.38.ffn_down_shexp.scale 0 1 17055027552 4 +tensor blk.38.ffn_gate_shexp.weight 40 2048x1024 17055027584 1179648 +tensor blk.38.ffn_gate_shexp.scale 0 1 17056207232 4 +tensor blk.38.ffn_up_shexp.weight 40 2048x1024 17056207264 1179648 +tensor blk.38.ffn_up_shexp.scale 0 1 17057386912 4 +tensor blk.38.attn_k.weight 40 2048x512 17057386944 589824 +tensor blk.38.attn_k.scale 0 1 17057976768 4 +tensor blk.38.attn_output.weight 40 4096x2048 17057976800 4718592 +tensor blk.38.attn_output.scale 0 1 17062695392 4 +tensor blk.38.attn_q.weight 40 2048x4096 17062695424 4718592 +tensor blk.38.attn_q.scale 0 1 17067414016 4 +tensor blk.38.attn_v.weight 40 2048x512 17067414048 589824 +tensor blk.38.attn_v.scale 0 1 17068003872 4 +tensor blk.38.ffn_down_exps.weight 40 512x2048x256 17068003904 150994944 +tensor blk.38.ffn_down_exps.scale 0 256 17218998848 1024 +tensor blk.38.ffn_gate_exps.weight 40 2048x512x256 17218999872 150994944 +tensor blk.38.ffn_gate_exps.scale 0 256 17369994816 1024 +tensor blk.38.ffn_up_exps.weight 40 2048x512x256 17369995840 150994944 +tensor blk.38.ffn_up_exps.scale 0 256 17520990784 1024 +tensor blk.39.ffn_down_shexp.weight 40 1024x2048 17520991808 1179648 +tensor blk.39.ffn_down_shexp.scale 0 1 17522171456 4 +tensor blk.39.ffn_gate_shexp.weight 40 2048x1024 17522171488 1179648 +tensor blk.39.ffn_gate_shexp.scale 0 1 17523351136 4 +tensor blk.39.ffn_up_shexp.weight 40 2048x1024 17523351168 1179648 +tensor blk.39.ffn_up_shexp.scale 0 1 17524530816 4 +tensor blk.39.attn_k.weight 40 2048x512 17524530848 589824 +tensor blk.39.attn_k.scale 0 1 17525120672 4 +tensor blk.39.attn_output.weight 40 4096x2048 17525120704 4718592 +tensor blk.39.attn_output.scale 0 1 17529839296 4 +tensor blk.39.attn_q.weight 40 2048x4096 17529839328 4718592 +tensor blk.39.attn_q.scale 0 1 17534557920 4 +tensor blk.39.attn_v.weight 40 2048x512 17534557952 589824 +tensor blk.39.attn_v.scale 0 1 17535147776 4 +tensor blk.39.ffn_down_exps.weight 40 512x2048x256 17535147808 150994944 +tensor blk.39.ffn_down_exps.scale 0 256 17686142752 1024 +tensor blk.39.ffn_gate_exps.weight 40 2048x512x256 17686143776 150994944 +tensor blk.39.ffn_gate_exps.scale 0 256 17837138720 1024 +tensor blk.39.ffn_up_exps.weight 40 2048x512x256 17837139744 150994944 +tensor blk.39.ffn_up_exps.scale 0 256 17988134688 1024 +tensor blk.40.ffn_down_shexp.weight 40 1024x2048 17988135712 1179648 +tensor blk.40.ffn_down_shexp.scale 0 1 17989315360 4 +tensor blk.40.ffn_gate_shexp.weight 40 2048x1024 17989315392 1179648 +tensor blk.40.ffn_gate_shexp.scale 0 1 17990495040 4 +tensor blk.40.ffn_up_shexp.weight 40 2048x1024 17990495072 1179648 +tensor blk.40.ffn_up_shexp.scale 0 1 17991674720 4 +tensor blk.40.attn_k.weight 40 2048x512 17991674752 589824 +tensor blk.40.attn_k.scale 0 1 17992264576 4 +tensor blk.40.attn_output.weight 40 4096x2048 17992264608 4718592 +tensor blk.40.attn_output.scale 0 1 17996983200 4 +tensor blk.40.attn_q.weight 40 2048x4096 17996983232 4718592 +tensor blk.40.attn_q.scale 0 1 18001701824 4 +tensor blk.40.attn_v.weight 40 2048x512 18001701856 589824 +tensor blk.40.attn_v.scale 0 1 18002291680 4 +tensor blk.40.ffn_down_exps.weight 40 512x2048x256 18002291712 150994944 +tensor blk.40.ffn_down_exps.scale 0 256 18153286656 1024 +tensor blk.40.ffn_gate_exps.weight 40 2048x512x256 18153287680 150994944 +tensor blk.40.ffn_gate_exps.scale 0 256 18304282624 1024 +tensor blk.40.ffn_up_exps.weight 40 2048x512x256 18304283648 150994944 +tensor blk.40.ffn_up_exps.scale 0 256 18455278592 1024 +tensor blk.41.ffn_down_shexp.weight 40 1024x2048 18455279616 1179648 +tensor blk.41.ffn_down_shexp.scale 0 1 18456459264 4 +tensor blk.41.ffn_gate_shexp.weight 40 2048x1024 18456459296 1179648 +tensor blk.41.ffn_gate_shexp.scale 0 1 18457638944 4 +tensor blk.41.ffn_up_shexp.weight 40 2048x1024 18457638976 1179648 +tensor blk.41.ffn_up_shexp.scale 0 1 18458818624 4 +tensor blk.41.attn_k.weight 40 2048x512 18458818656 589824 +tensor blk.41.attn_k.scale 0 1 18459408480 4 +tensor blk.41.attn_output.weight 40 4096x2048 18459408512 4718592 +tensor blk.41.attn_output.scale 0 1 18464127104 4 +tensor blk.41.attn_q.weight 40 2048x4096 18464127136 4718592 +tensor blk.41.attn_q.scale 0 1 18468845728 4 +tensor blk.41.attn_v.weight 40 2048x512 18468845760 589824 +tensor blk.41.attn_v.scale 0 1 18469435584 4 +tensor blk.41.ffn_down_exps.weight 40 512x2048x256 18469435616 150994944 +tensor blk.41.ffn_down_exps.scale 0 256 18620430560 1024 +tensor blk.41.ffn_gate_exps.weight 40 2048x512x256 18620431584 150994944 +tensor blk.41.ffn_gate_exps.scale 0 256 18771426528 1024 +tensor blk.41.ffn_up_exps.weight 40 2048x512x256 18771427552 150994944 +tensor blk.41.ffn_up_exps.scale 0 256 18922422496 1024 +tensor blk.42.ffn_down_shexp.weight 40 1024x2048 18922423520 1179648 +tensor blk.42.ffn_down_shexp.scale 0 1 18923603168 4 +tensor blk.42.ffn_gate_shexp.weight 40 2048x1024 18923603200 1179648 +tensor blk.42.ffn_gate_shexp.scale 0 1 18924782848 4 +tensor blk.42.ffn_up_shexp.weight 40 2048x1024 18924782880 1179648 +tensor blk.42.ffn_up_shexp.scale 0 1 18925962528 4 +tensor blk.42.attn_k.weight 40 2048x512 18925962560 589824 +tensor blk.42.attn_k.scale 0 1 18926552384 4 +tensor blk.42.attn_output.weight 40 4096x2048 18926552416 4718592 +tensor blk.42.attn_output.scale 0 1 18931271008 4 +tensor blk.42.attn_q.weight 40 2048x4096 18931271040 4718592 +tensor blk.42.attn_q.scale 0 1 18935989632 4 +tensor blk.42.attn_v.weight 40 2048x512 18935989664 589824 +tensor blk.42.attn_v.scale 0 1 18936579488 4 +tensor blk.42.ffn_down_exps.weight 40 512x2048x256 18936579520 150994944 +tensor blk.42.ffn_down_exps.scale 0 256 19087574464 1024 +tensor blk.42.ffn_gate_exps.weight 40 2048x512x256 19087575488 150994944 +tensor blk.42.ffn_gate_exps.scale 0 256 19238570432 1024 +tensor blk.42.ffn_up_exps.weight 40 2048x512x256 19238571456 150994944 +tensor blk.42.ffn_up_exps.scale 0 256 19389566400 1024 +tensor blk.43.ffn_down_shexp.weight 40 1024x2048 19389567424 1179648 +tensor blk.43.ffn_down_shexp.scale 0 1 19390747072 4 +tensor blk.43.ffn_gate_shexp.weight 40 2048x1024 19390747104 1179648 +tensor blk.43.ffn_gate_shexp.scale 0 1 19391926752 4 +tensor blk.43.ffn_up_shexp.weight 40 2048x1024 19391926784 1179648 +tensor blk.43.ffn_up_shexp.scale 0 1 19393106432 4 +tensor blk.43.attn_k.weight 40 2048x512 19393106464 589824 +tensor blk.43.attn_k.scale 0 1 19393696288 4 +tensor blk.43.attn_output.weight 40 4096x2048 19393696320 4718592 +tensor blk.43.attn_output.scale 0 1 19398414912 4 +tensor blk.43.attn_q.weight 40 2048x4096 19398414944 4718592 +tensor blk.43.attn_q.scale 0 1 19403133536 4 +tensor blk.43.attn_v.weight 40 2048x512 19403133568 589824 +tensor blk.43.attn_v.scale 0 1 19403723392 4 +tensor blk.43.ffn_down_exps.weight 40 512x2048x256 19403723424 150994944 +tensor blk.43.ffn_down_exps.scale 0 256 19554718368 1024 +tensor blk.43.ffn_gate_exps.weight 40 2048x512x256 19554719392 150994944 +tensor blk.43.ffn_gate_exps.scale 0 256 19705714336 1024 +tensor blk.43.ffn_up_exps.weight 40 2048x512x256 19705715360 150994944 +tensor blk.43.ffn_up_exps.scale 0 256 19856710304 1024 +tensor blk.44.ffn_down_shexp.weight 40 1024x2048 19856711328 1179648 +tensor blk.44.ffn_down_shexp.scale 0 1 19857890976 4 +tensor blk.44.ffn_gate_shexp.weight 40 2048x1024 19857891008 1179648 +tensor blk.44.ffn_gate_shexp.scale 0 1 19859070656 4 +tensor blk.44.ffn_up_shexp.weight 40 2048x1024 19859070688 1179648 +tensor blk.44.ffn_up_shexp.scale 0 1 19860250336 4 +tensor blk.44.attn_k.weight 40 2048x512 19860250368 589824 +tensor blk.44.attn_k.scale 0 1 19860840192 4 +tensor blk.44.attn_output.weight 40 4096x2048 19860840224 4718592 +tensor blk.44.attn_output.scale 0 1 19865558816 4 +tensor blk.44.attn_q.weight 40 2048x4096 19865558848 4718592 +tensor blk.44.attn_q.scale 0 1 19870277440 4 +tensor blk.44.attn_v.weight 40 2048x512 19870277472 589824 +tensor blk.44.attn_v.scale 0 1 19870867296 4 +tensor blk.44.ffn_down_exps.weight 40 512x2048x256 19870867328 150994944 +tensor blk.44.ffn_down_exps.scale 0 256 20021862272 1024 +tensor blk.44.ffn_gate_exps.weight 40 2048x512x256 20021863296 150994944 +tensor blk.44.ffn_gate_exps.scale 0 256 20172858240 1024 +tensor blk.44.ffn_up_exps.weight 40 2048x512x256 20172859264 150994944 +tensor blk.44.ffn_up_exps.scale 0 256 20323854208 1024 +tensor blk.45.ffn_down_shexp.weight 40 1024x2048 20323855232 1179648 +tensor blk.45.ffn_down_shexp.scale 0 1 20325034880 4 +tensor blk.45.ffn_gate_shexp.weight 40 2048x1024 20325034912 1179648 +tensor blk.45.ffn_gate_shexp.scale 0 1 20326214560 4 +tensor blk.45.ffn_up_shexp.weight 40 2048x1024 20326214592 1179648 +tensor blk.45.ffn_up_shexp.scale 0 1 20327394240 4 +tensor blk.45.attn_k.weight 40 2048x512 20327394272 589824 +tensor blk.45.attn_k.scale 0 1 20327984096 4 +tensor blk.45.attn_output.weight 40 4096x2048 20327984128 4718592 +tensor blk.45.attn_output.scale 0 1 20332702720 4 +tensor blk.45.attn_q.weight 40 2048x4096 20332702752 4718592 +tensor blk.45.attn_q.scale 0 1 20337421344 4 +tensor blk.45.attn_v.weight 40 2048x512 20337421376 589824 +tensor blk.45.attn_v.scale 0 1 20338011200 4 +tensor blk.45.ffn_down_exps.weight 40 512x2048x256 20338011232 150994944 +tensor blk.45.ffn_down_exps.scale 0 256 20489006176 1024 +tensor blk.45.ffn_gate_exps.weight 40 2048x512x256 20489007200 150994944 +tensor blk.45.ffn_gate_exps.scale 0 256 20640002144 1024 +tensor blk.45.ffn_up_exps.weight 40 2048x512x256 20640003168 150994944 +tensor blk.45.ffn_up_exps.scale 0 256 20790998112 1024 +tensor blk.46.ffn_down_shexp.weight 40 1024x2048 20790999136 1179648 +tensor blk.46.ffn_down_shexp.scale 0 1 20792178784 4 +tensor blk.46.ffn_gate_shexp.weight 40 2048x1024 20792178816 1179648 +tensor blk.46.ffn_gate_shexp.scale 0 1 20793358464 4 +tensor blk.46.ffn_up_shexp.weight 40 2048x1024 20793358496 1179648 +tensor blk.46.ffn_up_shexp.scale 0 1 20794538144 4 +tensor blk.46.attn_k.weight 40 2048x512 20794538176 589824 +tensor blk.46.attn_k.scale 0 1 20795128000 4 +tensor blk.46.attn_output.weight 40 4096x2048 20795128032 4718592 +tensor blk.46.attn_output.scale 0 1 20799846624 4 +tensor blk.46.attn_q.weight 40 2048x4096 20799846656 4718592 +tensor blk.46.attn_q.scale 0 1 20804565248 4 +tensor blk.46.attn_v.weight 40 2048x512 20804565280 589824 +tensor blk.46.attn_v.scale 0 1 20805155104 4 +tensor blk.46.ffn_down_exps.weight 40 512x2048x256 20805155136 150994944 +tensor blk.46.ffn_down_exps.scale 0 256 20956150080 1024 +tensor blk.46.ffn_gate_exps.weight 40 2048x512x256 20956151104 150994944 +tensor blk.46.ffn_gate_exps.scale 0 256 21107146048 1024 +tensor blk.46.ffn_up_exps.weight 40 2048x512x256 21107147072 150994944 +tensor blk.46.ffn_up_exps.scale 0 256 21258142016 1024 +tensor blk.47.ffn_down_shexp.weight 40 1024x2048 21258143040 1179648 +tensor blk.47.ffn_down_shexp.scale 0 1 21259322688 4 +tensor blk.47.ffn_gate_shexp.weight 40 2048x1024 21259322720 1179648 +tensor blk.47.ffn_gate_shexp.scale 0 1 21260502368 4 +tensor blk.47.ffn_up_shexp.weight 40 2048x1024 21260502400 1179648 +tensor blk.47.ffn_up_shexp.scale 0 1 21261682048 4 +tensor blk.47.attn_k.weight 40 2048x512 21261682080 589824 +tensor blk.47.attn_k.scale 0 1 21262271904 4 +tensor blk.47.attn_output.weight 40 4096x2048 21262271936 4718592 +tensor blk.47.attn_output.scale 0 1 21266990528 4 +tensor blk.47.attn_q.weight 40 2048x4096 21266990560 4718592 +tensor blk.47.attn_q.scale 0 1 21271709152 4 +tensor blk.47.attn_v.weight 40 2048x512 21271709184 589824 +tensor blk.47.attn_v.scale 0 1 21272299008 4 +tensor blk.47.ffn_down_exps.weight 40 512x2048x256 21272299040 150994944 +tensor blk.47.ffn_down_exps.scale 0 256 21423293984 1024 +tensor blk.47.ffn_gate_exps.weight 40 2048x512x256 21423295008 150994944 +tensor blk.47.ffn_gate_exps.scale 0 256 21574289952 1024 +tensor blk.47.ffn_up_exps.weight 40 2048x512x256 21574290976 150994944 +tensor blk.47.ffn_up_exps.scale 0 256 21725285920 1024 +tensor blk.48.ffn_down_shexp.weight 40 1024x2048 21725286944 1179648 +tensor blk.48.ffn_down_shexp.scale 0 1 21726466592 4 +tensor blk.48.ffn_gate_shexp.weight 40 2048x1024 21726466624 1179648 +tensor blk.48.ffn_gate_shexp.scale 0 1 21727646272 4 +tensor blk.48.ffn_up_shexp.weight 40 2048x1024 21727646304 1179648 +tensor blk.48.ffn_up_shexp.scale 0 1 21728825952 4 +tensor blk.48.attn_k.weight 40 2048x512 21728825984 589824 +tensor blk.48.attn_k.scale 0 1 21729415808 4 +tensor blk.48.attn_output.weight 40 4096x2048 21729415840 4718592 +tensor blk.48.attn_output.scale 0 1 21734134432 4 +tensor blk.48.attn_q.weight 40 2048x4096 21734134464 4718592 +tensor blk.48.attn_q.scale 0 1 21738853056 4 +tensor blk.48.attn_v.weight 40 2048x512 21738853088 589824 +tensor blk.48.attn_v.scale 0 1 21739442912 4 +tensor blk.48.ffn_down_exps.weight 40 512x2048x256 21739442944 150994944 +tensor blk.48.ffn_down_exps.scale 0 256 21890437888 1024 +tensor blk.48.ffn_gate_exps.weight 40 2048x512x256 21890438912 150994944 +tensor blk.48.ffn_gate_exps.scale 0 256 22041433856 1024 +tensor blk.48.ffn_up_exps.weight 40 2048x512x256 22041434880 150994944 +tensor blk.48.ffn_up_exps.scale 0 256 22192429824 1024 +tensor token_embd.weight 30 2048x150144 22192430848 614989824 +tensor output_norm.weight 0 2048 22807420672 8192 +tensor blk.0.attn_norm.weight 0 2048 22807428864 8192 +tensor blk.0.ffn_norm.weight 0 2048 22807437056 8192 +tensor blk.0.attn_k_norm.weight 0 128 22807445248 512 +tensor blk.0.attn_q_norm.weight 0 128 22807445760 512 +tensor blk.0.attn_sinks.weight 0 32 22807446272 128 +tensor blk.1.attn_norm.weight 0 2048 22807446400 8192 +tensor blk.1.ffn_norm.weight 0 2048 22807454592 8192 +tensor blk.1.attn_k_norm.weight 0 128 22807462784 512 +tensor blk.1.attn_q_norm.weight 0 128 22807463296 512 +tensor blk.1.attn_sinks.weight 0 32 22807463808 128 +tensor blk.2.attn_norm.weight 0 2048 22807463936 8192 +tensor blk.2.ffn_gate_inp.weight 30 2048x256 22807472128 1048576 +tensor blk.2.ffn_norm.weight 0 2048 22808520704 8192 +tensor blk.2.attn_k_norm.weight 0 128 22808528896 512 +tensor blk.2.attn_q_norm.weight 0 128 22808529408 512 +tensor blk.2.attn_sinks.weight 0 32 22808529920 128 +tensor blk.3.attn_norm.weight 0 2048 22808530048 8192 +tensor blk.3.ffn_gate_inp.weight 30 2048x256 22808538240 1048576 +tensor blk.3.ffn_norm.weight 0 2048 22809586816 8192 +tensor blk.3.attn_k_norm.weight 0 128 22809595008 512 +tensor blk.3.attn_q_norm.weight 0 128 22809595520 512 +tensor blk.3.attn_sinks.weight 0 32 22809596032 128 +tensor blk.4.attn_norm.weight 0 2048 22809596160 8192 +tensor blk.4.ffn_gate_inp.weight 30 2048x256 22809604352 1048576 +tensor blk.4.ffn_norm.weight 0 2048 22810652928 8192 +tensor blk.4.attn_k_norm.weight 0 128 22810661120 512 +tensor blk.4.attn_q_norm.weight 0 128 22810661632 512 +tensor blk.4.attn_sinks.weight 0 32 22810662144 128 +tensor blk.5.attn_norm.weight 0 2048 22810662272 8192 +tensor blk.5.ffn_gate_inp.weight 30 2048x256 22810670464 1048576 +tensor blk.5.ffn_norm.weight 0 2048 22811719040 8192 +tensor blk.5.attn_k_norm.weight 0 128 22811727232 512 +tensor blk.5.attn_q_norm.weight 0 128 22811727744 512 +tensor blk.5.attn_sinks.weight 0 32 22811728256 128 +tensor blk.6.attn_norm.weight 0 2048 22811728384 8192 +tensor blk.6.ffn_gate_inp.weight 30 2048x256 22811736576 1048576 +tensor blk.6.ffn_norm.weight 0 2048 22812785152 8192 +tensor blk.6.attn_k_norm.weight 0 128 22812793344 512 +tensor blk.6.attn_q_norm.weight 0 128 22812793856 512 +tensor blk.6.attn_sinks.weight 0 32 22812794368 128 +tensor blk.7.attn_norm.weight 0 2048 22812794496 8192 +tensor blk.7.ffn_gate_inp.weight 30 2048x256 22812802688 1048576 +tensor blk.7.ffn_norm.weight 0 2048 22813851264 8192 +tensor blk.7.attn_k_norm.weight 0 128 22813859456 512 +tensor blk.7.attn_q_norm.weight 0 128 22813859968 512 +tensor blk.7.attn_sinks.weight 0 32 22813860480 128 +tensor blk.8.attn_norm.weight 0 2048 22813860608 8192 +tensor blk.8.ffn_gate_inp.weight 30 2048x256 22813868800 1048576 +tensor blk.8.ffn_norm.weight 0 2048 22814917376 8192 +tensor blk.8.attn_k_norm.weight 0 128 22814925568 512 +tensor blk.8.attn_q_norm.weight 0 128 22814926080 512 +tensor blk.8.attn_sinks.weight 0 32 22814926592 128 +tensor blk.9.attn_norm.weight 0 2048 22814926720 8192 +tensor blk.9.ffn_gate_inp.weight 30 2048x256 22814934912 1048576 +tensor blk.9.ffn_norm.weight 0 2048 22815983488 8192 +tensor blk.9.attn_k_norm.weight 0 128 22815991680 512 +tensor blk.9.attn_q_norm.weight 0 128 22815992192 512 +tensor blk.9.attn_sinks.weight 0 32 22815992704 128 +tensor blk.10.attn_norm.weight 0 2048 22815992832 8192 +tensor blk.10.ffn_gate_inp.weight 30 2048x256 22816001024 1048576 +tensor blk.10.ffn_norm.weight 0 2048 22817049600 8192 +tensor blk.10.attn_k_norm.weight 0 128 22817057792 512 +tensor blk.10.attn_q_norm.weight 0 128 22817058304 512 +tensor blk.10.attn_sinks.weight 0 32 22817058816 128 +tensor blk.11.attn_norm.weight 0 2048 22817058944 8192 +tensor blk.11.ffn_gate_inp.weight 30 2048x256 22817067136 1048576 +tensor blk.11.ffn_norm.weight 0 2048 22818115712 8192 +tensor blk.11.attn_k_norm.weight 0 128 22818123904 512 +tensor blk.11.attn_q_norm.weight 0 128 22818124416 512 +tensor blk.11.attn_sinks.weight 0 32 22818124928 128 +tensor blk.12.attn_norm.weight 0 2048 22818125056 8192 +tensor blk.12.ffn_gate_inp.weight 30 2048x256 22818133248 1048576 +tensor blk.12.ffn_norm.weight 0 2048 22819181824 8192 +tensor blk.12.attn_k_norm.weight 0 128 22819190016 512 +tensor blk.12.attn_q_norm.weight 0 128 22819190528 512 +tensor blk.12.attn_sinks.weight 0 32 22819191040 128 +tensor blk.13.attn_norm.weight 0 2048 22819191168 8192 +tensor blk.13.ffn_gate_inp.weight 30 2048x256 22819199360 1048576 +tensor blk.13.ffn_norm.weight 0 2048 22820247936 8192 +tensor blk.13.attn_k_norm.weight 0 128 22820256128 512 +tensor blk.13.attn_q_norm.weight 0 128 22820256640 512 +tensor blk.13.attn_sinks.weight 0 32 22820257152 128 +tensor blk.14.attn_norm.weight 0 2048 22820257280 8192 +tensor blk.14.ffn_gate_inp.weight 30 2048x256 22820265472 1048576 +tensor blk.14.ffn_norm.weight 0 2048 22821314048 8192 +tensor blk.14.attn_k_norm.weight 0 128 22821322240 512 +tensor blk.14.attn_q_norm.weight 0 128 22821322752 512 +tensor blk.14.attn_sinks.weight 0 32 22821323264 128 +tensor blk.15.attn_norm.weight 0 2048 22821323392 8192 +tensor blk.15.ffn_gate_inp.weight 30 2048x256 22821331584 1048576 +tensor blk.15.ffn_norm.weight 0 2048 22822380160 8192 +tensor blk.15.attn_k_norm.weight 0 128 22822388352 512 +tensor blk.15.attn_q_norm.weight 0 128 22822388864 512 +tensor blk.15.attn_sinks.weight 0 32 22822389376 128 +tensor blk.16.attn_norm.weight 0 2048 22822389504 8192 +tensor blk.16.ffn_gate_inp.weight 30 2048x256 22822397696 1048576 +tensor blk.16.ffn_norm.weight 0 2048 22823446272 8192 +tensor blk.16.attn_k_norm.weight 0 128 22823454464 512 +tensor blk.16.attn_q_norm.weight 0 128 22823454976 512 +tensor blk.16.attn_sinks.weight 0 32 22823455488 128 +tensor blk.17.attn_norm.weight 0 2048 22823455616 8192 +tensor blk.17.ffn_gate_inp.weight 30 2048x256 22823463808 1048576 +tensor blk.17.ffn_norm.weight 0 2048 22824512384 8192 +tensor blk.17.attn_k_norm.weight 0 128 22824520576 512 +tensor blk.17.attn_q_norm.weight 0 128 22824521088 512 +tensor blk.17.attn_sinks.weight 0 32 22824521600 128 +tensor blk.18.attn_norm.weight 0 2048 22824521728 8192 +tensor blk.18.ffn_gate_inp.weight 30 2048x256 22824529920 1048576 +tensor blk.18.ffn_norm.weight 0 2048 22825578496 8192 +tensor blk.18.attn_k_norm.weight 0 128 22825586688 512 +tensor blk.18.attn_q_norm.weight 0 128 22825587200 512 +tensor blk.18.attn_sinks.weight 0 32 22825587712 128 +tensor blk.19.attn_norm.weight 0 2048 22825587840 8192 +tensor blk.19.ffn_gate_inp.weight 30 2048x256 22825596032 1048576 +tensor blk.19.ffn_norm.weight 0 2048 22826644608 8192 +tensor blk.19.attn_k_norm.weight 0 128 22826652800 512 +tensor blk.19.attn_q_norm.weight 0 128 22826653312 512 +tensor blk.19.attn_sinks.weight 0 32 22826653824 128 +tensor blk.20.attn_norm.weight 0 2048 22826653952 8192 +tensor blk.20.ffn_gate_inp.weight 30 2048x256 22826662144 1048576 +tensor blk.20.ffn_norm.weight 0 2048 22827710720 8192 +tensor blk.20.attn_k_norm.weight 0 128 22827718912 512 +tensor blk.20.attn_q_norm.weight 0 128 22827719424 512 +tensor blk.20.attn_sinks.weight 0 32 22827719936 128 +tensor blk.21.attn_norm.weight 0 2048 22827720064 8192 +tensor blk.21.ffn_gate_inp.weight 30 2048x256 22827728256 1048576 +tensor blk.21.ffn_norm.weight 0 2048 22828776832 8192 +tensor blk.21.attn_k_norm.weight 0 128 22828785024 512 +tensor blk.21.attn_q_norm.weight 0 128 22828785536 512 +tensor blk.21.attn_sinks.weight 0 32 22828786048 128 +tensor blk.22.attn_norm.weight 0 2048 22828786176 8192 +tensor blk.22.ffn_gate_inp.weight 30 2048x256 22828794368 1048576 +tensor blk.22.ffn_norm.weight 0 2048 22829842944 8192 +tensor blk.22.attn_k_norm.weight 0 128 22829851136 512 +tensor blk.22.attn_q_norm.weight 0 128 22829851648 512 +tensor blk.22.attn_sinks.weight 0 32 22829852160 128 +tensor blk.23.attn_norm.weight 0 2048 22829852288 8192 +tensor blk.23.ffn_gate_inp.weight 30 2048x256 22829860480 1048576 +tensor blk.23.ffn_norm.weight 0 2048 22830909056 8192 +tensor blk.23.attn_k_norm.weight 0 128 22830917248 512 +tensor blk.23.attn_q_norm.weight 0 128 22830917760 512 +tensor blk.23.attn_sinks.weight 0 32 22830918272 128 +tensor blk.24.attn_norm.weight 0 2048 22830918400 8192 +tensor blk.24.ffn_gate_inp.weight 30 2048x256 22830926592 1048576 +tensor blk.24.ffn_norm.weight 0 2048 22831975168 8192 +tensor blk.24.attn_k_norm.weight 0 128 22831983360 512 +tensor blk.24.attn_q_norm.weight 0 128 22831983872 512 +tensor blk.24.attn_sinks.weight 0 32 22831984384 128 +tensor blk.25.attn_norm.weight 0 2048 22831984512 8192 +tensor blk.25.ffn_gate_inp.weight 30 2048x256 22831992704 1048576 +tensor blk.25.ffn_norm.weight 0 2048 22833041280 8192 +tensor blk.25.attn_k_norm.weight 0 128 22833049472 512 +tensor blk.25.attn_q_norm.weight 0 128 22833049984 512 +tensor blk.25.attn_sinks.weight 0 32 22833050496 128 +tensor blk.26.attn_norm.weight 0 2048 22833050624 8192 +tensor blk.26.ffn_gate_inp.weight 30 2048x256 22833058816 1048576 +tensor blk.26.ffn_norm.weight 0 2048 22834107392 8192 +tensor blk.26.attn_k_norm.weight 0 128 22834115584 512 +tensor blk.26.attn_q_norm.weight 0 128 22834116096 512 +tensor blk.26.attn_sinks.weight 0 32 22834116608 128 +tensor blk.27.attn_norm.weight 0 2048 22834116736 8192 +tensor blk.27.ffn_gate_inp.weight 30 2048x256 22834124928 1048576 +tensor blk.27.ffn_norm.weight 0 2048 22835173504 8192 +tensor blk.27.attn_k_norm.weight 0 128 22835181696 512 +tensor blk.27.attn_q_norm.weight 0 128 22835182208 512 +tensor blk.27.attn_sinks.weight 0 32 22835182720 128 +tensor blk.28.attn_norm.weight 0 2048 22835182848 8192 +tensor blk.28.ffn_gate_inp.weight 30 2048x256 22835191040 1048576 +tensor blk.28.ffn_norm.weight 0 2048 22836239616 8192 +tensor blk.28.attn_k_norm.weight 0 128 22836247808 512 +tensor blk.28.attn_q_norm.weight 0 128 22836248320 512 +tensor blk.28.attn_sinks.weight 0 32 22836248832 128 +tensor blk.29.attn_norm.weight 0 2048 22836248960 8192 +tensor blk.29.ffn_gate_inp.weight 30 2048x256 22836257152 1048576 +tensor blk.29.ffn_norm.weight 0 2048 22837305728 8192 +tensor blk.29.attn_k_norm.weight 0 128 22837313920 512 +tensor blk.29.attn_q_norm.weight 0 128 22837314432 512 +tensor blk.29.attn_sinks.weight 0 32 22837314944 128 +tensor blk.30.attn_norm.weight 0 2048 22837315072 8192 +tensor blk.30.ffn_gate_inp.weight 30 2048x256 22837323264 1048576 +tensor blk.30.ffn_norm.weight 0 2048 22838371840 8192 +tensor blk.30.attn_k_norm.weight 0 128 22838380032 512 +tensor blk.30.attn_q_norm.weight 0 128 22838380544 512 +tensor blk.30.attn_sinks.weight 0 32 22838381056 128 +tensor blk.31.attn_norm.weight 0 2048 22838381184 8192 +tensor blk.31.ffn_gate_inp.weight 30 2048x256 22838389376 1048576 +tensor blk.31.ffn_norm.weight 0 2048 22839437952 8192 +tensor blk.31.attn_k_norm.weight 0 128 22839446144 512 +tensor blk.31.attn_q_norm.weight 0 128 22839446656 512 +tensor blk.31.attn_sinks.weight 0 32 22839447168 128 +tensor blk.32.attn_norm.weight 0 2048 22839447296 8192 +tensor blk.32.ffn_gate_inp.weight 30 2048x256 22839455488 1048576 +tensor blk.32.ffn_norm.weight 0 2048 22840504064 8192 +tensor blk.32.attn_k_norm.weight 0 128 22840512256 512 +tensor blk.32.attn_q_norm.weight 0 128 22840512768 512 +tensor blk.32.attn_sinks.weight 0 32 22840513280 128 +tensor blk.33.attn_norm.weight 0 2048 22840513408 8192 +tensor blk.33.ffn_gate_inp.weight 30 2048x256 22840521600 1048576 +tensor blk.33.ffn_norm.weight 0 2048 22841570176 8192 +tensor blk.33.attn_k_norm.weight 0 128 22841578368 512 +tensor blk.33.attn_q_norm.weight 0 128 22841578880 512 +tensor blk.33.attn_sinks.weight 0 32 22841579392 128 +tensor blk.34.attn_norm.weight 0 2048 22841579520 8192 +tensor blk.34.ffn_gate_inp.weight 30 2048x256 22841587712 1048576 +tensor blk.34.ffn_norm.weight 0 2048 22842636288 8192 +tensor blk.34.attn_k_norm.weight 0 128 22842644480 512 +tensor blk.34.attn_q_norm.weight 0 128 22842644992 512 +tensor blk.34.attn_sinks.weight 0 32 22842645504 128 +tensor blk.35.attn_norm.weight 0 2048 22842645632 8192 +tensor blk.35.ffn_gate_inp.weight 30 2048x256 22842653824 1048576 +tensor blk.35.ffn_norm.weight 0 2048 22843702400 8192 +tensor blk.35.attn_k_norm.weight 0 128 22843710592 512 +tensor blk.35.attn_q_norm.weight 0 128 22843711104 512 +tensor blk.35.attn_sinks.weight 0 32 22843711616 128 +tensor blk.36.attn_norm.weight 0 2048 22843711744 8192 +tensor blk.36.ffn_gate_inp.weight 30 2048x256 22843719936 1048576 +tensor blk.36.ffn_norm.weight 0 2048 22844768512 8192 +tensor blk.36.attn_k_norm.weight 0 128 22844776704 512 +tensor blk.36.attn_q_norm.weight 0 128 22844777216 512 +tensor blk.36.attn_sinks.weight 0 32 22844777728 128 +tensor blk.37.attn_norm.weight 0 2048 22844777856 8192 +tensor blk.37.ffn_gate_inp.weight 30 2048x256 22844786048 1048576 +tensor blk.37.ffn_norm.weight 0 2048 22845834624 8192 +tensor blk.37.attn_k_norm.weight 0 128 22845842816 512 +tensor blk.37.attn_q_norm.weight 0 128 22845843328 512 +tensor blk.37.attn_sinks.weight 0 32 22845843840 128 +tensor blk.38.attn_norm.weight 0 2048 22845843968 8192 +tensor blk.38.ffn_gate_inp.weight 30 2048x256 22845852160 1048576 +tensor blk.38.ffn_norm.weight 0 2048 22846900736 8192 +tensor blk.38.attn_k_norm.weight 0 128 22846908928 512 +tensor blk.38.attn_q_norm.weight 0 128 22846909440 512 +tensor blk.38.attn_sinks.weight 0 32 22846909952 128 +tensor blk.39.attn_norm.weight 0 2048 22846910080 8192 +tensor blk.39.ffn_gate_inp.weight 30 2048x256 22846918272 1048576 +tensor blk.39.ffn_norm.weight 0 2048 22847966848 8192 +tensor blk.39.attn_k_norm.weight 0 128 22847975040 512 +tensor blk.39.attn_q_norm.weight 0 128 22847975552 512 +tensor blk.39.attn_sinks.weight 0 32 22847976064 128 +tensor blk.40.attn_norm.weight 0 2048 22847976192 8192 +tensor blk.40.ffn_gate_inp.weight 30 2048x256 22847984384 1048576 +tensor blk.40.ffn_norm.weight 0 2048 22849032960 8192 +tensor blk.40.attn_k_norm.weight 0 128 22849041152 512 +tensor blk.40.attn_q_norm.weight 0 128 22849041664 512 +tensor blk.40.attn_sinks.weight 0 32 22849042176 128 +tensor blk.41.attn_norm.weight 0 2048 22849042304 8192 +tensor blk.41.ffn_gate_inp.weight 30 2048x256 22849050496 1048576 +tensor blk.41.ffn_norm.weight 0 2048 22850099072 8192 +tensor blk.41.attn_k_norm.weight 0 128 22850107264 512 +tensor blk.41.attn_q_norm.weight 0 128 22850107776 512 +tensor blk.41.attn_sinks.weight 0 32 22850108288 128 +tensor blk.42.attn_norm.weight 0 2048 22850108416 8192 +tensor blk.42.ffn_gate_inp.weight 30 2048x256 22850116608 1048576 +tensor blk.42.ffn_norm.weight 0 2048 22851165184 8192 +tensor blk.42.attn_k_norm.weight 0 128 22851173376 512 +tensor blk.42.attn_q_norm.weight 0 128 22851173888 512 +tensor blk.42.attn_sinks.weight 0 32 22851174400 128 +tensor blk.43.attn_norm.weight 0 2048 22851174528 8192 +tensor blk.43.ffn_gate_inp.weight 30 2048x256 22851182720 1048576 +tensor blk.43.ffn_norm.weight 0 2048 22852231296 8192 +tensor blk.43.attn_k_norm.weight 0 128 22852239488 512 +tensor blk.43.attn_q_norm.weight 0 128 22852240000 512 +tensor blk.43.attn_sinks.weight 0 32 22852240512 128 +tensor blk.44.attn_norm.weight 0 2048 22852240640 8192 +tensor blk.44.ffn_gate_inp.weight 30 2048x256 22852248832 1048576 +tensor blk.44.ffn_norm.weight 0 2048 22853297408 8192 +tensor blk.44.attn_k_norm.weight 0 128 22853305600 512 +tensor blk.44.attn_q_norm.weight 0 128 22853306112 512 +tensor blk.44.attn_sinks.weight 0 32 22853306624 128 +tensor blk.45.attn_norm.weight 0 2048 22853306752 8192 +tensor blk.45.ffn_gate_inp.weight 30 2048x256 22853314944 1048576 +tensor blk.45.ffn_norm.weight 0 2048 22854363520 8192 +tensor blk.45.attn_k_norm.weight 0 128 22854371712 512 +tensor blk.45.attn_q_norm.weight 0 128 22854372224 512 +tensor blk.45.attn_sinks.weight 0 32 22854372736 128 +tensor blk.46.attn_norm.weight 0 2048 22854372864 8192 +tensor blk.46.ffn_gate_inp.weight 30 2048x256 22854381056 1048576 +tensor blk.46.ffn_norm.weight 0 2048 22855429632 8192 +tensor blk.46.attn_k_norm.weight 0 128 22855437824 512 +tensor blk.46.attn_q_norm.weight 0 128 22855438336 512 +tensor blk.46.attn_sinks.weight 0 32 22855438848 128 +tensor blk.47.attn_norm.weight 0 2048 22855438976 8192 +tensor blk.47.ffn_gate_inp.weight 30 2048x256 22855447168 1048576 +tensor blk.47.ffn_norm.weight 0 2048 22856495744 8192 +tensor blk.47.attn_k_norm.weight 0 128 22856503936 512 +tensor blk.47.attn_q_norm.weight 0 128 22856504448 512 +tensor blk.47.attn_sinks.weight 0 32 22856504960 128 +tensor blk.48.attn_norm.weight 0 2048 22856505088 8192 +tensor blk.48.ffn_gate_inp.weight 30 2048x256 22856513280 1048576 +tensor blk.48.ffn_norm.weight 0 2048 22857561856 8192 +tensor blk.48.attn_k_norm.weight 0 128 22857570048 512 +tensor blk.48.attn_q_norm.weight 0 128 22857570560 512 +tensor blk.48.attn_sinks.weight 0 32 22857571072 128 +type 0 tensors 731 elements 253304 bytes 1013216 +type 30 tensors 48 elements 332136448 bytes 664272896 +type 40 tensors 485 elements 39452934144 bytes 22192275456 +data used 22857561568 padded 22857571200 +quant file_type 39 quantization_version 2 +tokenizer bos 150000 eos 150001 diff --git a/om/flint/test/gguf-synth-report.txt b/om/flint/test/gguf-synth-report.txt new file mode 100644 index 00000000..3e736c50 --- /dev/null +++ b/om/flint/test/gguf-synth-report.txt @@ -0,0 +1,38 @@ +gguf version 3 tensors 4 kvs 27 alignment 32 data 1248 bytes 2080 +kv general.architecture string 5 flint +kv general.alignment u32 32 +kv general.name string 22 Synthetic GGUF fixture +kv general.file_type u32 39 +kv general.quantization_version u32 2 +kv t.u8 u8 200 +kv t.i8 i8 -5 +kv t.u16 u16 60000 +kv t.i16 i16 -300 +kv t.u32 u32 4000000000 +kv t.i32 i32 -70000 +kv t.f32 f32 bits 1069547520 +kv t.bool bool 1 +kv t.u64 u64 1099511627779 +kv t.i64 i64 -1099511627776 +kv t.f64 f64 bits 4598175219545276416 +kv t.long string 100 +kv t.tab string 3 +kv t.au8 array u8 3 sum 6 values 1 2 3 +kv t.ai32 array i32 3 sum 150007 values 150001 -1 7 +kv t.af32 array f32 2 sum 2139095040 values 1065353216 1073741824 +kv t.abool array bool 3 sum 2 values 1 0 1 +kv t.astr array string 2 bytes 5 +kv t.ai64 array i64 10 sum -5 +kv t.aempty array u32 0 sum 0 +kv tokenizer.ggml.bos_token_id u32 1 +kv tokenizer.ggml.eos_token_id u32 2 +tensor a.weight 40 128x2 0 144 +tensor a.scale 0 1 160 4 +tensor b.weight 30 64x3 192 384 +tensor c.weight 0 16x2x2 576 256 +type 0 tensors 2 elements 65 bytes 260 +type 30 tensors 1 elements 192 bytes 384 +type 40 tensors 1 elements 256 bytes 144 +data used 788 padded 832 +quant file_type 39 quantization_version 2 +tokenizer bos 1 eos 2 diff --git a/om/flint/test/ggufgen.py b/om/flint/test/ggufgen.py new file mode 100755 index 00000000..e32c2b7e --- /dev/null +++ b/om/flint/test/ggufgen.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +"""Synthetic GGUF v3 fixtures for om/flint/gguf.om (Core #834). Standard library only. + + ggufgen.py OUT CASE writes the GGUF file OUT for CASE (see CASES) + +"base" is a valid file: every scalar value type 0..12, arrays of six element types (one empty), +general.alignment, and four tensors (NVFP4, its F32 .scale, BF16, a rank-3 F32) laid out the way +ggml's gguf writer lays them out (data section aligned, each tensor padded to the alignment). +Every other case changes one thing so that exactly one guard of gguf.om must refuse it. +""" +import struct +import sys + +ALIGN = 32 +# ggml type: (block elements, block bytes) at llama.cpp b11804 (ggml.c type_traits) +TYPES = {0: (1, 4), 30: (1, 2), 40: (64, 36)} + + +def gstr(b): + return struct.pack("/gguf-py). The two module files the report +depends on are checked against their sha256 at that commit before anything is read. +Format (one line each, file order for kv and tensor lines): + gguf version V tensors T kvs K alignment A data D bytes F + kv KEY u8|i8|u16|i16|u32|i32|u64|i64 VALUE | f32|f64 bits B | bool 0|1 + kv KEY string LEN [TEXT] TEXT when 1 <= LEN <= 64 and every byte is 32..126 + kv KEY array ETYPE N bytes B string elements: B = total string bytes + kv KEY array ETYPE N sum S [values ..] numbers (float: their bits), values when N <= 8 + tensor NAME TYPE D0xD1.. OFFSET NBYTES dims innermost first, OFFSET within the data section + type ID tensors N elements E bytes B ascending ggml type id + data used U padded P + quant file_type X quantization_version Y (none when absent) + tokenizer bos X eos Y (none when absent) +""" +import hashlib +import os +import sys + +PIN = { + "gguf_reader.py": "d0ea743200e19d7ef0a4c969edcc4a6dba8e3656a790b217e3bdc7b31170718e", + "constants.py": "8d82aa2afea617f2ce1c9775fdad16dbb5a1dfa51261250d0d8918a78557bb3f", +} +TNAME = ["u8", "i8", "u16", "i16", "u32", "i32", "f32", "bool", "string", "array", "u64", "i64", "f64"] +SIGNED = {1, 3, 5, 11} +FLOAT = {6: " 0: + s += " values " + " ".join(str(v) for v in vals) + return s + v = num(f.parts[-1], t) + if t in FLOAT: + return "kv %s %s bits %d" % (k, TNAME[t], v) + return "kv %s %s %d" % (k, TNAME[t], v) + + +def scalar(r, k): + f = r.fields.get(k) + if f is None or int(f.types[0]) in (8, 9): + return "none" + return str(num(f.parts[-1], int(f.types[0]))) + + +def report(path): + gguf = pinned() + r = gguf.GGUFReader(path) + a = r.alignment + out = [] + ver = int(r.fields["GGUF.version"].parts[-1][0]) + kvs = [(k, f) for k, f in r.fields.items() if not k.startswith("GGUF.")] + out.append("gguf version %d tensors %d kvs %d alignment %d data %d bytes %d" + % (ver, len(r.tensors), len(kvs), a, r.data_offset, os.path.getsize(path))) + for k, f in kvs: + out.append(kvline(k, f)) + types = {} + used = padded = 0 + for t in r.tensors: + ty = int(t.tensor_type) + nb = int(t.n_bytes) + out.append("tensor %s %d %s %d %d" % (t.name, ty, "x".join(str(int(d)) for d in t.shape), + int(t.data_offset) - r.data_offset, nb)) + c = types.setdefault(ty, [0, 0, 0]) + c[0] += 1 + c[1] += int(t.n_elements) + c[2] += nb + used += nb + padded += (nb + a - 1) // a * a + for ty in sorted(types): + out.append("type %d tensors %d elements %d bytes %d" % (ty, *types[ty])) + out.append("data used %d padded %d" % (used, padded)) + out.append("quant file_type %s quantization_version %s" + % (scalar(r, "general.file_type"), scalar(r, "general.quantization_version"))) + out.append("tokenizer bos %s eos %s" + % (scalar(r, "tokenizer.ggml.bos_token_id"), scalar(r, "tokenizer.ggml.eos_token_id"))) + sys.stdout.write("\n".join(out) + "\n") + + +if __name__ == "__main__": + if len(sys.argv) == 3 and sys.argv[1] == "report": + report(sys.argv[2]) + else: + sys.exit("usage: ggufref.py report GGUF") From 1a7d91fcdbe367c7824733b791cb7307a7d8b903 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 30 Oct 2026 13:34:55 -0500 Subject: [PATCH 2/4] om/flint: derive and freeze the NVFP4 dequant tolerance before any full comparison (Refs #834) --- .crumb | 10 +++++----- om/flint/README.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.crumb b/.crumb index 84995eff..7885e73a 100644 --- a/.crumb +++ b/.crumb @@ -125,14 +125,14 @@ } ], "children_root": "sha256:05d34c0deec7c4a6cd3aa12640dca0c20bd8b2d4a4df809b234090822f422b4f", - "compiled_at": "2026-10-30T18:31:03Z", + "compiled_at": "2026-10-30T18:34:55Z", "compiler": "crumb-compile/1", - "digest": "sha256:94b6783f638710770517c352b5995e8a7f0e2df4fc7b5565bc39b985d273633a", + "digest": "sha256:64f7dfb9c81d6551c2f7d005f2c288eb0fe82ee77a1e8a7aa79073f7cea18323", "evidence_files": 3602, "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b", - "files": 8111, - "generated_at_commit": "fceadf514f8421e9119762f6723f872696dd12bd", - "source_tree": "sha256:a2564e3a8ac47b85b5be5a7c9ff16bc2e5eec221ba96ccfab43a18c46db98969" + "files": 8116, + "generated_at_commit": "dc0205ddad2127096b41cb3b89514702e872dc37", + "source_tree": "sha256:24699ed02c66a617f739eef87bf7dd2b43e77d90981765d4d806c33f9a4a998d" } }, "history": [], diff --git a/om/flint/README.md b/om/flint/README.md index 8971614e..acc47bcf 100644 --- a/om/flint/README.md +++ b/om/flint/README.md @@ -260,6 +260,37 @@ Each is NOT_RUN when unset. NOT_RUN for this unit: the name map and shape cross- the safetensors inventory, the totals reconciliation, NVFP4 block dequantization against the BF16 shards, and any serving or GPU evidence. +### NVFP4 dequantization tolerance (derived from the format before any full comparison) + +ggml b11804 (`dequantize_row_nvfp4` in `ggml/src/ggml-quants.c`, `ggml_ue4m3_to_fp32` in +`ggml-impl.h`) decodes one 36-byte block of 64 elements as four 16-element sub-blocks: +`y[16s + j] = E2M1(qs[8s + j] & 15) · ue(d[s])` and `y[16s + j + 8] = E2M1(qs[8s + j] >> 4) · ue(d[s])` +for j < 8. Here E2M1 is the value set ±{0, 0.5, 1, 1.5, 2, 3, 4, 6}. ue(x) is 0 for x = 0 or 127. Otherwise, with +e = (x >> 3) & 15 and m = x & 7, it is m · 2^-9 when e = 0 and (1 + m/8) · 2^(e-7) when e > 0. The +llama.cpp graph multiplies by the tensor's F32 `.scale` (one value, or one per expert for `_exps`). +So the dequantized weight is ŵ = q · D with D = ue(d[s]) · scale. + +The bound for a reference BF16 weight w is + + |w - ŵ| <= 1 · D + max(0, |w| - 6 · D) + 2^-8 · |w| + +It has three terms: + +- **1 · D:** a nearest-value quantizer's worst error on the E2M1 grid is half the largest grid gap. + The largest gap is the top binade, 4 to 6. + Wolfram: `g={0,1/2,1,3/2,2,3,4,6}; {Max[Differences[g]]/2, Position[Differences[g], Max[Differences[g]]]}` → `{1, {{7}}}`. +- **max(0, |w| - 6 · D):** clipping. When the E4M3 sub-scale was rounded down, the block's largest + value lies beyond 6 · D. +- **2^-8 · |w|:** the rounding of the reference to BF16 (8-bit significand, unit roundoff 2^-8). + Wolfram: `2^(1-8)/2` → `1/256`. + +The comparison is in f64. q · ue · scale is exact there (significand bits: 2 + 4 + 24 = 30, at most 53). + +The pass rule is zero violations over the sampled blocks. The bound was fixed and committed before +the full comparison. An earlier 30-block probe (max 1.031 · D, without the 2^-8 term) was +exploratory, and the bound does not use it. If real tensors exceed the bound, the gate reports +FAIL with the numbers; the bound is not loosened. + ## Complete bounded host forward `FLINT_FORWARD=1` adds a full 49-layer chained computation to the same check command. From b38aef37a9ad9fc88ab2d9d897cb1d19e67c252d Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 30 Oct 2026 13:53:38 -0500 Subject: [PATCH 3/4] flint gguf: map and deq modes (Core #834 item 7) map: GGUF->HF name map, transposed shapes, expert stacking, scale siblings and pinned totals against the 36734-row inventory (74-79). deq: sampled NVFP4 blocks (seed 834 LCG), F32/BF16 bit equality, under the bound frozen in 1a7d91fc. On the serving file deq FAILS: 7782 of 18657280 sampled values over the bound (worst 1.394x) and 48 of 241440 unquantized values differ, so the GGUF was not built from the 2a247be0 weights bit for bit. Bound not loosened. --- .crumb | 8 +- om/flint/README.md | 98 ++++- om/flint/check.sh | 61 ++- om/flint/gguf.om | 1033 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 1190 insertions(+), 10 deletions(-) diff --git a/.crumb b/.crumb index 7885e73a..4d9651de 100644 --- a/.crumb +++ b/.crumb @@ -125,14 +125,14 @@ } ], "children_root": "sha256:05d34c0deec7c4a6cd3aa12640dca0c20bd8b2d4a4df809b234090822f422b4f", - "compiled_at": "2026-10-30T18:34:55Z", + "compiled_at": "2026-10-30T18:53:37Z", "compiler": "crumb-compile/1", - "digest": "sha256:64f7dfb9c81d6551c2f7d005f2c288eb0fe82ee77a1e8a7aa79073f7cea18323", + "digest": "sha256:b27cd965bfdb741a5a14dd5a34ebdf78326926a5b62fe484a46f8f6e4190a390", "evidence_files": 3602, "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b", "files": 8116, - "generated_at_commit": "dc0205ddad2127096b41cb3b89514702e872dc37", - "source_tree": "sha256:24699ed02c66a617f739eef87bf7dd2b43e77d90981765d4d806c33f9a4a998d" + "generated_at_commit": "1a7d91fcdbe367c7824733b791cb7307a7d8b903", + "source_tree": "sha256:81e437da507a2544c51946a4b760bef10d5fbed9bb891491e65c7e2ae8826d7b" } }, "history": [], diff --git a/om/flint/README.md b/om/flint/README.md index acc47bcf..ba07df90 100644 --- a/om/flint/README.md +++ b/om/flint/README.md @@ -234,7 +234,7 @@ routers), 731 F32 (type 0: norms, sinks and the 485 NVFP4 `.scale` tensors). | code | reason | cause | |---|---|---| -| 2 | usage | not `report GGUF` | +| 2 | usage | not `report GGUF`, `map GGUF TSV` or `deq GGUF TSV SHARD_DIR` | | 3 | io | open, stat, read or close failed | | 4 | not-regular-file | directory, symlink (O_NOFOLLOW) or device | | 60 | gguf-truncated | the header ends before a field it declares | @@ -251,14 +251,104 @@ routers), 731 F32 (type 0: norms, sinks and the 485 NVFP4 `.scale` tensors). | 71 | tensor-tiling | offset not the padded end of the previous tensor, or bytes after the last | | 72 | header-capacity | header over 16 MiB, more than 4096 tensors, 1024 keys or 999999 array elements | | 73 | output-capacity | report over 4 MiB | +| 74 | inventory-tsv | a TSV row not `name shard BF16 R[xC] begin end`, end - begin not 2 · elements, a duplicate name, over 8 MiB or 65536 rows | +| 75 | name-map | a GGUF tensor name with no rule below | +| 76 | tensor-class | GGUF type or dims not those of the tensor's class, or the transposed shape differs from the TSV | +| 77 | coverage | a mapped name absent from the TSV, a TSV row named twice, or a TSV row never named | +| 78 | scale-sibling | an NVFP4 `X.weight` without an F32 `X.scale` of [1] (or [ne2] for `_exps`), or #scales ≠ #NVFP4 | +| 79 | totals | TSV, GGUF or routed element totals differ from the pinned ones | Gate arm 6 of `check.sh`: the synthetic report equals the referee's; usage, absent file, directory and symlink refusals; 20 refusal fixtures; 13 guard mutants (each `gg_die N` removed must stop its fixture producing N) and an O_NOFOLLOW mutant. `FLINT_GGUF=file` compares the serving report with the frozen one; `FLINT_GGUF_PY=cmd` reruns the referee on both files. -Each is NOT_RUN when unset. NOT_RUN for this unit: the name map and shape cross-check against -the safetensors inventory, the totals reconciliation, NVFP4 block dequantization against the -BF16 shards, and any serving or GPU evidence. +Each is NOT_RUN when unset. + +### Map: GGUF tensors against the safetensors inventory + +`flint-gguf map GGUF TSV` reads the GGUF header and the TSV that `manifest.om` writes from the +shard headers (the `FLINT_SHARDS` arm's `real.tsv`, sha `TSV_PIN`). Every GGUF tensor whose name +does not end in `.scale` gets one Hugging Face name; a stacked `_exps` tensor gets one name per +routed expert e < ne2. The rules (`blk.N.` becomes `model.layers.N.`): + +| GGUF | HF | class | +|---|---|---| +| `token_embd.weight` | `model.embed_tokens.weight` | BF16 matrix | +| `output_norm.weight` | `model.norm.weight` | F32 vector | +| `output.weight` | `lm_head.weight` | NVFP4 matrix | +| `attn_norm` / `ffn_norm` | `input_layernorm` / `post_attention_layernorm` | F32 vector | +| `attn_q` / `attn_k` / `attn_v` / `attn_output` | `self_attn.q_proj` / `k_proj` / `v_proj` / `o_proj` | NVFP4 matrix | +| `attn_q_norm` / `attn_k_norm` | `self_attn.q_norm` / `k_norm` | F32 vector | +| `attn_sinks.weight` | `self_attn.softmax_offset` | F32 vector | +| `ffn_gate` / `ffn_up` / `ffn_down` | `mlp.gate_proj` / `up_proj` / `down_proj` | NVFP4 matrix | +| `ffn_gate_inp` | `mlp.gate` | BF16 matrix | +| `ffn_{gate,up,down}_shexp` | `mlp.shared_expert.{gate,up,down}_proj` | NVFP4 matrix | +| `ffn_{gate,up,down}_exps`, expert e | `mlp.experts.e.{gate,up,down}_proj` | NVFP4, 3 dims | + +(`.weight` is kept on both sides except `softmax_offset`.) An F32 vector has 1 dim, type 0 and +ne0 = the HF length; a matrix has 2 dims (3 for `_exps`), type 30 (BF16) or 40 (NVFP4), and +HF shape [ne1, ne0]: GGUF ne0 is the HF column count, so the row-major HF matrix and the GGUF +rows are in the same order. Each name must hit exactly one TSV row, every TSV row must be hit, +each NVFP4 tensor needs its `.scale` sibling, and the totals are pinned: 39785287456 elements +(Wolfram `216864+332136448+39452934144` → 39785287456, the F32, BF16 and NVFP4 sums) and +37849399296 routed (Wolfram `141*256*512*2048` → 37849399296). The serving file gives +`map units 36734 tensors 779 scales 485 elements 39785287456 routed 37849399296`: 638 plain +tensors plus 141 `_exps` tensors × 256 experts = 36734 units, the TSV's row count. + +### Deq: sampled NVFP4 blocks against the BF16 shards + +`flint-gguf deq GGUF TSV SHARD_DIR` runs map, then compares GGUF data with the BF16 bytes of +each unit's TSV row (the shard file `SHARD_DIR/`, offset 8 + header length + begin): + +- F32 vectors: every value; the GGUF f32 must equal the BF16 value widened, bit for bit. +- BF16 matrices: 8 sampled 64-value chunks per tensor, byte for byte. +- NVFP4 units (tensors, and each expert slice): 8 sampled 36-byte blocks per unit, each of its + 64 values under the frozen bound below. The block of row r, block k of expert e is at + `offset + e · (ne0 · ne1 / 64 · 36) + (r · ne0/64 + k) · 36`; the scale is the F32 at + `.scale` offset + 4e. + +Sample k of a unit: k = 0 is row 0 block 0, k = 1 the last row's last block, k = 2..7 come from +the 64-bit LCG x ← x · 6364136223846793005 + 1442695040888963407 (seed 834 once, continued over +units in GGUF tensor order, then expert order) with row = (x >> 33) mod rows and block = +(x >> 11) mod (ne0/64). The output line is `deq units U blocks B elements N violations V +strict S worst_ppm W exact X mismatches M PASS|FAIL`: strict counts values over the bound +without its BF16 term, worst_ppm is the largest |w − ŵ| / bound × 10^6, exact and mismatches +count the F32 and BF16 values compared bit for bit. A violation also prints the first one +(tensor, expert, row, column, |w − ŵ| / D and bound / D in ppm). FAIL exits 1. + +Gate arm 6, when `FLINT_GGUF` and the TSV are present: the map line; three TSV mutants on +`model.layers.2.mlp.experts.0.down_proj.weight` (row dropped → 77, shape 512x2048 → 76, dtype +F16 → 74); the synthetic GGUF → 75; source mutants expert-dup (`gg_hu or e 1` → 77) and totals +(→ 79). With `FLINT_SHARDS` too: deq must PASS, and three source mutants must FAIL it with at +least ten times the unmutated run's violations (and at least 1000), so a failing unmutated run +cannot pass them by default: expert-swap (`gg_hu sub 255 e`, which still maps), +nibble-hi-for-lo (the low nibble decoded from the high one) and scale-order (sub-scales of a +block read in reverse). Not covered: the unsampled NVFP4 blocks (291520 of 616452096 are +sampled; Wolfram `N[291520/(39452934144/64)*100, 4]` → 0.04729 %), serving or GPU evidence. + +### Observed on the serving file: deq FAILS against `flint-2a247be0` + +Run on 2026-10-30 (host, cores 0-4, 62 s, 24 MB RSS): + + deq units 36734 blocks 291520 elements 18657280 violations 7782 strict 19841 worst_ppm 1394455 exact 241440 mismatches 48 FAIL + first_violation blk.0.attn_q.weight expert 0 row 2566 col 1841 err_over_d_ppm 1022222 bound_over_d_ppm 1019444 + +7782 of 18657280 sampled NVFP4 values exceed the frozen bound (Wolfram → 0.04171 %), the worst by +1.394 × the bound. The bound stays as committed. The cause is the reference, not the decoder: +48 of the 241440 values that need no quantization (F32 norms and sinks, BF16 router and +embedding chunks) differ from the shards bit for bit, which no NVFP4 decode can cause. A +throwaway numpy probe over whole tensors (not part of the gate) found 7983313 of 307494912 +`token_embd` values different (Wolfram → 2.596 %), differing elements in `output_norm` (7 of +2048), and in `attn_q_norm`, `attn_k_norm` and `attn_sinks` of layers 19, 20, 28, 32, 34, 35, +38 and 48 (one to four each, e.g. 0.00098419 against 0.00086594 in layer 28's k norm); all 47 +routers equal. On `blk.0.attn_q.weight` the violators all sit at the 4/6 rounding midpoint +(|w/D| from 4.74 to 5.19, decoded as 4 or 6); requantizing the shard weights to the nearest +E2M1 value agrees with 98.17 % of the file's codes; the block maximum over 6 · D has median +1.0007. So the GGUF was quantized from weights close to, but not equal to, the released +checkpoint (`RecursiveSI/flint` has one revision, 2a247be0; the GGUF is +`RecursiveSI/flint-nvfp4-gguf@6ec43e19`). The tie from the serving file to the checked weights +is therefore exact for names, shapes, layout and totals, and approximate (not within the frozen +bound) for values. ### NVFP4 dequantization tolerance (derived from the format before any full comparison) diff --git a/om/flint/check.sh b/om/flint/check.sh index 528754a9..3dc244e8 100755 --- a/om/flint/check.sh +++ b/om/flint/check.sh @@ -303,6 +303,7 @@ GG_SYN_PIN=6a1f3670e45718338c82551237e0b1fc7a0c922a0c92ee52d4c0bb91342b6baa GG_REP_PIN=cbd3becec35ff580cb16db5789bf5a73cd56b775109cb193ce8ad3ffd00b3851 GG_SUM='flint-gguf ok tensors 4 kvs 27 bytes 2080' GG_REAL_SUM='flint-gguf ok tensors 1264 kvs 43 bytes 22863084160' +GG_MAP='map units 36734 tensors 779 scales 485 elements 39785287456 routed 37849399296' ggen() { python3 "$here/test/ggufgen.py" "$b/g.gguf" "$1" < /dev/null; } grun() { # binary [file]; sets rc, leaves g.out and g.err timeout 120 "$1" report "${2:-$b/g.gguf}" > "$b/g.out" 2> "$b/g.err" < /dev/null @@ -326,7 +327,7 @@ else else bad "gguf base: rc $rc, $(head -c 200 "$b/g.err") $(cmp "$b/g.out" "$here/test/gguf-synth-report.txt" 2>&1 | head -c 200)" fi - for args in "" "report" "report a b" "frob $b/g.gguf" "report $b/g.gguf x y z"; do + for args in "" "report" "report a b" "frob $b/g.gguf" "report $b/g.gguf x y z" "map $b/g.gguf" "map $b/g.gguf a b" "deq $b/g.gguf a"; do # shellcheck disable=SC2086 "$b/gg" $args > "$b/u.out" 2> /dev/null < /dev/null r=$? @@ -414,6 +415,64 @@ GGUF_GUARDS else echo "NOT_RUN FLINT_GGUF_PY (interpreter with llama.cpp b11804 gguf-py; frozen reports used)" fi + # map: every non-scale GGUF tensor (each routed expert slice of an _exps tensor on its own) + # names exactly one row of the FLINT_SHARDS arm's TSV with the transposed shape, every row is + # named once, every NVFP4 tensor has its F32 .scale sibling, and the totals are the pinned ones. + # deq: the sampled NVFP4 blocks against the BF16 shards under the frozen README bound. + if [ -n "${FLINT_GGUF:-}" ] && [ -s "$b/real.tsv" ]; then + gmap() { # binary tsv [gguf]; sets rc, leaves m.out and m.err + timeout 120 "$1" map "${3:-$FLINT_GGUF}" "$2" > "$b/m.out" 2> "$b/m.err" < /dev/null + rc=$? + } + gsite() { # name from to; writes $b/gmut.om when the site occurs on exactly one line + if [ "$(grep -cF -- "$2" "$here/gguf.om")" != 1 ]; then bad "gguf mutant $1: site must occur exactly once"; return 1; fi + printf '%s\n' "${gs//"$2"/"$3"}" > "$b/gmut.om" + build "$b/gmut" "$b/gmut.om" || { bad "gguf mutant $1: does not compile"; return 1; } + } + gmap "$b/gg" "$b/real.tsv" + if [ "$rc" = 0 ] && [ "$(cat "$b/m.out")" = "$GG_MAP" ]; then ok "gguf map: $GG_MAP"; else bad "gguf map: rc $rc, $(head -c 200 "$b/m.err") $(head -c 200 "$b/m.out")"; fi + xn='model.layers.2.mlp.experts.0.down_proj.weight' + for tm in "drop 77" "shape 76" "dtype 74"; do + read -r tk tw <<< "$tm" + awk -F'\t' -v OFS='\t' -v n="$xn" -v m="$tk" '$1 == n && m == "drop" { next } $1 == n && m == "shape" { $4 = "512x2048" } $1 == n && m == "dtype" { $3 = "F16" } { print }' "$b/real.tsv" > "$b/tm.tsv" + gmap "$b/gg" "$b/tm.tsv" + if [ "$rc" = "$tw" ]; then ok "gguf map TSV $tk $xn: $tw"; else bad "gguf map TSV $tk $xn: want $tw, got $rc"; fi + done + ggen base + gmap "$b/gg" "$b/real.tsv" "$b/g.gguf" + if [ "$rc" = 75 ]; then ok "gguf map synthetic names: 75"; else bad "gguf map synthetic names: want 75, got $rc"; fi + if gsite expert-dup "gg_hu e" "gg_hu or e 1"; then + gmap "$b/gmut" "$b/real.tsv" + if [ "$rc" = 77 ]; then ok "gguf mutant expert-dup: 77"; else bad "gguf mutant expert-dup: want 77, got $rc"; fi + fi + if gsite totals "const GFT ulong 39785287456" "const GFT ulong 39785287457"; then + gmap "$b/gmut" "$b/real.tsv" + if [ "$rc" = 79 ]; then ok "gguf mutant totals: 79"; else bad "gguf mutant totals: want 79, got $rc"; fi + fi + if [ -n "${FLINT_SHARDS:-}" ]; then + gdeq() { # binary; sets rc, dl (the deq line) and dv (its violation count) + timeout 1800 "$1" deq "$FLINT_GGUF" "$b/real.tsv" "$FLINT_SHARDS" > "$b/d.out" 2> "$b/d.err" < /dev/null + rc=$? + dl=$(sed -n 2p "$b/d.out") + dv=$(sed -n 's/.* violations \([0-9]*\) .*/\1/p' <<< "$dl") + } + gdeq "$b/gg" + v0=$dv + if [ "$rc" = 0 ] && [ "${dl%% PASS}" != "$dl" ] && [ "$(sed -n 1p "$b/d.out")" = "$GG_MAP" ]; then ok "gguf deq: $dl"; else bad "gguf deq: rc $rc, $(head -c 300 "$b/d.out") $(head -c 200 "$b/d.err")"; fi + # A mutant must FAIL with at least ten times the unmutated violations (and at least 1000), + # so a failing unmutated run cannot make the mutants pass by default. + for dm in "expert-swap|gg_hu e|gg_hu sub 255 e" "nibble-hi-for-lo|gg_cmp add mul s 16 j and q 15 d|gg_cmp add mul s 16 j shr q 4 d" "scale-order|d = mul gg_ue get gqb s sc|d = mul gg_ue get gqb sub 3 s sc"; do + IFS='|' read -r mn mf mt <<< "$dm" + gsite "$mn" "$mf" "$mt" || continue + gdeq "$b/gmut" + if [ "$rc" = 1 ] && [ "${dl%% FAIL}" != "$dl" ] && [ -n "$dv" ] && [ "$dv" -ge $((10 * ${v0:-0})) ] && [ "$dv" -ge 1000 ]; then ok "gguf mutant $mn: $dl"; else bad "gguf mutant $mn: want FAIL with >= 10 x $v0 violations, got rc $rc: $dl"; fi + done + else + echo "NOT_RUN gguf deq (needs FLINT_SHARDS)" + fi + else + echo "NOT_RUN gguf map/deq (needs FLINT_GGUF and the FLINT_SHARDS arm's TSV)" + fi fi n=$((pass + fail)) diff --git a/om/flint/gguf.om b/om/flint/gguf.om index 65170652..4e600179 100644 --- a/om/flint/gguf.om +++ b/om/flint/gguf.om @@ -37,13 +37,35 @@ global gkvo ulong 1024 global gbe ulong 64 global gbb ulong 64 global gtyc ulong 192 +const GFT ulong 39785287456 +const GFR ulong 37849399296 +global gtv uchar 8388608 +global grno ulong 65536 +global grnl ulong 65536 +global grr ulong 65536 +global grc ulong 65536 +global grso ulong 65536 +global grsl ulong 65536 +global grbg ulong 65536 +global grmk ulong 65536 +global gtab ulong 131072 +global gtsc ulong 4096 +global ghn uchar 512 +global gshn ulong 64 +global gshl ulong 64 +global gshf ulong 64 +global gshb ulong 64 +global gqb uchar 256 +global gwb uchar 256 +global gfb uchar 8 +global gdv f64 8 note gst slots: 0 header cursor, 1 header bytes loaded, 2 file size, 3 tensor count, 4 kv count, note 5 stdout length, 6 alignment, 7 data section start, 8 version, 9 st_size from gg_open, note 10 tensor bytes used, 11 tensor bytes padded, 14 stderr length, 30 guard-mutant scratch text tref "refused " -text tg2 "usage: flint-gguf report GGUF" +text tg2 "usage: flint-gguf report GGUF | map GGUF TSV | deq GGUF TSV SHARD_DIR" text tg3 "io" text tg4 "not-regular-file" text tg60 "gguf-truncated" @@ -60,6 +82,12 @@ text tg70 "tensor-past-eof" text tg71 "tensor-tiling" text tg72 "header-capacity" text tg73 "output-capacity" +text tg74 "inventory-tsv" +text tg75 "name-map" +text tg76 "tensor-class" +text tg77 "coverage" +text tg78 "scale-sibling" +text tg79 "totals" text tmagic "GGUF" text trep "report" text talign "general.alignment" @@ -101,6 +129,80 @@ text tt1 "tokenizer bos " text tt2 " eos " text tnone "none" text tok "flint-gguf ok tensors " +text tmap "map" +text tdeq "deq" +text tbf16 "BF16" +text tscl ".scale" +text twt ".weight" +text tblk "blk." +text tmly "model.layers." +text tmexp "mlp.experts." +text ttok "token_embd.weight" +text thtok "model.embed_tokens.weight" +text tonrm "output_norm.weight" +text thnrm "model.norm.weight" +text tout "output.weight" +text thout "lm_head.weight" +text tr1 "attn_norm.weight" +text th1 "input_layernorm.weight" +text tr2 "ffn_norm.weight" +text th2 "post_attention_layernorm.weight" +text tr3 "attn_q.weight" +text th3 "self_attn.q_proj.weight" +text tr4 "attn_k.weight" +text th4 "self_attn.k_proj.weight" +text tr5 "attn_v.weight" +text th5 "self_attn.v_proj.weight" +text tr6 "attn_output.weight" +text th6 "self_attn.o_proj.weight" +text tr7 "attn_q_norm.weight" +text th7 "self_attn.q_norm.weight" +text tr8 "attn_k_norm.weight" +text th8 "self_attn.k_norm.weight" +text tr9 "attn_sinks.weight" +text th9 "self_attn.softmax_offset" +text tr10 "ffn_gate.weight" +text th10 "mlp.gate_proj.weight" +text tr11 "ffn_up.weight" +text th11 "mlp.up_proj.weight" +text tr12 "ffn_down.weight" +text th12 "mlp.down_proj.weight" +text tr13 "ffn_gate_inp.weight" +text th13 "mlp.gate.weight" +text tr14 "ffn_gate_shexp.weight" +text th14 "mlp.shared_expert.gate_proj.weight" +text tr15 "ffn_up_shexp.weight" +text th15 "mlp.shared_expert.up_proj.weight" +text tr16 "ffn_down_shexp.weight" +text th16 "mlp.shared_expert.down_proj.weight" +text tr17 "ffn_gate_exps.weight" +text tr18 "ffn_up_exps.weight" +text tr19 "ffn_down_exps.weight" +text tpg "gate_proj.weight" +text tpu "up_proj.weight" +text tpd "down_proj.weight" +text tmu "map units " +text tmt " tensors " +text tms " scales " +text tme " elements " +text tmr " routed " +text tdu "deq units " +text tdb " blocks " +text tdv " violations " +text tdst " strict " +text tdw " worst_ppm " +text tdx " exact " +text tdm " mismatches " +text tpass " PASS" +text tfail " FAIL" +text tfv "first_violation " +text tfe " expert " +text tfr " row " +text tfc " col " +text tfd " err_over_d_ppm " +text tfb " bound_over_d_ppm " +text tmok "flint-gguf map ok units " +text tnm "name" note ======== output buffers ======== @@ -907,6 +1009,908 @@ gg_close fd gg_head end +note ======== map: GGUF tensors against the safetensors inventory (manifest.om TSV) ======== + +note gst slots for map and deq: 20 TSV length, 21 TSV rows, 22 ghn length, 23 GGUF fd, +note 24 open shards, 25 sample generator state, 26 units, 27 GGUF elements, 28 routed elements, +note 29 scale tensors, 31 NVFP4 tensors, 32 mapped tensors, 41 TSV elements, 42/43 sampled +note row/block, 45 elements compared, 46 violations, 47 strict over-count, 48 blocks, +note 49 exact values compared, 50 exact mismatches, 51 violation recorded, 52..55 first violation +note tensor/expert/row/col, 57/58 current tensor/expert + +fn gg_ltv fd long n ulong to void +o = ulong 0 +while lt o n bound 999999 +r = pread int fd gtv o sub n o long o +if le r 0 +gg_die 3 tg3 +end +o = add o ulong r +end +end + +fn gg_fld p ulong to ulong +q = p +m = get gst 20 +while lt q m bound 999999 +c = get gtv q +if or eq c 9 eq c 10 +ret q +end +q = add q 1 +end +ret m +end + +note gg_tab: field end e must be a tab; returns the next field start +fn gg_tab e ulong to ulong +if ge e get gst 20 +gg_die 74 tg74 +end +if ne get gtv e 9 +gg_die 74 tg74 +end +ret add e 1 +end + +fn gg_num p ulong e ulong to ulong +if or ge p e gt sub e p 19 +gg_die 74 tg74 +end +v = ulong 0 +for i ulong sub e p +c = get gtv add p i +if or lt c 48 gt c 57 +gg_die 74 tg74 +end +v = add mul v 10 ulong sub c 48 +end +ret v +end + +fn gg_tvt p ulong e ulong t view uchar * to bool +if ne sub e p len t +ret false +end +for i ulong len t +if ne get gtv add p i get t i +ret false +end +end +ret true +end + +note gg_shp: shape field R (a vector, cols 0) or RxC +fn gg_shp k ulong p ulong e ulong to void +x = p +while lt x e bound 99 +if eq get gtv x 120 +break +end +x = add x 1 +end +put grr k gg_num p x +put grc k 0 +if lt x e +put grc k gg_num add x 1 e +end +end + +fn gg_hht p ulong n ulong to ulong +h = ulong 14695981039346656037 +for i ulong n +h = mul xor h ulong get gtv add p i 1099511628211 +end +ret and h 131071 +end + +fn gg_hhn n ulong to ulong +h = ulong 14695981039346656037 +for i ulong n +h = mul xor h ulong get ghn i 1099511628211 +end +ret and h 131071 +end + +fn gg_tveq a ulong b ulong n ulong to bool +for i ulong n +if ne get gtv add a i get gtv add b i +ret false +end +end +ret true +end + +fn gg_hput k ulong to void +p = get grno k +n = get grnl k +h = gg_hht p n +while true bound 131072 +v = get gtab h +if eq v 0 +put gtab h add k 1 +ret +end +j = sub v 1 +if eq get grnl j n +if gg_tveq get grno j p n +gg_die 74 tg74 +end +end +h = and add h 1 131071 +end +gg_die 74 tg74 +end + +note gg_row: one TSV row k at p (name, shard, BF16, shape, begin, end); returns the next row +fn gg_row k ulong p ulong to ulong +e = gg_fld p +if or eq e p gt sub e p 255 +gg_die 74 tg74 +end +put grno k p +put grnl k sub e p +p = gg_tab e +e = gg_fld p +put grso k p +put grsl k sub e p +p = gg_tab e +e = gg_fld p +if not gg_tvt p e tbf16 +gg_die 74 tg74 +end +p = gg_tab e +e = gg_fld p +gg_shp k p e +p = gg_tab e +e = gg_fld p +put grbg k gg_num p e +p = gg_tab e +e = gg_fld p +z = gg_num p e +if ge e get gst 20 +gg_die 74 tg74 +end +if ne get gtv e 10 +gg_die 74 tg74 +end +n = get grr k +if gt get grc k 0 +n = mul n get grc k +end +if ne sub z get grbg k mul n 2 +gg_die 74 tg74 +end +put gst 41 add get gst 41 n +gg_hput k +ret add e 1 +end + +fn gg_tsv a ulong to void +n = gg_argp a +fd = gg_open n +s = get gst 9 +if or eq s 0 gt s len gtv +gg_die 74 tg74 +end +gg_ltv fd s +gg_close fd +put gst 20 s +p = gg_fld 0 +if not gg_tvt 0 p tnm +gg_die 74 tg74 +end +while lt p s bound 999 +if eq get gtv p 10 +break +end +p = add p 1 +end +p = add p 1 +while lt p s bound 999999 +k = get gst 21 +if ge k len grno +gg_die 74 tg74 +end +p = gg_row k p +put gst 21 add k 1 +end +end + +note ======== GGUF name to Hugging Face name ======== + +fn gg_hc c uchar to void +n = get gst 22 +if ge n len ghn +gg_die 75 tg75 +end +put ghn n c +put gst 22 add n 1 +end + +fn gg_ht t view uchar * to void +for i ulong len t +gg_hc get t i +end +end + +fn gg_hu v ulong to void +n = gg_dec v +for i ulong n +gg_hc get gdg sub sub n i 1 +end +end + +fn gg_hg p ulong n ulong to void +for i ulong n +gg_hc get gh add p i +end +end + +fn gg_heqt p ulong n ulong t view uchar * to bool +if ne n len t +ret false +end +ret gg_htx p t +end + +fn gg_hsfx p ulong n ulong t view uchar * to bool +if lt n len t +ret false +end +ret gg_htx add p sub n len t t +end + +note gg_hx: routed expert e of a stacked _exps tensor +fn gg_hx e ulong t view uchar * to ulong +gg_ht tmexp +gg_hu e +gg_hc 46 +gg_ht t +ret ulong 4 +end + +fn gg_hra r ulong n ulong to ulong +if gg_heqt r n tr1 +gg_ht th1 +ret ulong 1 +end +if gg_heqt r n tr2 +gg_ht th2 +ret ulong 1 +end +if gg_heqt r n tr3 +gg_ht th3 +ret ulong 3 +end +if gg_heqt r n tr4 +gg_ht th4 +ret ulong 3 +end +if gg_heqt r n tr5 +gg_ht th5 +ret ulong 3 +end +if gg_heqt r n tr6 +gg_ht th6 +ret ulong 3 +end +if gg_heqt r n tr7 +gg_ht th7 +ret ulong 1 +end +if gg_heqt r n tr8 +gg_ht th8 +ret ulong 1 +end +if gg_heqt r n tr9 +gg_ht th9 +ret ulong 1 +end +ret ulong 0 +end + +fn gg_hrb r ulong n ulong e ulong to ulong +if gg_heqt r n tr10 +gg_ht th10 +ret ulong 3 +end +if gg_heqt r n tr11 +gg_ht th11 +ret ulong 3 +end +if gg_heqt r n tr12 +gg_ht th12 +ret ulong 3 +end +if gg_heqt r n tr13 +gg_ht th13 +ret ulong 2 +end +if gg_heqt r n tr14 +gg_ht th14 +ret ulong 3 +end +if gg_heqt r n tr15 +gg_ht th15 +ret ulong 3 +end +if gg_heqt r n tr16 +gg_ht th16 +ret ulong 3 +end +if gg_heqt r n tr17 +ret gg_hx e tpg +end +if gg_heqt r n tr18 +ret gg_hx e tpu +end +if gg_heqt r n tr19 +ret gg_hx e tpd +end +gg_die 75 tg75 +ret ulong 0 +end + +note gg_hf: HF name of tensor i (expert e) into ghn; returns its class: 0 a .scale tensor, +note 1 F32 vector, 2 BF16 matrix, 3 NVFP4 matrix, 4 NVFP4 stacked experts +fn gg_hf i ulong e ulong to ulong +put gst 22 0 +no = get gtno i +nl = get gtnl i +if gg_hsfx no nl tscl +ret ulong 0 +end +if gg_heqt no nl ttok +gg_ht thtok +ret ulong 2 +end +if gg_heqt no nl tonrm +gg_ht thnrm +ret ulong 1 +end +if gg_heqt no nl tout +gg_ht thout +ret ulong 3 +end +if lt nl 7 +gg_die 75 tg75 +end +if not gg_htx no tblk +gg_die 75 tg75 +end +p = add no 4 +d = ulong 0 +while lt add d 6 nl bound 4 +c = get gh add p d +if or lt c 48 gt c 57 +break +end +d = add d 1 +end +if or eq d 0 ne get gh add p d 46 +gg_die 75 tg75 +end +gg_ht tmly +gg_hg p d +gg_hc 46 +r = add add p d 1 +rl = sub nl add d 5 +k = gg_hra r rl +if gt k 0 +ret k +end +ret gg_hrb r rl e +end + +note gg_look: TSV row of the HF name in ghn, or coverage refusal +fn gg_look to ulong +n = get gst 22 +h = gg_hhn n +while true bound 131072 +v = get gtab h +if eq v 0 +gg_die 77 tg77 +end +j = sub v 1 +if eq get grnl j n +o = get grno j +f = true +for i ulong n +if ne get gtv add o i get ghn i +f = false +break +end +end +if f +ret j +end +end +h = and add h 1 131071 +end +gg_die 77 tg77 +ret ulong 0 +end + +note gg_chk: GGUF type and dims of tensor i against class c and the HF shape of row r +note (GGUF ne0 is the HF column count: the HF row-major matrix is the GGUF row order) +fn gg_chk i ulong c ulong r ulong to void +w = ulong 40 +k = ulong 2 +if eq c 1 +w = 0 +k = 1 +end +if eq c 2 +w = 30 +end +if eq c 4 +k = 3 +end +if or ne get gtty i w ne get gtnd i k +gg_die 76 tg76 +end +gg_chs i c r +end + +fn gg_chs i ulong c ulong r ulong to void +d0 = get gtdm mul i 4 +d1 = get gtdm add mul i 4 1 +rr = get grr r +rc = get grc r +if eq c 1 +d1 = d0 +d0 = 0 +end +if or ne rr d1 ne rc d0 +gg_die 76 tg76 +end +end + +note gg_sib: the F32 .scale sibling of NVFP4 tensor i: one value, or one per expert +fn gg_sib i ulong c ulong to void +no = get gtno i +nl = get gtnl i +if not gg_hsfx no nl twt +gg_die 78 tg78 +end +b = sub nl 7 +n = ulong 1 +if eq c 4 +n = get gtdm add mul i 4 2 +end +for j ulong get gst 3 +if eq get gtnl j add b 6 +o = get gtno j +if gg_heq o no b +if gg_htx add o b tscl +gg_sck j n +put gtsc i j +ret +end +end +end +end +gg_die 78 tg78 +end + +fn gg_sck j ulong n ulong to void +t = get gtty j +d = get gtnd j +m = get gtdm mul j 4 +if or or ne t 0 ne d 1 ne m n +gg_die 78 tg78 +end +end + +fn gg_unit i ulong c ulong to void +put gst 32 add get gst 32 1 +put gst 27 add get gst 27 get gtne i +n = ulong 1 +if ge c 3 +put gst 31 add get gst 31 1 +gg_sib i c +end +if eq c 4 +n = get gtdm add mul i 4 2 +put gst 28 add get gst 28 get gtne i +end +for e ulong n +k = gg_hf i e +r = gg_look +gg_chk i c r +if gt get grmk r 0 +gg_die 77 tg77 +end +put grmk r 1 +put gst 26 add get gst 26 1 +end +end + +fn gg_map to void +for i ulong get gst 3 +c = gg_hf i 0 +if eq c 0 +put gst 29 add get gst 29 1 +else +gg_unit i c +end +end +for r ulong get gst 21 +if ne get grmk r 1 +gg_die 77 tg77 +end +end +if ne get gst 29 get gst 31 +gg_die 78 tg78 +end +if or or ne get gst 41 GFT ne get gst 27 GFT ne get gst 28 GFR +gg_die 79 tg79 +end +end + +fn gg_omap to void +gg_otx tmu +gg_ou get gst 26 +gg_otx tmt +gg_ou get gst 32 +gg_otx tms +gg_ou get gst 29 +gg_otx tme +gg_ou get gst 27 +gg_otx tmr +gg_ou get gst 28 +gg_ob 10 +end + +note ======== deq: sampled GGUF blocks against the BF16 shards ======== + +fn gg_pq fd long n ulong pos ulong to void +o = ulong 0 +while lt o n bound 99 +r = pread int fd gqb o sub n o long add pos o +if le r 0 +gg_die 3 tg3 +end +o = add o ulong r +end +end + +fn gg_pw fd long n ulong pos ulong to void +o = ulong 0 +while lt o n bound 99 +r = pread int fd gwb o sub n o long add pos o +if le r 0 +gg_die 3 tg3 +end +o = add o ulong r +end +end + +note gg_shd: index of the open shard of TSV row r (opened once: SHARD_DIR/shard name) +fn gg_shd r ulong to ulong +so = get grso r +sl = get grsl r +m = get gst 24 +for j ulong m +if eq get gshl j sl +if gg_tveq get gshn j so sl +ret j +end +end +end +if ge m 64 +gg_die 3 tg3 +end +n = gg_argp 4 +if gt add add n sl 1 len gpth +gg_die 2 tg2 +end +put gpth n 47 +for i ulong sl +put gpth add add n 1 i get gtv add so i +end +fd = gg_open add add n 1 sl +r8 = pread int fd gfb 0 8 long 0 +if ne r8 8 +gg_die 3 tg3 +end +hl = ulong 0 +for i ulong 8 +hl = or hl shl ulong get gfb i mul 8 i +end +put gshn m so +put gshl m sl +put gshf m ulong fd +put gshb m add 8 hl +put gst 24 add m 1 +ret m +end + +note gg_hw: n bytes of TSV row r's tensor data at byte off into gwb +fn gg_hw r ulong off ulong n ulong to void +j = gg_shd r +gg_pw long get gshf j n add add get gshb j get grbg r off +end + +note gg_gq: n bytes of the GGUF data section at off into gqb +fn gg_gq off ulong n ulong to void +gg_pq long get gst 23 n add get gst 7 off +end + +fn gg_bf x ulong to f64 +lo = uint get gwb mul x 2 +hi = uint get gwb add mul x 2 1 +ret f64 bitcast f32 or shl hi 24 shl lo 16 +end + +note gg_ue: ggml_ue4m3_to_fp32 without its 0.5 (E2M1 values are used, not ggml's doubled ints) +fn gg_ue x uchar to f64 +if or eq x 0 eq x 127 +ret 0.0f64 +end +e = ulong and shr x 3 15 +m = f64 ulong and x 7 +if eq e 0 +ret mul m 0.001953125f64 +end +p = add 1.0f64 div m 8.0f64 +if ge e 7 +for k ulong sub e 7 +p = mul p 2.0f64 +end +else +for k ulong sub 7 e +p = mul p 0.5f64 +end +end +ret p +end + +fn gg_e2 n uchar to f64 +m = and n 7 +v = mul f64 ulong m 0.5f64 +if eq m 4 +v = 2.0f64 +end +if eq m 5 +v = 3.0f64 +end +if eq m 6 +v = 4.0f64 +end +if eq m 7 +v = 6.0f64 +end +if ge n 8 +v = neg v +end +ret v +end + +note gg_cmp: element x of the block (col c0 + x) against the frozen bound in README.md: +note |w - q D| <= D + max(0, |w| - 6 D) + 2^-8 |w| +fn gg_cmp x ulong n uchar d f64 to void +w = gg_bf x +a = fabs w +t = fabs sub w mul gg_e2 n d +c = sub a mul 6.0f64 d +if lt c 0.0f64 +c = 0.0f64 +end +s = add d c +b = add s mul a 0.00390625f64 +put gst 45 add get gst 45 1 +if gt t s +put gst 47 add get gst 47 1 +end +if gt b 0.0f64 +if gt div t b get gdv 0 +put gdv 0 div t b +end +end +if gt t b +put gst 46 add get gst 46 1 +if eq get gst 51 0 +put gst 51 1 +put gst 52 get gst 57 +put gst 53 get gst 58 +put gst 54 get gst 42 +put gst 55 add mul get gst 43 64 x +put gdv 1 div t d +put gdv 2 div b d +end +end +end + +note gg_smp: sample k of a unit with `rows` rows of `bpr` blocks: k 0 the first block, k 1 +note the last, k >= 2 from a 64-bit LCG seeded once with 834 (rows and blocks in gst 42/43) +fn gg_smp k ulong rows ulong bpr ulong to void +if eq k 0 +put gst 42 0 +put gst 43 0 +ret +end +if eq k 1 +put gst 42 sub rows 1 +put gst 43 sub bpr 1 +ret +end +x = add mul get gst 25 6364136223846793005 1442695040888963407 +put gst 25 x +put gst 42 rem shr x 33 rows +put gst 43 rem shr x 11 bpr +end + +note gg_bof: GGUF data offset of the sampled block (row gst 42, block gst 43) of expert e +fn gg_bof i ulong e ulong to ulong +ne0 = get gtdm mul i 4 +sl = mul div mul ne0 get gtdm add mul i 4 1 64 36 +k = add mul get gst 42 div ne0 64 get gst 43 +ret add add get gtof i mul e sl mul k 36 +end + +note gg_blk: one sampled NVFP4 block of tensor i, expert e, against TSV row r; sc the .scale +fn gg_blk i ulong e ulong r ulong sc f64 to void +gg_gq gg_bof i e 36 +o = get gst 42 +o = mul o get gtdm mul i 4 +o = add o mul get gst 43 64 +gg_hw r mul o 2 128 +for s ulong 4 +d = mul gg_ue get gqb s sc +for j ulong 8 +q = get gqb add 4 add mul s 8 j +gg_cmp add mul s 16 j and q 15 d +gg_cmp add add mul s 16 j 8 shr q 4 d +end +end +put gst 48 add get gst 48 1 +end + +note gg_xbf: sampled 64-value chunk of a BF16 tensor, bit for bit +fn gg_xbf i ulong r ulong to void +ne0 = get gtdm mul i 4 +o = mul add mul get gst 42 ne0 mul get gst 43 64 2 +gg_gq add get gtof i o 128 +gg_hw r o 128 +for k ulong 128 +if ne get gqb k get gwb k +put gst 50 add get gst 50 1 +end +end +put gst 49 add get gst 49 64 +end + +note gg_xf: an F32 vector, every value, against the BF16 value widened exactly +fn gg_xf i ulong r ulong to void +n = get gtdm mul i 4 +o = ulong 0 +while lt o n bound 9999 +k = sub n o +if gt k 32 +k = ulong 32 +end +gg_gq add get gtof i mul o 4 mul k 4 +gg_hw r mul o 2 mul k 2 +for x ulong k +gg_xf1 x +end +put gst 49 add get gst 49 k +o = add o k +end +end + +fn gg_xf1 x ulong to void +v = ulong 0 +p = mul x 4 +for y ulong 4 +t = ulong get gqb add p y +v = or v shl t mul 8 y +end +p = mul x 2 +u = shl ulong get gwb add p 1 24 +u = or u shl ulong get gwb p 16 +if ne v u +put gst 50 add get gst 50 1 +end +end + +fn gg_scl i ulong e ulong to f64 +gg_gq add get gtof get gtsc i mul e 4 4 +v = uint 0 +for y ulong 4 +v = or v shl uint get gqb y mul 8 uint y +end +ret f64 bitcast f32 v +end + +fn gg_dqu i ulong c ulong e ulong r ulong to void +put gst 26 add get gst 26 1 +put gst 57 i +put gst 58 e +if eq c 1 +gg_xf i r +ret +end +rows = get gtdm add mul i 4 1 +bpr = div get gtdm mul i 4 64 +if eq c 2 +for k ulong 8 +gg_smp k rows bpr +gg_xbf i r +end +ret +end +sc = gg_scl i e +for k ulong 8 +gg_smp k rows bpr +gg_blk i e r sc +end +end + +fn gg_deq to void +n = gg_argp 2 +put gst 23 ulong gg_open n +put gst 25 834 +for i ulong get gst 3 +c = gg_hf i 0 +if gt c 0 +m = ulong 1 +if eq c 4 +m = get gtdm add mul i 4 2 +end +for e ulong m +k = gg_hf i e +gg_dqu i c e gg_look +end +end +end +end + +fn gg_odeq to bool +gg_otx tdu +gg_ou get gst 26 +gg_otx tdb +gg_ou get gst 48 +gg_otx tme +gg_ou get gst 45 +gg_otx tdv +gg_ou get gst 46 +gg_otx tdst +gg_ou get gst 47 +gg_otx tdw +gg_ou ulong mul get gdv 0 1000000.0f64 +gg_otx tdx +gg_ou get gst 49 +gg_otx tdm +gg_ou get gst 50 +f = or gt get gst 46 0 gt get gst 50 0 +if f +gg_otx tfail +else +gg_otx tpass +end +gg_ob 10 +if gt get gst 51 0 +i = get gst 52 +gg_otx tfv +gg_oh get gtno i get gtnl i +gg_otx tfe +gg_ou get gst 53 +gg_otx tfr +gg_ou get gst 54 +gg_otx tfc +gg_ou get gst 55 +gg_otx tfd +gg_ou ulong mul get gdv 1 1000000.0f64 +gg_otx tfb +gg_ou ulong mul get gdv 2 1000000.0f64 +gg_ob 10 +end +ret f +end + fn main to int c = argcnt if or lt c 3 gt c 5 @@ -930,6 +1934,33 @@ gg_oflush gg_sum ret 0 end +if and eq c 4 gg_isarg 1 tmap +gg_read 2 +gg_tsv 3 +gg_map +gg_omap +gg_oflush +put gst 14 0 +gg_etx tmok +gg_eu get gst 26 +gg_eput 10 +gg_eflush +ret 0 +end +if and eq c 5 gg_isarg 1 tdeq +gg_read 2 +gg_tsv 3 +gg_map +gg_omap +put gst 26 0 +gg_deq +f = gg_odeq +gg_oflush +if f +ret 1 +end +ret 0 +end gg_die 2 tg2 ret 1 end From 3a2ca5ab4b9938d60c8566fe934d91f20f27ad75 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 30 Oct 2026 14:08:17 -0500 Subject: [PATCH 4/4] flint-gguf: split deq into deq-exact (gguf-py b11804 decode digest) and provenance The decode digest of every sampled NVFP4 block is recomputed by test/ggufdeq.py with llama.cpp b11804's gguf-py decoder; equal digests mean bit-equal decodes. Code 8 now decodes to +0 as in ggml. The provenance bound against flint-2a247be0 stays as frozen and still FAILS; README records H1-H3 with the residual. Refs #834, #804. --- .crumb | 8 +-- om/flint/README.md | 98 +++++++++++++++++++-------- om/flint/check.sh | 30 ++++++--- om/flint/gguf.om | 25 ++++++- om/flint/test/ggufdeq.py | 141 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 260 insertions(+), 42 deletions(-) create mode 100755 om/flint/test/ggufdeq.py diff --git a/.crumb b/.crumb index 4d9651de..b6be727d 100644 --- a/.crumb +++ b/.crumb @@ -125,14 +125,14 @@ } ], "children_root": "sha256:05d34c0deec7c4a6cd3aa12640dca0c20bd8b2d4a4df809b234090822f422b4f", - "compiled_at": "2026-10-30T18:53:37Z", + "compiled_at": "2026-10-30T19:08:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:b27cd965bfdb741a5a14dd5a34ebdf78326926a5b62fe484a46f8f6e4190a390", + "digest": "sha256:430afe222453d8290fc7be5a847669af7d7c3446357867dc78568f5220bf5089", "evidence_files": 3602, "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b", "files": 8116, - "generated_at_commit": "1a7d91fcdbe367c7824733b791cb7307a7d8b903", - "source_tree": "sha256:81e437da507a2544c51946a4b760bef10d5fbed9bb891491e65c7e2ae8826d7b" + "generated_at_commit": "b38aef37a9ad9fc88ab2d9d897cb1d19e67c252d", + "source_tree": "sha256:a5cc591f04a374571ac5ba734f680cb47e1ef0ff3bf60f7c67f71c26b3a617fd" } }, "history": [], diff --git a/om/flint/README.md b/om/flint/README.md index ba07df90..527fae35 100644 --- a/om/flint/README.md +++ b/om/flint/README.md @@ -295,7 +295,7 @@ each NVFP4 tensor needs its `.scale` sibling, and the totals are pinned: 3978528 `map units 36734 tensors 779 scales 485 elements 39785287456 routed 37849399296`: 638 plain tensors plus 141 `_exps` tensors × 256 experts = 36734 units, the TSV's row count. -### Deq: sampled NVFP4 blocks against the BF16 shards +### Deq: sampled NVFP4 blocks decoded (deq-exact) and against the BF16 shards (provenance) `flint-gguf deq GGUF TSV SHARD_DIR` runs map, then compares GGUF data with the BF16 bytes of each unit's TSV row (the shard file `SHARD_DIR/`, offset 8 + header length + begin): @@ -310,45 +310,89 @@ each unit's TSV row (the shard file `SHARD_DIR/`, offset 8 + header lengt Sample k of a unit: k = 0 is row 0 block 0, k = 1 the last row's last block, k = 2..7 come from the 64-bit LCG x ← x · 6364136223846793005 + 1442695040888963407 (seed 834 once, continued over units in GGUF tensor order, then expert order) with row = (x >> 33) mod rows and block = -(x >> 11) mod (ne0/64). The output line is `deq units U blocks B elements N violations V -strict S worst_ppm W exact X mismatches M PASS|FAIL`: strict counts values over the bound +(x >> 11) mod (ne0/64). Output, after the map line: + + deq units U blocks B elements N decode_digest H + provenance violations V strict S worst_ppm W exact X mismatches M PASS|FAIL + +H is a digest of every sampled NVFP4 block in sample order: its TSV row index, sample row, sample +block, then its 64 decoded values ŵ as f64 bits (sub-block s, j < 8: value 16s+j, then 16s+j+8); +h starts at 1469598103934665603 and each word v gives h = (h xor v) · 1099511628211 mod 2^64, then +h = h xor (h >> 29). The shift is needed: without it a flipped top bit (a zero's sign) never +reaches the lower bits, and two flips cancel. `test/ggufdeq.py` recomputes the line from the same +GGUF bytes with its own name map and sampler and llama.cpp b11804's gguf-py decoder +(`gguf.quants.dequantize`, sha256-pinned with `gguf_reader.py` and `constants.py`), times the +`.scale` in f64; all products are exact in f64, so equal digests mean bit-equal decodes. ggml +decodes code 8 (sign set, magnitude 0) as +0, so gguf.om does too. + +The provenance line compares the same values with the shards: strict counts values over the bound without its BF16 term, worst_ppm is the largest |w − ŵ| / bound × 10^6, exact and mismatches count the F32 and BF16 values compared bit for bit. A violation also prints the first one -(tensor, expert, row, column, |w − ŵ| / D and bound / D in ppm). FAIL exits 1. +(tensor, expert, row, column, |w − ŵ| / D and bound / D in ppm). Provenance FAIL exits 1. Gate arm 6, when `FLINT_GGUF` and the TSV are present: the map line; three TSV mutants on `model.layers.2.mlp.experts.0.down_proj.weight` (row dropped → 77, shape 512x2048 → 76, dtype F16 → 74); the synthetic GGUF → 75; source mutants expert-dup (`gg_hu or e 1` → 77) and totals -(→ 79). With `FLINT_SHARDS` too: deq must PASS, and three source mutants must FAIL it with at -least ten times the unmutated run's violations (and at least 1000), so a failing unmutated run -cannot pass them by default: expert-swap (`gg_hu sub 255 e`, which still maps), -nibble-hi-for-lo (the low nibble decoded from the high one) and scale-order (sub-scales of a -block read in reverse). Not covered: the unsampled NVFP4 blocks (291520 of 616452096 are -sampled; Wolfram `N[291520/(39452934144/64)*100, 4]` → 0.04729 %), serving or GPU evidence. +(→ 79). With `FLINT_SHARDS` too, two separately labelled checks: -### Observed on the serving file: deq FAILS against `flint-2a247be0` +- `gguf deq-exact`: the decode line equals the frozen `GG_DEQ` (and the referee's line when + `FLINT_GGUF_PY` is set). Pre-registered: equal digests, i.e. 0 mismatching values. +- `gguf provenance (frozen bound vs 2a247be0)`: must PASS; it FAILS on the serving file (below). -Run on 2026-10-30 (host, cores 0-4, 62 s, 24 MB RSS): +Four source mutants must change the digest: expert-swap (`gg_hu sub 255 e`, which still maps), +nibble-hi-for-lo (the low nibble decoded from the high one) and scale-order (sub-scales of a block +read in reverse) must also FAIL provenance with at least ten times the unmutated run's violations +(and at least 1000), so a failing unmutated run cannot pass them by default; neg-zero (code 8 +decoded as −0) must leave the violations unchanged. Not covered: the unsampled NVFP4 blocks +(291520 of 616452096 are sampled; Wolfram `N[291520/(39452934144/64)*100, 4]` → 0.04729 %), +serving or GPU evidence. - deq units 36734 blocks 291520 elements 18657280 violations 7782 strict 19841 worst_ppm 1394455 exact 241440 mismatches 48 FAIL +### Observed on the serving file: deq-exact PASSES, provenance FAILS against `flint-2a247be0` + +Run on 2026-10-30 (host, cores 0-4): + + deq units 36734 blocks 291520 elements 18657280 decode_digest 2297050257563874686 + provenance violations 7782 strict 19841 worst_ppm 1394455 exact 241440 mismatches 48 FAIL first_violation blk.0.attn_q.weight expert 0 row 2566 col 1841 err_over_d_ppm 1022222 bound_over_d_ppm 1019444 +The referee printed the same decode line. Before the code-8 fix gguf.om printed digest +11480760261068712155 (−0 for code 8), which the referee did not match. + 7782 of 18657280 sampled NVFP4 values exceed the frozen bound (Wolfram → 0.04171 %), the worst by -1.394 × the bound. The bound stays as committed. The cause is the reference, not the decoder: +1.394 × the bound. The bound stays as committed. The decode is not the cause (deq-exact), and 48 of the 241440 values that need no quantization (F32 norms and sinks, BF16 router and -embedding chunks) differ from the shards bit for bit, which no NVFP4 decode can cause. A -throwaway numpy probe over whole tensors (not part of the gate) found 7983313 of 307494912 -`token_embd` values different (Wolfram → 2.596 %), differing elements in `output_norm` (7 of -2048), and in `attn_q_norm`, `attn_k_norm` and `attn_sinks` of layers 19, 20, 28, 32, 34, 35, -38 and 48 (one to four each, e.g. 0.00098419 against 0.00086594 in layer 28's k norm); all 47 -routers equal. On `blk.0.attn_q.weight` the violators all sit at the 4/6 rounding midpoint -(|w/D| from 4.74 to 5.19, decoded as 4 or 6); requantizing the shard weights to the nearest -E2M1 value agrees with 98.17 % of the file's codes; the block maximum over 6 · D has median -1.0007. So the GGUF was quantized from weights close to, but not equal to, the released -checkpoint (`RecursiveSI/flint` has one revision, 2a247be0; the GGUF is -`RecursiveSI/flint-nvfp4-gguf@6ec43e19`). The tie from the serving file to the checked weights -is therefore exact for names, shapes, layout and totals, and approximate (not within the frozen -bound) for values. +embedding chunks) differ from the shards bit for bit, which no NVFP4 decode can cause. The file's +layout (`.scale` siblings, `general.tensor_extra.prec_a4`) matches `_nvfp4_pack`/`_repack_nvfp4` +in llama.cpp c7fc5094 `conversion/base.py`, which copy a ModelOpt NVFP4 checkpoint's codes and +E4M3 scales unchanged and store `weight_scale_2` as `.scale` (the writer revision itself is not +recorded in the file); the model card's link to that "native NVFP4 export" was removed as private +(`6ec43e19`). Three hypotheses, tested with throwaway numpy probes (not part of the gate), H1 on +the same sampled blocks and H2/H3 on whole tensors: + +- H1, rounding order. Re-deriving each sampled code as round-to-nearest E2M1 of w/d from the + shard weights: with the stored d = ue · scale, 18262166 of 18657280 codes agree (Wolfram → + 97.882 %; whole 16-value sub-blocks 71.194 %); with the unrounded d = amax16 / 6, 17617910 + (94.429 %; sub-blocks 43.713 %). The stored scale byte equals e4m3(amax16 / (6 · scale)) for + 1134500 of 1166080 sub-blocks (97.292 %). Rejected: no rounding rule reproduces the codes. All + 395114 differing codes are one grid step from the re-derived code; moving w to the stored + code's interval needs |Δw| of median 6.54e-6, 99th percentile 4.32e-5, maximum 4.81e-4. +- H2, norm offset. The differing F32 tensors are BF16-valued; the shard medians of |w| are 0.70 + to 4.95, f32(w + 1) − 1 = w for every element, and the differences are 1 to 89 BF16 ulps on + the smallest elements (|w| from 1.6e-4 to 0.065), no sign flips. Rejected: no +1 or other + transform; individual small values differ. +- H3, `token_embd`. BF16 in both files. 7983313 of 307494912 values differ (Wolfram → 2.596 %), + none subnormal, infinite or NaN; 5320661 by one BF16 ulp; absolute difference median 1.53e-5, + 99th percentile 1.22e-4, maximum 4.88e-4, mean −1.06e-7, correlation with w −0.045; 148820 of + 150144 rows touched. The share of values that differ falls with magnitude: 68.49 % in + [2^-10, 2^-9), 0.306 % in [2^-6, 2^-5), 0.000022 % in [2^-4, 2^-3) (Wolfram). + +One explanation fits all three: the quantized checkpoint was made from weights that differ from +2a247be0 by a small additive perturbation (|Δw| up to about 5e-4, visible only where it exceeds +half a BF16 ulp), not by a scaling or a quantizer rule. The code flips need |Δw| inside the range +the embedding shows. That is an inference; the private export is not available to check it. +The tie from the serving file to the checked weights is therefore exact for names, shapes, +layout, totals and decode, and approximate (not within the frozen bound) for values: provenance +FAIL with the residual quantified above. ### NVFP4 dequantization tolerance (derived from the format before any full comparison) diff --git a/om/flint/check.sh b/om/flint/check.sh index 3dc244e8..41e4a18c 100755 --- a/om/flint/check.sh +++ b/om/flint/check.sh @@ -304,6 +304,7 @@ GG_REP_PIN=cbd3becec35ff580cb16db5789bf5a73cd56b775109cb193ce8ad3ffd00b3851 GG_SUM='flint-gguf ok tensors 4 kvs 27 bytes 2080' GG_REAL_SUM='flint-gguf ok tensors 1264 kvs 43 bytes 22863084160' GG_MAP='map units 36734 tensors 779 scales 485 elements 39785287456 routed 37849399296' +GG_DEQ='deq units 36734 blocks 291520 elements 18657280 decode_digest 2297050257563874686' ggen() { python3 "$here/test/ggufgen.py" "$b/g.gguf" "$1" < /dev/null; } grun() { # binary [file]; sets rc, leaves g.out and g.err timeout 120 "$1" report "${2:-$b/g.gguf}" > "$b/g.out" 2> "$b/g.err" < /dev/null @@ -418,7 +419,8 @@ GGUF_GUARDS # map: every non-scale GGUF tensor (each routed expert slice of an _exps tensor on its own) # names exactly one row of the FLINT_SHARDS arm's TSV with the transposed shape, every row is # named once, every NVFP4 tensor has its F32 .scale sibling, and the totals are the pinned ones. - # deq: the sampled NVFP4 blocks against the BF16 shards under the frozen README bound. + # deq: the sampled NVFP4 blocks decoded (deq-exact, against gguf-py b11804) and compared with the + # BF16 shards under the frozen README bound (provenance). if [ -n "${FLINT_GGUF:-}" ] && [ -s "$b/real.tsv" ]; then gmap() { # binary tsv [gguf]; sets rc, leaves m.out and m.err timeout 120 "$1" map "${3:-$FLINT_GGUF}" "$2" > "$b/m.out" 2> "$b/m.err" < /dev/null @@ -450,22 +452,34 @@ GGUF_GUARDS if [ "$rc" = 79 ]; then ok "gguf mutant totals: 79"; else bad "gguf mutant totals: want 79, got $rc"; fi fi if [ -n "${FLINT_SHARDS:-}" ]; then - gdeq() { # binary; sets rc, dl (the deq line) and dv (its violation count) + gdeq() { # binary; sets rc, dl (the decode line), pl (the provenance line) and dv (its violations) timeout 1800 "$1" deq "$FLINT_GGUF" "$b/real.tsv" "$FLINT_SHARDS" > "$b/d.out" 2> "$b/d.err" < /dev/null rc=$? dl=$(sed -n 2p "$b/d.out") - dv=$(sed -n 's/.* violations \([0-9]*\) .*/\1/p' <<< "$dl") + pl=$(sed -n 3p "$b/d.out") + dv=$(sed -n 's/^provenance violations \([0-9]*\) .*/\1/p' <<< "$pl") } gdeq "$b/gg" v0=$dv - if [ "$rc" = 0 ] && [ "${dl%% PASS}" != "$dl" ] && [ "$(sed -n 1p "$b/d.out")" = "$GG_MAP" ]; then ok "gguf deq: $dl"; else bad "gguf deq: rc $rc, $(head -c 300 "$b/d.out") $(head -c 200 "$b/d.err")"; fi - # A mutant must FAIL with at least ten times the unmutated violations (and at least 1000), - # so a failing unmutated run cannot make the mutants pass by default. - for dm in "expert-swap|gg_hu e|gg_hu sub 255 e" "nibble-hi-for-lo|gg_cmp add mul s 16 j and q 15 d|gg_cmp add mul s 16 j shr q 4 d" "scale-order|d = mul gg_ue get gqb s sc|d = mul gg_ue get gqb sub 3 s sc"; do + rc0=$rc + # deq-exact: the decode digest equals the one frozen from gguf-py b11804 (rerun when FLINT_GGUF_PY is set). + dref=$GG_DEQ + if [ -n "${FLINT_GGUF_PY:-}" ]; then + dref=$($FLINT_GGUF_PY "$here/test/ggufdeq.py" "$FLINT_GGUF" "$b/real.tsv" 2>&1 < /dev/null) + fi + if { [ "$rc" = 0 ] || [ "$rc" = 1 ]; } && [ "$(sed -n 1p "$b/d.out")" = "$GG_MAP" ] && [ "$dl" = "$GG_DEQ" ] && [ "$dref" = "$GG_DEQ" ]; then ok "gguf deq-exact: $dl"; else bad "gguf deq-exact: rc $rc, om '$dl', referee '$dref', frozen '$GG_DEQ' $(head -c 200 "$b/d.err")"; fi + # provenance: the same blocks against the flint-2a247be0 shards under the frozen README bound. + if [ "$rc" = 0 ] && [ "${pl%% PASS}" != "$pl" ]; then ok "gguf provenance (frozen bound vs 2a247be0): $pl"; else bad "gguf provenance (frozen bound vs 2a247be0): rc $rc, $pl"; fi + # A mutant must change the decode digest and FAIL provenance with at least ten times the unmutated + # violations (and at least 1000), so a failing unmutated run cannot make the mutants pass by default. + # neg-zero changes only the digest: ggml decodes code 8 as +0. + for dm in "expert-swap|gg_hu e|gg_hu sub 255 e" "nibble-hi-for-lo|gg_cmp add mul s 16 j and q 15 d|gg_cmp add mul s 16 j shr q 4 d" "scale-order|d = mul gg_ue get gqb s sc|d = mul gg_ue get gqb sub 3 s sc" "neg-zero|if and ge n 8 gt m 0|if ge n 8"; do IFS='|' read -r mn mf mt <<< "$dm" gsite "$mn" "$mf" "$mt" || continue gdeq "$b/gmut" - if [ "$rc" = 1 ] && [ "${dl%% FAIL}" != "$dl" ] && [ -n "$dv" ] && [ "$dv" -ge $((10 * ${v0:-0})) ] && [ "$dv" -ge 1000 ]; then ok "gguf mutant $mn: $dl"; else bad "gguf mutant $mn: want FAIL with >= 10 x $v0 violations, got rc $rc: $dl"; fi + if [ "$mn" = neg-zero ]; then + if [ "$rc" = "$rc0" ] && [ -n "$dl" ] && [ "$dl" != "$GG_DEQ" ] && [ "$dv" = "$v0" ]; then ok "gguf mutant $mn: $dl"; else bad "gguf mutant $mn: want a changed digest and $v0 violations, got rc $rc: $dl $pl"; fi + elif [ "$rc" = 1 ] && [ -n "$dl" ] && [ "$dl" != "$GG_DEQ" ] && [ "${pl%% FAIL}" != "$pl" ] && [ -n "$dv" ] && [ "$dv" -ge $((10 * ${v0:-0})) ] && [ "$dv" -ge 1000 ]; then ok "gguf mutant $mn: $dl $pl"; else bad "gguf mutant $mn: want a changed digest and FAIL with >= 10 x $v0 violations, got rc $rc: $dl $pl"; fi done else echo "NOT_RUN gguf deq (needs FLINT_SHARDS)" diff --git a/om/flint/gguf.om b/om/flint/gguf.om index 4e600179..7abe2958 100644 --- a/om/flint/gguf.om +++ b/om/flint/gguf.om @@ -188,7 +188,7 @@ text tme " elements " text tmr " routed " text tdu "deq units " text tdb " blocks " -text tdv " violations " +text tdv "provenance violations " text tdst " strict " text tdw " worst_ppm " text tdx " exact " @@ -201,6 +201,7 @@ text tfr " row " text tfc " col " text tfd " err_over_d_ppm " text tfb " bound_over_d_ppm " +text tdh " decode_digest " text tmok "flint-gguf map ok units " text tnm "name" @@ -1682,18 +1683,29 @@ end if eq m 7 v = 6.0f64 end -if ge n 8 +note ggml's kvalues_mxfp4 has 0 for code 8: a negative zero code decodes to +0 +if and ge n 8 gt m 0 v = neg v end ret v end +note gg_mix: digest of 64-bit words (gst 59) that the referee recomputes: h = (h xor v) * p, +note then h xor (h >> 29), so a flip of a high bit (a zero's sign) reaches the low bits +fn gg_mix v ulong to void +h = mul xor get gst 59 v 1099511628211 +h = xor h shr h 29 +put gst 59 h +end + note gg_cmp: element x of the block (col c0 + x) against the frozen bound in README.md: note |w - q D| <= D + max(0, |w| - 6 D) + 2^-8 |w| fn gg_cmp x ulong n uchar d f64 to void +y = mul gg_e2 n d +gg_mix bitcast ulong y w = gg_bf x a = fabs w -t = fabs sub w mul gg_e2 n d +t = fabs sub w y c = sub a mul 6.0f64 d if lt c 0.0f64 c = 0.0f64 @@ -1757,6 +1769,9 @@ o = get gst 42 o = mul o get gtdm mul i 4 o = add o mul get gst 43 64 gg_hw r mul o 2 128 +gg_mix r +gg_mix get gst 42 +gg_mix get gst 43 for s ulong 4 d = mul gg_ue get gqb s sc for j ulong 8 @@ -1853,6 +1868,7 @@ fn gg_deq to void n = gg_argp 2 put gst 23 ulong gg_open n put gst 25 834 +put gst 59 1469598103934665603 for i ulong get gst 3 c = gg_hf i 0 if gt c 0 @@ -1875,6 +1891,9 @@ gg_otx tdb gg_ou get gst 48 gg_otx tme gg_ou get gst 45 +gg_otx tdh +gg_ou get gst 59 +gg_ob 10 gg_otx tdv gg_ou get gst 46 gg_otx tdst diff --git a/om/flint/test/ggufdeq.py b/om/flint/test/ggufdeq.py new file mode 100755 index 00000000..0cd0f331 --- /dev/null +++ b/om/flint/test/ggufdeq.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python3 +"""Decode referee for `flint-gguf deq` (Core #834 item 7). + +Usage: ggufdeq.py GGUF TSV + +Recomputes the second line of `flint-gguf deq`, + + deq units U blocks B elements N decode_digest H + +independently of gguf.om: names from its own map of GGUF to Hugging Face names, the TSV row index +of each unit (data lines, 0-based), the seeded sample (8 blocks per unit, LCG seed 834 continued +across units, BF16 units included), and each sampled NVFP4 block decoded by llama.cpp b11804's +gguf-py (`gguf.quants.dequantize`, the port of ggml's `dequantize_row_nvfp4`) times the tensor's +F32 `.scale` in f64. H is the digest gguf.om computes: h = 1469598103934665603, then for every +word v, h = (h xor v) * 1099511628211 mod 2^64 followed by h = h xor (h >> 29), over each sampled +block's TSV row index, sample row, +sample block and its 64 values as f64 bits (sub-block s, j < 8: value 16s+j, then 16s+j+8). +The gguf-py files used are checked against their sha256 at commit c7fc5094 first. +""" +import hashlib +import os +import struct +import sys + +PIN = { + "gguf_reader.py": "d0ea743200e19d7ef0a4c969edcc4a6dba8e3656a790b217e3bdc7b31170718e", + "constants.py": "8d82aa2afea617f2ce1c9775fdad16dbb5a1dfa51261250d0d8918a78557bb3f", + "quants.py": "5c30d83fda855283a3239e479a26f35ea002ddd7650fcc4d255e6210fc9e72f1", +} +M64 = (1 << 64) - 1 +LAYER = { + "attn_norm.weight": "input_layernorm.weight", + "ffn_norm.weight": "post_attention_layernorm.weight", + "attn_q.weight": "self_attn.q_proj.weight", + "attn_k.weight": "self_attn.k_proj.weight", + "attn_v.weight": "self_attn.v_proj.weight", + "attn_output.weight": "self_attn.o_proj.weight", + "attn_q_norm.weight": "self_attn.q_norm.weight", + "attn_k_norm.weight": "self_attn.k_norm.weight", + "attn_sinks.weight": "self_attn.softmax_offset", + "ffn_gate.weight": "mlp.gate_proj.weight", + "ffn_up.weight": "mlp.up_proj.weight", + "ffn_down.weight": "mlp.down_proj.weight", + "ffn_gate_inp.weight": "mlp.gate.weight", + "ffn_gate_shexp.weight": "mlp.shared_expert.gate_proj.weight", + "ffn_up_shexp.weight": "mlp.shared_expert.up_proj.weight", + "ffn_down_shexp.weight": "mlp.shared_expert.down_proj.weight", +} +EXPS = {"ffn_gate_exps.weight": "gate_proj", "ffn_up_exps.weight": "up_proj", "ffn_down_exps.weight": "down_proj"} +TOP = {"token_embd.weight": "model.embed_tokens.weight", "output_norm.weight": "model.norm.weight", + "output.weight": "lm_head.weight"} + + +def pinned(): + import gguf + d = os.path.dirname(gguf.__file__) + for f, want in PIN.items(): + got = hashlib.sha256(open(os.path.join(d, f), "rb").read()).hexdigest() + if got != want: + sys.exit("ggufdeq: %s/%s sha256 %s is not the b11804 file" % (d, f, got)) + return gguf + + +def hf_names(name, ne2): + if name in TOP: + return [TOP[name]] + _, layer, rest = name.split(".", 2) + if rest in EXPS: + return ["model.layers.%s.mlp.experts.%d.%s.weight" % (layer, e, EXPS[rest]) for e in range(ne2)] + return ["model.layers.%s.%s" % (layer, LAYER[rest])] + + +class Sampler: + def __init__(self): + self.x = 834 + + def pick(self, k, rows, bpr): + if k == 0: + return 0, 0 + if k == 1: + return rows - 1, bpr - 1 + self.x = (self.x * 6364136223846793005 + 1442695040888963407) & M64 + return (self.x >> 33) % rows, (self.x >> 11) % bpr + + +def main(): + if len(sys.argv) != 3: + sys.exit("usage: ggufdeq.py GGUF TSV") + gguf = pinned() + import numpy as np + from gguf.quants import dequantize + nvfp4 = gguf.GGMLQuantizationType.NVFP4 + row = {} + for i, ln in enumerate(open(sys.argv[2]).read().splitlines()[1:]): + row[ln.split("\t", 1)[0]] = i + reader = gguf.GGUFReader(sys.argv[1]) + byname = {t.name: t for t in reader.tensors} + smp = Sampler() + h = 1469598103934665603 + units = blocks = elements = 0 + for t in reader.tensors: + if t.name.endswith(".scale"): + continue + ty = t.tensor_type.value + ne = [int(v) for v in t.shape] + names = hf_names(t.name, ne[2] if len(ne) == 3 else 1) + units += len(names) + if ty == 0: + continue + rows, bpr = ne[1], ne[0] // 64 + if ty == 30: + for k in range(8): + smp.pick(k, rows, bpr) + continue + if ty != nvfp4.value: + sys.exit("ggufdeq: %s has type %d" % (t.name, ty)) + raw = np.asarray(t.data, dtype=np.uint8).reshape(-1) + scale = np.asarray(byname[t.name[:-len(".weight")] + ".scale"].data, dtype=np.float32).reshape(-1) + per = rows * bpr * 36 + for e, hn in enumerate(names): + r = row[hn] + sc = float(scale[e]) + for k in range(8): + rr, bb = smp.pick(k, rows, bpr) + o = e * per + (rr * bpr + bb) * 36 + v = dequantize(raw[o:o + 36], nvfp4).reshape(-1) + words = [r, rr, bb] + for s in range(4): + for j in range(8): + for x in (16 * s + j, 16 * s + j + 8): + words.append(struct.unpack("> 29 + blocks += 1 + elements += 64 + print("deq units %d blocks %d elements %d decode_digest %d" % (units, blocks, elements, h)) + + +if __name__ == "__main__": + main()