Instructions to use loqy/Nanbeige4.2-3B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use loqy/Nanbeige4.2-3B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use loqy/Nanbeige4.2-3B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "loqy/Nanbeige4.2-3B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "loqy/Nanbeige4.2-3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
- Ollama
How to use loqy/Nanbeige4.2-3B-GGUF with Ollama:
ollama run hf.co/loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use loqy/Nanbeige4.2-3B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "loqy/Nanbeige4.2-3B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use loqy/Nanbeige4.2-3B-GGUF with Docker Model Runner:
docker model run hf.co/loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
- Lemonade
How to use loqy/Nanbeige4.2-3B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Nanbeige4.2-3B-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use loqy/Nanbeige4.2-3B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use loqy/Nanbeige4.2-3B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loqy/Nanbeige4.2-3B-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "loqy/Nanbeige4.2-3B-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
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
- -
4-bit