M2: TranslationAdapter/AdapterRegistry with documented Hy-MT3 prompts and publisher sampling; all 102 languages with BCP-47 variants, RTL and dense-script flags; normalisation, NLLanguage detection, content classification and exact-join script-aware chunking; protected-token scanning and output validation; prompt policy with one documented fallback; shared TranslationPipeline with Core error mapping. The CLI now reports sourceLanguage and warning codes. M3: pure DoubleCopyDetector, 120 ms PasteboardWatcher with 750 ms own-write suppression, SystemPasteboard snapshot/restore and markers, CapturePolicy for the 4000/2000 limits, ServicesProvider and the menu-bar action. T3.5 (10-app manual matrix) remains intentionally open. Docs: ARCHITECTURE, TRANSLATION_OUTPUT, HYMT3_MODEL (§7 spike), SELECTION_AND_CLIPBOARD, PROGRESS; ADR-016 superseded by ADR-017/018. Verified: make verify green (format, strict lint, scripts, privacy, Debug+Release signatures, package tests); live 7B CLI en→de/de→en/Markdown/JSON/placeholders; empty input exits 2 and unreachable exits 3.
9.5 KiB
Hy-MT3 model and adapter
Status: Draft v1.0, researched 2026-11-26. Model cards and conversions change; re-check tags, sizes and licences before T2.7 and before any release. Everything here is guidance for adapters, Settings hints and the evaluation. Never hard-code this list as "available" in the app; discover installed models at runtime.
Sources: Hy-MT3-7B-GGUF, Hy-MT3-1.8B-GGUF, Hy-MT3 GitHub, Hy-MT3 report.
1. Family and tags
| Model | Role | Tag | Size | Notes |
|---|---|---|---|---|
| Hy-MT3-7B | Default (provisional) | hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M |
5.15 GB download; about 6.5 GB resident with 8K context | 7.5B parameters, hunyuan-dense, Q4_K_M |
| Hy-MT3-1.8B | Fast preset | hf.co/tencent/Hy-MT3-1.8B-GGUF:Q4_K_M |
1.35 GB download | 2B-class, Q4_K_M; VERIFY on your Ollama |
| Hy-MT3-30B-A3B | Quality, not a preset | hf.co/tencent/Hy-MT3-30B-A3B-GGUF:* |
far above 16 GB | MoE, 3B active; hidden unless installed |
- Licence: Apache-2.0 per the Hugging Face model cards.
/api/showreportslicense: nullfor the GGUF, so show the model-card licence in Settings, not the Ollama field. - 102 supported languages. See
docs/LANGUAGES.mdfor the exact model names. - The model has no default system prompt. Do not send one.
/api/showcapabilities:["completion"]. No vision, no thinking. Do not sendimagesorthink.- Chat template (verified):
{{ if .System }}<|startoftext|>{{ .System }}<|extra_4|>{{ end }}{{ if .Prompt }}<|startoftext|>{{ .Prompt }}<|extra_0|>{{ end }}{{ .Response }}<|eos|>. - Model card max context: 8192. GGUF metadata reports
context_length = 262144; that is the base model metadata, not the documented translation context. Setnum_ctx: 8192.
2. Sampling
Publisher recommendation for 1.8B and 7B:
{
"temperature": 0.7,
"top_p": 0.6,
"top_k": 20,
"repetition_penalty": 1.05,
"max_tokens": 4096
}
In Ollama:
| Ollama option | Value |
|---|---|
temperature |
0.7 |
top_p |
0.6 |
top_k |
20 |
repeat_penalty |
1.05 |
num_predict |
4096 |
num_ctx |
8192 |
/api/show reports only stop tokens, no sampling defaults, so the adapter must set these explicitly. The M7 evaluation compares temperature 0.7 with 0.2; a translation app may prefer lower variance, but the publisher default is the starting point.
3. The canonical default prompt
This is the only default in v1. It is byte-exact: keep the bold markers, the period after the target language, the colon and the blank line.
Translate the following text into {target_lang}. Note that you should **only output the translated result without any additional explanation**:
{source_text}
{target_lang}is the exact full English name from the model card (German,Chinese,Traditional Chinese,Portuguese,Norwegian Nynorsk,Cyrillic Kazakh, …).- No source-language field, no system message, no timestamp, no app name.
- The prefix depends only on
{target_lang}; append{source_text}last. This preserves Ollama's prompt-prefix cache. - The owner's reference run reported 177/178 prompt tokens cached; our run reported 178 prompt tokens, 246 output tokens, 44.6 tok/s, 6.52 s total on an M5 Pro 48 GB.
4. Other documented templates
These are the only allowed alternatives (ADR-012). v1 defaults to the template above for everything; the others are fallbacks selected by content class or validation.
Terminology (future glossary)
*Reference the following translations:*
{source_term} translates to {target_term}
{source_term} translates to {target_term}
Translate the following text into {target_lang}. Note that you must **ONLY output the translated result without any additional explanation**:
{source_text}
Style (future style presets)
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_preference}**
2. **{user_preference}**
3. ...
4. Translate the [Source Text] into {target_lang}.
Delimiters (placeholder-heavy 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 1 (Markdown, JSON, HTML)
### 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 (background information)
[Background Information]
{background_text}
Please translate the following text into {target_lang}, taking the provided background information into consideration.
[Source Text]
{source_text}
5. Content policy for v1
| Source content | Prompt |
|---|---|
| Plain prose, light Markdown, ordinary URLs | Default |
| JSON, HTML, Markdown tables, complex nesting | Structured Data 1 with format_type (JSON, HTML, Markdown) |
| Many placeholders/delimiters, or a protected token was lost | Delimiters (one retry only) |
| User glossary (future) | Terminology |
| User style (future) | Style |
The default prompt already preserved a URL, an e-mail, {{limit}}, a code span and a JSON object in our checks. Validation is still mandatory; do not assume.
6. Known limitations
- Literal compounds. Technical English sometimes becomes a literal German compound ("thinking tokens" → "Denktokens", "non-thinking mode" → "nicht-denkenden Modus"). A style or terminology prompt may help; do not rewrite silently.
- Preamble risk. The model usually follows "only output the translation", but can add an explanation on unusual input. Detect and flag; never strip automatically.
- Long input. The card's context is 8192. Chunk before the limit; do not rely on the GGUF metadata's larger base context.
- Numbers and units. Locale formatting may change (
1.5→1,5). Validate semantic numeric presence, not the exact string. - Code and keys. The default template handles simple JSON well; use Structured Data 1 for real code or nested data. Never translate identifiers silently.
- Same-language input. A German→German request may return the text unchanged or "improved"; detect and warn.
- No glossary in v1. Terminology consistency across a document is not guaranteed.
7. Compatibility spike results (T2.7)
Fill in from the spike. One row per tag and direction.
| Tag | Digest (first 12) | Ollama | Direction | Works | Notes (quality, preamble, tokens, speed) |
|---|---|---|---|---|---|
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | en→de | ✅ | 33 output tokens, 0.94 s, no warnings. "Meeting" stayed as a loanword; no preamble. |
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | de→en | ✅ | 26 output tokens, 0.66 s, no warnings; 9:30 and Room 4B preserved. |
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | markdown | ✅ | 50 output tokens, 1.18 s, no warnings; heading, bold, code span and link URL preserved. "num_ctx setting" became "num_ctx-Einstieg" (literal-compound limitation, not edited). |
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | json | ✅ | 21 output tokens, 0.57 s, no warnings; keys and structure preserved, feature values translated. |
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | placeholders | ✅ | 28 output tokens, 0.72 s, no warnings; URL, e-mail, {{name}} and ${deadline} preserved. |
| hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M | 262ac792aeb5 | 0.40.18 | long paragraph | ⚠️ | 4,315 varied chars → 2 chunks, 1,240 output tokens, 29.1 s, no warnings. An 8,785-char synthetic text whose source repeated identical blocks emitted a repeated window; the guard stopped it with repetitionLoop and missing-token warnings. Source repetition is indistinguishable from model repetition to the output-only guard. |
| hf.co/tencent/Hy-MT3-1.8B-GGUF:Q4_K_M | en→de | ☐ | Not installed; VERIFY deferred to T2.7/T7.4. | ||
| hf.co/tencent/Hy-MT3-1.8B-GGUF:Q4_K_M | de→en | ☐ | Not installed; VERIFY deferred to T2.7/T7.4. |
Prompt-prefix note: the prefix stayed identical across the en→de runs; Ollama reported 43–773 prompt tokens depending on chunk count. The /api/chat final object exposes prompt/eval counts but not the cached-token count, so cache reuse is inferred from the unchanged prefix and the owner's earlier 177/178 measurement, not from a new counter.
8. Adding a model
- Capture fixtures (
make fixtures) for the new tag. - Extend
HyMT3Adapteronly if the model family is still Hy-MT3; a different family needs its own adapter and documented prompts. - Bump the adapter
version. - Add it to this document with sources and licence status.
- Run
/evaluateon the corpus before offering it as a preset.