--- language: - zh - en - ja - ko - ar - de - fr - es - ru - bn - cs - et - fa - he - id - kn - ro - ta - te - tl - tr - uk library_name: transformers license: apache-2.0 base_model: openbmb/MiniCPM5-2B base_model_relation: finetune pipeline_tag: translation tags: - translation - minicpm - minicpm5 - gguf - on-device ---

🤗 Hugging Face  |   💾 GGUF

MiniTranslator-2B — multilingual translation, 2B parameters

# MiniTranslator-2B ## Model Introduction MiniTranslator-2B is a 2B multilingual translation model built on [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B). It supports translation among Chinese, English, and 20 additional languages, and follows translation instructions in both Chinese and English. The model is designed for general translation workloads as well as on-device and edge deployment. MiniTranslator-2B is released in BF16 and in four GGUF variants (F16 / Q8_0 / Q6_K / Q4_K_M), so the same model can run with transformers, vLLM, SGLang, or llama.cpp. ## Results All translation results use greedy decoding (`temperature=0`) and XCOMET (higher is better). Instruction-following results use the benchmark's rule-based scoring. ### Translation ![Translation benchmark comparison](imgs/results_translation.png) MiniTranslator-2B is competitive with Hy-MT2-1.8B on FLORES-200, NTREX-128, and WMT24++, and leads on HardMTBench by 3.1 points. WMT25 long-form and structured content remains the largest gap to the 7B and 30B-A3B models. ### Instruction Following ![Instruction-following benchmark comparison](imgs/results_instruction.png) ## Model Links | Model | Description | Download | |---|---|---| | MiniTranslator-2B | BF16 weights | [🤗 Model](https://huggingface.co/Caldalis/MiniTranslator-2B) | | MiniTranslator-2B-GGUF | F16 / Q8_0 / Q6_K / Q4_K_M | [🤗 Model](https://huggingface.co/Caldalis/MiniTranslator-2B-GGUF) | ## Translation Task Instruction Examples (Chinese-English Comparison) *Note: both `source_lang` and `target_lang` should use full language names. Use Chinese names in Chinese prompts and English names in English prompts.* | Type | Chinese prompt | English prompt | |---|---|---| | **Default Translation** | 将以下文本翻译为 `{target_lang}`,只输出译文:

`{source_text}` | Translate the following text into `{target_lang}`. Output only the translation:

`{source_text}` | | **Terminology** | *参考下面的翻译:*
`{text}` 翻译成 `{text}`
`{text}` 翻译成 `{text}`

将以下文本翻译为 `{target_lang}`,只输出译文:

`{source_text}` | *Reference the following translations:*
`{text}` translates to `{text}`
`{text}` translates to `{text}`

Translate the following text into `{target_lang}`. Output only the translation:

`{source_text}` | | **Style** | 请将以下文本翻译为 `{target_lang}`。
翻译风格要严格符合【**`{target_style}`**】

`{source_text}` | Please translate the following text into `{target_lang}`. The translation style must strictly conform to [**`{target_style}`**]:

`{source_text}` | | **Personalization** | *【待翻译文本】*
`{source_text}`

*【翻译任务】*
1、**`{user_preferences}`**
2、**`{user_preferences}`**
3、……
4、将【待翻译文本】翻译为 `{target_lang}`。 | *[Source Text]*
`{source_text}`

*[Translation Tasks]*
1. **`{user_preferences}`**
2. **`{user_preferences}`**
3. ...
4. Translate the [Source Text] into `{target_lang}`. | | **Delimiters** | 请将以下文本准确翻译为 `{target_lang}`。
你必须在译文中**保留等量的分隔符,绝对不可遗漏、转义或翻译该符号,并注意分隔符的位置**。

`{source_text}` | Please accurately translate the following text into `{target_lang}`.
You must **retain the exact same number of delimiters in the translation. Strictly do not omit, escape, or translate these symbols, and pay close attention to their placement**.

`{source_text}` | | **Structured Data** | *# 任务目标*
将下方 `{source_text}` 中的 `{format_type}` 格式数据翻译为 `{target_lang}`。

*# 严格约束*
1. **结构锁定**:绝对保持原有的 `{format_type}` 数据结构、缩进和层级完全不变。
2. **选择性翻译**:仅翻译面向用户展示的可见文本内容。
3. **禁止修改**:**严禁**翻译或更改任何代码标签、键名(Key)、变量占位符(如 `{{var}}`、`${var}`、`%s`、`%d` 等)或代码属性。

*# 数据输入*
`{source_text}` | *### Task*
Translate the user-facing text within the following `{format_type}` data into `{target_lang}`.

*### Strict Rules*
1. **Structure Preservation:** You MUST preserve the original `{format_type}` data structure, nesting, hierarchy, and indentation exactly as they are.
2. **Selective Translation:** Translate ONLY the visible, user-facing text content/values.
3. **Strict Non-Translation:** NEVER translate or alter code tags, keys, properties, object names, or variable placeholders. Leave them exactly in their original English/code form.

*### Source Data*
`{source_text}` | | **Background Information** | *【背景信息】*
`{background_text}`

请结合背景信息将以下文本翻译为 `{target_lang}`。

*【待翻译文本】*
`{source_text}` | *[Background Information]*
`{background_text}`

Please translate the following text into `{target_lang}`, taking the provided background information into consideration.

*[Source Text]*
`{source_text}` | --- ## Inference and Deployment Recommended decoding parameters. The model does not have a default system prompt. ```json { "temperature": 0, "top_p": 0.95, "max_tokens": 4096 } ``` Greedy decoding (`temperature=0`) is recommended for translation. If sampling is needed, use a low temperature (0.2–0.3) and `top_p=0.9`. Thinking mode is supported by the chat template but should be disabled for translation: pass `enable_thinking=False` in transformers, `--reasoning off` in llama.cpp, or `chat_template_kwargs: {"enable_thinking": false}` in an OpenAI-compatible request. ### transformers `transformers>=5.6.0` ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer model_path = "Caldalis/MiniTranslator-2B" tokenizer = AutoTokenizer.from_pretrained(model_path) model = AutoModelForCausalLM.from_pretrained( model_path, dtype=torch.bfloat16, device_map="auto", ) model.eval() prompt = "将以下文本翻译成英语,只输出译文:\n\n今天天气真好。" messages = [{"role": "user", "content": prompt}] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, enable_thinking=False, return_tensors="pt", ).to(model.device) with torch.no_grad(): outputs = model.generate(**inputs, max_new_tokens=4096, do_sample=False) response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True) print(response) ``` ### vLLM ```bash vllm serve Caldalis/MiniTranslator-2B --tensor-parallel-size 1 ``` ### SGLang ```bash python3 -m sglang.launch_server --model Caldalis/MiniTranslator-2B --tp 1 ``` ### llama.cpp ```bash llama-server -m MiniTranslator-2B-Q4_K_M.gguf -c 4096 --reasoning off --port 8080 ``` ```bash curl http://127.0.0.1:8080/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "messages": [{"role": "user", "content": "将以下文本翻译成英语,只输出译文:\n\n今天天气真好。"}], "temperature": 0, "max_tokens": 4096 }' ``` On llama.cpp builds without `--reasoning`, omit the server flag and add `"chat_template_kwargs": {"enable_thinking": false}` to the request body. ## Quantization | File | Quantization | Size (bytes) | SHA-256 | |---|---|---:|---| | `MiniTranslator-2B-F16.gguf` | F16 | 5,039,006,496 | `236b69f8d40370ac390ff6f48283349d66318d654094a643d3641f148aa8e958` | | `MiniTranslator-2B-Q8_0.gguf` | Q8_0 | 2,679,710,496 | `5999502dd1e520b18fcfa5bade61b64b7b119fa991d16f15b816f4f3b46d1997` | | `MiniTranslator-2B-Q6_K.gguf` | Q6_K | 2,070,225,696 | `df7895713c691700c36b1db458a8998cb2ac8cd60e8cff1cb8976a3fe500dd93` | | `MiniTranslator-2B-Q4_K_M.gguf` | Q4_K_M | 1,561,318,176 | `e7ebfd5120803c59163ed0cb44725c1e43e97be8434b031474c36ef32a867114` | Weights are converted with `llama.cpp/convert_hf_to_gguf.py` and quantized with `llama-quantize`. See the GGUF model repository for conversion and usage details. ## Supported Languages | Language | Abbr. | Chinese Name | |---|---|---| | Chinese | zh | 中文 | | English | en | 英语 | | Japanese | ja | 日语 | | Korean | ko | 韩语 | | Arabic | ar | 阿拉伯语 | | German | de | 德语 | | French | fr | 法语 | | Spanish | es | 西班牙语 | | Russian | ru | 俄语 | | Bengali | bn | 孟加拉语 | | Czech | cs | 捷克语 | | Estonian | et | 爱沙尼亚语 | | Persian | fa | 波斯语 | | Hebrew | he | 希伯来语 | | Indonesian | id | 印尼语 | | Kannada | kn | 卡纳达语 | | Romanian | ro | 罗马尼亚语 | | Tamil | ta | 泰米尔语 | | Telugu | te | 泰卢固语 | | Filipino | tl | 菲律宾语 | | Turkish | tr | 土耳其语 | | Ukrainian | uk | 乌克兰语 | The base model supports additional languages beyond this list. Quality on low-resource directions varies and should be validated on in-domain data. ## License Released under the **Apache License 2.0**. This model is a derivative of [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B); see `NOTICE` for attribution. "MiniCPM" and any OpenBMB marks remain the property of their owners.