ANTIMEME SYSTEMWORKS

ANTIMEME SYSTEMWORKS // CREATIVE UTILITIES DIVISION

Qwen3-4B / Low-RAM benchmark

8 quantizations. One CPU setup. Quality, file size and throughput in the same record.

AM-RS-2026 // QWEN3-4B // V1.0_BUILD


GGUF conversions and quantizations of Qwen/Qwen3-4B, with measured WikiText-2 perplexity and CPU throughput. The files contain no fine-tuning. Compare the recorded setup and uncertainty before transferring these results to another machine.

01 / 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:

  1. Machine-readable results (data/results.tsv)
  2. Exact methodology; pinned llama.cpp build + commit, fixed corpus, fixed context, fixed threads, fixed seed
  3. A CPU benchmark you can re-run (bench/run_bench.sh)
  4. 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.

02 / 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.

03 / 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 reduces the perplexity gap (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.

04 / Benchmarks

Eight quantizations, CPU-only, 16 threads. The perplexity axis is truncated to show the measured differences; throughput starts at zero.

Qwen3-4B measured perplexity and generation throughput

Open the interactive quant picker. Select a row for the exact GGUF download. File size is measured; the picker's RAM figure is a rule-of-thumb estimate.

05 / 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 balanced file size; runtime RAM depends on context
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

06 / 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

Use a compatible llama.cpp-based client, such as llama-cli or llama-server, with support for this model and quantization.

07 / 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.

08 / 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).

09 / 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

10 / 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)

11 / 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.


ANTIMEME SYSTEMWORKS // CREATIVE UTILITIES DIVISION // P.01

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

3-bit

4-bit

5-bit

6-bit

8-bit

16-bit

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

Model tree for b4ph/qwen3-4b-lowram-bench

Finetuned
Qwen/Qwen3-4B
Quantized
(361)
this model

Space using b4ph/qwen3-4b-lowram-bench 1