Skip to content

fix(gguf): shape.rs byte-size table covers the IQ/TQ ggml types (#3601) - #3654

Closed
alfredodeza wants to merge 2 commits into
mainfrom
fix/3601-shape-iq-byte-size
Closed

alfredodeza wants to merge 2 commits into
mainfrom
fix/3601-shape-iq-byte-size

Conversation

@alfredodeza

Copy link
Copy Markdown
Contributor

Summary

Closes #3601.

apr inspect (via RosettaStone::inspect → GgufReader::get_tensor_raw)
refused any tensor carrying an IQ-family or ternary ggml dtype with
Unsupported dtype N for raw extraction, even though aprender-serve's
GGML_TYPES table (#3432) already has correct, vetted block/byte sizes for
these ids. Real Unsloth UD-* dynamic quants mix IQ4_XS/IQ2_XXS/etc.
into otherwise-K-quant GGUFs, so real downloads crashed apr inspect
(repro: Qwen3.5-4B-UD-Q4_K_XL.gguf, dtype 23 = IQ4_XS).

Change

  • crates/aprender-core/src/format/gguf/shape.rs: add the missing ggml ids
    (16-23 IQ2_XXS..IQ4_XS, 29 IQ1_M, 34/35 TQ1_0/TQ2_0) to get_tensor_raw's
    byte_size match, using the same blck_size/type_size pairs as
    aprender-serve/src/gguf/ggml_type_table.rs's GGML_TYPES so the two
    tables agree.
  • crates/aprender-core/src/format/gguf/builder.rs: regression test
    test_get_tensor_raw_sizes_every_iq_and_tq_id builds a synthetic
    single-tensor GGUF per new id and asserts get_tensor_raw returns the
    exact byte count instead of refusing.

This is a pre-#3421/Phase-2 leaf fix (same shape as #3432): aprender-core
can't depend on aprender-serve, and the unified TRAITS crate #3430
proposes doesn't exist yet, so this duplicates the vetted sizes locally.
When Phase 2 lands, this call site becomes one more to migrate.

Test plan

  • cargo test -p aprender-core --lib format::gguf — 380 passed
  • cargo clippy -p aprender-core --lib -- -D warnings — clean
  • Manual repro on the pinned release binary: apr inspect ~/Downloads/Qwen3.5-4B-UD-Q4_K_XL.gguf now succeeds (previously
    error: ... Unsupported dtype 23 for raw extraction)

🤖 Generated with Claude Code

apr inspect (RosettaStone -> GgufReader::get_tensor_raw) refused any tensor
carrying an IQ-family or ternary ggml dtype ("Unsupported dtype N for raw
extraction"), even though aprender-serve's GGML_TYPES table (#3432) already
has the correct, vetted block/byte sizes for these ids. Real Unsloth "UD-*"
dynamic quants mix IQ4_XS/IQ2_XXS/etc. into otherwise-K-quant GGUFs, so this
crashed apr inspect on real downloads (repro: Qwen3.5-4B-UD-Q4_K_XL.gguf,
dtype 23 = IQ4_XS).

Adds the missing ids (16-23, 29, 34, 35) to shape.rs's byte_size match, using
the same sizes as ggml_type_table.rs, plus a regression test pinning all of
them via a synthetic single-tensor GGUF per id.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alfredodeza

Copy link
Copy Markdown
Contributor Author

Superseded by #3660, which lands the same fix more completely:

Closing this one; #3660 is the fix that should land for #3601.

@alfredodeza
alfredodeza deleted the fix/3601-shape-iq-byte-size branch September 21, 2026 06:25
@github-actions

Copy link
Copy Markdown

§13.11 rung 1 — quorum shadow verdict

S13-SHADOW pr=3654 head=f60304b3c178d716c03c12972c8f789e7b0ba938 verdict=REFUSE class=Q1 arm_rc=1

Shadow mode: this records a verdict and merges nothing. A refusal
to arm is not a block (§13 adds zero rows to §7) — the pull request is
exactly as green as it was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apr inspect (RosettaStone / core::format::gguf::shape) has no byte-size entry for any IQ-family ggml type — crashes on real Unsloth dynamic quants

1 participant