Run this model with HF Jobs
Run litert-community/MiniTranslator-2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/litert-community/MiniTranslator-2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/litert-community/MiniTranslator-2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use litert-community/MiniTranslator-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/MiniTranslator-2B 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 # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=litert-community/MiniTranslator-2B \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/MiniTranslator-2B 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
MiniTranslator-2B — LiteRT-LM
This repository holds MiniTranslator-2B, a 2B model that translates among Chinese, English and 20 more languages, as one file for LiteRT-LM: MiniTranslator-2B_int8.litertlm (dynamic INT8, 2.55 GB). It ran with LiteRT-LM v0.20.1 on a Snapdragon Galaxy S26 and a Pixel 11 Pro, on the CPU and the GPU, and on the CPU of a Mac M4 Max; on the Mac, the GPU was not checked.
CPU speed with LiteRT-LM v0.20.1 on 4 threads (2026-12-05): a 1,024-token prefill, then 256 decoded tokens; each range spans three processes. Speed still being tuned (updates follow).
| Phone | Prefill (tokens/s) | Decode (tokens/s) | Time to first token (s) |
|---|---|---|---|
| Snapdragon Galaxy S26 | 235.40–238.76 | 15.30–16.37 | 4.35–4.42 |
On the GPU of both phones, both replies of the output check below were the original FP32 model's.
Run it (litert-lm 0.20.1 needs Python 3.10 or newer):
pip install litert-lm==0.20.1
litert-lm run --from-huggingface-repo litert-community/MiniTranslator-2B MiniTranslator-2B_int8.litertlm --backend cpu --top-k 1 --prompt $'Translate the following text into Chinese. Output only the translation:\n\nThe model does not have a default system prompt.'
On the Mac M4 Max the reply was 该模型没有默认的系统提示。, the original model's reply.
When it does not work:
- The prompt (with the tokens the chat template adds) and the reply together must fit in 4,096 tokens.
- In a script, add
< /dev/nullto the command. When stdin is not a terminal,litert-lm runreads it to the end as more prompt text, so a pipe that stays open makes it wait with no output. ERROR: … weight_cache.cc:99: fingerprint … could not be matchedon stderr: the Mac runs that showed it still printed the reply and exited with status 0. It appeared only in runs that came right after a run of a different LiteRT-LM build on the same file.- A download that is cut short without an error stays in the cache folder (by default
~/.litert-lm/cache/huggingface/litert-community/MiniTranslator-2B/), and later runs reuse it. The litert-lm 0.20.1 command line does not compare the downloaded size with the expected one. If a run fails with a bus error or withtoo large for file size, deleteMiniTranslator-2B_int8.litertlmfrom that folder and run the command again. - With LiteRT-LM 0.18.1, 0.19.0 and 0.20.0, a blocking
send_messagecall of the Python API that is still generating after 10 minutes fails withDEADLINE_EXCEEDED(LiteRT-LM's default timeout). In Mac GPU tests that ran LFM2.5-350M (int4) and paused the process past the 10 minutes, some 0.18.1 and 0.19.0 processes then aborted while they closed the conversation. Stream the reply withsend_message_asyncinstead, which has no such wait, or lowermax_output_tokensso that a reply ends sooner. Neither this file nor LiteRT-LM 0.20.1 was run against that limit. - On LiteRT-LM 0.18.1 and 0.19.1, once a message fails because it does not fit in the context window, every later message in that conversation fails as well (the next one with
Task failed with state: 7). Start a new conversation after such an error. - On a Pixel 8a, a LiteRT-LM v0.18.0 or v0.18.1 Android build with its tag's prebuilt accelerator libraries crashes (SIGSEGV) while it builds the GPU engine for a Qwen3-0.6B file whose weights sit in a TFLiteWeights section, as this file's do (LiteRT-LM #3986). This file was not run on those builds; on 2026-12-05 it ran on the GPU of the Snapdragon Galaxy S26 and the Pixel 11 Pro with a LiteRT-LM v0.20.1 Android build.
Prompts
Use the prompt forms in the original card's section "Translation Task Instruction Examples (Chinese-English Comparison)", with the target language named in full, in the prompt's language. Chinese to English, with the same flags:
litert-lm run --from-huggingface-repo litert-community/MiniTranslator-2B MiniTranslator-2B_int8.litertlm --backend cpu --top-k 1 --prompt $'将以下文本翻译成英语,只输出译文:\n\n今天天气真好。'
On the Mac M4 Max the reply was Today’s weather is so nice.. --top-k 1 makes decoding greedy, as the author recommends for translation.
First run
By default, the command keeps the downloaded file in ~/.litert-lm/cache/huggingface/litert-community/MiniTranslator-2B/ and uses that copy on later runs. On first use, the runtime also wrote a 2.26 GB cache for the CPU next to the model (Mac and phones).
Output check
This file and the original model answered both prompts above with greedy decoding and thinking off; the original model ran at revision 727585b on a Mac CPU.
| Run | Chinese to English | English to Chinese |
|---|---|---|
| Original model, FP32 | Today’s weather is wonderful. |
该模型没有默认的系统提示。 |
| Original model, BF16 (its released type) | Today’s weather is so nice. |
该模型没有默认的系统提示。 |
| This file, Snapdragon Galaxy S26, GPU | same as FP32 | same as both |
| This file, Snapdragon Galaxy S26, CPU, one thread | same as FP32 | 该模型没有默认的系统提示词。 |
| This file, Pixel 11 Pro, GPU | same as FP32 | same as both |
| This file, Pixel 11 Pro, CPU, one thread | same as FP32 | 该模型没有默认的系统提示词。 |
This file, Mac M4 Max, CPU, one thread (--cpu-thread-count 1) |
same as FP32 | 该模型没有默认的系统提示词。 |
| This file, Mac M4 Max, CPU, the commands above | same as BF16 | same as both |
该模型没有默认的系统提示词。 has one more token, 词 ("word"), before 。. At that point, the original FP32 model's top two tokens are 。 and 词, 0.10 apart in logits. Both sentences are correct Chinese for the English one. The phone runs used the binary in the next section.
How the speed was measured
Snapdragon Galaxy S26 (SM-S942Q, Android 16) and Pixel 11 Pro (Android 17) with litert_lm_advanced_main, built for Android arm64 from the LiteRT-LM v0.20.1 tag with its GPU accelerator linked in. The speed above is from the Galaxy S26, with these flags in effect besides the model and prompt files: --backend=cpu --num_cpu_threads=4 --benchmark --use_session=true --benchmark_prefill_tokens=1024 --benchmark_decode_tokens=256 --max_num_tokens=2048 --max_output_tokens=2048 --async=false --num_iterations=1; each process had 4 threads in most of its /proc readings. In the output check, on the GPU (OpenCL) of both phones, all 1,876 operations of the prefill graph and all 1,695 of the decode graph ran on the GPU.
Chat template
Apart from whitespace, the file's chat template differs from the original in two ways:
- With
add_generation_prompt=Trueandenable_thinkingunset, it renders the original thinking-off prompt (<think>\n\n</think>\n\nafter<|im_start|>assistant), as the author recommends for translation. At the end of the prompt, the original template adds that block only whenenable_thinking=Falseis passed. - System, user and assistant messages may carry their content as a string or as a list of text parts (
[{"type": "text", "text": "…"}]). The original template reads only the string form in these messages.
For the two prompts above, a two-turn conversation, and the author's terminology, delimiter and structured-data forms, all rendered with add_generation_prompt=True, the changed template with enable_thinking unset gives the same tokens as the original with enable_thinking=False, with content as a string and as text parts. In a second check, system turns, assistant reasoning, tool calls and responses, and explicit thinking settings rendered as in the original.
The file
| File | Bytes | sha256 |
|---|---|---|
MiniTranslator-2B_int8.litertlm |
2,546,548,736 | 4276ba7d3936355f2e856baee1e44d00ff456acc5b18a37c32624b5d72f6fb53 |
It was made from the original BF16 checkpoint at revision 727585b: exported to a float LiteRT graph with litert-torch 0.9.4, then quantized with ai-edge-quantizer 0.9.0 to int8 weights (symmetric, per channel) in every fully connected layer, the output head included, and in the embedding table, with float activations.
License
Apache License 2.0, as the original model. LICENSE and NOTICE here are the original repository's files, unchanged. The model is the work of the MiniTranslator-2B authors (Caldalis/MiniTranslator-2B), fine-tuned from openbmb/MiniCPM5-2B. Changes from the original: converted to the LiteRT-LM format, weights quantized to int8, and the chat template changed as described above. This conversion is not an official release of the model's authors or of OpenBMB.
- Downloads last month
- -