Instructions to use nicolasembleton/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 nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use nicolasembleton/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 "nicolasembleton/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": "nicolasembleton/Nanbeige4.2-3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
- Ollama
How to use nicolasembleton/Nanbeige4.2-3B-GGUF with Ollama:
ollama run hf.co/nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
- Unsloth Studio
How to use nicolasembleton/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 nicolasembleton/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 nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF to start chatting
- Pi
How to use nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
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": "nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use nicolasembleton/Nanbeige4.2-3B-GGUF with Docker Model Runner:
docker model run hf.co/nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
- Lemonade
How to use nicolasembleton/Nanbeige4.2-3B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nicolasembleton/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 nicolasembleton/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 nicolasembleton/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 nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use nicolasembleton/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 nicolasembleton/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 "nicolasembleton/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
Quantized GGUF versions of Nanbeige/Nanbeige4.2-3B for efficient local inference via llama.cpp, LM Studio, and Ollama.
Nanbeige4.2-3B is a loop transformer (num_loops=2) trained on Chinese/English data. 3B parameters, 256K context, optimized for general-purpose chat and instruction following.
Quantization overview
This repo ships best quality per compression band — no Q2, no I-quants, no XL variants. Just the cleanest K-quant in each size band plus the lossless baselines.
| File | Size | Bits/weight | Use case |
|---|---|---|---|
Nanbeige4.2-3B-F16.gguf |
~8.2 GB | 16 | Full precision, lossless |
Nanbeige4.2-3B-BF16.gguf |
~8.2 GB | 16 (bfloat16) | Faster loading, equivalent quality |
Nanbeige4.2-3B-Q8_0.gguf |
~4.3 GB | 8 | Near-lossless |
Nanbeige4.2-3B-Q6_K.gguf |
~3.4 GB | 6 | Excellent quality |
Nanbeige4.2-3B-Q5_K_M.gguf |
~2.9 GB | ~5.5 | High quality |
Nanbeige4.2-3B-Q4_K_M.gguf |
~2.5 GB | ~4.5 | Recommended default |
Nanbeige4.2-3B-Q3_K_L.gguf |
~2.3 GB | ~3.5 | Tight memory, lowest viable quality |
All K-quants use an importance matrix (imatrix) calibrated against Project Gutenberg text for better quality at low bit-widths.
Running
llama.cpp (CLI)
llama-cli -m Nanbeige4.2-3B-Q4_K_M.gguf -c 4096 --color -i --temp 0.1 --top-k 50 --repeat-penalty 1.1
llama.cpp (one-liner via HF)
llama-cli -hf nicolasembleton/Nanbeige4.2-3B-GGUF:Q4_K_M -c 4096 --color -i
Python (llama-cpp-python)
from llama_cpp import Llama
llm = Llama(
model_path="Nanbeige4.2-3B-Q4_K_M.gguf",
n_ctx=4096,
n_threads=8,
n_gpu_layers=99, # offload all layers to GPU if available
)
print(llm("Hello, how are you?", max_tokens=256)["choices"][0]["text"])
Ollama
Create a Modelfile:
FROM ./Nanbeige4.2-3B-Q4_K_M.gguf
Then:
ollama create nanbeige4.2-3b -f Modelfile
ollama run nanbeige4.2-3b
In-browser (ONNX Runtime Web + Transformers.js)
For browser-based inference, use ONNX Runtime Web directly — no web-llm needed.
Option 1: Our ONNX export (cross-browser, including Apple Safari)
nicolasembleton/Nanbeige4.2-3B-ONNX — BF16 weights with a working num_loops=2 unroll. Works in Chrome, Firefox, Edge (WebGPU fast path) and Apple Safari 17+ macOS (WASM fallback).
import * as ort from "onnxruntime-web";
const session = await ort.InferenceSession.create(
"https://huggingface.co/nicolasembleton/Nanbeige4.2-3B-ONNX/resolve/main/model.onnx",
{ executionProviders: ["webgpu", "wasm"] }, // Safari 17 macOS falls back to WASM
);
const inputIds = BigInt64Array.from(/* your token ids */);
const feeds = {
input_ids: new ort.Tensor("int64", inputIds, [1, inputIds.length]),
attention_mask: new ort.Tensor("int64", new BigInt64Array(inputIds.length).fill(1n), [1, inputIds.length]),
position_ids: new ort.Tensor("int64", [...Array(inputIds.length).keys()].map(BigInt), [1, inputIds.length]),
};
const { logits } = await session.run(feeds);
Option 2: Community WebGPU-only export (Chrome, Firefox, Edge)
Michionlion/Nanbeige4.2-3B-ONNX-WebGPU — Q4F16 WebGPU-optimized, smaller (~3 GB) but no WASM fallback.
import { pipeline } from "@huggingface/transformers";
const generator = await pipeline(
"text-generation",
"Michionlion/Nanbeige4.2-3B-ONNX-WebGPU",
{
device: "webgpu",
dtype: "q4f16",
model_file_name: "model_webgpu_mlp",
use_external_data_format: 2,
},
);
const output = await generator("Hello, how are you?", { max_new_tokens: 256 });
Architecture note: Nanbeige's
num_loops=2(two passes per physical layer) was previously only available in community ONNX exports via custom kernels (MatMulNBitsMlp). Our export unrolls the loop at the Python level — 44 sequential layer calls with shared 22 weights — producing a standard ONNX graph that runs in stock ONNX Runtime Web.
Note: This GGUF repo is for native/server-side inference (llama.cpp, Ollama, LM Studio). The ONNX repo above covers browser inference with cross-browser support including Apple Safari WASM fallback.
Architecture
NanbeigeForCausalLM — loop transformer with 22 layers, num_loops=2 (two passes per layer). 48 heads, 8 KV heads, 3072 hidden, 166144 vocab, 256K context.
Built with llama.cpp b10276 (Aug 2026) — the first release to include Nanbeige architecture support.
Files
*.gguf— quantized model filesREADME.md— this file
License
Inherited: Apache 2.0 license (see Nanbeige/Nanbeige4.2-3B).
Citation
@misc{nanbeige42-3b-gguf,
title = {{Nanbeige4.2-3B-GGUF}},
author = {{Nanbeige, quantizations by nicolasembleton}},
year = {{2026}},
howpublished = {{Hugging Face}},
note = {{GGUF quantizations of Nanbeige4.2-3B. For browser inference use nicolasembleton/Nanbeige4.2-3B-ONNX (cross-browser including Apple Safari) or Michionlion/Nanbeige4.2-3B-ONNX-WebGPU (WebGPU-only).}},
}}
- Downloads last month
- 470
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit