Instructions to use Andgihat/Nanbeige4.2-3B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Andgihat/Nanbeige4.2-3B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Andgihat/Nanbeige4.2-3B-GGUF", filename="Nanbeige4.2-3B-Q8_0.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Andgihat/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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- Ollama
How to use Andgihat/Nanbeige4.2-3B-GGUF with Ollama:
ollama run hf.co/Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use Andgihat/Nanbeige4.2-3B-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Andgihat/Nanbeige4.2-3B-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Andgihat/Nanbeige4.2-3B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Andgihat/Nanbeige4.2-3B-GGUF to start chatting
- Pi
How to use Andgihat/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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Andgihat/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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use Andgihat/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 Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
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 "Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL" \ --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"
- Docker Model Runner
How to use Andgihat/Nanbeige4.2-3B-GGUF with Docker Model Runner:
docker model run hf.co/Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
- Lemonade
How to use Andgihat/Nanbeige4.2-3B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Andgihat/Nanbeige4.2-3B-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.Nanbeige4.2-3B-GGUF-UD-Q4_K_XL
List all available models
lemonade list
Nanbeige4.2-3B — GGUF (imatrix + KLD-guided dynamic quants)
GGUF quantizations of Nanbeige/Nanbeige4.2-3B — a Looped Transformer (22 physical layers reused num_loops=2 → 44 effective depth; ~4B total / ~3B non-embedding).
These are not naive quants. Each is imatrix-calibrated and uses a per-tensor mixed-precision recipe derived from a measured KL-divergence sensitivity map of this specific model (the same idea as Unsloth Dynamic, built and verified here from scratch).
⚠️ This is the only GGUF of Nanbeige4.2 that exists, and it will not run on stock llama.cpp / Ollama / LM Studio yet — see Compatibility.
Compatibility
Nanbeige4.2 uses a looped architecture not yet in upstream llama.cpp. The GGUF carries general.architecture = nanbeige, understood only by:
- The authors' branch:
Nanbeige/llama.cpp @ nanbeige42 - Our fork with the arch ported in + prebuilt Windows CUDA (sm_120) binaries: BeeLlama.cpp @ nanbeige-arch (release) — includes KVarN, so the native 256K context fits on 16 GB (
-ctk kvarn3 -ctv kvarn3).
Unmodified upstream fails with unknown architecture 'nanbeige'.
Quantizations
Quality measured as KL-divergence vs the BF16 model and Same-top-p (how often the quant's argmax token matches BF16) on wiki.test.raw. Lower KLD / higher top-p = closer to full precision.
| File | Size | KL-div ↓ | Same top-p ↑ | Pick if |
|---|---|---|---|---|
Nanbeige4.2-3B-UD-Q4_K_XL.gguf |
2.62 GB | 0.137 | 84.4 % | smallest, VRAM-tight |
Nanbeige4.2-3B-UD-Q6_K.gguf |
3.32 GB | 0.048 | 90.4 % | balanced |
Nanbeige4.2-3B-UD-Q6_K_XL.gguf |
3.67 GB | 0.024 | 92.9 % | near-lossless |
Nanbeige4.2-3B-Q8_0.gguf |
4.43 GB | 0.009 | 95.4 % | max fidelity |
Note: absolute KLD is small but the tiers are genuinely separated — plain perplexity hides this. For an agent/reasoning model where exact tokens matter (tool-calls, code, math), prefer UD-Q6_K or higher.
Benchmark — GSM8K recovery vs BF16
100 GSM8K test questions, greedy, reasoning enabled. Recovery = accuracy ÷ BF16 accuracy. Agreement = share of questions where the quant's final answer matches the BF16 model's.
| Model | Accuracy | Recovery | Agreement w/ BF16 |
|---|---|---|---|
| BF16 (reference) | 93 % | 100 % | 100 % |
UD-Q4_K_XL |
92 % | 98.9 % | 88 % |
UD-Q6_K |
90 % | 96.8 % | 91 % |
Q8_0 |
89 % | 95.7 % | 94 % |
All quants recover ~96–99 % of BF16 accuracy — near-lossless in practice; even the smallest UD-Q4_K_XL loses 1 question in 100. At n=100 the absolute-accuracy differences are within statistical noise (±3 pts) and do not rank the quants. The Agreement column is the meaningful signal: it is monotonic (Q8 > Q6 > Q4), matching the KLD ranking — higher precision deviates less from full precision.
Methodology
- imatrix via
llama-imatrixover bartowskicalibration_datav3(Dampf & Kalomaze). Included asnanbeige42-imatrix-v3.datso you can roll your own quants. (A larger multilingual corpus was tested and gave no KLD improvement — weight importance here is largely language-independent.) - KLD sensitivity sweep: starting from a uniform Q4_K base, each tensor category was bumped to Q6_K one at a time and the KLD gain per MB measured. Key findings for this looped model:
attn_v/attn_kare near-free wins (tiny under GQA — 8 KV heads — yet large KLD drop). Always bumped.attn_qis a trap (large tensor, negligible gain) — left at Q4 in the leaner quants.token_embd/outputare sensitive (unusual — driven by the concatenated n-gram embeddings) and dominate at the high-precision end (hence the_XL= Q8 embed/output).
- Bits are then allocated by measured efficiency, not by a fixed template.
_XLmarks embed/output kept at higher precision (same convention as Unsloth UD).
Running (BeeLlama fork)
llama-server -m Nanbeige4.2-3B-UD-Q6_K.gguf -ngl 99 -c 32768 --jinja
Chat template is embedded. Authors' sampling: agent temp 1.0, reasoning temp 0.6 with long context.
Credits & license
- Base model Nanbeige/Nanbeige4.2-3B, Apache 2.0 — all rights to the original authors.
- Calibration data: bartowski / Dampf / Kalomaze.
- These GGUFs are a quantized derivative, released under the same Apache 2.0. Changes vs original: GGUF conversion + quantization only; weights otherwise unmodified.
- Downloads last month
- -
4-bit
6-bit
8-bit