Instructions to use litert-community/Hy-MT2-1.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/Hy-MT2-1.8B with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli litert-lm run \ --from-huggingface-repo=litert-community/Hy-MT2-1.8B \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/Hy-MT2-1.8B with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Measured on device (edge-compat): Galaxy S26 Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 20.8 tok/s Β· prefill 386 tok/s Β· TTFT 560 ms Β· all 1489 ops delegated (2026-09-05); Mac Studio M4 Max Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 105.8 tok/s Β· prefill 2008 tok/s Β· TTFT 137 ms (2026-08-27); Galaxy S26 Β· LiteRT-LM 0.16.0 Β· CPU Β· decode 12.3 tok/s Β· prefill 126 tok/s Β· TTFT 1.64 s (2026-09-05). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/hy-mt2-1.8b-int8/CARD.md
Hy-MT2-1.8B β LiteRT-LM
tencent/Hy-MT2-1.8B converted to the LiteRT-LM (.litertlm) format for on-device inference with Google's LiteRT-LM runtime. To our knowledge this is the first Hy-MT2 in LiteRT form β the Hub otherwise carries GGUF, MLX and FP8 conversions.
Hy-MT2-1.8B is Tencent's "fast-thinking" multilingual translation model: 33 languages, tuned to follow translation instructions rather than chat. It is a dense hunyuan_v1_dense stack β 32 layers, hidden 2048, 16 query / 4 KV heads (GQA) with QK-norm, head_dim 128, vocab 120,818, tied embeddings β 2.04B parameters.
| File | Recipe | Size |
|---|---|---|
Hy-MT2-1.8B_int8.litertlm |
export-time dynamic int8 (linears + embedding) | 1.82 GB |
Correctness
All numbers below were measured on this exact file (litert-lm 0.16.0, Apple M4 Max).
- Chat template is byte-equal to the source: the embedded Jinja matches the repo's
chat_template.jinjaexactly (654 / 654 bytes). - 8-question sanity gate: 6/8 on CPU and 6/8 on GPU, non-degenerate, with the same two misses on both backends ("Cool" for the opposite of hot, "pink" for the rhyme) β a property of this translation-tuned 1.8B, not of a backend. Arithmetic, factual and translation items are all correct.
- Translation greedy A/B vs the HF reference (PyTorch bf16, greedy, the source README's default-translation prompt): byte-identical on 1 of 3 probes; the other two are fluent alternates of the usual int8-vs-bf16 kind (e.g. spectaculaire β significative). No degeneration on any probe.
- No duplicate start token. The source chat template renders
<|hy_begin_of_sentence|>itself, and the LiteRT-LM engine also prepends the metadatastart_tokenβ measured inside the runtime:[start_token]+promptand[template BOS]+promptgenerate byte-identical greedy output, so the default export was feeding BOS twice. This bundle drops the metadata start token; the on-device token stream matches the training stream. Honest note: the double-BOS variant happened to score 8/8 on the sanity gate β the stream-faithful file ships anyway, because matching the training stream is the property that generalizes. - Stop token is
<|hy_place_holder_no_2|>(id 120020), as the source declares.
Usage
Hy-MT2 expects translation instructions, not open chat. The source model card's default prompt works verbatim:
litert-lm run ./Hy-MT2-1.8B_int8.litertlm --prompt \
"Translate the following text into Japanese. Note that you should **only output the translated result without any additional explanation**:
The weather is nice today, so let's go for a walk in the park."
# GPU
litert-lm run ./Hy-MT2-1.8B_int8.litertlm --backend gpu --prompt "..."
The bundle carries the tokenizer and the stock Hy-MT2 chat template (max_num_tokens 4096).
Performance
litert-lm benchmark <file> -p 256 -d 256 --runs 3 --cache no, litert-lm 0.16.0, Apple M4 Max. Two independent protocol runs per cell; the GPU cell was taken after a β₯300 s rest:
| Backend | Prefill (256) | Decode | TTFT |
|---|---|---|---|
| GPU | 2008 / 2003 tok/s | 105.8 / 105.4 tok/s | 0.137 s |
| CPU | 211.0 / 210.0 tok/s | 34.0 / 32.4 tok/s | 1.24 / 1.25 s |
Both backends were gated on real generations before benchmarking (a broken backend can still print benchmark numbers). GPU repeats within ~0.3%, CPU decode within ~5%.
Conversion notes
Converted with stock litert-torch 0.9.3 through hf-to-litertlm β one command:
python scripts/convert.py tencent/Hy-MT2-1.8B
Two things route this family correctly, both measured:
- The
dynamic-with-alpharope resolves statically. transformers computesbase = rope_theta * alpha^(dim/(dim-2))once at init and never rescales belowmax_position_embeddingsβ only the leftover data-dependent cache-growth branch killstorch.export. The converter bakes the resolved base (11,158,839.925) intorope_thetaand dropsrope_scaling;inv_freqand teacher-forced logits are bitwise-equal to the HF reference, valid to 262,144 positions (far past this bundle's 4,096 context). - The engine prepends the metadata start token unconditionally, so a template that renders its own BOS must not also declare one β see Correctness above.
Export took 120 s on an M4 Max. See REPRODUCE.md for the full measurement record behind every claim on this card.
Raspberry Pi 5 (CPU)
Measured on a Raspberry Pi 5 Model B Rev 1.1 (8 GB, Raspberry Pi OS 64-bit) with litert-lm benchmark 0.16.1: CPU backend, 4 threads, 256 prefill + 256 decode tokens, --cache memory (the compile cache lives and dies with the process, so every invocation compiles the model from scratch; nothing is reused between runs), one warm-up plus one timed iteration per invocation, 3 invocations per file with cooldown in between. Values are the median across invocations (minβmax in parentheses). No thermal throttling occurred during these runs (vcgencmd get_throttled stayed 0x0). Every file listed produced coherent text in a real generation on this backend before its numbers were recorded.
| File | Prefill (tok/s) | Decode (tok/s) | TTFT | Peak RSS |
|---|---|---|---|---|
Hy-MT2-1.8B_int8.litertlm |
25.0 (24.9β25.8) | 2.7 (2.6β2.7) | 10.6 s | 2.9 GB |
- Downloads last month
- 189
Model tree for litert-community/Hy-MT2-1.8B
Base model
tencent/Hy-MT2-1.8B