Retrieved article excerpt
Open article · Retrieved 2026-10-22T13:28:09.270153+00:00
## Repository navigation
# nemotron : support non-standard GQA, BPE tokenizer and domyn-small pre-type - #23343
#23343
Merged
[CISC](https://github.com/CISC) merged 5 commits into
[ggml-org:master](https://github.com/ggml-org/llama.cpp/tree/master)ggml-org/llama.cpp:masterfrom
[martin-cimmino:fix/vocab-minerva-metaspace](https://github.com/martin-cimmino/llama.cpp/tree/fix/vocab-minerva-metaspace)martin-cimmino/llama.cpp:fix/vocab-minerva-metaspaceCopy head branch name to clipboard
Oct 22, 2026
Merged
## [nemotron : support non-standard GQA, BPE tokenizer and domyn-small pre-type](https://github.com/ggml-org/llama.cpp/pull/23343#top)#23343 [CISC](https://github.com/CISC) merged 5 commits into [ggml-org:master](https://github.com/ggml-org/llama.cpp/tree/master)ggml-org/llama.cpp:masterfrom [martin-cimmino:fix/vocab-minerva-metaspace](https://github.com/martin-cimmino/llama.cpp/tree/fix/vocab-minerva-metaspace)martin-cimmino/llama.cpp:fix/vocab-minerva-metaspaceCopy head branch name to clipboard
## Conversation
[@martin-cimmino](https://github.com/martin-cimmino)
### @martin-cimmino **[martin-cimmino](https://github.com/martin-cimmino)** commented [May 19, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issue-4478417661) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/ggml-org/llama.cpp/pull/23343).
Copy link
Copy Markdown
Contributor
## Overview
This PR adds support for `domyn/Domyn-Small-v1.0`, fixing issues in both the vocab decoder and the Nemotron model loader/converter.
Vocab decoder: without a dedicated pre-tokenizer type, the current code routes the Domyn-Small tokenizer through the generic GPT-2 BPE decode path, which cannot handle Metaspace-encoded spaces (▁ U+2581) and produces corrupted output for every space-prefixed token. This PR adds `LLAMA_VOCAB_PRE_TYPE_DOMYN_SMALL = 52` in `llama-vocab.h` and a new branch in `llama-vocab.cpp` that sets `escape_whitespaces = true`. Domyn-Small shares the same regex rules as minerva-7b (same tokenizer family), but we kept that path untouched and added a new key.
Nemotron model loader: `create_tensor_qkv` was called with n\_embd for the Q-projection width and `layer.wo` was shaped as `{n_embd, n_embd}`. For a 48-head model like Domyn-Small this causes a tensor shape mismatch crash on load. Fixed to use `n_embd_head_k * n_head` explicitly for both.
Nemotron converter: the formula `int(rot_pct * n_embd) // n_head` produces 42 for a 48-head model instead of the correct 64. Fixed to read `head_dim` from the model config (falling back to `n_embd // n_head` if absent). Additionally, `NemotronModel.set_vocab()` unconditionally called `_set_vocab_sentencepiece()`, crashing when no `tokenizer.model` file is present. Added a fallback to `_set_vocab_gpt2()` for BPE-only tokenizers, and registered the Domyn-Small tokenizer hash in `get_vocab_base_pre()`.
## Additional information
Tested with domyn/Domyn-Small-v1.0 (BF16 GGUF, 45/45 CTest pass).
Note that this PR only affects models that already have tokenizer.ggml.pre = "domyn-small" in their GGUF.
Hugging Face model link at <https://huggingface.co/domyn/Domyn-Small-v1.0>
## Requirements
- I have read and agree with the contributing guidelines
- AI usage disclosure: Yes, I used Claude Code to help locate relevant code paths and draft this PR description. All changes were reviewed and tested by me.
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
requested a review
from [CISC](https://github.com/CISC)
as a [code owner](https://github.com/ggml-org/llama.cpp/blob/d14ce3dab4de197adec5166faa54ac5db8262f26/CODEOWNERS#L96)
[May 19, 2026 14:52](https://github.com/ggml-org/llama.cpp/pull/23343#event-25711636982)
[@ggml-gh-bot](https://github.com/apps/ggml-gh-bot)
### This comment was marked as resolved.
[Sign in to view](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fggml-org%2Fllama.cpp%2Fpull%2F23343)
[@martin-cimmino](https://github.com/martin-cimmino)
### **[martin-cimmino](https://github.com/martin-cimmino)** commented [May 19, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4489364665)
Copy link
Copy Markdown
Contributor
Author
| |
| --- |
| I think there was a mistake in classifying this PR as AI generated |
[@CISC](https://github.com/CISC)
### **[CISC](https://github.com/CISC)** commented [May 19, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4491089210)
Copy link
Copy Markdown
Member
| |
| --- |
| Note that this PR only affects models that already have tokenizer.ggml.pre = "domyn-small" in their GGUF. And how would they get that? :) This value needs to be introduced at conversion, does this model have a unique tokenizer `chkhsh`? |
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
mentioned this pull request
[May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#ref-pullrequest-4484318157)
[nemotron : support non-standard GQA head counts and BPE tokenizer
#23391](https://github.com/ggml-org/llama.cpp/pull/23391)
Closed
[@martin-cimmino](https://github.com/martin-cimmino)
### **[martin-cimmino](https://github.com/martin-cimmino)** commented [May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4495915876)
Copy link
Copy Markdown
Contributor
Author
| |
| --- |
| Yes, the "domyn-small" string is written during conversion by the companion PR at [#23391](https://github.com/ggml-org/llama.cpp/pull/23391). chkhsh = 6e4d72c6e5260b90606e26a0931fa15e4b42ec6e97719d12919f2b1f93478262 That hash is unique to the Domyn-Small-v1.0 tokenizer. Happy to combine them into a single PR if that's preferred. |
[@CISC](https://github.com/CISC)
### **[CISC](https://github.com/CISC)** commented [May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4496321614)
Copy link
Copy Markdown
Member
| |
| --- |
| Happy to combine them into a single PR if that's preferred. Yes, makes no sense to separate them, one does not work without the other. |
[@martin-cimmino](https://github.com/martin-cimmino)
### **[martin-cimmino](https://github.com/martin-cimmino)** commented [May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4496804828) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/ggml-org/llama.cpp/pull/23343).
Copy link
Copy Markdown
Contributor
Author
| |
| --- |
| [@CISC](https://github.com/CISC) Done, I've also updated the PR description. |
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
[force-pushed](https://github.com/ggml-org/llama.cpp/compare/c7a2ea1a8ee1e68133b5d8ea640e39833027c79d..66523330560174803fa9c282967d54d4be5f80bd)
the
fix/vocab-minerva-metaspace
branch
from
[`c7a2ea1`](https://github.com/ggml-org/llama.cpp/commit/c7a2ea1a8ee1e68133b5d8ea640e39833027c79d) to
[`6652333`](https://github.com/ggml-org/llama.cpp/commit/66523330560174803fa9c282967d54d4be5f80bd) [Compare](https://github.com/ggml-org/llama.cpp/compare/c7a2ea1a8ee1e68133b5d8ea640e39833027c79d..66523330560174803fa9c282967d54d4be5f80bd)
[May 20, 2026 09:38](https://github.com/ggml-org/llama.cpp/pull/23343#event-25749926329)
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
requested a review
from a team
as a [code owner](https://github.com/ggml-org/llama.cpp/blob/e2b129e1bf37203c23b430d2a1b7c66f42d11672/CODEOWNERS#L111)
[May 20, 2026 09:38](https://github.com/ggml-org/llama.cpp/pull/23343#event-25749926393)
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
[force-pushed](https://github.com/ggml-org/llama.cpp/compare/66523330560174803fa9c282967d54d4be5f80bd..af15aee6ff8eec38f6d0cbdedfec143387c185a8)
the
fix/vocab-minerva-metaspace
branch
from
[`6652333`](https://github.com/ggml-org/llama.cpp/commit/66523330560174803fa9c282967d54d4be5f80bd) to
[`af15aee`](https://github.com/ggml-org/llama.cpp/commit/af15aee6ff8eec38f6d0cbdedfec143387c185a8) [Compare](https://github.com/ggml-org/llama.cpp/compare/66523330560174803fa9c282967d54d4be5f80bd..af15aee6ff8eec38f6d0cbdedfec143387c185a8)
[May 20, 2026 09:39](https://github.com/ggml-org/llama.cpp/pull/23343#event-25749966954)
[@martin-cimmino](https://github.com/martin-cimmino)
[martin-cimmino](https://github.com/martin-cimmino)
changed the title
~~vocab : add domyn-small Metaspace BPE pre-tokenizer type~~
nemotron : support non-standard GQA, BPE tokenizer and domyn-small pre-type
[May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#event-25749984464)
[@github-actions](https://github.com/apps/github-actions)
[github-actions](https://github.com/apps/github-actions)
Bot
added
[model](https://github.com/ggml-org/llama.cpp/issues?q=state%3Aopen%20label%3Amodel)
Model specific
[python](https://github.com/ggml-org/llama.cpp/issues?q=state%3Aopen%20label%3Apython)
python script changes
labels
[May 20, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#event-25764153466)
[@martin-cimmino](https://github.com/martin-cimmino)
### **[martin-cimmino](https://github.com/martin-cimmino)** commented [May 27, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4554694123)
Copy link
Copy Markdown
Contributor
Author
| |
| --- |
| [@CISC](https://github.com/CISC) friendly ping on this one when you have a moment 🙏 I've combined the two PRs as you suggested and the branch is ready for another look. No rush — just flagging it in case it got buried. Happy to make any further changes. |
[@CISC](https://github.com/CISC)
### **[CISC](https://github.com/CISC)** commented [May 27, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-4554858624)
Copy link
Copy Markdown
Member
| |
| --- |
| [@CISC](https://github.com/CISC) friendly ping on this one when you have a moment 🙏 I've combined the two PRs as you suggested and the branch is ready for another look. No rush — just flagging it in case it got buried. Happy to make any further changes. It's in my queue, however this one requires checking that we do not break any nemotron models, so might be in the queue a while. |
[@ARC345](https://github.com/ARC345)
[ARC345](https://github.com/ARC345)
mentioned this pull request
[Oct 10, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#ref-issue-5789511805)
[Feature Request: Support BharatGen Param-1 (ParamBharatGenForCausalLM)
#30273](https://github.com/ggml-org/llama.cpp/issues/30273)
Open
4 tasks done
[@Jeronymous](https://github.com/Jeronymous)
[Jeronymous](https://github.com/Jeronymous)
mentioned this pull request
[Oct 14, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#ref-issue-5848573455)
[Eval bug: NemotronForCausalLM with decoupled head\_dim (head\_dim != n\_embd / n\_head) fails to load ("error loading model: check\_tensor\_dims: tensor ... has wrong shape")
#30518](https://github.com/ggml-org/llama.cpp/issues/30518)
Closed
[@Jeronymous](https://github.com/Jeronymous)
### **[Jeronymous](https://github.com/Jeronymous)** commented [Oct 14, 2026](https://github.com/ggml-org/llama.cpp/pull/23343#issuecomment-6169714982)
Copy link
Copy Markdown
| |
| --- |
| [@martin-cimmino](https://github.com/martin-cimmino) [@CISC](https://github.com/CISC) could this get rebased and merged? I just hit the exact bug it fixes and opened [#30518](https://github.com/ggml-org/llama.cpp/issues/30518): another public Nemotron model won't load (with a head\_dim that doesn't match hidden\_size/num\_heads), involving the same attn\_q shape mismatch as this PR solves. It would be a shame to let it stall since the fix is already here. this one requires checking that we do not break any nemotron models For what it's worth I went through the diff and the r