Nanbeige4.2-3B GGUF, tokenizer-faithful

A Q4_K_M conversion of Nanbeige/Nanbeige4.2-3B that keeps the model's BPE merge table, so it tokenizes the way the model was trained.

Why this exists

Every published GGUF conversion of this model that we measured drops the merge table. The model's tokenizer is BPE with 296,888 merges over a Metaspace pre-tokenizer; the stock conversion path exports it as SentencePiece with tokenizer.ggml.model = llama, no merges, and synthesized scores equal to the negation of each token's rank. A unigram Viterbi over those scores approximates BPE and agrees with it on common text, but not everywhere.

Measured over 6,857 strings (English and French prose, source code, JSON and tool-call payloads, Chinese, adversarial whitespace, and vocabulary-boundary concatenations):

Conversion Divergent from the reference tokenizer
owao/Nanbeige4.2-3B-GGUF 34.5%
bartowski/Nanbeige_Nanbeige4.2-3B-GGUF same tokenizer shape
Andgihat/Nanbeige4.2-3B-GGUF same tokenizer shape
this repository 0.00%

Example, taken from ordinary prose:

"  silently implementing them."
  SPM conversion  [259, 75410, 14250, 876, 152361]        (5 tokens)
  reference       [259, 24049, 1787, 14250, 876, …]       (6 tokens)

Provenance

Item Value
Source weights Nanbeige/Nanbeige4.2-3B revision 451ed48c3273ecef7ea8faaa43c31ce529763bb1
Converter llama.cpp b10731 (0eadefebd3f8f92a86d634a0e5b8fffc9dc792c0) with conversion/nanbeige.py replaced by the file in this repository
Quantizer llama-quantize from the same b10731 release, Q4_K_M
File Nanbeige4.2-3B-Q4_K_M.gguf, 2,579,880,160 bytes
SHA-256 01739fad13be318c5c8620f8de52731608bb750ae887e9445cc81cb4a189e45d
License Apache-2.0, unchanged from upstream

conversion-nanbeige.py in this repository is the exact converter used. It follows Gemma4Model.set_vocab: export the BPE vocabulary, declare tokenizer.ggml.model and .pre as gemma4 (which selects LLAMA_VOCAB_TYPE_BPE and the SPM-style Metaspace pre-tokenizer already in llama.cpp), and load the merge table.

Known limitation

llama.cpp's BPE path escapes whitespace inside each fragment but never prepends the leading U+2581 that this model's Metaspace pre-tokenizer (prepend_scheme: "first") requires, and it does not read tokenizer.ggml.add_space_prefix — only the SPM and UGM tokenizers consult it.

In practice the first token of a prompt loses its leading (system instead of ▁system). That is one token per request, with no divergence anywhere else. Supplying the leading space yourself reproduces the reference exactly, which is how the 0.00% above was measured.

The clean fix belongs upstream, in the BPE tokenizer rather than in any GGUF.

Recommended sampling

From the model card: temperature 0.6, top-p 0.95, top-k 20 for reasoning and chat; the publisher recommends temperature 1.0 for agentic and tool-use work.

Trademarks

Nanbeige is a trademark of its owner. This repository redistributes an Apache-2.0 model under its original terms and claims no affiliation or endorsement.

Downloads last month
-
GGUF
Model size
4B params
Architecture
nanbeige
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for loqy/Nanbeige4.2-3B-GGUF

Quantized
(47)
this model