genmai
A Japanese kana-kanji conversion model: it converts a reading (katakana) into Japanese text, optionally conditioned on the text before the cursor. It is the AI converter of the macOS input method genmai, which runs it on device with MLX.
- Architecture: GPT-2, character-level vocabulary, 24 layers, 1024 hidden, 310M parameters
- Base model: Miwa-Keita/zenz-v2.5-medium (CC BY-SA 4.0)
- Weights: fp32 safetensors (1.2 GB). The input method converts them to bf16 (0.6 GB) with
Tools/prepare_genmai_model.sh.
Versions
Model files are at the repository root; releases are git tags. Use a tag to pin a version.
| tag | model | parameters | weights |
|---|---|---|---|
v0.2.0 |
genmai 0.2.0 (medium) โ current main |
310M | fp32 safetensors (1.2 GB) |
v0.1.0 |
genmai 0.1.0 (medium) | 310M | fp32 safetensors (1.2 GB) |
Files: model.safetensors, config.json (the prompt format is recorded as "genmai_prompt_format": "zenzlc"),
tokenizer.json and tokenizer_config.json.
from transformers import AutoModelForCausalLM, AutoTokenizer
m = AutoModelForCausalLM.from_pretrained("subdiox/genmai", revision="v0.2.0")
tok = AutoTokenizer.from_pretrained("subdiox/genmai", revision="v0.2.0")
Prompt format (zenzlc)
Left context first (up to the last 500 characters), then the reading, then the output:
<s>[U+EE02]{left context}[U+EE00]{reading in katakana}[U+EE01]{output}</s>
[U+EE0x] are the private-use marker characters U+EE02 (context), U+EE00 (input) and U+EE01 (output).
Without context the [U+EE02]{left context} part is omitted. Spaces are written as U+3000 and newlines are
removed. config.json records the format name (genmai_prompt_format). Decode with beam search (genmai uses 5 beams) and stop at EOS;
long readings are split at ใใ into chunks of at most 40 characters, each decoded after the previous output.
Training
Fine-tuned from zenz-v2.5-medium in several stages on (reading, text) pairs:
- ~3M automatically read sentences from Japanese Wikipedia, FineWeb-2 (Japanese), Aozora Bunko and Diet minutes (readings by UniDic with corrections learned from reviewed samples);
- long left context (up to 500 characters);
- reading/surface pairs of the Mozc dictionary (dictionary_oss) and sentences containing rare dictionary words;
- a final stage on curated data: hand-checked items, synthetic sentences and homophone sets generated with Claude, and LLM-judged corrections, with replay of the earlier data.
0.2.0 adds, at the same size: 3.2M more automatically read pairs (unused parts of Wikipedia and FineWeb-2), two rounds of training on ~1M pairs each with an auxiliary next-character language-model loss on the real text before the cursor (so the model learns how words are used in running text, not only the conversions), and a uniform average of the weights of 0.1.0 and the two new models.
Evaluation
Top-1 accuracy, beam size 5, bf16; candidates whose reading does not match the input are dropped. AJIMEE, everyday sentences and ime_v1 dev are judged leniently (orthographic variants accepted); homophones = word-level accuracy on held-out homophone sentences; hard = 28 sentences written to stress an IME (exact match up to orthography).
| set | genmai 0.2.0 | genmai 0.1.0 | Zenzai (zenz-v3.2-small, azooKey settings) |
|---|---|---|---|
| AJIMEE-Bench (200) | 95.5 % | 93.5 % | 85.5 % |
| everyday sentences (101) | 98.0 % | 97.0 % | 97.0 % |
| ime_v1 dev (544) | 93.6 % | 93.0 % | โ |
| homophone sentences (1,607) | 92.2 % | 91.4 % | โ |
| hard IME sentences (28) | 21 / 28 | 23 / 28 | โ |
0.2.0 newly gets e.g. ๆฏใฏๆญฏใ็ใใใใ, ๅผ่ญ, ่คๅๅง; it loses ใฆใฑใ (โ ๅใใ) and ๅ็ท (โ ้ๆฆ, no context). Through the input method, 0.1.0 (session layer, strict exact match): AJIMEE-Bench 90.5 %, everyday sentences 92.1 %.
Limitations
- Readings that repeat one sound (ใใใใฎใใใใใใใใงใใใใใ) tend to map every occurrence to the same word or drop part of the reading.
- Rare proper nouns and fine homophone distinctions (็นๅพด/็น้ท, ่ฟฝๅ/่ฟฝๆฑ) are still error-prone.
- The model copies the left context strongly: a wrong conversion earlier in the context can be repeated.
License and attribution
CC BY-SA 4.0. The training data include Wikipedia (CC BY-SA), FineWeb-2 (ODC-By), Aozora Bunko, the National Diet minutes, and the Mozc dictionary (BSD-3-Clause, Copyright Google Inc.; contains data derived from IPAdic, Copyright Nara Institute of Science and Technology).
- Downloads last month
- 23
Model tree for subdiox/genmai
Base model
ku-nlp/gpt2-medium-japanese-char