Skip to content

Published *-Q2_0.gguf files (all four Bonsai rungs) declare type 42 with the group-128 layout and will not load on current prism HEAD #167

Description

@ralphbutler

Summary

Every *-Q2_0.gguf file currently published on the Hugging Face prism-ml repos declares ggml
tensor type 42 while storing the group-128 / 34-byte block layout. Current prism HEAD
reads type 42 as the official group-64 / 18-byte Q2_0, so it refuses to load them.

The loader already detects this precisely and prints an excellent diagnostic, so this is not a
report that something is silently broken — it is that the published reference models cannot be
loaded by a fresh build of the reference implementation, which is a confusing first experience.

Affected files

All four rungs, verified by reading each file's header over HTTP range requests and measuring the
block size from the gaps between consecutive tensor offsets (no full downloads):

repo file declared type measured layout
prism-ml/Ternary-Bonsai-1.7B-gguf Ternary-Bonsai-1.7B-Q2_0.gguf 42 group 128, 34 B/block
prism-ml/Ternary-Bonsai-4B-gguf Ternary-Bonsai-4B-Q2_0.gguf 42 group 128, 34 B/block
prism-ml/Ternary-Bonsai-8B-gguf Ternary-Bonsai-8B-Q2_0.gguf 42 group 128, 34 B/block
prism-ml/Ternary-Bonsai-27B-gguf Ternary-Bonsai-27B-Q2_0.gguf 42 group 128, 34 B/block

The *-PQ2_0.gguf files load fine — those use type 142, which matches QK_PQ2_0 = 128.

Reproducer

git clone --depth 1 -b prism https://github.com/PrismML-Eng/llama.cpp.git
cd llama.cpp && cmake -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF
cmake --build build -j --target llama-cli
./build/bin/llama-cli -m Ternary-Bonsai-1.7B-Q2_0.gguf -p "The capital of France is" -n 24 -ngl 0
gguf_init_from_reader: tensor 'blk.0.attn_k.weight' has offset 82516128, expected 87369536
gguf_init_from_reader: this file matches the legacy Prism Q2_0 layout (group size 128 stored as
  ggml type id 42), but this build reads Q2_0 as the official group-64 format
gguf_init_from_reader: you are probably using the wrong GGUF: use the PQ2_0 version of this model
  (ggml type id 142) or download the group-64 Q2_0 file
llama_model_load: error loading model: failed to load model

The 6% size difference is what makes the two layouts distinguishable: (n/128)*34 vs (n/64)*18.

Root cause

From ggml/src/ggml-common.h at HEAD:

#define QK2_0 64          // block_q2_0     = 2 + 64/4  = 18 bytes
#define QK_PQ2_0 128      // block_pq2_0    = 2 + 128/4 = 34 bytes

and ggml/include/ggml.h:

GGML_TYPE_Q2_0    = 42,
// Prism-private Q2_0 at group size 128 (upstream Q2_0 is group 64) ...
GGML_TYPE_PQ2_0 = 142,

So type 42 was renumbered to the upstream group-64 meaning after these model files were
published, and the group-128 layout moved to 142. The files were not re-tagged.

Possible resolutions

Any one of these would fix the first-run experience; listed in the order that seems least
disruptive:

  1. Re-tag and re-upload the four *-Q2_0.gguf files with type 142, or simply retire them in
    favour of the already-correct *-PQ2_0.gguf files.
  2. Note it in the model cards. Each card currently recommends the Q2_0 file — e.g. the 1.7B
    card lists Ternary-Bonsai-1.7B-Q2_0.gguf as "recommended" — which is the file that will
    not load. Pointing readers at PQ2_0 would be enough.
  3. Accept the legacy layout on read. The loader already identifies it with certainty from the
    offset arithmetic, so it could remap type 42 to PQ2_0 for files that match, rather than
    erroring.

Happy to send a PR for (2) or (3) if either is welcome.

Environment

  • PrismML-Eng/llama.cpp prism @ d8d96cf
  • macOS 15 (Darwin 25.6.0), Apple M4 Max, 128 GB
  • cmake 4.x, Release build, Metal + BLAS enabled

Aside

Found while writing an independent ternary inference engine that reads these files directly. That
reader derives the block layout from the tensor offsets instead of trusting the type id, so it
loads both variants — which is how the discrepancy surfaced. Both files decode to bit-identical
weights, so this really is only a labelling problem.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions