Q Project logo

Qwen2.5-0.5B-Instruct-qpack

Qwen2.5-0.5B-Instruct in 232 MiB: 80k vocabulary, 4-bit GPTQ, 4-bit head, lossless entropy coding

Size 4-bit License

Base model N-Q-164M-Chat

This is a size/speed research release, not a new model. It is Qwen/Qwen2.5-0.5B-Instruct re-quantised and repacked for the qpack engine. A 0.5B model still gets many facts and most arithmetic wrong, and 4-bit quantisation makes that slightly worse. No safety tuning was added.

What this is

The qpack single-file container (.qpack, mmap-able, tokenizer included) with three size reductions applied to the original weights, in this order:

  1. Vocabulary trimmed 151,936 → 80,000 tokens. Token frequencies come from English/Russian Wikipedia and public-domain fiction that do not overlap the evaluation texts; byte tokens and special tokens are always kept and merges that produce removed tokens are pruned. The C++ and Python tokenizers agree on 88/88 test strings (RU/EN/CJK/emoji/specials). Text in scripts that were rare in the frequency sample is split into more, smaller pieces.
  2. 4-bit weights (groups of 32 with an fp16 scale), GPTQ with act-order, calibrated on 4,088 tokens of RU/EN text, plus a 4-bit output head (the head is the largest matrix read at every decoded token).
  3. Lossless rANS entropy coding of the 4-bit weights and scales (QPACK3). It is decoded once at load, so kernels are untouched; the result is bit-identical to the unpacked file.

Files

file format size notes
qwen2.5-0.5b-instruct.trim80k.q4.packed.qpack QPACK3 232.2 MiB smallest; needs the engine from the main branch
qwen2.5-0.5b-instruct.trim80k.q4.qpack QPACK2 256.1 MiB memory-mapped; readable by older engine versions

qpack-pack --unpack turns the first into the second byte for byte (checked with cmp).

Honest results

Perplexity: qpack-perplexity -c 256 --chunks 4 (4 × 256 tokens per text, so differences below ~0.3 % are noise) on five texts that are not in the calibration or vocabulary-frequency data. The reference is qpack's own 4-bit mixed quantisation of the untrimmed model (q4m, 352.4 MiB); I did not measure the original bf16/f16 model, so the deltas below are relative to that 4-bit baseline, not to the original weights.

text q4m baseline (352.4 MiB) this model (256.1 / 232.2 MiB) Δ
Wikipedia RU 10.296 10.363 +0.65 %
Wikipedia EN 15.337 15.464 +0.82 %
held-out RU 19.702 19.874 +0.87 %
held-out EN 15.120 15.260 +0.93 %
fiction EN 19.180 19.449 +1.40 %

Size: 352.4 MiB → 232.2 MiB (−34 %). Speed of decoding (greedy, same files):

backend tok/s note
CPU, 16 threads (AVX2 Xeon, shared VM) ≈ 85–90 noisy; ±10 % between identical runs
NVIDIA Tesla P4 (CUDA backend) ≈ 252 median of 5 interleaved runs, 1113 MHz

Compared with llama.cpp (same model, measured on our hardware)

CPU: Xeon E5-2683 v4, threads pinned, 5 interleaved rounds, shared host (5-10 % noise). GPU: Tesla P4 (the qpack CUDA path was tuned on this card). Quality is bits per byte on four texts relative to llama.cpp f16 (noise about 0.3 %). Only Qwen2.5-0.5B was tested.

format MiB CPU decode, 8 thr (tok/s) P4 decode (tok/s) quality loss vs f16
qpack trim80k + q4 head (this repo) 232 83.9 257.8 +2.32 %
qpack q4m 352 67.4 226.7 +1.67 %
llama.cpp Q4_K_M 379 57.0 150.3 +1.50 %
llama.cpp Q4_0 336 68.6 164.8 +5.80 %

At 4 bits quality is equal to Q4_K_M within noise; the advantage is decode speed and file size. CPU prompt processing is slower than llama.cpp for 4-bit formats (16 threads: 405 vs 443 tok/s for Q4_K_M, 708 for Q4_0). Details and caveats: comparison.

Things that were tried and did not pass the +2 % budget (and are therefore not in this model): 4-bit groups of 64 or 128 (−11 to −15 MiB but +4 % to +13 % perplexity), removing any single transformer layer (≥ +7 %), and 1-bit weights (perplexity 10³–10⁷ on a 0.5B dense model).

Quick sanity check with the packed file: "What is the capital of France? Answer in one sentence." → "The capital of France is Paris." A Russian arithmetic question ("Сколько будет дважды два?") was answered wrongly ("Два двойника равно три.") — typical for this size, and not fixed by this work.

Usage

git clone https://github.com/Q-Project-LM/qpack && cd qpack
cmake -S . -B build && cmake --build build -j          # add -DQPACK_CUDA=ON for the NVIDIA backend
build/qpack-cli -m qwen2.5-0.5b-instruct.trim80k.q4.packed.qpack -q "What is the capital of France?"
# GPU: QPACK_DEVICE=cuda build/qpack-cli -m ... (Pascal or newer)

Format description: QPACK2.md (includes the QPACK3 section for the entropy-coded blobs). The WASM/JS and Android readers do not understand QPACK3 yet; use the QPACK2 file there.

Limitations

  • Quality of the original model, minus the small losses above. Facts, math and long-context behaviour are weak at 0.5B.
  • The 80k vocabulary is tuned for English and Russian; other languages tokenise into more pieces.
  • Perplexity was measured on short samples and against a 4-bit baseline, not against the original weights.
  • Only greedy decoding speed was benchmarked; the machine was shared, see the noise notes above.

License and data terms

Weights and code: Apache-2.0 (see LICENSE, NOTICE). The base model is Alibaba Cloud's Qwen2.5-0.5B-Instruct (Apache-2.0); see its model card for its training data and terms. Calibration and vocabulary-frequency texts: Wikipedia (CC BY-SA) and Project Gutenberg public-domain books.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for q-project/Qwen2.5-0.5B-Instruct-qpack

Finetuned
(1,198)
this model