Qwen2.5-0.5B-Instruct — SMQ Q2K/TQ9_128 QAT GGUF
This is a mixed-precision SMQ quantization of Qwen2.5-0.5B-Instruct, adapted with SMQ's closed-form algebraic QAT before quantization.
The release artifact is:
qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf
It uses standard Q2_K blocks for ffn_down and dense TQ9_128 blocks for the remaining weight matrices. Loading it requires the patched llama.cpp-tr runtime because TQ9_128 is GGML type ID 44.
Model details
| Field | Value |
|---|---|
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Architecture | qwen2 |
| GGUF tensor elements | 630,167,424 (includes untied token_embd and output) |
| Layers | 24 |
| Hidden size | 896 |
| Attention heads | 14 |
| KV heads | 2 (GQA) |
| Feed-forward size | 4864 |
| Context length | 32768 |
| Vocab size | 151936 |
| RoPE base | 1,000,000 |
| RMSNorm epsilon | 1e-6 |
| Tokenizer | GPT-2 BPE (qwen2 pre-tokenizer), BOS 151643, EOS 151645 |
| Chat template | Qwen2.5 template preserved from the source GGUF |
| License | Apache-2.0 |
Quantization recipe
The quantization plan was produced with smq_gguf_convert_live.py using --qtype q2_k and automatic 256 → 128 block-size fallback:
| Tensors | Format | Count | Nominal BPW |
|---|---|---|---|
blk.*.ffn_down.weight | Q2_K | 24 | 2.625 |
Attention projections, ffn_gate, ffn_up, token_embd, output | TQ9_128 | 146 | 3.375 |
| Norms and biases | F32 (passthrough) | 121 | 32.0 |
- File size: 262,249,824 bytes (250 MiB)
- Effective payload: ~3.25 bpw
- GGUF
general.file_type: 44 (TQ9_128)
Q2_K applies only to ffn_down because those rows have ne[0] = 4864, which is divisible by 256. The other matrices have ne[0] = 896 and therefore fall back to the 128-weight TQ9_128 format.
Perplexity
Reported with llama-perplexity using the same corpus and settings for all three artifacts. These are internal validation numbers, not a held-out benchmark.
| Artifact | File | Perplexity | Relative to Q8_0 |
|---|---|---|---|
| Q8_0 input | qwen2.5-0.5b-instruct-q8_0.gguf | 20.0075 | — |
| Q2K/TQ9_128, no QAT | qwen2.5-0.5b-instruct-q8_0-SMQ-Q2K-qat-f16-SMQqq-Q2K.gguf | 50.7231 | +153.5% |
| Q2K/TQ9_128 + SMQ QAT (this file) | qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf | 24.0632 | +20.3% |
SMQ QAT reduces perplexity by 52.6% in this instance, versus the same quantization plan without QAT (2.11× lower), recovering most of the loss.
Example invocation (perplexity depends on corpus, context length, and backend):
./build/bin/llama-perplexity \
-m qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf \
-f calibration_data.txt \
-c 512 \
-ngl 99
Requirements
- llama.cpp-tr build with
TQ9_128support (GGML type ID 44): https://github.com/ternii-ai/tritq-vllm - Stock
llama.cppcannot load this file because of theTQ9_128tensors. - For SMQ QAT / conversion: Python 3.10+, PyTorch, NumPy,
gguf,transformers,tokenizers, andsafetensors.
Usage
CLI
./build/bin/llama-cli \
-m qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf \
-p "What is the capital of France?" \
-n 32 \
-ngl 99
Server
./build/bin/llama-server \
-m qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf \
-c 32768 \
-ngl 99 \
--jinja \
--host 0.0.0.0 \
--port 8080
The model's maximum context is 32768 tokens. Larger -c values are capped by the runtime.
Known runtime issue
With the tested llama.cpp-tr build, using --cache-type-k q5_1 --cache-type-v q5_1 produces corrupted generation. The same failure reproduces with the original Q8_0 model, so it is a runtime KV-cache issue rather than a problem with this quantization. Use the default F16 KV cache.
Reproduction
1. Algebraic QAT
python train_smq_qat.py \
--gguf qwen2.5-0.5b-instruct-q8_0.gguf \
--corpus calibration_data.txt \
--output qwen2.5-0.5b-instruct-q8_0-SMQ-Q2K-qat-f16.gguf \
--qtype q2_k \
--device cuda:0
2. Quantize the adapted F16 staging GGUF
python smq_gguf_convert_live.py \
qwen2.5-0.5b-instruct-q8_0-SMQ-Q2K-qat-f16.gguf \
--qtype q2_k \
--output-gguf qwen2.5-0.5b-instruct-Q2K-TQ9_128-SMQ.gguf
The converter automatically selects TQ9_128 for tensors whose row length is not divisible by the Q2_K block size of 256.
Limitations
- This is a 0.5B model; expect limited reasoning, factual accuracy, and long-context performance compared with larger Qwen2.5 models.
- Perplexity was measured on the calibration corpus, so the reported number is optimistic relative to a held-out evaluation.
TQ9_128is not supported by stockllama.cpp; use the patched runtime.- The Qwen2.5 chat template is preserved, but this artifact is a quantized research release and has not been evaluated on standard safety or capability benchmarks.
Credits
- Base model: Qwen2.5-0.5B-Instruct, Apache-2.0.
- Quantization and QAT: SMQ (
smq_gguf_convert_live.py,smq_qat.py), Apache-2.0. TQ9_128format and kernels: llama.cpp-tr (https://github.com/ternii-ai/tritq-vllm), Apache-2.0.