Skip to content

model: add dots3-note - #27060

Merged
ngxson merged 8 commits into
masterfrom
xsn/dots3-note
Aug 21, 2026
Merged

model: add dots3-note#27060
ngxson merged 8 commits into
masterfrom
xsn/dots3-note

Conversation

@ngxson

@ngxson ngxson commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Overview

Support https://huggingface.co/dots-studio/dots3-note-prev

Ref HF impl: huggingface/transformers#47844

So far, the biggest change is DSA + SWA, so the llama-kv-cache-dsa had to be extended

Additional information

This PR was tested with a slice (3 layers, 16 experts) from the real weight. Other configs and tokenizer stay unchanged

Logits validation (passed --> good/acceptable NMSE):

ctx exercises NMSE mean/max top-1 (all pos)
1800 SWA window active, DSA dense-equivalent 5.0e-6 / 9.1e-6 99.11%
3200 + real DSA top-k pruning (>2048) 2.6e-5 / 3.0e-4 98.78%

TODO:

  • decide if extending llama-kv-cache-dsa is ok
  • fix Metal mul_mat issue --> will be a separate PR
  • add MTP support
  • add vision + audio support --> dedicated branch, to be pushed as follow-up PR: xsn/dots3-note...xsn/dots3-note-mtmd
  • maybe fix the model saver/loader, not sure

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: most code generated by AI, human validated at each steps to make sure there is no invasive changes

@github-actions github-actions Bot added model Model specific testing Everything test related conversion labels Aug 14, 2026
Comment thread src/llama-kv-cache-dsa.cpp Outdated
Comment on lines +32 to +49
const bool has_swa = swa_type != LLAMA_SWA_TYPE_NONE;

const layer_filter_cb filter_mla_full = [&](int32_t il) {
if (filter_mla && !filter_mla(il)) {
return false;
}

return !(has_swa && model.hparams.is_swa(il));
};

const layer_filter_cb filter_mla_swa = [&](int32_t il) {
if (filter_mla && !filter_mla(il)) {
return false;
}

return model.hparams.is_swa(il);
};

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

CC @fairydreaming @ggerganov , I think adding SWA to DSA cache is not too invasive, do you think it's ok to keep this change as-is?

@fairydreaming fairydreaming Aug 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ngxson From my understanding SWA in Dots3 is for non-DSA layers (they are ordinary MLA layers that don't use lightning indexer at all), so the cleanest solution that follows other memory classes would be probably to create llama_kv_cache_dsa_iswa class that would combine llama_kv_cache_dsa instance for DSA layers and llama_kv_cache instance for SWA layers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

that makes sense, I moved the logic to a new llama_kv_cache_dsa_iswa, PTAL: d9de2b2

Comment thread src/models/dots3note.cpp Outdated
@ngxson

ngxson commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

I think this PR is ready to be reviewed as-is

2 follow-up PRs planned: multimodal (see xsn/dots3-note...xsn/dots3-note-mtmd) and MTP support (TODO)

@ngxson
ngxson marked this pull request as ready for review August 17, 2026 19:46
Comment thread conversion/dots3.py
Comment thread src/models/dots3note.cpp Outdated
Comment thread src/models/dots3note.cpp Outdated
@ngxson
ngxson requested a review from CISC August 19, 2026 11:56
@ngxson
ngxson requested a review from fairydreaming August 19, 2026 11:57
Comment thread src/models/dots3note.cpp Outdated
Comment thread src/models/dots3note.cpp Outdated
@ngxson

ngxson commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

tested the Q8_0 weight on a big mac 512GB RAM

image

@ngxson
ngxson merged commit 5a32f7b into master Aug 21, 2026
28 of 29 checks passed
therealkenc pushed a commit to therealkenc/llama.cpp that referenced this pull request Aug 24, 2026
* text: conversion

* init impl

* address review comments

* fix rope

* move to a new llama_kv_cache_dsa_iswa
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
* text: conversion

* init impl

* address review comments

* fix rope

* move to a new llama_kv_cache_dsa_iswa
JenySadadia pushed a commit to JenySadadia/qvac-fabric-llm.cpp that referenced this pull request Sep 7, 2026
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa`
wrapper.

Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)")
Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
JenySadadia pushed a commit to JenySadadia/qvac-fabric-llm.cpp that referenced this pull request Sep 7, 2026
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa`
wrapper.

Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)")
Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
JenySadadia pushed a commit to JenySadadia/qvac-fabric-llm.cpp that referenced this pull request Sep 7, 2026
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa`
wrapper.

Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)")
Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
gagallo7 pushed a commit to gagallo7/qvac-fabric-llm.cpp that referenced this pull request Sep 8, 2026
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa`
wrapper.

Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)")
Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
gagallo7 pushed a commit to gagallo7/qvac-fabric-llm.cpp that referenced this pull request Sep 10, 2026
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa`
wrapper.

Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)")
Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion model Model specific testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants