Hy-MT2-1.8B optimized for Arm-based mobile CPUs with SME2
Hy-MT2-1.8B machine translation model optimized as a Q4_0 plus Q8_0 GGUF for the llama.cpp runtime on Arm-based mobile CPUs with SME2.
Summary
This repository contains an Arm-optimized version of tencent/Hy-MT2-1.8B for machine translation. The model is provided as a GGUF file for the llama.cpp runtime, targeting Mobile CPU systems. The transformer body is quantized to Q4_0, the tied token-embedding and output-projection tensor is kept at Q8_0, and normalization weights remain at F32.
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 FLORES-200 and measured performance on a representative evaluation target using synthetic llama-bench token sequences.
Key results
| Area | Result |
|---|---|
| Model format | GGUF (llama.cpp) |
| Target device class | Mobile CPU |
| Reference device | vivo X300 (C1-Ultra, C1-Premium, C1-Pro, Android 16 / OriginOS 6) |
| Primary performance result | 34.02 tokens/sec decode throughput, 3011.16 ms time to first token |
| Accuracy result | FLORES-200 accuracy 83.14 |
| Size / memory result | 1087.12 MB model, 3.15x smaller than the F16 baseline; 2238.21 MB peak memory |
Original model
| Field | Value |
|---|---|
| Original model | tencent/Hy-MT2-1.8B |
| Original source | Hugging Face |
| Original developer | Tencent |
| Original model card | tencent/Hy-MT2-1.8B |
| Original license | Apache-2.0 |
Model files
| File | Description |
|---|---|
tencent__Hy-MT2-1.8B_llamacpp_q4_0_embq8_0.gguf |
Arm-optimized quantized 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/ |
FP16 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 (8 cores, aarch64, neon + dotprod + i8mm), CPU |
| OS | android — Android 16 / OriginOS 6 |
| Runtime | llama.cpp |
| Backend / delegate | CPU with KleidiAI, built with -march=armv8.6-a+dotprod+i8mm, 4 threads |
| Batch size | 1 |
| Precision | Q4_0 transformer weights, Q8_0 tied embedding / output projection, F32 normalization weights |
| Runs | 100 measured |
Performance results
| Metric | Original / baseline | Arm-optimized | Improvement |
|---|---|---|---|
| p50 end-to-end latency | 43829.64 ms | 6791.26 ms | 6.45x |
| Time to first token | 28731.00 ms | 3011.16 ms | 9.54x |
| Decode throughput | 8.48 tokens/sec | 34.02 tokens/sec | 4.01x |
| Model size | 3421.34 MB | 1087.12 MB | 3.15x smaller |
| Peak memory | 3551.34 MB | 2238.21 MB | 1.59x 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 | FLORES-200 |
| Split | 0-shot |
| Number of samples | N/A |
| Metric(s) | FLORES-200 accuracy |
| Evaluation runtime | llama.cpp |
Accuracy results
| Metric | Original / baseline | Arm-optimized | Change |
|---|---|---|---|
| FLORES-200 | 83.65 | 83.14 | -0.51 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 | GGUF conversion for the llama.cpp runtime, from the HF checkpoint via a convert_hf_to_gguf.py-style pipeline, per this project's llama.cpp backend |
| Quantization | Yes | Q4_0 weight quantization for the transformer body, Q8_0 for the tied embedding / output-projection tensor, calibrated with llama-imatrix on a ~130k-token round-robin-balanced corpus across FLORES-200 dev-split language pairs (seeded, not a fixed sample count, and not stratified in the statistical sense). This is static, weight-only quantization: Q4_0/Q8_0 are int4/int8 weight formats respectively, while activations stay in float (f16/f32) at inference time — the imatrix statistics are computed offline before deployment, not recomputed per inference. |
| Runtime/backend selection | Yes | llama.cpp CPU backend with KleidiAI, built with -march=armv8.6-a+dotprod+i8mm, 4 threads |
| Graph/runtime compatibility updates | Yes | Graph/runtime compatibility comes from convert_hf_to_gguf.py, which maps the HF checkpoint's tensor names, shapes, and architecture metadata onto ggml's expected tensor layout and naming convention, and a pre-build patch to llama.cpp itself, which prevents a bug where the EOS token is written incorrectly (so generation would otherwise never terminate). |
| 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
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
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 | [0, 120817] |
| Preprocessing | Apply the chat template embedded in the .gguf as a single user turn with add_generation_prompt=true; render the instruction "Translate the following text into {target_lang}. Note that you should only output the translated result without any additional explanation:" followed by the source text; tokenize with the GGUF-embedded tokenizer, vocabulary size 120818 |
Expected output
| Property | Value |
|---|---|
| Output shape | [1, seq_len, 120818] |
| Output type | Per-token logits over the vocabulary, decoded autoregressively to translated text |
| Postprocessing | Sample with temperature 0.7, top_p 0.8, repeat_penalty 1.05; generate up to max(64, 4 * source_token_count) tokens or until stop token id 120020; decode and strip surrounding whitespace |
This pre/postprocessing is implemented explicitly in example.py's preprocess/postprocess functions, which build the chat-marker prompt and parse the completion before and after the call to create_completion.
Intended use
This model is intended for developers evaluating machine translation 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 FLORES-200 and may not generalize to all domains.
- The average accuracy change hides an uneven distribution across language directions: a minority of directions regress substantially more than the average, almost all of them low-resource, non-Latin-script targets, and quality degradation is larger out of English than into it.
- Speedup ratios are not portable across hosts. The same artifact shows much smaller ratios against its F16 reference on a server-class Arm host, because the phone ratios are driven as much by how poorly F16 runs on that device as by the quantization itself. Re-measure on your own target.
- 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 Q8_0 embedding is the decode lever for this model. Hy-MT2 ties token_embd.weight to the output projection, so that single 120818 x 2048 tensor is a matrix-vector product executed for every decoded token — the largest tensor on the hottest path. There is no separate output tensor to promote.
- Q4_0 is a legacy single-scale 4-bit block format, not a k-quant. llama-quantize additionally promotes the first four ffn_down tensors to Q4_1 of its own accord. A Q4_K_M build of the same model loses less quality on average and spreads that loss diffusely across directions; it is the more conservative choice where the weakest supported language sets the floor.
- The exact recipe:
llama-quantize --imatrix <flores200-dev.imatrix> --token-embedding-type q8_0 \
tencent__Hy-MT2-1.8B_llamacpp_original.gguf \
tencent__Hy-MT2-1.8B_llamacpp_q4_0_embq8_0.gguf Q4_0
- Q4_0 and Q8_0 are among the types Arm KleidiAI ships microkernels for, and the benchmark binary was built with i8mm enabled, so this recipe is eligible for the KleidiAI INT8 path — engagement was not directly confirmed on device for this run.
- The reference GGUF is F16 rather than BF16 on purpose: ggml has no optimized BF16 CPU kernel, and a BF16 reference would inflate every speedup ratio reported above.
- Calibration used the FLORES-200 dev split, deliberately disjoint from the devtest split the quality numbers are scored on.
About this version
Original Model: tencent/Hy-MT2-1.8B by Tencent - 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.