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.

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/null to the command. When stdin is not a terminal, litert-lm run reads 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 matched on 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 with too large for file size, delete MiniTranslator-2B_int8.litertlm from that folder and run the command again.
  • With LiteRT-LM 0.18.1, 0.19.0 and 0.20.0, a blocking send_message call of the Python API that is still generating after 10 minutes fails with DEADLINE_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 with send_message_async instead, which has no such wait, or lower max_output_tokens so 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=True and enable_thinking unset, it renders the original thinking-off prompt (<think>\n\n</think>\n\n after <|im_start|>assistant), as the author recommends for translation. At the end of the prompt, the original template adds that block only when enable_thinking=False is 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
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for litert-community/MiniTranslator-2B

Quantized
(4)
this model