Downloads · 30 days
113
42% of all-time downloads
Arm/qwen2-5-1-5b-instruct-onnx-genai-int4-kquantlast-emb-int4
qwen2-5-1-5b-instruct-onnx-genai-int4-kquantlast-emb-int4 is a text generation model from Arm. Use it when you need the model to write or continue text. It is set up for onnxruntime-genai. The card lists the license as apache-2.0.
An instruction-tuned 1.5B-parameter text generation model, quantized to INT4 weights and packaged as an ONNX GenAI bundle for onnxruntime-genai on Arm-based Cloud CPU systems.
Downloads · 30 days
113
42% of all-time downloads
All-time downloads
272
Public
Repo size
1.1 GB
Likes
0
Public
Click a slice to open those files.
.data1.1 GB · 99%
From the Hugging Face model README
An instruction-tuned 1.5B-parameter text generation model, quantized to INT4 weights and packaged as an ONNX GenAI bundle for onnxruntime-genai on Arm-based Cloud CPU systems.
This repository contains an Arm-optimized version of Qwen/Qwen2.5-1.5B-Instruct for text generation. The model is provided in ONNX for the onnxruntime-genai runtime, targeting Cloud CPU systems.
The recipe is mixed-precision rather than uniformly INT4: attention and FFN weights are quantized to INT4 with GPTQ (group size 32, asymmetric), activations are dynamic INT8, the language-model head is kept at INT8, and the embedding table is INT4 block-quantized. Keeping the head at higher precision is what holds the accuracy loss to under two points.
This version is intended to demonstrate efficient inference on Arm-based platforms while preserving the original model's intended behavior. Arm has evaluated this model on MMLU and measured performance on a representative evaluation target.
Key results
| Area | Result |
|---|---|
| Model format | ONNX |
| Target device class | Cloud CPU |
| Reference device | AWS Graviton G4 (Neoverse-V2, Linux Ubuntu 24.04.4 LTS) |
| Primary performance result | 39.53 tokens/sec, 710.15 ms time to first token |
| Accuracy result | MMLU 61.03% (5-shot) |
| Size / memory result | 1078.68 MB, 6.29x smaller than the FP32 baseline |
| Field | Value |
|---|---|
| Original model | Qwen2.5-1.5B-Instruct |
| Original source | Hugging Face |
| Original developer | Alibaba Cloud (Qwen team) |
| Original model card | Qwen/Qwen2.5-1.5B-Instruct |
| Original license | Apache-2.0 |
| File | Description |
|---|---|
model.onnx | Arm-optimized model for deployment |
example.py | Minimal inference example |
pyproject.toml | Pinned runtime dependencies for example.py, resolved with uv |
uv.lock | Locked dependency resolution for pyproject.toml |
config.yaml | Model I/O contract used by the example |
benchmarks/ | FP32 baseline and Arm-optimized benchmark records |
Performance was measured on the reference configuration below. Results are intended to make the optimization reproducible but do not guarantee identical performance on every Arm-based system.
Reference configuration
| Field | Value |
|---|---|
| Device / platform | AWS Graviton G4 |
| CPU / accelerator | Neoverse-V2, CPU execution, 4 threads |
| OS | Linux Ubuntu 24.04.4 LTS |
| Runtime | ONNX Runtime 1.27.0, via onnxruntime-genai |
| Backend / delegate | MLAS, KleidiAI |
| Batch size | 1 |
| Precision | INT4 weights (GPTQ, per-group, asymmetric), dynamic INT8 activations, INT8 language-model head, INT4 block-quantized embeddings |
| Runs | 2 warmup + 30 measured |
Performance results
| Metric | Original / baseline | Arm-optimized | Improvement |
|---|---|---|---|
| p50 latency | 7514.74 ms | 2235.38 ms | 3.36x faster |
| p90 latency | 7710.21 ms | 2314.48 ms | 3.33x faster |
| p99 latency | 7896.74 ms | 2351.23 ms | 3.36x faster |
| Throughput | 10.96 tokens/sec | 39.53 tokens/sec | 3.61x |
| Time to first token | 2039.75 ms | 710.15 ms | 2.87x faster |
| Model size | 6780.30 MB | 1078.68 MB | 6.29x smaller |
| Peak memory | 6117.85 MB | 1570.45 MB | 3.90x less |
Latency and throughput are measured over a 127-token prompt generating 60 tokens.
Accuracy was evaluated using the same preprocessing, input resolution, and evaluation protocol described below. Where possible, the optimized model is compared against the original model under the same evaluation conditions.
Evaluation setup
| Field | Value |
|---|---|
| Dataset | MMLU |
| Split | test, 5-shot |
| Number of samples | 9183 |
| Metric(s) | MMLU accuracy, MMLU macro accuracy |
| Evaluation runtime | ONNX Runtime |
Accuracy results
| Metric | Original / baseline | Arm-optimized | Change |
|---|---|---|---|
| MMLU accuracy | 62.98% | 61.03% | -1.95 pp |
| MMLU macro accuracy | 61.99% | 60.11% | -1.87 pp |
Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.
Arm optimized this model for efficient inference on Arm-based platforms using a hardware-aware conversion and validation flow.
For this release, Arm used:
| Optimization area | Applied? | Notes |
|---|---|---|
| Model conversion | Yes | Exported to ONNX with the onnxruntime-genai model builder, packing INT4 weights into MatMulNBits and fusing attention into GroupQueryAttention |
| Quantization | Yes | GPTQ one-shot post-training quantization: INT4 per-group asymmetric weights (group size 32) on attention and FFN, dynamic INT8 activations, INT8 language-model head, INT4 block-quantized embeddings |
| Runtime/backend selection | Yes | ONNX Runtime CPU execution provider with MLAS and KleidiAI |
| Accuracy validation | Yes | Compared against the original model or published baseline |
| Performance validation | Yes | Measured on the reference Arm platform |
The goal of this process is to improve deployment characteristics such as latency, memory use, model size, and runtime compatibility while preserving the model's intended behavior. Detailed conversion scripts, calibration configuration, or backend-specific implementation details may be provided separately where appropriate.
Dependencies are declared in pyproject.toml, which ships with this repository. Resolve and install them into a local virtual environment with uv:
uv python install
uv sync --frozen
uv run example.py
The ordinary run prints the completion without changing repository files. To write and compare a separate result:
uv run example.py --output /tmp/qwen-predictions.json
cmp /tmp/qwen-predictions.json predictions.json
Validation used Arm/qwen2-5-1-5b-instruct-onnx-genai-int4-kquantlast-emb-int4 revision a33b51936e6163c8de454ca0a991a575eb8813c2.
Transformers reports that PyTorch is unavailable. This is expected: the example uses Transformers only for its local tokenizer, while generation runs through ONNX Runtime GenAI. The notice did not affect inference or the expected completion.
| Property | Value |
|---|---|
| Input shape | [1, T] token ids, where T is dynamic up to 4096 |
| Input type | int64 |
| Input range | Token ids in the Qwen2.5 vocabulary, 0 to 151935 |
| Preprocessing | Tokenize the prompt with the bundled Qwen2.5 BPE tokenizer, adding special tokens; no truncation or padding is needed for a single-sequence greedy decode |
| Property | Value |
|---|---|
| Output shape | [1, N] where N is prompt tokens plus generated tokens |
| Output type | Generated token id sequence |
| Postprocessing | Detokenize with the same tokenizer, skipping special tokens; decoding is greedy, with no sampling |
This model is intended for developers evaluating text generation workloads on Arm-based platforms. It is suitable as a reference implementation for benchmarking, prototyping, and integration exploration.
The ONNX graph stores its weights in an external data file, so model.onnx and model.onnx.data must be downloaded together and kept side by side. The runtime also reads genai_config.json, tokenizer.json, and tokenizer_config.json from the same directory, and example.py loads the tokenizer from these local files rather than from the Hugging Face Hub, so an ordinary run needs no network access.
Original Model: Qwen2.5-1.5B-Instruct by Alibaba Cloud (Qwen team) - Repository
Optimization/conversion: Arm-Optimized version for execution on Arm-based platforms.
Converted/optimized by: Arm
License: The Original Model and the Optimized Model are subject to Apache-2.0.
This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.
No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.
For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.
Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.
You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.
The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.
Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.
To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.
You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.
Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.