Skip to content

model: add Domyn Edge 4B Model - #32559

Merged
ggerganov merged 5 commits into
ggml-org:masterfrom
martin-cimmino:feat/domyn_edge
Nov 20, 2026
Merged

ggerganov merged 5 commits into
ggml-org:masterfrom
martin-cimmino:feat/domyn_edge

Conversation

@nicholas-mainardi-domyn

Copy link
Copy Markdown
Contributor

Overview

This PR adds support for the Domyn Edge architecture. Domyn Edge is a new 4B model being progressively released by Domyn. The latest model checkpoint can be found here; later checkpoints up to the final version of the model will be progressively released, but the model architecture won't change, so this PR will work with upcoming checkpoints of the model.

Additional information

The model architecture for Domyn Edge has been added following the guidelines and best practices suggested in add-new-model and the docs.

Architecture distinctive features:

  • Interleaved SWA, with RoPE only on the SWA layers
  • Different head dims for SWA and full layers
  • Q/K norm, with Q-norm having no weight
  • The tokenizer reuses the qwen2 pre-tokenizer, so there's no new pre-type

The PR also updates test-llama-archs module to correctly mock a domyn edge GGUF. All the ctest ran successfully

Conversion Correctness Tests

The following tests were run to assess the correctness of the model architecture w.r.t. HF model:

  • Tokenizer tests:
    • Run test-tokenizer-0 on the test cases generated by convert_hf_to_gguf_update.py
    • Run tests/test-tokenizer-random.py
  • Logits matching:
    • Run the causal-verify-logits recipe on the GGUF model converted with bf16 weights (same as source) in examples/model_conversion to check that computed logits are close
    • Ran an ad-hoc test to compare logits distribution and top-k matched tokens over 100 prompts of different lengths, up to 16384 characters, running both models over float32 on CPU (without flash attention to reduce noise due to different kernel implementations and precision):
Metric llama-f32 vs HF f32
Prompts compared 100
Top-1 agreement 100.0%
Prompts w/ top-10 rank diff 0/100
Mean top-10 overlap 10.00/10
Prompts w/ swap gap > 0.001 0/100
max|Δ| median 4.101e-05
max|Δ| p95 2.597e-04
max|Δ| max 1.585e-03
KL median 5.361e-11
KL p95 1.316e-09
KL max 6.285e-08
  • Quantization-related tests:
    • Run causal-run-quantized-model recipe in examples/model_conversion for a quantized Q8_0 model
    • Run llama-perplexity over metal backend, using wikitext test split, to compute perplexity over 20 chunks of 4k tokens each:
Model Config Perplexity vs f16
f16 15.0575 —
f16 + q8_0 KV 15.0664 +0.06%
Q8_0 quantized model 15.1006 +0.29%
Q4_K_M quantized model 16.6946 +10.9%
Q4_K_M + llama-imatrix (on wikitext train split) 15.9722 +6.1%

Minor Additional Changes

These are small changes to fix some minor issues I identified when testing the model:

  • Fix calls to libllama.tokenize/detokenize in tests/test-tokenizer-random.py to match the new APIs, providing as input argument the vocabulary rather than the model
  • Fix creation of the tokenizers folder in convert_hf_to_gguf_update.py only after the successful download of the model; otherwise the generation of the test cases on new models may fail if the user doesn't have access to other models

I believe they are small enough to avoid having a distinct PR for them, but I am open to moving such fixes to specific PRs

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES.
    • AI-generated code for the GGML graph implementation and the RoPe pattern/sliding window GGUF conversion. I reviewed all the generated code, fixing it when necessary.
    • Run AI-assistant to review the changes following the code-review skill before opening the PR; I addressed the requested changes directly to ensure they were legitimate

@ggml-gh-bot

This comment was marked as off-topic.

@nicholas-mainardi-domyn

nicholas-mainardi-domyn commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

I confirm the commit messages and the PR description were written by myself

@github-actions github-actions Bot added model Model specific testing Everything test related conversion labels Nov 18, 2026
@nicholas-mainardi-domyn
nicholas-mainardi-domyn marked this pull request as ready for review November 18, 2026 18:12
Comment thread convert_hf_to_gguf_update.py Resolved
def tokenize(self, text: str, add_special: bool = False, parse_special: bool = False) -> list[int]:
encoded_text: bytes = text.encode("utf-8")
num = self.lib.llama_tokenize(self.model, encoded_text, len(encoded_text), self.token_ids, len(self.token_ids), add_special, parse_special)
num = self.lib.llama_tokenize(self.vocab, encoded_text, len(encoded_text), self.token_ids, len(self.token_ids), add_special, parse_special)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 Guess you're the first one to use this for almost 2 years...

@CISC CISC added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Nov 19, 2026
@ggerganov
ggerganov merged commit 55d3235 into ggml-org:master Nov 20, 2026
27 checks passed
Kidplayer666 pushed a commit to Kidplayer666/llama.cpp that referenced this pull request Nov 20, 2026
* feat: add domyn-edge model

* Generate tokenizer hash for conversion + fix tests

* Address changes according to code-review skill

* catch ValueError in convert_hf_to_gguf_update.py

* renegerate fusion test baseline + fix model naming style
Annieren pushed a commit to Annieren/llama.cpp-upstream that referenced this pull request Nov 23, 2026
* feat: add domyn-edge model

* Generate tokenizer hash for conversion + fix tests

* Address changes according to code-review skill

* catch ValueError in convert_hf_to_gguf_update.py

* renegerate fusion test baseline + fix model naming style
Mr-J-369 pushed a commit to Mr-J-369/llama.cpp-Android that referenced this pull request Nov 25, 2026
* feat: add domyn-edge model

* Generate tokenizer hash for conversion + fix tests

* Address changes according to code-review skill

* catch ValueError in convert_hf_to_gguf_update.py

* renegerate fusion test baseline + fix model naming style

(cherry picked from commit 55d3235)
Nindaleth pushed a commit to Nindaleth/llama.cpp that referenced this pull request Nov 26, 2026
* feat: add domyn-edge model

* Generate tokenizer hash for conversion + fix tests

* Address changes according to code-review skill

* catch ValueError in convert_hf_to_gguf_update.py

* renegerate fusion test baseline + fix model naming style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. model Model specific testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants