Instructions to use b4ph/qwen3-4b-lowram-bench 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 b4ph/qwen3-4b-lowram-bench 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 b4ph/qwen3-4b-lowram-bench:Q4_K_M # Run inference directly in the terminal: llama cli -hf b4ph/qwen3-4b-lowram-bench:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf b4ph/qwen3-4b-lowram-bench:Q4_K_M # Run inference directly in the terminal: llama cli -hf b4ph/qwen3-4b-lowram-bench: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 b4ph/qwen3-4b-lowram-bench:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf b4ph/qwen3-4b-lowram-bench: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 b4ph/qwen3-4b-lowram-bench:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf b4ph/qwen3-4b-lowram-bench:Q4_K_M
Use Docker
docker model run hf.co/b4ph/qwen3-4b-lowram-bench:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use b4ph/qwen3-4b-lowram-bench with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "b4ph/qwen3-4b-lowram-bench" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "b4ph/qwen3-4b-lowram-bench", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/b4ph/qwen3-4b-lowram-bench:Q4_K_M
- Ollama
How to use b4ph/qwen3-4b-lowram-bench with Ollama:
ollama run hf.co/b4ph/qwen3-4b-lowram-bench:Q4_K_M
- Unsloth Desktop
- Pi
How to use b4ph/qwen3-4b-lowram-bench with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf b4ph/qwen3-4b-lowram-bench: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": "b4ph/qwen3-4b-lowram-bench:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use b4ph/qwen3-4b-lowram-bench with Docker Model Runner:
docker model run hf.co/b4ph/qwen3-4b-lowram-bench:Q4_K_M
- Lemonade
How to use b4ph/qwen3-4b-lowram-bench with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull b4ph/qwen3-4b-lowram-bench:Q4_K_M
Run and chat with the model
lemonade run user.qwen3-4b-lowram-bench-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use b4ph/qwen3-4b-lowram-bench with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf b4ph/qwen3-4b-lowram-bench: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 b4ph/qwen3-4b-lowram-bench:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use b4ph/qwen3-4b-lowram-bench with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf b4ph/qwen3-4b-lowram-bench: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 "b4ph/qwen3-4b-lowram-bench: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"
Qwen3-4B โ Low-RAM Quantization Benchmark (reproducible, CPU-only)
A reproducible, transparent benchmark of the base Qwen/Qwen3-4B model across the standard llama.cpp K-quantization ladder, plus an imatrix comparison โ measured on a single real CPU, with machine-readable data and exact reproduction steps.
No training, no fine-tuning, no modifications. These are pure GGUF conversions and quantizations of the Apache-2.0 base model. The value of this repo is the benchmark methodology and the numbers โ not the weights.
Why this repo exists
Most GGUF model cards on the Hub give subjective quality labels ("very high quality, recommended") with no reproducible numbers, and the few that publish perplexity are single-setup with no way to reproduce them. This repo fills that gap:
- Machine-readable results (
data/results.tsv) - Exact methodology โ pinned llama.cpp build + commit, fixed corpus, fixed context, fixed threads, fixed seed
- A CPU benchmark you can re-run (
bench/run_bench.sh) - The imatrix question answered for base Qwen3-4B โ the one comparison that separates "good quant" from "best quant," independently reproduced here on a real CPU.
Results
Perplexity on the canonical WikiText-2 test set (the exact corpus llama.cpp's own CI
uses โ so these numbers are directly comparable to the ecosystem's), context 2048,
16 threads, all CPU (-ngl 0), seed 1. Throughput via llama-bench (512-token prompt
processing pp512 and 128-token generation tg128, 5 repeats, mean reported).
| Quant | File size | Perplexity (WikiText-2) | ฮ vs F16 | pp512 (t/s) | tg128 (t/s) |
|---|---|---|---|---|---|
| F16 (BF16) | 8.05 GB | 13.4304 | โ | 357.6 | 2.52 |
| Q8_0 | 4.28 GB | 13.4409 | +0.0105 | 1355.9 | 5.04 |
| Q6_K | 3.31 GB | 13.4404 | +0.0099 | 1523.2 | 5.93 |
| Q5_K_M | 2.89 GB | 13.5362 | +0.1058 | 1917.1 | 5.64 |
| Q4_K_M | 2.50 GB | 13.7304 | +0.3000 | 2064.8 | 6.50 |
| Q4_K_M + imatrix | 2.50 GB | 13.6760 | +0.2456 | 1965.3 | 6.41 |
| Q3_K_M | 2.08 GB | 15.6641 | +2.2337 | 2142.5 | 6.56 |
| Q3_K_M + imatrix | 2.08 GB | 14.8237 | +1.3933 | 2308.2 | 5.89 |
Reading the table: Q8_0/Q6_K are essentially lossless (+0.01 PPL). Q4_K_M is the knee of the curve โ 2.5 GB (31% of BF16) for +0.30 PPL, and it's the fastest generator of the non-Q3 set. Q3_K_M is a real quality cliff (+2.23 PPL), which is exactly where imatrix earns its keep.
The imatrix question
imatrix ("importance matrix") quantization uses a calibration set
(wikitext-2 wiki.train.raw, 11 MB โ standard practice) to learn which weight directions
matter most, so the quantizer spends its bits where they count. Measured here for base
Qwen3-4B (the delta vs the same non-imatrix quant):
| Quant | PPL without imatrix | PPL with imatrix | ฮ (imatrix gain) |
|---|---|---|---|
| Q4_K_M | 13.7304 | 13.6760 | โ0.054 (small) |
| Q3_K_M | 15.6641 | 14.8237 | โ0.840 (large) |
The pattern is the well-documented one, now reproduced at this scale: imatrix pays off
disproportionately at low bit-counts, where every bit matters. At Q4_K_M the gain is
real but small; at Q3_K_M โ where the plain quant is already 2.23 PPL worse than F16 โ
imatrix recovers most of the cliff (back to +1.39). The cost is a one-time calibration
pass (~3 h on this CPU; trivial on GPU) and a ~2.5 MB .dat file. Rule of thumb: run
imatrix when you drop to Q3 or below. The two imatrix files let you A/B this yourself.
Benchmarks
Size vs accuracy and size vs speed (CPU-only, 16 threads). Light/dark variants render automatically from your Hub theme.
Files
| File | Quant | Size | Notes |
|---|---|---|---|
Qwen3-4B-F16.gguf |
F16 | 8.05 GB | full-precision baseline |
Qwen3-4B-Q8_0.gguf |
Q8_0 | 4.28 GB | near-lossless |
Qwen3-4B-Q6_K.gguf |
Q6_K | 3.31 GB | K-quant (super-block scaling) |
Qwen3-4B-Q5_K_M.gguf |
Q5_K_M | 2.89 GB | K-quant, "M" = mixed precision |
Qwen3-4B-Q4_K_M.gguf |
Q4_K_M | 2.50 GB | workhorse โ runs in ~3 GB RAM |
Qwen3-4B-Q4_K_M_imatrix.gguf |
Q4_K_M+im | 2.50 GB | imatrix-quantized |
Qwen3-4B-Q3_K_M.gguf |
Q3_K_M | 2.08 GB | smallest plain quant |
Qwen3-4B-Q3_K_M_imatrix.gguf |
Q3_K_M+im | 2.08 GB | imatrix-quantized |
Machine-readable results: data/results.tsv ยท
Eval corpus: data/wiki.test.raw ยท
Harness: bench/run_bench.sh
How to use
pip install -U "huggingface_hub[cli]"
# grab just the file you want
hf download b4ph/qwen3-4b-lowram-bench --include "Qwen3-4B-Q4_K_M.gguf" --local-dir ./models
Run locally (llama.cpp):
llama-cli -m models/Qwen3-4B-Q4_K_M.gguf -c 4096
Any llama.cpp-based client works: LM Studio, Ollama (ollama import),
llama-server, text-generation-webui, etc.
How to reproduce the numbers
Harness: llama.cpp build 10516, commit b95502ba9 (the exact build used โ the
quantizer's behavior is version-sensitive, so pinning matters).
Hardware: 16-core x86-64 CPU (AVX-512 + VNNI), 61.6 GB RAM. GPU present (RTX 5090)
but unused (-ngl 0) โ all numbers are pure-CPU, so they're reproducible on any
comparable CPU box.
# quality axis โ fixed corpus, fixed ctx, fixed seed
llama-perplexity -m Qwen3-4B-<QUANT>.gguf \
-f wiki.test.raw -c 2048 -t 16 -ngl 0 -s 1
# speed axis โ 512-token prompt + 128-token generation, 5 repeats
llama-bench -m Qwen3-4B-<QUANT>.gguf -p 512 -n 128 -t 16 -ngl 0 -r 5
To add imatrix quants (as done for Q4_K_M and Q3_K_M here):
# 1. generate the importance matrix from a calibration set
llama-imatrix -m Qwen3-4B-F16.gguf -f wiki.train.raw -c 2048 -t 16 -ngl 0 -o imatrix.dat
# 2. quantize using it (note: long --imatrix flag)
llama-quantize --imatrix imatrix.dat Qwen3-4B-F16.gguf Qwen3-4B-Q4_K_M_imatrix.gguf Q4_K_M
The full loop (perplexity + speed for every quant, TSV output) is in
bench/run_bench.sh.
Base model
Converted from Qwen/Qwen3-4B via llama.cpp's
convert_hf_to_gguf.py (at the matching build commit). Model: 36 layers, hidden 2560,
GQA 32/8 heads, vocab 151936, 4.0B params, natively 262,144 context (RoPE-scaled).
Appropriate uses
- CPU-only / low-RAM deployment of Qwen3-4B (laptops, SBCs, servers without GPUs)
- Quantization selection: pick the smallest quant whose perplexity delta you accept
- Benchmarking/teaching material for the sizeโquality tradeoff
Out-of-scope uses
- Any claim that these quants were trained, fine-tuned, or otherwise modified
- Using these numbers to compare against other models (different corpus settings would be needed for a fair cross-model eval)
- High-stakes / safety-critical deployment โ Qwen3-4B's own limitations apply (see the base model card)
Licensing
- Base model: Apache 2.0 (per Qwen/Qwen3-4B's
LICENSE, which is carried in this repo as
LICENSE) - These GGUFs are derivative works of the Apache-2.0 base โ Apache 2.0
- Eval corpus: WikiText-2 (research benchmark corpus)
Community benchmark, independent of Qwen/Alibaba. Not affiliated with or endorsed by Alibaba Cloud.
- Downloads last month
- 86
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit