--- language: - ja license: gpl-3.0 pipeline_tag: text-generation tags: - pytorch - coreml - japanese - kana-kanji-conversion - input-method - causal-lm - contextual-reranking - tiny-gpt --- # VimeML Japanese v6 VimeML Japanese v6 is a family of Japanese decoder-only models for kana input methods. One model does two jobs: - **kana-to-text generation**: a hiragana reading goes in and whole conversions come out, conditioned on the text before the cursor; - **reranking** of an input method's conversion candidates (AzooKey in the Vime client), together with its own generated candidates. v6 follows [vimeml-tiny-ja-v4.2](https://huggingface.co/Voltline/vimeml-tiny-ja-v4.2), which only reranks AzooKey's candidates. This repository holds every v6 model in its own directory. | Directory | Model | Target | Parameters | Status | | --- | --- | --- | ---: | --- | | `20m/` | `vimeml-ja-v6-20m` | iPhone (Core ML INT8) | 20,036,736 | Released 2026-11-28 | | `200m/` | `vimeml-ja-v6-200m` | Desktop (PyTorch, GPU) | 193,625,088 | Released 2026-11-28 | Both share one 12,288-piece tokenizer, the same prompt format, search and scoring. This is a custom PyTorch model, not a Transformers `AutoModel` integration or an instruction or chat model. Tokenization, the reading index, beam search and merging run outside the network. The code is in `source/`; there is no `trust_remote_code`. ## Files | Path | Contents | | --- | --- | | `20m/inference/` | FP32 state_dict (`weights.pt`), `config.json`, `tokenizer.model` and the provenance `manifest.json`; no optimizer state | | `20m/coreml/ios18-int8-block32-kvbatch-v4/` | Batched KV-cache Core ML multifunction `.mlpackage` (functions `logits`, `scored`, `score` and `prefix` over one weight copy) and its manifest. This is the package the Vime client loads, for beam search and candidate scoring. | | `20m/coreml/ios18-int8-block32/` | Stateless Core ML `.mlpackage` (full-window logits) and manifest; the INT8 source of the KV package and the alignment reference | | `20m/evaluation/summary.json` | Aggregate test, alignment and latency results; no benchmark text | | `200m/inference/` | FP32 checkpoint for inference (`model.pt`: weights and model configuration; no optimizer state), `tokenizer.model` (the same file as in `20m/`) and the provenance `manifest.json` | | `200m/evaluation/summary.json` | Aggregate test and desktop latency results; no benchmark text | | `readings/kana-index.json` | Hiragana reading → vocabulary piece index for the constrained search, shared by all v6 models (SHA256 `b60c485d…de5b`); the one used for every result below | | `source/` | Frozen VimeML Python source, scripts, configurations and requirements at the commit in `RELEASE.json` | | `infer.py` | FP32 generation, merging with given candidates, and reranking with the bundled source | | `verify_release.py` | Checks the inventory (`--hashes` also hashes every file) | | `RELEASE.json`, `SHA256SUMS.txt` | Inventory with byte counts and SHA256 | | `LICENSE`, `LICENSE-EXCEPTION`, `NOTICE.md` | GPL-3.0-or-later, the App Store exception, and data attribution | ## How it works The prompt is `[BOS, CTX] + context + [READ] + reading + [OUT]`. The context is the text left of the cursor, at most 64 characters; the reading is hiragana (katakana is folded to hiragana). 1. **Constrained beam search, 16 per reading position.** A hypothesis may only add a vocabulary piece whose reading, from `readings/kana-index.json`, matches the next kana. Hypotheses compete only with others that have consumed the same number of kana. A hypothesis finishes when it has consumed the whole reading, and `log P(EOS)` is added to its score. The ten best distinct texts are kept. 2. **Merging.** The input method's top 20 candidates (AzooKey N-best 20 in Vime) and the ten generated texts form one list, without duplicates. 3. **Scoring.** The same model scores every text on that list twice: `gen_score`, the log probability of the text and EOS after the prompt above, and `lm_score`, the log probability of the text after the context in language-model mode. Candidates are shown in order of `gen_score + 1.6 × lm_score`. In the Vime client, each keystroke shows AzooKey's top 20 reordered by step 3, which is fast. After a short pause, the full search runs in the background and its candidates are merged in; a new keystroke cancels it. ## vimeml-ja-v6-20m ### Model | Item | Value | | --- | --- | | Architecture | Decoder-only transformer, d_model 384, 9 layers, 6 heads, SwiGLU 960, RMSNorm, learned positions, tied embeddings, context 128 tokens | | Tokenizer | SentencePiece unigram `ja-unigram-12288`, 12,288 pieces, SHA256 `61d71460…aa53`; pad 0, unk 1, bos 2, eos 3; task ids CTX 4, READ 5, OUT 6 | | Checkpoint | `colloq-c40` step 30,000, SHA256 `19b04ddfe0f98041ffe50511cab9d64d2f2a20b2918f5e78cc78c0768981d15f` (the training checkpoint is not included; `20m/inference` is its FP32 weights) | | Bundle manifest | SHA256 `29d140ce1ff7ef7e901c9e8b3bd4d7b9b4374bee5bef9edfd56353fb4bc82786`; both Core ML manifests point to it | ### Training Each stage starts from the final checkpoint of the one before. 1. **Pretraining** from random weights, 1,081,942 updates, on V4.2's text and budget: Japanese web sentences (FineWeb2-Edu Japanese, Tatoeba) and dialogue (RealPersonaChat, Multi-Relational Multi-Party Chat Corpus). 2. **Reading post-training** (60,000 updates): the model learns to write text from its kana reading. Training pairs come from the same text, with readings from two dictionaries (UniDic and Sudachi), kept only where the two agree or differ in a known way, alongside plain language-model windows. 3. **Distillation** (`kd-cont`, 30,000 updates): token-level distillation from `vimeml-ja-v6-200m`, which shares the tokenizer. It restores language-model ability that reading training had weakened, so the model can score candidates well. 4. **Colloquial post-training** (`colloq-c40`, 30,000 updates, same teacher): 208 of each 512 training samples come from colloquial paragraphs of FineWeb2 `jpn_Jpan`, chosen by a classifier, as plain text and as reading pairs. Each step was chosen on development sets, then checked once on held-out test splits under a plan committed before the test was opened. ### Test results Opened once under a preregistered plan (2026-11-28). The headline metric is lenient Top-1 of the shown first candidate: a candidate that writes the answer's words with a different kana or kanji spelling also counts. Exact Top-1 needs the answer string. **`ime-kana-ja-v1` test** (600 items from WRIME and JMultiWOZ, 59 author and dialogue clusters) | Setup | Lenient Top-1 | Exact Top-1 | Lenient Top-3 | | --- | ---: | ---: | ---: | | AzooKey order | 74.83 | 59.33 | 86.67 | | V4.2 reranking (the previous deployment) | 85.00 | 67.00 | 90.50 | | **v6-20m** | **88.00** | **71.67** | **92.50** | This was the primary hypothesis: +18 items over V4.2 reranking (+30 / −12), cluster sign-flip p 0.0024. In exact Top-1 the gain is +28 items (p 0.0054). Generation alone, without AzooKey's candidates, reaches 69.33 lenient; the merged list is what ships. **`ime-kana-ja-colloq-v1` test** (600 colloquial spans from a held-out FineWeb2 split) | Setup | Lenient Top-1 | Exact Top-1 | | --- | ---: | ---: | | AzooKey order | 72.50 | 54.33 | | V4.2 reranking | 84.83 | 63.50 | | **v6-20m** | **89.50** | **74.00** | Against V4.2 reranking: +28 lenient, +63 exact items, p < 0.001. **Reranking only.** On the Standard development set (728 items), reranking AzooKey's candidates by `lm_score` alone gives 518 exact Top-1, against a floor of 501 from V4.2's seed range. The kana benchmark's readings come from dictionaries and were checked automatically; the colloquial readings were confirmed by an LLM. Neither was reviewed by hand. ### Deployment The Core ML packages target iOS 18, compute on the CPU in FP32, and store weights as INT8 with symmetric per-block-32 quantization. The KV package keeps its cache in FP32. | Check (Mac, coremltools 9.0) | Result | | --- | --- | | Stateless FP32 against PyTorch | max 3.43e-5 (gate 3e-4), 5/5 | | KV v4 INT8 against stateless INT8 | logits 3.05e-5, scored 2.00e-5, score sums 2.17e-5, prefix 2.29e-5 | | INT8 search against the FP32 fixture (125 cases) | shown top 1 equal in 124/125 for scoring and for the full flow (gate 123); the one difference is a near tie between two correct spellings | | Vime (Swift) against the fixture | all prompt and candidate token ids equal; shown top 1 124/125, the same case as on Mac | | `int8-merged` package | 23,271,109 bytes | Final scores of the merged list differ from FP32 by up to 2.04. Scores of generated candidates differ by at most 0.54, as in the Chinese v2; the merged list adds AzooKey's candidates, and `1.6 × lm_score` widens the gap. The release is judged on the shown top 1. **Latency** (same Release build, 8 sentences, 95 keystrokes): | Device | Reranked AzooKey top 20, per key: p50 / p95 / max | Within 60 ms | Full flow after a pause: p50 / p95 | | --- | --- | ---: | --- | | iPhone 13 Pro | 24.8 / 35.9 / 55.4 ms | 95 / 95 | 121 / 134 ms | | iPhone 16 Pro Max | 14.7 / 21.7 / 35.8 ms | 95 / 95 | 76 / 81 ms | Peak memory increase over the host process: 42.5 MB (13 Pro), 64.8 MB (16 Pro Max). ### Use ```bash pip install -r source/requirements.txt python verify_release.py --hashes python infer.py --kana きょうはいいてんきですね python infer.py --kana あした --context また --candidate 明日 --candidate あした python infer.py --context 今日は --candidate いい天気 --candidate 良い転機 ``` With `--candidate` and `--kana`, the given candidates are merged with the generated ones as in the client; with `--candidate` alone they are ranked by `lm_score`. In the Vime client, v6-20m replaces V4.2; there is no fallback model. ### Limitations - Context is limited to 64 characters of the same field, and the model has no memory of the user's own words. - The search can only produce pieces listed in the reading index; words whose readings the dictionaries miss come only from the input method's candidates. - The model ranks text. It has no safety tuning, and it can produce whatever its training text contains. Products that show its output to users should filter it. ## vimeml-ja-v6-200m The desktop model, and the teacher `vimeml-ja-v6-20m` was distilled from. It uses the same tokenizer, prompt, search and scoring as the 20M. ### Model | Item | Value | | --- | --- | | Architecture | Decoder-only transformer, d_model 1024, 15 layers, 16 heads, SwiGLU 2560, RMSNorm, learned positions, tied embeddings, context 128 tokens | | Tokenizer | `ja-unigram-12288`, the same file as the 20M (SHA256 `61d71460…aa53`) | | Checkpoint | `200m-joint` step 845,000, SHA256 `47721ddd357cb3a720d7108e4aeaa60f671d83167504fd9f649365b37d70a843`; `200m/inference/model.pt` holds its FP32 weights, with logits equal to the checkpoint's | ### Training One stage from random weights: 845,000 updates of 832 samples, mixing language-model text (the V4.2 sources and FineWeb2 `jpn_Jpan` web text) with kana reading pairs built as for the 20M. There is no separate reading post-training or distillation. ### Test results Opened under a second preregistered plan (2026-11-28), run once on the same test splits after the 20M. | Set | Setup | Lenient Top-1 | Exact Top-1 | | --- | --- | ---: | ---: | | `ime-kana-ja-v1` test | V4.2 reranking | 85.00 | 67.00 | | | v6-20m | 88.00 | 71.67 | | | **v6-200m** | **89.33** | **73.00** | | `ime-kana-ja-colloq-v1` test | V4.2 reranking | 84.83 | 63.50 | | | v6-20m | 89.50 | 74.00 | | | **v6-200m** | **90.00** | **75.33** | Against V4.2 reranking on the kana test: +26 items lenient (+39 / −13), cluster sign-flip p 0.00095; +36 exact (p 0.0026). Against v6-20m: +8 kana (p 0.15) and +3 colloquial (p 0.69), not a significant difference; the 200M's gain over the 20M is in sentences of 21–40 characters. Standard development reranking by `lm_score`: 517 exact Top-1 (floor 501). ### Desktop latency Windows laptop with an RTX 5060 Laptop GPU, PyTorch 2.10, all 600 items of `ime-kana-ja-v1` development (the CPU row: every 6th item). Times are per input, end to end, in ms (p50 / p95). | Backend | Reranked AzooKey top 20 | Full flow: search, merge and scoring | | --- | --- | --- | | **CUDA graphs, FP16** | **19 / 31** (600 / 600 within 60 ms) | **115 / 280** | | CUDA graphs, FP32 | 42 / 96 | 254 / 589 | | Eager, FP32 | 45 / 100 | 298 / 643 | | CPU, 8 threads, FP32 | 453 / 1,262 | 2,048 / 4,243 | With CUDA graphs in FP16 the full flow takes 70 / 98 ms for answers of 4–10 characters, 110 / 174 for 11–20 and 199 / 330 for 21–40. FP16 and FP32 show the same first candidate on all 600 items, in both lists. CUDA graph decoding is `vimeml.deployment.zh_torch_graph.GraphBackend` in `source/`; capture takes about 2 s once at load. The model is meant for a GPU; on a CPU the 20M is the practical choice. ### Use ```bash python infer.py --model 200m --device cuda --kana きょうはいいてんきですね ``` `infer.py` runs the reference FP32 path; the timings above use the graph backend. Limitations are those of the 20M. ## License GPL-3.0-or-later, with an additional permission for app-store distribution (`LICENSE-EXCEPTION`). Applications that bundle a model must show the license and the data attribution in `NOTICE.md`.