HuggingFaceTB/SmolLM2-360M-Instruct optimized for Arm-based mobile CPUs with SME2

A quantized version of HuggingFaceTB/SmolLM2-360M-Instruct for text generation, exported to ExecuTorch (.pte) and optimized for Arm-based mobile CPUs with SME2.

Summary

This repository contains an Arm-optimized version of HuggingFaceTB/SmolLM2-360M-Instruct for text generation, quantized with a mixed recipe: 4-bit per-group symmetric weights (group size 32) on the transformer linear layers and dynamic per-token 8-bit asymmetric activations, with the token embedding and lm_head kept at higher precision. The model is provided in ExecuTorch (.pte) format, targeting Mobile CPU systems.

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 ExecuTorch (.pte)
Target device class Mobile CPU
Reference device vivo X300 (C1-Ultra, C1-Premium, C1-Pro, Android 16 / OriginOS 6)
Primary performance result 100.36 tokens/sec generation (30.92x faster than baseline), time to first token 195.50 ms
Accuracy result MMLU 31.72% (0-shot)
Size / memory result 240.05 MB (6.50x smaller), peak memory 858.38 MB

Original model

Field Value
Original model HuggingFaceTB/SmolLM2-360M-Instruct
Original source Hugging Face
Original developer Hugging Face (HuggingFaceTB)
Original model card HuggingFaceTB/SmolLM2-360M-Instruct
Original license Apache-2.0

Model files

File Description
HuggingFaceTB__SmolLM2-360M-Instruct_executorch_optimized.pte 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

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 vivo X300
CPU / accelerator C1-Ultra, C1-Premium, C1-Pro, 16 GB system memory; CPU execution backend
OS Android 16 / OriginOS 6
Runtime ExecuTorch 1.1.0
Backend / delegate XNNPACK, KleidiAI
Batch size 1
Precision Mixed — 4-bit per-group symmetric weights (group size 32) on the transformer linear layers, dynamic per-token 8-bit asymmetric activations; token embedding and lm_head kept at higher precision
Runs 5 warmup + 20 measured

Measurement conditions. Each measured run consumes a 125-token prompt and generates 128 tokens, using 4 CPU threads, 5 warm-up runs and 20 measured runs. Each run starts only once Android reports thermal status 0 (NONE), after a 30 s settle. The device is set to fixed performance mode, which is the official recommendation.

The FP32 reference was exported without fused SDPA-with-KV-cache, so part of this ratio reflects graph structure rather than precision.

Performance results

Metric Original / baseline Arm-optimized Improvement
Tokens per second 3.25 100.36 30.92x
Time to first token (ms) 1272.50 195.50 6.51x faster
End-to-end latency p50 (ms) 40378.50 1459.50 27.67x faster
End-to-end latency p90 (ms) 43270 1521 28.45x faster
End-to-end latency p99 (ms) 44084 1540 28.63x faster
Model load time (ms) 1062.50 477.00 2.23x faster
Time to first inference (ms) 44084 1287 34.25x faster
Model size (MB) 1561.03 240.05 6.50x smaller
Peak memory (MB) 2993.56 858.38 3.49x less

Accuracy

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 0-shot
Number of samples 5000
Metric(s) MMLU accuracy, length-normalized cloze (the mmlu_continuation task of lm-evaluation-harness, no chat template)
Evaluation runtime ExecuTorch 1.1.0 (CPU, XNNPACK, KleidiAI)

Accuracy results

Metric Original / baseline Arm-optimized Change
MMLU accuracy (%) 32.56 31.72 -0.84 pp

Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.

Arm optimization approach

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 ExecuTorch .pte through the optimum-executorch xnnpack recipe
Quantization Yes PTQ-static, mixed precision — 4-bit per-group symmetric weights (group size 32) on the transformer linear layers, dynamic per-token 8-bit asymmetric activations; the token embedding and lm_head were skipped from quantization to keep accuracy within acceptable ranges; calibrated on 200 randomly sampled MMLU prompts
Runtime/backend selection Yes XNNPACK + KleidiAI delegate
Graph/runtime compatibility updates Yes Performed as part of the ExecuTorch export pipeline
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.

Using this model

Python environment

A representative evaluation target for this model is an Android handset, which does not run Python and uv. The environment recorded in .python-version, pyproject.toml, and uv.lock describes the AWS Graviton host the example was locked and run on. No Graviton latency or memory benchmark is reported here — the figures in the Performance section were measured on the vivo X300 itself.

The example was tested with Python 3.13.15 and ExecuTorch 1.1.0 on Ubuntu 24.04 (glibc 2.39). Requires Python 3.13. The example requires the runtime's XNNPACK backend, which the ExecuTorch backend registry reports as registered. No native packages beyond the Python wheels are needed.

Install dependencies

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

Run the example

uv run example.py

Note: The Python/uv example runs on AWS Graviton (Ubuntu arm64) to confirm runtime compatibility only, and is intended as a guideline for building an equivalent run script on Mobile CPU systems.

Expected input

Property Value
Input shape [1, 2048]
Input type int64
Input range Integer token IDs over the SmolLM2 vocabulary of 49152 tokens
Preprocessing Tokenize with the SmolLM2 BPE tokenizer (no chat template, no special tokens), truncate from the left to a maximum length of 2047, convert to an int64 tensor, and build an int64 cache_position tensor holding the positions of the new tokens within the static KV-cache

Expected output

Property Value
Output shape [1, T, 49152]
Output type Causal-LM logits over the SmolLM2 vocabulary of 49152 tokens
Postprocessing For generation, take the argmax at the last position, append the token, advance the cache, and stop on the end-of-sequence token or the maximum sequence length, then detokenize with special tokens skipped. For MMLU scoring, append each answer choice to the prompt as a continuation, accumulate its log-probability one token at a time under teacher forcing, normalize by the character length of the choice, and take the argmax over the four choices

Intended use

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.

Limitations

  • Performance depends on the target device, runtime version, backend/delegate support, memory configuration, and system load.
  • Accuracy was evaluated on MMLU, 0-shot, over 5000 sampled questions and may not generalize to all domains.
  • This release preserves the original model's intended task and behavior, but users should validate it for their own application, data, and deployment environment.
  • This repository is not a replacement for the original model documentation.

Additional notes

The exported .pte uses a fixed maximum sequence length of 2048, with the dynamic dimension capped at 2047; longer contexts require re-exporting with a larger maximum length.

The export substitutes a custom fused SDPA kernel and a custom static KV-cache before capture. The token embedding and the final lm_head projection were skipped from quantization and kept at higher precision to keep accuracy within acceptable ranges; all intermediate transformer linear layers (the Q/K/V/O projections and the feed-forward up, gate and down projections) are quantized.

The bundled example.py scores MMLU with the cloze protocol, appending each answer choice to the prompt as a continuation and comparing length-normalized log-probabilities. This is the protocol the reported accuracy was measured with.

Time to first inference is dominated by a one-time repacking of the 4-bit weights into the micro-kernel format on the first call; that cost amortizes over subsequent calls but should be considered when designing the request path.

About this version

Original Model: HuggingFaceTB/SmolLM2-360M-Instruct by Hugging Face (HuggingFaceTB) - 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.

Original Model and Documentation

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.

Licenses and Third-Party Terms

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.

Purpose of this Release

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.

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

Model tree for Arm/smollm2-360m-instruct-8da4w-xnnpack-executorch

Quantized
(116)
this model

Collection including Arm/smollm2-360m-instruct-8da4w-xnnpack-executorch