Skip to content

vocab : fix Nemotron-3.5-Embed tokenization - #30974

Merged
danbev merged 4 commits into
ggml-org:masterfrom
tokinasin:fix/nemoembed
Oct 23, 2026
Merged

danbev merged 4 commits into
ggml-org:masterfrom
tokinasin:fix/nemoembed

Conversation

@tokinasin

Copy link
Copy Markdown
Contributor

Overview

Nemotron-3.5-Embed inserts U+200C immediately after [ and < in user input (Nemotron-3 does not). The official implementation removes these characters after identifying special tokens, but #30877 left them intact. This fix adds the missing normalization step.

Sorry for the oversight! 🙏

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, I used Codex for research, code generation and reviews, etc.

@CISC

CISC commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Nemotron-3.5-Embed inserts U+200C immediately after [ and < in user input (Nemotron-3 does not). The official implementation removes these characters after identifying special tokens

Sorry, what? Where does it do that?

@tokinasin

tokinasin commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Sorry, what? Where does it do that?

The U+200C insertion is done at

https://huggingface.co/nvidia/Nemotron-3.5-Embed-1B-BF16/blob/main/chat_template.jinja#L7-L9

and the normalization is defined at

https://huggingface.co/nvidia/Nemotron-3.5-Embed-1B-BF16/blob/main/tokenizer.json#L9007

@CISC

CISC commented Oct 22, 2026

Copy link
Copy Markdown
Member

and the normalization is defined at
https://huggingface.co/nvidia/Nemotron-3.5-Embed-1B-BF16/blob/main/tokenizer.json#L9007

Oh wow, that's, hm, special...

"normalizer": {
    "type": "Sequence",
    "normalizers": [
      {
        "type": "Replace",
        "pattern": {
          "String": "[\u200c"
        },
        "content": "["
      },
      {
        "type": "Replace",
        "pattern": {
          "String": "<\u200c"
        },
        "content": "<"
      }
    ]
  }

@CISC CISC left a comment

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.

Well, this sucks, but not likely we can generalize it within reason.

Comment thread src/llama-vocab.h Resolved
@CISC
CISC requested a review from danbev October 22, 2026 13:28
@CISC

CISC commented Oct 22, 2026

Copy link
Copy Markdown
Member

Rebase?

tokinasin and others added 3 commits October 22, 2026 22:56
Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
Comment thread src/llama-vocab.cpp Resolved
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
@tokinasin
tokinasin requested a review from CISC October 22, 2026 15:10
@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 Oct 22, 2026
@danbev
danbev merged commit f9599d0 into ggml-org:master Oct 23, 2026
16 checks passed
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
* vocab : fix Nemotron-3.5-Embed tokenization

* Update src/llama-vocab.h

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>

* rename

* Update src/llama-vocab.cpp

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants