Run Tencent Hy-MT3 Locally: 30B-A3B Translation on llama.cpp v1.1.0
In this article
- What You're Setting Up
- Choose a Route
- Size the Machine from the Actual Files
- Where the bytes go
- KV cache
- Will it fit?
- Path 1: llama.cpp v1.1.0
- Step 1: Get llama.cpp v1.1.0
- Step 2: Download the GGUF
- Step 3: Start llama-server
- Step 4: Send a Test Translation
- Use the Card's Prompt Templates
- Step 5: Batch-Translate a Document
- Path 2: Ollama v0.40.19
- vLLM, SGLang and Transformers
- The Smaller Models
- Troubleshooting
- Benchmarks: Tencent's Own Numbers
- Practical Verdict
- What to Read Next
What You're Setting Up
Hy-MT3 is the third generation of Tencent's Hy translation models. The model card lists three sizes, 1.8B, 7B and a 30B-A3B mixture-of-experts model, and expands language coverage from 38 languages in Hy-MT2 to 102. All of them are Apache 2.0: the repo's LICENSE.txt states that Tencent Hy-MT3 "does not impose any additional restrictions beyond those specified in the license". The Hugging Face repos were created on 17 November 2026, and the card's news section dates the open-source release to 24 November. The technical report is arXiv 2611.27673 (v2, 23 November).
This guide is about Hy-MT3-30B-A3B, the model Tencent reports as the strongest of the three. Its config.json describes the architecture:
- Type:
hy_v3(HYV3ForCausalLM), 48 layers, hidden size 2,048. - Attention: grouped-query attention with 32 query heads and 4 KV heads of 128 dimensions, plus QK normalisation.
- Feed-forward: layer 0 is a dense FFN of 6,912. Layers 1 to 47 each hold 128 routed experts with an FFN size of 768. A sigmoid router with an expert-selection bias picks 8 of them per token, and 1 shared expert is always active.
- Size: the Hugging Face safetensors metadata counts 30,064,725,888 parameters. The card says "only 3B activated parameters".
- Vocabulary and context: 120,832 tokens.
max_position_embeddingsis 262,144, but the card's deployment section statesmax_context: 8192, and this guide follows the card.
The chat template defaults to non-thinking mode. The card's results note that "all other models, including Hy-MT3, are run in non-thinking mode", so leave the template's default alone.
This guide covers three routes: llama.cpp v1.1.0 with Tencent's own GGUF (the main route), Ollama through the Hugging Face registry, and pointers to vLLM, SGLang and Transformers as the card documents them. It ends with a batch script that translates whole files through llama-server using the card's prompt templates.
December 2026 status: llama.cpp has supported
hy_v3since PR #25395, merged on 13 July 2026 and first shipped in build b9993. This guide pins the stable v1.1.0 release from 26 November, whose binaries are published as build b12774. Up to b12867 (30 November), the only later change to thehy_v3model code adds FP8 and NVFP4 scale tensors (#28898), which Tencent's GGUFs do not contain. Ollama has no library model for Hy-MT3, but v0.40.19 bundles a llama.cpp build that includes the architecture. The GitHub repo has no issues filed, and the GGUF repo has one open discussion.
How this guide was checked: Model facts come from the cards for
tencent/Hy-MT3-30B-A3B(commite49cfa2) andtencent/Hy-MT3-30B-A3B-GGUF(commitf42e858), plusconfig.jsonandchat_template.jinjaat those revisions. File sizes come from the Hugging Face API at the same revisions. The GGUF metadata and tensor tables were read from each file's header over HTTP range requests. The template embedded in the GGUF is byte-identical to the repo'schat_template.jinja. Every llama-server flag and default was checked againstcommon/arg.cpp,common/common.hand the server sources at the v1.1.0 commit1715275. The Ollama details come from the v0.40.19 source (LLAMA_CPP_VERSION,server/images.go,server/routes.go,llm/llama_server.go) and from the manifests Hugging Face's registry serves for this repo. Benchmarks come from the card and the report. Issues and discussions were checked on 1 December 2026.
Requirements:
- llama.cpp route: Windows, Linux or macOS. An NVIDIA, AMD or Intel GPU helps but is not required. Budget 13 to 33 GB of combined VRAM and RAM depending on the file (see sizing), plus Python 3.10 or newer for the
hfdownload CLI and the batch script. - Ollama route: Ollama v0.40.19.
- Up to 33 GB of free disk space for one GGUF file.
Choose a Route
| Your situation | Use | Why |
|---|---|---|
| Any OS, any GPU size or CPU only | llama.cpp v1.1.0 with Tencent's GGUF | The route Tencent documents for GGUF. It uses the template embedded in the file and exposes /tokenize, which the batch script uses to size chunks. |
| You already run Ollama | hf.co/tencent/Hy-MT3-30B-A3B-GGUF:Q4_K_M | The architecture is in Ollama's bundled llama.cpp, but no public report confirms it works yet, and a Modelfile cannot turn top-k off. |
| 8 GB GPU, want the whole model in VRAM | Hy-MT3-7B-GGUF Q4_K_M (5.15 GB) | It fits whole. Tencent reports that 30B-A3B at IQ2 beats BF16 7B on every benchmark except Mandarin⇔Minority, so 30B-A3B IQ2 with experts in system RAM is the higher-quality option. |
| Server GPUs, many concurrent users | vLLM or SGLang built from source | The card's documented serving route. See the short section below. |
Size the Machine from the Actual Files
Tencent publishes three GGUF files. Sizes come from the Hugging Face API at revision f42e8581c94e4d1b2259d6171fa199a7fae56edd, and the tensor types come from each file's header:
| File | Bytes | Size | What is inside |
|---|---|---|---|
Hy-MT3-30B-A3B-IQ2.gguf | 13,083,836,064 | 13.08 GB / 12.19 GiB | llama.cpp file type IQ2_S. Expert gate and up projections in IQ2_S, expert down projections in IQ3_S or Q4_K. Imatrix-calibrated. |
Hy-MT3-30B-A3B-Q4_K_M.gguf | 19,502,694,048 | 19.50 GB / 18.16 GiB | Expert gate and up in Q4_K, expert down in Q4_K or Q6_K. Imatrix-calibrated. |
Hy-MT3-30B-A3B-Q8_0.gguf | 32,791,821,792 | 32.79 GB / 30.54 GiB | Q8_0 throughout, apart from the BF16 tensors listed below. |
All three keep the token embeddings, output head, layer-0 dense FFN and shared experts in BF16. The IQ2 and Q4_K_M headers record the importance matrix as imatrix.gguf, built from calib_chat.txt over 1,156 chunks. For comparison, the BF16 safetensors in tencent/Hy-MT3-30B-A3B total 60.13 GB, and tencent/Hy-MT3-30B-A3B-FP8 totals 30.58 GB.
Where the bytes go
On a GPU too small for the whole file, the split that matters is routed experts versus everything else. llama.cpp keeps "everything else" on the GPU and moves experts to system RAM layer by layer. From the tensor tables:
| File | Routed experts (47 MoE layers) | Everything else | Experts per MoE layer |
|---|---|---|---|
| IQ2 | 10.74 GB / 10.00 GiB | 2.34 GB / 2.18 GiB | 206 to 231 MiB, 218 MiB on average |
| Q4_K_M | 17.16 GB / 15.98 GiB | 2.34 GB / 2.18 GiB | 324 to 374 MiB, 348 MiB on average |
| Q8_0 | 30.16 GB / 28.09 GiB | 2.63 GB / 2.45 GiB | 612 MiB |
"Everything else" includes the 5.13 MB GGUF header, attention weights, embeddings, the output head, the dense first layer and the shared experts.
KV cache
This is arithmetic from config.json, not a measurement. All 48 layers use full attention. Each stores K and V for 4 KV heads of 128 dimensions, so an f16 cache costs:
48 layers × 4 heads × 128 dims × 2 (K and V) × 2 bytes = 98,304 bytes (96 KiB) per token
That is 768 MiB for one 8,192-token slot and 3 GiB for four. At the 262,144 positions in config.json, it would be 24 GiB, which is what llama-server allocates if you do not set --ctx-size (Step 3 explains why).
Will it fit?
Every figure here is arithmetic from the file sizes, not a measurement. GPU memory is treated as binary (a "24 GB" card has 24 GiB). Each row assumes one 8,192-token slot (0.75 GiB of KV cache) and llama.cpp's default --fit margin of 1,024 MiB per device. "Left over" must still hold the compute buffers, whose size llama-server prints when it loads.
| Hardware | File | Placement | Left over |
|---|---|---|---|
| CPU only, 32 GB RAM | Q4_K_M | All in RAM: 18.16 GiB + 0.75 GiB KV | 13.1 GiB for the OS. The card's own llama.cpp example runs on the CPU (-ngl 0). |
| 8 GB GPU + 32 GB RAM | Q4_K_M | 2.18 GiB non-expert + KV on the GPU, about 4 GiB of experts on the GPU, about 11.9 GiB in RAM | Set by --fit |
| 8 GB GPU + 16 GB RAM | IQ2 | About 4 GiB of experts on the GPU, about 5.9 GiB in RAM | Set by --fit |
| 12 GB GPU | IQ2 | About 8 GiB of experts on the GPU, about 1.9 GiB in RAM | Set by --fit |
| 16 GB GPU | IQ2 | Whole file: 12.19 + 0.75 + 1.0 margin = 13.94 GiB | 2.06 GiB |
| 24 GB GPU | Q4_K_M | Whole file: 18.16 + 0.75 + 1.0 = 19.91 GiB | 4.09 GiB (1.84 GiB with four 8K slots) |
| 32 GB GPU | Q8_0 | 30.54 + 0.75 + 1.0 = 32.29 GiB, just over, so a few expert layers go to RAM | Set by --fit |
| 48 GB GPU | Q8_0 | Whole file | 15.7 GiB |
| Mac, 32 GB unified | Q4_K_M | Whole file + KV: 18.91 GiB | 13.1 GiB for macOS and your apps |
Tencent's quantization table (in Benchmarks) shows Q4_K_M within 0.4 points of BF16 on every benchmark, and Q8_0 no more than 0.5 points above Q4_K_M. Use Q4_K_M when you have the memory. Use IQ2 to fit a 16 GB card whole, or to keep less in system RAM, at a cost of up to 2.53 points. To budget other models the same way, use the VRAM calculator.
Path 1: llama.cpp v1.1.0
Step 1: Get llama.cpp v1.1.0
Windows: prebuilt binaries. The v1.1.0 release's binaries are attached to build b12774, the same commit. Each Windows CUDA build comes with a separate archive of CUDA DLLs:
| Platform | Build archive | CUDA runtime archive |
|---|---|---|
| Windows x64, CUDA 12 | llama-b12774-bin-win-cuda-12.4-x64.zip (357.9 MB) | cudart-llama-bin-win-cuda-12.4-x64.zip (391.4 MB) |
| Windows x64, CUDA 13 | llama-b12774-bin-win-cuda-13.5-x64.zip (226.9 MB) | cudart-llama-bin-win-cuda-13.5-x64.zip (426.3 MB) |
| Windows x64, Vulkan (AMD, Intel, NVIDIA) | llama-b12774-bin-win-vulkan-x64.zip (39.1 MB) | Not needed |
| Windows x64, CPU only | llama-b12774-bin-win-cpu-x64.zip (25.2 MB) | Not needed |
Both CUDA 12.4 archives keep their files at the archive root, llama-server.exe in one and cudart64_12.dll, cublas64_12.dll and cublasLt64_12.dll in the other. Extract them into the same folder:
$rel = "https://github.com/ggml-org/llama.cpp/releases/download/b12774"
New-Item -ItemType Directory -Force "$HOME\llama.cpp-b12774" | Out-Null
Set-Location "$HOME\llama.cpp-b12774"
Invoke-WebRequest "$rel/llama-b12774-bin-win-cuda-12.4-x64.zip" -OutFile llama.zip
Invoke-WebRequest "$rel/cudart-llama-bin-win-cuda-12.4-x64.zip" -OutFile cudart.zip
Expand-Archive llama.zip -DestinationPath . -Force
Expand-Archive cudart.zip -DestinationPath . -Force
.\llama-server.exe --version
Linux and macOS: build from the tag. These commands follow the project's build documentation:
git clone --branch v1.1.0 --depth 1 https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build -DGGML_CUDA=ON
cmake --build build --config Release -j --target llama-server
./build/bin/llama-server --version
Leave out -DGGML_CUDA=ON for a CPU-only build. On macOS, Metal is enabled by default. The b12774 release also publishes Linux archives for CPU, Vulkan, CUDA 12.8, CUDA 13.5 and ROCm 10.0, and a macOS arm64 archive.
Step 2: Download the GGUF
Install the Hugging Face CLI and download the file pinned to the revision this guide was checked against. Linux and macOS:
pip install -U huggingface_hub
hf download tencent/Hy-MT3-30B-A3B-GGUF Hy-MT3-30B-A3B-Q4_K_M.gguf \
--revision f42e8581c94e4d1b2259d6171fa199a7fae56edd \
--local-dir ~/models/hy-mt3
Windows PowerShell:
pip install -U huggingface_hub
hf download tencent/Hy-MT3-30B-A3B-GGUF Hy-MT3-30B-A3B-Q4_K_M.gguf `
--revision f42e8581c94e4d1b2259d6171fa199a7fae56edd `
--local-dir "$HOME\models\hy-mt3"
Swap in Hy-MT3-30B-A3B-IQ2.gguf or Hy-MT3-30B-A3B-Q8_0.gguf to match the sizing table. The GGUF carries Tencent's chat template but no sampling settings, so the next step sets them.
Step 3: Start llama-server
Linux and macOS:
./build/bin/llama-server \
--model ~/models/hy-mt3/Hy-MT3-30B-A3B-Q4_K_M.gguf \
--alias hy-mt3 \
--host 127.0.0.1 \
--port 8080 \
--ctx-size 8192 \
--parallel 1 \
--n-predict 4096 \
--temp 0.7 \
--top-p 1.0 \
--top-k 0 \
--min-p 0 \
--repeat-penalty 1.0
Windows PowerShell, from the folder you extracted in Step 1:
.\llama-server.exe `
--model "$HOME\models\hy-mt3\Hy-MT3-30B-A3B-Q4_K_M.gguf" `
--alias hy-mt3 `
--host 127.0.0.1 `
--port 8080 `
--ctx-size 8192 `
--parallel 1 `
--n-predict 4096 `
--temp 0.7 `
--top-p 1.0 `
--top-k 0 `
--min-p 0 `
--repeat-penalty 1.0
The card recommends temperature 0.7, top_p 1.0, top_k -1, repetition_penalty 1.0 and max_tokens 4096 for 30B-A3B, and notes that the models "do not have a default system_prompt". What each flag does at v1.1.0:
| Flag | Why it is here |
|---|---|
--ctx-size 8192 | The card's max_context. The default, 0, means "loaded from model": 262,144 tokens here, or about 24 GiB of KV cache. With -c set, --fit does not shrink the context. |
--parallel 1 | Without it, llama-server sets slots to auto, which server.cpp turns into 4 slots sharing one unified KV pool, so concurrent requests compete for the same 8,192 tokens. One slot gives each request the full 8,192. Step 4 shows the multi-slot setup. |
--n-predict 4096 | The card's max_tokens. The default is -1 (no limit). A request's own max_tokens overrides it. |
--temp 0.7, --top-p 1.0 | The card's values. llama.cpp's defaults are 0.80 and 0.95. |
--top-k 0 | The card's -1 means top-k is off. In llama.cpp, 0 disables it; the default is 40. |
--min-p 0 | The card lists no min-p. llama.cpp applies min-p 0.05 by default, and 0 turns it off. |
--repeat-penalty 1.0 | The card's value and also llama.cpp's default (1.0 = disabled). It is written out so the full sampler setup is visible. |
--port 8080, --host 127.0.0.1 | The default port at v1.1.0 is 9931, and the default host is already 127.0.0.1. If you bind to 0.0.0.0, add --api-key. |
Three things are left at their defaults on purpose:
--jinjais on by default at v1.1.0, so the server renders the template embedded in the GGUF.- GPU layers (
-ngl) default to auto. --fitis on by default. Per the fit-params README, when the model does not fit it keeps the dense weights on the GPU and moves theffn_*_expstensors of overflowing layers to system memory, leaving a 1,024 MiB margin per device (--fit-target). That is the placement the sizing table assumes. If you prefer to choose,--n-cpu-moe Nkeeps the experts of the first N layers on the CPU and--cpu-moekeeps all of them there.
When the server is up, compare the buffer sizes it logs for each device with the sizing table. GET /health reports when it is ready.
Step 4: Send a Test Translation
The prompt below is the card's English "Default Translation" template filled in for German. Linux and macOS:
curl http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "hy-mt3",
"messages": [{"role": "user", "content": "Translate the following text into German. Note that you should only output the translated result without any additional explanation:\n\nThe meeting has moved to Thursday at 3 p.m. Please bring the signed contract."}],
"max_tokens": 256
}'
Windows PowerShell 5.1. Sending the body as UTF-8 bytes keeps non-ASCII text intact:
$prompt = "Translate the following text into German. Note that you should only output the translated result without any additional explanation:`n`nThe meeting has moved to Thursday at 3 p.m. Please bring the signed contract."
$body = @{
model = "hy-mt3"
messages = @(@{ role = "user"; content = $prompt })
max_tokens = 256
} | ConvertTo-Json -Depth 5
$r = Invoke-RestMethod -Uri http://127.0.0.1:8080/v1/chat/completions -Method Post `
-ContentType "application/json; charset=utf-8" -Body ([Text.Encoding]::UTF8.GetBytes($body))
$r.choices[0].message.content
The translation is in choices[0].message.content, and finish_reason should be stop. Do not add a system message, and do not send reasoning_effort.
What the model receives. Rendering the template from the repo with Python's jinja2 for that one user message gives:
<|hy_begin▁of▁sentence|><|reasoning_mode|>reasoning_effort:no_think<|hy_User|>Translate the following text into German. Note that you should only output the translated result without any additional explanation:
The meeting has moved to Thursday at 3 p.m. Please bring the signed contract.<|hy_Assistant|><think></think>
The template accepts reasoning_effort values high, low and no_think. Anything else, or nothing, becomes no_think, which closes the thinking block (<think></think>) before the reply. high or low leaves it open, which is not the mode Tencent evaluated. The template ignores enable_thinking.
Use the Card's Prompt Templates
The card's instruction table is the most important practical detail for this model. These are the English versions, copied as plain text. The card shows them in a Markdown table with some words in bold or italics; its own Transformers example sends the default instruction as plain text, followed by a blank line and the source, so plain text is used here. The card also gives a Chinese version of each template. Its note: "both source_lang and target_lang should use the full language names. Chinese names should be used in Chinese prompts, and English names should be used in English prompts."
Default Translation
Translate the following text into {target_lang}. Note that you should only output the translated result without any additional explanation:
{source_text}
Terminology. One translates to line per glossary entry:
Reference the following translations:
{text} translates to {text}
{text} translates to {text}
{text} translates to {text}
Translate the following text into {target_lang}. Note that you must ONLY output the translated result without any additional explanation:
{source_text}
Style
Please translate the following text into {target_lang}. Note that the translation style must strictly conform to [{target_style}]:
{source_text}
Personalization
[Source Text]
{source_text}
[Translation Tasks]
1. {user_preferences}
2. {user_preferences}
3. ...
4. Translate the [Source Text] into {target_lang}.
Delimiters
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 1. For JSON, YAML, HTML and similar. {format_type} names the format:
### 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}
Structured Data 2. Despite the name, this one carries background context:
[Background Information]
{background_text}
Please translate the following text into {target_lang}, taking the provided background information into consideration.
[Source Text]
{source_text}
The card's code examples do not all use these exact words. Its Transformers example uses a different Chinese wording, and its llama-completion example uses "Translate the following segment into Chinese, without additional explanation". Tencent's own instruction-following benchmark, IFMTBench (in the Hy-MT2 repo), is written as free-form requests, and the model is scored on following them. Treat the table as the documented starting point, not the only wording the model accepts.
Language names to use. These are the English names from the card's "Supported Languages" tables, 102 in total. The card's language codes are in brackets where the name alone is ambiguous:
| Group | Languages |
|---|---|
| Supported since Hy-MT2 (33) | Chinese, English, French, Portuguese, Spanish, Japanese, Turkish, Russian, Arabic, Korean, Thai, Italian, German, Vietnamese, Malay, Indonesian, Filipino, Hindi, Traditional Chinese (zh-TR), Polish, Czech, Dutch, Khmer, Burmese, Persian, Gujarati, Urdu, Telugu, Marathi, Hebrew, Bengali, Tamil, Ukrainian |
| Chinese minority languages and dialects, since Hy-MT2 (5) | Tibetan, Traditional Mongolian (mn), Cantonese, Arabic Kazakh (kk), Uyghur |
| New in Hy-MT3 (64) | Greek, Romanian, Hungarian, Bulgarian, Serbian, Croatian, Slovak, Slovenian, Albanian, Macedonian, Belarusian, Lithuanian, Latvian, Estonian, Finnish, Swedish, Danish, Norwegian (nb), Norwegian Nynorsk, Icelandic, Irish, Scottish Gaelic, Welsh, Catalan, Galician, Basque, Afrikaans, Luxembourgish, Maltese, Esperanto, Yiddish, Armenian, Georgian, Azerbaijani, Uzbek, Kyrgyz, Turkmen, Tajik, Tatar, Bashkir, Kurdish, Central Kurdish, Pashto, Nepali, Sinhala, Punjabi, Sindhi, Assamese, Odia, Kannada, Malayalam, Sanskrit, Lao, Javanese, Sundanese, Cebuano, Waray, Swahili, Amharic, Somali, Malagasy, Haitian Creole, Cyrillic Kazakh (kk-Cyrl), Cyrillic Mongolian (mn-Cyrl) |
Step 5: Batch-Translate a Document
The script below translates a UTF-8 text or Markdown file through llama-server. It uses only the Python standard library:
- Chunking. It splits the file at blank lines and packs paragraphs into chunks of up to
--chunk-tokenstokens. It counts them with llama-server'sPOST /tokenize, so the count uses the model's own tokenizer. - Templates. It fills in the card's Default template. When a glossary entry appears in a chunk, it switches to the card's Terminology template with only the entries found in that chunk.
- Sampling. It sends the card's
temperature,top_pandmax_tokenswith every request. Top-k, min-p and the repeat penalty come from the server flags in Step 3. - Failure check. If a reply stops for any reason other than
stop, the script raises an error instead of writing a truncated translation.
Save it as translate_file.py:
#!/usr/bin/env python3
"""Translate a UTF-8 text or Markdown file with Hy-MT3 through llama-server."""
import argparse
import concurrent.futures
import json
import sys
import urllib.request
# "Default Translation" template from the Hy-MT3 model card (English version).
DEFAULT_PROMPT = (
"Translate the following text into {target_lang}. Note that you should only "
"output the translated result without any additional explanation:\n\n{source_text}"
)
# "Terminology" template from the same card.
TERMS_PROMPT = (
"Reference the following translations:\n{terms}\n\n"
"Translate the following text into {target_lang}. Note that you must ONLY "
"output the translated result without any additional explanation:\n\n{source_text}"
)
def post(url, payload):
request = urllib.request.Request(
url,
data=json.dumps(payload).encode("utf-8"),
headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(request, timeout=900) as response:
return json.loads(response.read().decode("utf-8"))
def count_tokens(server, text):
return len(post(f"{server}/tokenize", {"content": text})["tokens"])
def make_chunks(server, text, budget):
"""Pack blank-line-separated paragraphs into chunks of at most `budget` tokens."""
chunks, current = [], []
for paragraph in text.split("\n\n"):
candidate = "\n\n".join(current + [paragraph])
if current and count_tokens(server, candidate) > budget:
chunks.append("\n\n".join(current))
current = [paragraph]
else:
current.append(paragraph)
if current:
chunks.append("\n\n".join(current))
for number, chunk in enumerate(chunks, 1):
if count_tokens(server, chunk) > budget:
print(f"warning: chunk {number} is one paragraph over the budget", file=sys.stderr)
return chunks
def translate(args, glossary, chunk):
terms = [f"{source} translates to {target}" for source, target in glossary if source in chunk]
if terms:
prompt = TERMS_PROMPT.format(terms="\n".join(terms), target_lang=args.target, source_text=chunk)
else:
prompt = DEFAULT_PROMPT.format(target_lang=args.target, source_text=chunk)
reply = post(f"{args.server}/v1/chat/completions", {
"model": args.model,
"messages": [{"role": "user", "content": prompt}],
"temperature": 0.7,
"top_p": 1.0,
"max_tokens": 4096,
})
choice = reply["choices"][0]
if choice["finish_reason"] != "stop":
raise RuntimeError(f"finish_reason={choice['finish_reason']}; lower --chunk-tokens")
return choice["message"]["content"].strip()
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("input")
parser.add_argument("output")
parser.add_argument("--target", required=True, help='full language name, e.g. "German"')
parser.add_argument("--server", default="http://127.0.0.1:8080")
parser.add_argument("--model", default="hy-mt3")
parser.add_argument("--glossary", help="UTF-8 file, one 'source<TAB>target' pair per line")
parser.add_argument("--chunk-tokens", type=int, default=1500)
parser.add_argument("--workers", type=int, default=1, help="match llama-server --parallel")
args = parser.parse_args()
with open(args.input, encoding="utf-8") as f:
text = f.read()
glossary = []
if args.glossary:
with open(args.glossary, encoding="utf-8") as f:
glossary = [tuple(line.rstrip("\n").split("\t", 1)) for line in f if "\t" in line]
chunks = make_chunks(args.server, text, args.chunk_tokens)
print(f"{len(chunks)} chunks", file=sys.stderr)
with concurrent.futures.ThreadPoolExecutor(max_workers=args.workers) as pool:
results = list(pool.map(lambda chunk: translate(args, glossary, chunk), chunks))
with open(args.output, "w", encoding="utf-8") as f:
f.write("\n\n".join(results) + "\n")
if __name__ == "__main__":
main()
Run it the same way on every OS. Python reads Windows line endings as \n, so CRLF files split correctly:
python translate_file.py report.md report.de.md --target German --glossary glossary.tsv
The glossary is a UTF-8 file with one tab-separated pair per line, for example net profit<TAB>Reingewinn.
Why 1,500 tokens. The card's limits are max_context: 8192 and max_tokens: 4096. A 1,500-token chunk plus the template and glossary lines, plus a 4,096-token reply, stays under 8,192. It also leaves room for a translation more than twice as long in tokens as its source. If you raise --chunk-tokens, keep the prompt plus 4,096 under the slot size. A single paragraph longer than the budget still goes out as its own chunk, with a warning. If its reply stops at length, the script exits without writing the output file.
Translating several chunks at once. Give the server more slots and grow the context to match:
./build/bin/llama-server \
--model ~/models/hy-mt3/Hy-MT3-30B-A3B-Q4_K_M.gguf \
--alias hy-mt3 --host 127.0.0.1 --port 8080 \
--ctx-size 32768 --parallel 4 --n-predict 4096 \
--temp 0.7 --top-p 1.0 --top-k 0 --min-p 0 --repeat-penalty 1.0
Then pass --workers 4 to the script. Setting --parallel explicitly leaves the unified KV cache off, and llama-context.cpp then gives each slot n_ctx / n_seq_max, so 32,768 / 4 = 8,192 tokens per slot. The KV cache grows to 3 GiB, which the sizing table accounts for in the 24 GB row.
Keeping terms and context consistent.
- Glossary terms: the glossary handles names and terms. Keep it to entries that matter, because every matching entry adds a line to the prompt.
- Context across chunks: use the card's Structured Data 2 template. Put a one-paragraph description of the document, or the paragraph before the chunk, in
{background_text}. The card shows no template that combines background with a glossary, so pick one per request. - Markdown with code blocks or front matter: send those sections with the Structured Data 1 template, or leave them out of the file you translate.
Path 2: Ollama v0.40.19
There is no Hy-MT3 model in the Ollama library: ollama.com/library/hy-mt3 returned 404 on 1 December 2026, and its search lists only community uploads of the older Hy-MT2 and HY-MT1.5. The release notes for v0.40.18, v0.40.19 and the v0.40.20-rc0 pre-release, all published after the model appeared, do not mention it. The route that remains is Hugging Face's Ollama integration:
- Architecture support: v0.40.19's
LLAMA_CPP_VERSIONpins llama.cpp b12734, which is after b9993, so the bundled llama.cpp includeshy_v3. The v0.40.20-rc0 pre-release pins b12816. - Tags that resolve: Hugging Face's registry serves manifests for
:Q4_K_M(19,502,694,048-byte model layer) and:Q8_0(32,791,821,792 bytes). It rejects:IQ2with "The specified tag is not a valid quantization scheme". The full file name works as a tag, as Hugging Face's documentation allows:hf.co/tencent/Hy-MT3-30B-A3B-GGUF:Hy-MT3-30B-A3B-IQ2.gguf. - What comes with it: the registry adds a generated Go template and a
paramslayer that sets only stop strings. There are no sampling values. - No public reports: no Ollama issue mentions Hy-MT3 as of 1 December 2026, either as working or as failing.
The hf.co route pulls the repo's current files and offers no revision pin. Pull it, then create a model with the card's settings:
ollama pull hf.co/tencent/Hy-MT3-30B-A3B-GGUF:Q4_K_M
Save this as Modelfile:
FROM hf.co/tencent/Hy-MT3-30B-A3B-GGUF:Q4_K_M
PARAMETER num_ctx 8192
PARAMETER num_predict 4096
PARAMETER temperature 0.7
PARAMETER top_p 1.0
PARAMETER repeat_penalty 1.0
ollama create hy-mt3 -f Modelfile
ollama run hy-mt3
The commands are the same in PowerShell. The Modelfile reference documents top_k with a default of 40 and no value that turns it off, so this route cannot match the card's top_k -1 exactly. Ollama's OpenAI-compatible endpoint is http://localhost:11434/v1/chat/completions. The batch script above needs llama-server, because Ollama has no /tokenize endpoint.
Which template Ollama uses. The generated Go template is not the same as Tencent's. For a message without a system prompt, it leaves out the begin-of-sentence token and the reasoning_effort:no_think marker, and puts the end-of-sequence token text before the user turn. In v0.40.19, shouldPreferChatTemplate in server/images.go prefers the GGUF's own template when it declares more capabilities than the Go template. Hy-MT3's template mentions tools and the generated one does not, so chat formatting is handed to llama-server's Jinja renderer, which uses Tencent's template. Leave OLLAMA_GO_TEMPLATE unset: setting it to 1 forces the generated template.
On that path, Ollama forwards a boolean think setting to the template as enable_thinking. Hy-MT3's template ignores that key, so it stays in non-thinking mode. A string thinking level is forwarded as reasoning_effort, and high or low would open a thinking block, so do not request one.
vLLM, SGLang and Transformers
The base card documents these routes against the full-precision repo tencent/Hy-MT3-30B-A3B (BF16 weights, 60.13 GB):
- Transformers: the card requires
transformers>=5.6.0and loads the model withAutoModelForCausalLMintorch.bfloat16withdevice_map="auto". The latest release on 1 December 2026 is v5.24.1. - vLLM: the card builds vLLM from source (
uv pip install --editable . --torch-backend=auto), then runsvllm serve tencent/Hy-MT3-30B-A3B --tensor-parallel-size 1. - SGLang: the card builds SGLang from source with
transformers>=5.6.0, then runspython3 -m sglang.launch_server --model tencent/Hy-MT3-30B-A3B --tp 1.
The card names no vLLM or SGLang release version, only source builds. tencent/Hy-MT3-30B-A3B-FP8 (30.58 GB, with a kv_cache_scales.safetensors file) is the smaller checkpoint for these engines. The 30B-A3B repo ships no generation_config.json, so nothing in the repo sets sampling. Pass the card's values in each request. For serving at scale, see our vLLM self-hosting guide.
The Smaller Models
The same family has two dense models. Both use the hunyuan_v1_dense architecture, which llama.cpp loads as hunyuan-dense, as recorded in both GGUFs' headers:
| Repository (revision) | Files | Notes |
|---|---|---|
tencent/Hy-MT3-7B-GGUF (4447cb3) | IQ2 3.87 GB, Q4_K_M 5.15 GB, Q8_0 8.73 GB | Tencent's table puts Q4_K_M within 0.6 points of BF16 on every benchmark. |
tencent/Hy-MT3-1.8B-GGUF (0296962) | Q4_K_M 1.35 GB, Q8_0 1.91 GB | The most sensitive to quantization: Q4_K_M loses up to 2.55 points, Q8_0 stays within 0.6 except on IFMTBench (−1.60). Prefer Q8_0. |
For the 1.8B and 7B models, the card recommends temperature 0.7, top_p 0.6, top_k 20, repetition_penalty 1.05 and max_tokens 4096, which in llama-server is --temp 0.7 --top-p 0.6 --top-k 20 --repeat-penalty 1.05. Their generation_config.json files set top_p to 0.8 instead. The card is the documented recommendation. Each model repo also has an FP8 variant.
Troubleshooting
Issue and discussion states were checked on 1 December 2026. The Hy-MT3 GitHub repo has no issues, and no llama.cpp or Ollama issue mentions Hy-MT3.
| Symptom | Source | What to do |
|---|---|---|
| llama-server reserves far more memory than the weights need, or fails to allocate the KV cache | common/arg.cpp: -c defaults to 0, "loaded from model" | Set --ctx-size 8192. The full 262,144 positions cost about 24 GiB of f16 KV cache. |
Translations stop mid-sentence; finish_reason is length | Card: max_context: 8192, max_tokens: 4096 | Send shorter chunks. The batch script stops rather than writing a truncated file. |
| Concurrent requests run out of context | server.cpp: auto slots means 4 slots sharing one unified KV pool | Use --parallel 1, or --parallel N with --ctx-size set to N × 8,192. |
| The model starts reasoning before it translates | chat_template.jinja | Remove reasoning_effort from the request. Only high and low open a thinking block. |
No mmproj file for image translation | GGUF discussion #1 (open, no reply) | The models are text-only. Tencent's image results run OCR first (PaddleOCR in the report). Translate the OCR output. |
wrong number of tensors when loading a Hy3-family GGUF | llama.cpp #25657 (closed 21 July 2026) | Files made with pre-merge patches named the tensor exp_probs_b.bias. Tencent's Hy-MT3 GGUFs use exp_probs_b, which the loader expects. Use Tencent's files. |
Ollama rejects :IQ2 | Hugging Face registry: "The specified tag is not a valid quantization scheme" | Use the file name as the tag: :Hy-MT3-30B-A3B-IQ2.gguf. |
| A 1.25-bit (STQ1_0) quant of Hy-MT3-1.8B outputs garbage | 1.8B-GGUF discussion #1 (open) | A reply in the thread (26 November) says STQ works only through quantization-aware training for small models, and that AngelSlim expected to release 2-bit and 1.25-bit 1.8B GGUFs the following week. None was on Hugging Face on 1 December. Use Tencent's Q8_0. |
Benchmarks: Tencent's Own Numbers
These figures come from Tencent's report and card and have not been independently reproduced. Tencent publishes no BLEU, chrF or COMET scores for Hy-MT3. Every quality score is an LLM-as-a-judge score on a 0 to 100 scale:
- TransRubric is Tencent's own rubric-based judge, released with the model. It averages two judges, DeepSeek-V4.1-Flash and Qwen3.5-397B-A17B. Tencent reports that it beats chrF, COMET22 and xCOMET in the WMT26 metrics task.
- GEMBA uses GPT-OSS-120B with medium reasoning.
The test sets:
- General translation averages four of them: FLORES-200 across 33 languages in all 1,056 directions, FLORES-200 for 64 lower-resource languages paired with Chinese or English (256 directions), WMT26 GenMT (20 pairs) and Mandarin⇔Minority (10 directions).
- WildMTBench-202611 is Tencent's in-house set of 5,000 real-world samples.
- IFMTBench is Tencent's instruction-following set of 7,344 cases.
| Model (non-thinking unless marked T) | General translation avg, TransRubric / GEMBA |
|---|---|
| Hy-MT3-30B-A3B | 88.50 / 81.87 |
| Qwen3.8-Max | 88.02 / 81.08 |
| Hy-MT3-7B | 86.12 / 80.39 |
| Kimi-K3.1-Pro | 86.01 / 81.47 |
| DeepSeek-V4.1-Flash | 84.27 / 78.98 |
| Index-Translate-35B-A3B | 78.75 / 79.24 |
| Hy-MT2-30B-A3B | 76.75 / 75.17 |
| Hy-MT3-1.8B | 75.05 / 71.66 |
| DeepSeek-V4.1-Flash (T) | 94.09 / 82.68 |
| Kimi-K3.1-Pro (T) | 92.13 / 82.77 |
| GPT-6.1-Sol (T) | 92.08 / 82.96 |
| Claude-Opus-5.5 (T) | 91.84 / 83.25 |
Tencent's claim is the best result among non-thinking systems. Thinking-mode models in the same table score higher on the average, at several times the inference compute by Tencent's estimate. On the other benchmarks, by the report's own figures:
- WildMTBench-202611: Hy-MT3-30B-A3B scores 91.30, ahead of Qwen3.8-Max (90.94) and Kimi-K3.1-Pro (90.23) and behind GPT-6.1-Sol in thinking mode (92.50).
- HardMTBench (knowledge-intensive Chinese⇔English): 88.93, up from 81.38 for Hy-MT2-30B-A3B but behind Qwen3.8-Max (92.30) and Kimi-K3.1-Pro (92.04). The report attributes the gap to the larger models' stored knowledge.
- IFMTBench: 91.02 on single constraints, 79.74 on multiple constraints and 86.66 in total. On the multi-constraint subset it trails Qwen3.8-Max (82.84) and Kimi-K3.1-Pro (82.21).
- Game localization: in a human evaluation built with the Honor of Kings team, Hy-MT3-30B-A3B scores 89.6 against 88.7 for Gemini 3.1 Pro in thinking mode, with a 0.08% terminology error rate against 0.54%.
- Image translation: on VISTA-Bench with PaddleOCR input it scores 45.73, the best among non-thinking models, against 45.46 for Gemma4-26B-A4B and 51.97 for GPT-6.1-Sol in thinking mode.
The table that matters for local use is the report's quantization comparison (Table 8). All scores are TransRubric except IFMTB:
| Hy-MT3-30B-A3B | FLORES All-33 | FLORES Low-Res. | WMT26 | Mand. | WildMTB | HardMTB | IFMTB |
|---|---|---|---|---|---|---|---|
| BF16 | 92.40 | 92.13 | 85.63 | 83.85 | 91.30 | 88.93 | 86.66 |
| FP8 | 92.29 | 92.06 | 85.40 | 83.85 | 91.09 | 88.78 | 86.84 |
| Q8 (GGUF) | 92.37 | 92.15 | 85.65 | 83.98 | 91.17 | 88.93 | 86.69 |
| Q4_K_M (GGUF) | 92.33 | 92.09 | 85.46 | 83.48 | 91.22 | 88.82 | 86.64 |
| IQ2 (GGUF) | 91.44 | 90.08 | 83.37 | 81.32 | 90.81 | 87.74 | 85.74 |
Tencent's summary: for 30B-A3B, 8-bit and 4-bit stay within 0.4 points of BF16. IQ2 drops at most 2.53 points, mostly on low-resource FLORES, WMT26 and Mandarin⇔Minority, and still beats BF16 Hy-MT3-7B on every benchmark except Mandarin⇔Minority.
Practical Verdict
For local translation, run Tencent's Q4_K_M GGUF on llama.cpp v1.1.0 with the Step 3 flags. Tencent's own table puts it within 0.4 points of BF16, and it fits whole on a 24 GB card. On a 16 GB card, use IQ2 to keep everything on the GPU. On 8 to 12 GB, let --fit move experts to system RAM. The non-expert part is only about 2.2 GiB, and each token runs 8 of 128 routed experts per layer.
Most of the quality you get depends on the request, not the runtime:
- Use the card's templates and full language names.
- Send no system prompt and no
reasoning_effort. - Keep each request inside 8,192 tokens.
- Use the Terminology template for names and terms that must not drift.
Ollama is worth trying if it is already your runtime, but nobody has reported results yet, and it cannot switch top-k off. Record the llama.cpp build and the GGUF revision (f42e858) with any results you keep.
What to Read Next
- Run LLMs Locally: 6 Practical Methods: Ollama, LM Studio, vLLM, llama.cpp and others compared
- Run Inkling 2 Mini Locally: the same expert-offload sizing method on another MoE model
- Self-Hosting Your First LLM: hardware and quantization trade-offs before you buy
- VRAM calculator: budget memory for other models before you download them
Frequently asked questions
Which llama.cpp version runs Hy-MT3-30B-A3B?
Any build from b9993 onward. The model's architecture is hy_v3, and llama.cpp added it in PR #25395, merged on 13 July 2026. The stable v1.1.0 release (26 November 2026, the same commit as build b12774) includes it, and this guide pins v1.1.0. Tencent's GGUF files name the expert-bias tensor exp_probs_b, which is the name the hy_v3 loader expects, so no patched build is needed. The 7B and 1.8B models use the hunyuan-dense architecture, which v1.1.0 also supports.
What prompt format does Hy-MT3 expect?
A single user message with no system prompt. The card's default template is: Translate the following text into {target_lang}. Note that you should only output the translated result without any additional explanation: followed by a blank line and the source text. Use the full language name, such as German, not a code. The card also gives templates for terminology, style, delimiters, structured data and background context. The chat template wraps your message in non-thinking mode by default, which is how Tencent evaluated the model, so do not send a reasoning_effort value.
How much memory does Hy-MT3-30B-A3B need?
Tencent's GGUFs are 13.08 GB (IQ2), 19.50 GB (Q4_K_M) and 32.79 GB (Q8_0). By arithmetic from config.json, the f16 KV cache costs 96 KiB per token, or 768 MiB for one 8,192-token slot. That makes IQ2 a fit for a 16 GB GPU and Q4_K_M a fit for a 24 GB GPU, with 2 to 4 GiB left for compute buffers. On smaller GPUs, llama.cpp keeps the routed experts that do not fit in system RAM. Everything except the routed experts comes to about 2.2 GiB in every file.
Can I run Hy-MT3 with Ollama?
There is no hy-mt3 model in the Ollama library, and Ollama's release notes do not mention it. The Hugging Face route resolves: Hugging Face's registry serves manifests for hf.co/tencent/Hy-MT3-30B-A3B-GGUF:Q4_K_M and :Q8_0, and Ollama v0.40.19 bundles llama.cpp b12734, which includes the hy_v3 architecture. The :IQ2 tag is rejected; use the full file name as the tag instead. No public Ollama report confirms or rules out Hy-MT3 as of 1 December 2026. Ollama gets no sampling values from the repo, so set Tencent's in a Modelfile.
How long a document can Hy-MT3 translate in one request?
The model card gives max_context 8192 and recommends max_tokens 4096, so source text, prompt and translation must fit in 8,192 tokens. config.json allows 262,144 positions, but Tencent states the 8,192 limit, and llama-server would allocate about 24 GiB of KV cache at the full length. For longer files, split the text at paragraph boundaries. The script in this guide packs paragraphs into chunks of up to 1,500 tokens and stops if a reply ends with finish_reason length.
Can Hy-MT3 translate text in images?
Not directly. The models take text only, and the GGUF repo has no mmproj file, which a user asked about in an open Hugging Face discussion. Tencent's image translation results are OCR-cascaded: the paper runs PaddleOCR on each image and gives the recognised text to the model. Run OCR first and translate its output.
Related Guides
Run Inkling 2 Mini Locally with llama.cpp, Ollama and MLX (v1.1.0)
Run Inkling 2 Mini locally with llama.cpp v1.1.0, Ollama or MLX: real file sizes, pinned commands, and what the op-offload fix changes on small GPUs.
The Complete Developer Guide to Running LLMs Locally: From Ollama to Production
Everything you need to run LLMs on your own hardware in 2026: VRAM sizing, model formats, an 8-tool comparison table, a full local RAG pipeline, and Docker production deployment with GPU passthrough and Nginx auth.
Run GigaChat 4 37B-A4B Locally with llama.cpp (PR #32767 Build)
Run GigaChat 4 37B-A4B on an 8 GB GPU with the llama.cpp PR build: real GGUF sizes, MoE expert offload, MTP, tool calls and the noncommercial license.