Qwen2.5 0.5B Instruct, GPTQ INT4, Torq
Model Overview
Qwen2.5-0.5B-Instruct
compiled for the Synaptics Astraâ„¢ SL2610-Series Torq NPU. The weights are
INT4 and calibrated with GPTQ on HuggingFaceH4/ultrachat_200k.
- Model type: decoder-only LLM: 24 layers, hidden 896, 14 query and 2 KV heads.
- Input and output: text.
- Context: static, 256 tokens (prompt and generation).
- Vocabulary: the output is trimmed to Latin text, punctuation and digits (151,936 → 99,473 tokens, padded to 99,520). The model cannot generate CJK or other non-Latin scripts.
Files
| File | Description |
|---|---|
transformer.vmfb |
Static single-token decoder. Inputs: token_embedding [1,1,896] bf16, position_ids [1,1] i32, 24 × KV cache [1,4,256,64] bf16. Outputs: hidden state [1,1,896] and the updated KV caches. |
lm_head.vmfb.trim |
Vocabulary projection: hidden state → logits [1,1,99520] |
token_embeddings.npy |
bf16 [151936, 896] embedding table. The lookup runs on the host. |
token_id_lut.npy |
int32 [99520]: maps a compact logit index to a tokenizer ID |
tokenizer.json, tokenizer_config.json, config.json, generation_config.json |
From Qwen/Qwen2.5-0.5B-Instruct |
gptq/ |
GPTQ INT4 weights that torq-export-model qwen uses |
How it was built
Built with torq-tools:
torq-export-model qwen -s qwen2.5-0.5b-instruct
- Static conversion of the optimum ONNX export: single-token decode with a fixed 256-slot KV cache and causal masking.
- The token embeddings move to the host, the vocabulary is trimmed and the LM head is a separate model.
- Grouped-query attention reads the 2 KV heads directly, with no
repeat_kvcopy of the cache. - All 168 transformer MatMuls and the LM head use INT4
DequantizeLinear(block_size=32)with bf16 scales and INT4 zero points. The weights only are quantized; activations stay bf16. GPTQ (llmcompressor, asymmetric, group size 32) calibrated the weights on 256 samples × 1024 tokens. - torq-compiler 2.3.0 compiled the model for SL2610, with input prefetch
(stream-schedule). The compile flags are in torq-tools
src/torq/models/qwen/compile_flags.json.
Accuracy
The weight-quantization error was measured against the fp32 static model, with teacher-forced logits at 288 positions from 6 chat prompts:
| KL divergence | Cosine | Top-1 agreement | |
|---|---|---|---|
| GPTQ INT4 (this model) | 0.352 | 0.956 | 77.1 % |
| RTN INT4 (reference) | 0.442 | 0.930 | 73.3 % |
Most of the error comes from the transformer (KL 0.335). The INT4 LM head alone gives KL 0.011.
Performance
These values were measured on an SL2610 board with the NPU at 1 GHz and the
torq-examples qwen2_5 demo:
| Time per call | |
|---|---|
transformer.vmfb |
72.1 ms |
lm_head.vmfb.trim |
14.0 ms |
| Decode (chat demo) | 11.5 tok/s |
| Time to first token (13-token question after the system prompt) | 1.1 s |
Compile-time profile: the transformer takes 58.3 ms and 92 % of compute is hidden under DMA. The LM head takes 12.0 ms with 99.8 % hidden.
License
Qwen2.5-0.5B-Instruct is released by the Qwen team under the Apache License 2.0. See NOTICE.txt.
Learn More
- Downloads last month
- 43