Kaito-ishiguro commited on
Commit
80c86bb
Β·
1 Parent(s): c34c56f

Add Q4_K_M, Q5_K_M, Q8_0 GGUFs with model card and license files

Browse files
.gitattributes CHANGED
@@ -1,35 +1 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.gguf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaito Ishiguro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
LICENSE.CAT-Translate-0.8b ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CyberAgent AI Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
LICENSE.sarashina2.2-0.5b ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SB Intuitions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,3 +1,238 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ - ja
6
+ library_name: gguf
7
+ base_model: cyberagent/CAT-Translate-0.8b
8
+ pipeline_tag: translation
9
+ tags:
10
+ - translation
11
+ - gguf
12
+ - llama.cpp
13
+ - on-device
14
+ - offline
15
+ - ja
16
+ - en
17
+ - travel
18
+ - quantized
19
  ---
20
+
21
+ # cat-translate-0.8b-travel-gguf
22
+
23
+ Offline EN↔JA travel translator, Q4_K_M GGUF, runs fully on-device via llama.cpp / PocketPal.
24
+
25
+ Fine-tuned from [cyberagent/CAT-Translate-0.8b](https://huggingface.co/cyberagent/CAT-Translate-0.8b)
26
+ (itself built on [sbintuitions/sarashina2.2-0.5b](https://huggingface.co/sbintuitions/sarashina2.2-0.5b))
27
+ via LoRA domain adaptation on a curated travel corpus, then converted to GGUF via a
28
+ [patched `convert_hf_to_gguf.py`](#critical-tokenizer-note) and quantized with
29
+ importance-matrix (imatrix) calibration on travel data.
30
+
31
+ ---
32
+
33
+ ## Files
34
+
35
+ | File | Size | Notes |
36
+ |------|------|-------|
37
+ | `cat-translate-0.8b-travel-Q4_K_M.gguf` | 503.7 MB | **RECOMMENDED** β€” iPhone target |
38
+ | `cat-translate-0.8b-travel-Q5_K_M.gguf` | 569.2 MB | Alternate |
39
+ | `cat-translate-0.8b-travel-Q8_0.gguf` | 806.2 MB | Near-lossless reference |
40
+
41
+ All three files are imatrix-calibrated PTQ (importance-matrix post-training quantization),
42
+ calibrated on a 534-example travel corpus weighted toward emergency (134 examples, all
43
+ available) and food (200 examples) domains. Quantized with `llama-quantize --imatrix`.
44
+
45
+ ---
46
+
47
+ ## Intended Use & Scope
48
+
49
+ **Target use case:** consumer travel translation β€” ordering food, navigating transportation,
50
+ accommodation, shopping, and emergency communication in Japan.
51
+
52
+ Food and emergency domains are explicitly weighted in both fine-tuning (food is 42.5% of
53
+ training pairs) and in the importance matrix calibration (emergency is the heaviest-weighted
54
+ domain by proportion). The motivating scenario is a foreigner with no internet access facing
55
+ a Japanese-only emergency line β€” "Please call an ambulance" and "I am having an allergic
56
+ reaction" must be correct.
57
+
58
+ **This model is a credible demonstrator with rigorous safety-aware evaluation.** It is not a
59
+ deployable medical, legal, or defense product. The consumer travel app is the near-term target.
60
+ See the safety architecture note below for how life-critical phrases are handled in the intended
61
+ deployment.
62
+
63
+ **Not in scope:** medical advice, legal documents, regulated translation workflows, or any
64
+ context where a confident-wrong output carries high-stakes consequences.
65
+
66
+ ---
67
+
68
+ ## Safety Architecture
69
+
70
+ The intended deployment is a **hybrid phrasebook + LLM** system:
71
+
72
+ - **Deterministic, human-verified phrasebook** handles life-critical phrases: calling an
73
+ ambulance, reporting an allergic reaction, "I can't breathe", "I'm lost". These are fixed
74
+ strings β€” no probability, no hallucination risk.
75
+ - **The LLM handles the open-ended long tail:** menus, negotiations, descriptions β€” anything
76
+ that formulaic phrases don't cover.
77
+
78
+ A 4-bit quantized LLM alone **must not be relied on for life-critical phrases.** Confident-wrong
79
+ is the worst failure mode in an emergency; the phrasebook is the safety net.
80
+
81
+ ---
82
+
83
+ ## Evaluation
84
+
85
+ Measured on a 156-item held-out gold test set (78 EN→JA + 78 JA→EN), food- and
86
+ emergency-weighted, with all 44 emergency references human-verified. Evaluated at the desktop
87
+ inference stage using llama-server with plain-text prompts on stock llama.cpp b9716.
88
+
89
+ | Label | Size (MB) | COMET (all) | Δ vs bf16 | food COMET | emerg COMET | BLEU en→ja | BLEU ja→en |
90
+ |-------|-----------|-------------|-----------|------------|-------------|------------|------------|
91
+ | bf16 | 1,515.2 | 0.9001 | Β±0.0000 | 0.8960 | 0.8913 | 48.87 | 39.99 |
92
+ | Q8_0 | 806.2 | 0.9022 | +0.0021 | 0.8971 | 0.8925 | 49.79 | 40.35 |
93
+ | Q5_K_M | 569.2 | 0.9000 | βˆ’0.0001 | 0.8933 | 0.8925 | 48.92 | 41.32 |
94
+ | Q4_K_M | 503.7 | 0.8988 | βˆ’0.0013 | 0.8892 | 0.8986 | 47.96 | 38.97 |
95
+
96
+ **COMET model:** `Unbabel/wmt22-comet-da`.
97
+ **BLEU tokenizers:** `char` for EN→JA (sacrebleu), `13a` for JA→EN (sacrebleu).
98
+
99
+ **Why Q4_K_M:** COMET delta βˆ’0.0013 vs bf16 is inside the 0.005 negligible threshold, at
100
+ 67% smaller. Emergency gate clears: Q4 emerg COMET 0.8986 vs bf16 0.8913 β€” zero emergency
101
+ degradation at 4-bit (the small apparent gain is within n=44 noise; the honest claim is no
102
+ degradation). The entire quant ladder sits within ~0.003 COMET; quant choice collapses to
103
+ smallest-that-fits-the-phone.
104
+
105
+ ### Read these caveats before drawing conclusions
106
+
107
+ - **COMET β‰ˆ parity is the reliable signal.** Do not read small BLEU swings between quant
108
+ levels as quality conclusions β€” the variation is within small-sample noise.
109
+ - **These 156-item numbers are NOT comparable to Phase 3 (fine-tune) numbers.** The earlier
110
+ 40-item eval set contained shorter, more formulaic sentences. The 156-item set includes
111
+ longer, more varied sentences; BLEU naturally drops on harder sets. The difference is not
112
+ a regression.
113
+ - **EN→JA BLEU uses `char` tokenizer; JA→EN uses `13a`.** Mixing tokenizers makes numbers
114
+ incomparable. If you re-evaluate, pin these tokenizers explicitly.
115
+
116
+ ---
117
+
118
+ ## Differentiation
119
+
120
+ The value proposition is **pragmatics, not BLEU.** Incumbent offline NMT (Google Translate
121
+ offline ~47 MB, Apple ~100 MB) wins literal character-BLEU. This model's edge:
122
+
123
+ - **Pro-drop resolution** β€” correctly inferring dropped subjects/objects from context in Japanese
124
+ - **Keigo** β€” appropriate politeness register for service interactions (restaurant, hotel, shop)
125
+ - **Cultural and food context** β€” menu descriptions, allergen terms, regional food vocabulary
126
+
127
+ Do not frame this as a BLEU race against Google or Apple. Frame it on pragmatic correctness
128
+ in travel scenarios that require cultural and register awareness.
129
+
130
+ ---
131
+
132
+ ## Critical Tokenizer Note
133
+
134
+ This GGUF was built with a **patched `convert_hf_to_gguf.py`** and tokenizes correctly only
135
+ in llama.cpp builds that use the resulting `tokenizer.ggml.model = "t5"` path.
136
+
137
+ **Background:** `cyberagent/CAT-Translate-0.8b` uses a SentencePiece **Unigram** tokenizer
138
+ (inherited from `sbintuitions/sarashina2.2-0.5b`). The stock llama.cpp conversion script
139
+ hardcodes `tokenizer.ggml.model = "llama"` for all SPM models, routing the runtime into the
140
+ greedy-merge SPM path. SPM greedy-merge β‰  Unigram Viterbi β€” it produces silently wrong token
141
+ splits. **All known community GGUFs of this model family (mradermacher, mmnga-o) have this
142
+ bug.**
143
+
144
+ **The fix (applied at conversion time):** `llama.cpp/conversion/base.py::_set_vocab_sentencepiece()`
145
+ was modified to (1) detect `tokenizer.json β†’ model.type == "Unigram"` and emit
146
+ `tokenizer.ggml.model = "t5"`, routing llama.cpp into its `LLAMA_VOCAB_TYPE_UGM` Viterbi
147
+ path; and (2) selectively promote BYTE tokens to NORMAL type only for byte characters that
148
+ have no existing NORMAL token β€” so control characters like `\n` tokenize correctly without
149
+ triggering the duplicate-text assertion crash (`GGML_ASSERT(id_to_token.size() == token_to_id.size())`).
150
+
151
+ **Validation on stock llama.cpp b9716 (2026-06-19):** `/tokenize` on the template string:
152
+ 25/25 tokens match HF output exactly, including `\n\n` = `[25, 25]`. Broad parity test over
153
+ 30 diverse strings: all match. COMET β‰ˆ HF parity in both directions on the 40-sentence eval.
154
+
155
+ **Verify your build:** run `/tokenize` on a Japanese string and compare against HF tokenizer
156
+ output. If your llama.cpp or PocketPal build uses an unpatched conversion (model string
157
+ `"llama"` instead of `"t5"`), tokenization will be silently wrong and translation quality
158
+ will degrade. PocketPal validation on a real device remains a required gate before any app
159
+ deployment β€” b9716 desktop testing is a strong proxy, not a guarantee.
160
+
161
+ ---
162
+
163
+ ## Usage
164
+
165
+ ### llama-cli
166
+
167
+ ```bash
168
+ llama-cli \
169
+ -m cat-translate-0.8b-travel-Q4_K_M.gguf \
170
+ --no-warmup \
171
+ -p "Translate the following English text into Japanese.\n\nI'd like a table for two."
172
+ ```
173
+
174
+ ### llama-server (OpenAI-compatible)
175
+
176
+ ```bash
177
+ # Start server
178
+ llama-server -m cat-translate-0.8b-travel-Q4_K_M.gguf --port 8080
179
+
180
+ # Query
181
+ curl http://localhost:8080/completion \
182
+ -H "Content-Type: application/json" \
183
+ -d '{"prompt": "Translate the following English text into Japanese.\n\nI have a peanut allergy.", "n_predict": 128}'
184
+ ```
185
+
186
+ Use **plain-text prompts only** β€” no chat template, no system message. Template:
187
+ `"Translate the following {src_lang} text into {tgt_lang}.\n\n{source}"`
188
+
189
+ For JAβ†’EN: `"Translate the following Japanese text into English.\n\nζ•‘ζ€₯θ»Šγ‚’ε‘Όγ‚“γ§γγ γ•γ„γ€‚"`
190
+
191
+ ### PocketPal (iOS / Android)
192
+
193
+ Open PocketPal β†’ Models β†’ Add Model β†’ enter the Hugging Face repo ID
194
+ `kaiish/capynode` β†’ select `cat-translate-0.8b-travel-Q4_K_M.gguf`.
195
+ Enable airplane mode after download to confirm fully offline operation.
196
+
197
+ ---
198
+
199
+ ## Training Data Provenance
200
+
201
+ | Source | Pairs | License |
202
+ |--------|-------|---------|
203
+ | Gemini distillation (gemini-3.1-pro-preview / gemini-2.5-flash) | ~2,550 | Synthetic, Google AI Studio free tier |
204
+ | Tatoeba | ~1,230 | CC BY 2.0 |
205
+ | BSD | dropped | CC BY-NC-SA 4.0 β€” excluded (non-commercial clause) |
206
+
207
+ Final training corpus: **6,458 train / 718 validation** examples (bidirectional, sarashina2.2
208
+ instruct template). Domain distribution: food 42.5%, shopping 17.5%, transportation 15%,
209
+ accommodation 15%, emergency 5%, general 5%.
210
+
211
+ ---
212
+
213
+ ## License & Attribution
214
+
215
+ **License: MIT.** See [`LICENSE`](LICENSE) for this repository's terms.
216
+
217
+ This GGUF is built on two upstream MIT-licensed components. Their copyright and permission
218
+ notices are preserved verbatim in the bundled license files below β€” these are the authoritative
219
+ texts that must be carried forward in any distribution or deployment (e.g., in an app's About
220
+ or credits screen):
221
+
222
+ - [`LICENSE.sarashina2.2-0.5b`](LICENSE.sarashina2.2-0.5b) β€” Copyright (c) 2025 SB Intuitions
223
+ - [`LICENSE.CAT-Translate-0.8b`](LICENSE.CAT-Translate-0.8b) β€” Copyright (c) 2026 CyberAgent AI Lab
224
+
225
+ ### Model Lineage
226
+
227
+ ```
228
+ sbintuitions/sarashina2.2-0.5b (MIT β€” SB Intuitions, 2025)
229
+ β”‚
230
+ └── cyberagent/CAT-Translate-0.8b (MIT β€” CyberAgent AI Lab, 2026)
231
+ β”‚
232
+ └── LoRA fine-tune (travel domain adaptation)
233
+ β”‚
234
+ └── imatrix Q4_K_M GGUF (this repo β€” MIT, Kaito Ishiguro, 2026)
235
+ ```
236
+
237
+ **Cleared for:** quantizing, re-hosting on HuggingFace, and shipping in a closed-source paid,
238
+ subscription, or ad-supported app, provided both bundled license files above are preserved.
cat-translate-0.8b-travel-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adac6967c9614aad9adcd27edf9a69a1394fed504cb8485ade3f0548c3ecd055
3
+ size 528204288
cat-translate-0.8b-travel-Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:655e5c2d7c3772b05fac95efd4257c4a13dac917204e95c071b8c7bc523fc0f6
3
+ size 596812288
cat-translate-0.8b-travel-Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ab171ee0b16e07edc78216d6cedf155351f1fc6d478be121d9967f26862a74d
3
+ size 845362688