Skip to content

model: add MTP support for Nemotron model - #26725

Merged
ggerganov merged 3 commits into
ggml-org:masterfrom
ruixiang63:nemotron-nano-mtp
Aug 10, 2026
Merged

model: add MTP support for Nemotron model#26725
ggerganov merged 3 commits into
ggml-org:masterfrom
ruixiang63:nemotron-nano-mtp

Conversation

@ruixiang63

@ruixiang63 ruixiang63 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Overview

This PR adds MTP support for the Nemotron Nano model. Performance is not yet optimal and depends on PR #26623 being merged first.
I tested this PR on the top of PR #26623, and the performance looks good.

Additional information

Requirements

@ruixiang63
ruixiang63 requested a review from ggerganov August 7, 2026 13:46
@github-actions github-actions Bot added model Model specific conversion labels Aug 7, 2026
@ruixiang63
ruixiang63 requested a review from am17an August 7, 2026 13:47

@am17an am17an left a comment

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.

cpp side changes look ok.

@ggerganov
ggerganov marked this pull request as ready for review August 7, 2026 18:46
@ggerganov
ggerganov requested a review from CISC as a code owner August 7, 2026 18:46
Comment thread src/models/nemotron-h.cpp
Comment thread src/models/nemotron-h-moe.cpp Outdated
Qcur, Kcur, Vcur, nullptr, nullptr, nullptr, kq_scale, il);
cb(cur, "mtp_attn_out", il);
}

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.

The inp_out_ids gather can happen at this line, before the MoE FFN.
We need only attention to run over all n_tokens to fill KV.

This should help improve prefill perf a bit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Makes sense. I moved the inp_out_ids gather before the MoE FFN so attention still runs over all tokens while the MoE only processes the kept rows.
Guarded it the same way mimo2 does (crop_before_ffn = inp_out_ids && (!embeddings_nextn || embeddings_nextn_masked)).

@ggerganov
ggerganov merged commit 7a20b41 into ggml-org:master Aug 10, 2026
25 of 29 checks passed
@ruixiang63
ruixiang63 deleted the nemotron-nano-mtp branch August 10, 2026 20:27
mlogix added a commit to SynoriAI/llama.cpp that referenced this pull request Aug 11, 2026
…, multi-output backend sampling, pocket-tts

Merges 45 upstream commits (0865990..ebb546b, b10362-16-gebb546b7e) into
synori/llama-update-mtp-fit. Zero conflicts; all vendored patches carried over
untouched.

Primary motivation — new Meta architecture:
  * 62bf73d model: Muse Glimmer Support (ggml-org#26841)
    LLM_ARCH_MUSE_GLIMMER + src/models/muse-glimmer.cpp + the mtmd vision tower
    in tools/mtmd/models/muse-glimmer.cpp and conversion/muse_glimmer.py.

Other notable changes that touch our public API surface:
  * dd1ea52 llama : support multi-output backend sampling (ggml-org#25532)
    llama_context_params gains n_outputs_max_per_seq; llama_sampler_i.backend_init
    takes it as a third argument; new backend_reset / copy_state vtable slots and
    llama_sampler_copy().
  * 153d324 llama : default load-mode auto, avoids mmap on iGPUs (ggml-org#26081)
    llama_load_mode gains LLAMA_LOAD_MODE_AUTO = -1 (enum is now signed).
  * 6e62ba5 mtmd: support pocket-tts (ggml-org#26871)
    mtmd_gen_inp/mtmd_gen_out gain seed/temp/feats/is_eos; new
    mtmd_gen_inp_default(); mtmd_helper_gen_audio_step_gen() takes out_stop.
  * 157b81f model : Granite-Switch Architecture (ggml-org#25107)
  * 7a20b41 model: MTP support for Nemotron (ggml-org#26725) and
    cc078b4 Dflash support for nemotron-3.5 (ggml-org#26905)
  * e23e944 vendor : cpp-httplib 0.53.0, 4c6766f vendor : subprocess.h sync

Vendored patches preserved:
  * 919fde3 feat(rpc): thread-local last_error accessor — intact, upstream
    touched ggml-rpc.cpp by one unrelated line.
  * 3679b23 Fixes (RPC) — intact.
  * 2aa76c7 fix(metal): drop stray kernel_pad_f32 — still applies; upstream has
    since refactored pad into a templated kernel_pad_impl<T>, so the duplicate
    definition that referenced the nonexistent kargs_pad.s0..s3 is gone on both
    sides and nothing had to be re-applied.
crusaderky pushed a commit to crusaderky/llama.cpp that referenced this pull request Aug 12, 2026
* model: add MTP support for Nemotron Nano model

* model: add mtp_flags for nemotron model

* address review comments
huaxel pushed a commit to huaxel/CachyLLama that referenced this pull request Aug 12, 2026
* model: add MTP support for Nemotron Nano model

* model: add mtp_flags for nemotron model

* address review comments
Ooooze pushed a commit to AtomicBot-ai/atomic-llama-cpp-turboquant-nightly that referenced this pull request Aug 14, 2026
* model: add MTP support for Nemotron Nano model

* model: add mtp_flags for nemotron model

* address review comments

(cherry picked from commit 7a20b41)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants