VimeML Chinese v2
VimeML Chinese v2 is a family of Simplified Chinese decoder-only models for pinyin input methods. One model does three jobs:
- pinyin-to-sentence generation: keys go in (full pinyin, initials or a mix) and whole sentences come out, conditioned on the text before the cursor;
- reranking of an input method's candidates (librime with rime-ice in the Vime client);
- phrase prediction after the cursor.
v2 follows vimeml-tiny-zh-v1, which only reranks and predicts. This repository holds every v2 model in its own directory.
| Directory | Model | Target | Parameters | Status |
|---|---|---|---|---|
20m/ |
vimeml-zh-v2-20m |
iPhone (Core ML INT8) | 20,036,736 | Released 2026-11-23 |
200m/ |
vimeml-zh-v2-200m |
Desktop (PyTorch) | 193,625,088 | Released 2026-11-23 |
800m/ |
vimeml-zh-v2-800m |
Desktop | about 800M | Added after training and confirmation |
All three share the 12,288-piece tokenizer of v1 and the same prompt format and decoding. This is a custom PyTorch model, not a Transformers AutoModel integration or an instruction or chat model. Tokenization, the reading dictionary, beam search and rescoring run outside the network. The code for all of them 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 sentence 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 |
200m/inference/ |
FP32 model.pt (weights plus the header the loader reads; no optimizer state), tokenizer.model and the provenance manifest.json |
200m/evaluation/summary.json |
Aggregate test and latency results of the 200M |
readings/vime_pinyin.dict.yaml |
Pinyin reading dictionary (Rime format) for generation, shared by all v2 models; the one used for every result below |
20m/evaluation/summary.json |
Aggregate test, alignment and latency results; no benchmark text |
source/ |
Frozen VimeML Python source, scripts, configurations and requirements at the commit in RELEASE.json |
infer.py |
FP32 generation, reranking and prediction with the bundled source, for either model (--model 20m or 200m) |
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 |
vimeml-zh-v2-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, 12,288 pieces, SHA256 68bd37c4…7e5a; pad 0, unk 1, bos 2, eos 3; task ids CTX 4, READ 5, OUT 6 |
| Checkpoint | colloq-c40 step 30,000, SHA256 0ec5ffb110fc3959534858fe1a931f4c177878daa8db33bea861c843ca1c1027 (the training checkpoint is not included; 20m/inference is its FP32 weights) |
| Bundle manifest | SHA256 bce7eeffe684a38f4c6ad247efc9186eaf858965a6b1b5e28d305a6459677d64; both Core ML manifests point to it |
Training
Each stage starts from the final checkpoint of the one before.
- vimeml-tiny-zh-v1: language-model pretraining on FineWeb2
cmn_Haniand LCCC, 844,730 updates. - Pinyin tasks (
s1-task, thenr2-cont, 60,000 updates): the same model learns to write a sentence from its keys. Training pairs come from web text with machine-generated readings, typed as full pinyin, mixed abbreviation, all initials, or with keyboard errors, alongside plain language-model windows. - Distillation (
kd-cont, 30,000 updates): token-level distillation from a 200M model with the same tokenizer, trained jointly on language modeling and pinyin. This restores the language-model ability that pinyin training had weakened, so the model can rescore its own candidates. - Colloquial post-training (
colloq-c40, 30,000 updates, same teacher): 208 of each 512 training windows come from colloquial text. These are chat-like and spoken-style paragraphs from FineWeb2, and dialogue turns from Douban, MMChat and Tieba. All of them passed rule cleaning and an LLM quality screen. Overlap between the colloquial benchmark and the training text was removed.
Each step was chosen on development sets, then checked once on held-out test splits under a plan committed before the test was opened.
How generation works
The prompt is [BOS, CTX] + context + [READ] + keys + [OUT]. The context is the text left of the cursor, at most 64 characters. The keys are the raw key string, encoded by SentencePiece as one piece of text.
- Beam search, 16 per key position. A hypothesis may only add a character whose reading, or its initial (
zh,chandshcount as initials), matches the next keys. Hypotheses compete only with others that have consumed the same number of keys. A hypothesis finishes when it has consumed every key, andlog P(EOS)is added to its score. - Top 10. The ten best distinct texts are kept, with their generation score
gen_score. - Self-rescoring. The same model, in language-model mode, scores each text after the context (
lm_score). Candidates are shown in order ofgen_score + 1.6 × lm_score, with ties kept in generation order.
Readings come from readings/vime_pinyin.dict.yaml, the Vime client's dictionary (SHA256 3a1654cd…0c8a), which every result below used. Any other Rime-format .dict.yaml with per-character readings can be passed with --readings; it changes which characters are reachable, so results can differ.
Test results
Every number below comes from a test split that was opened once, under a preregistered plan. The headline metric is Top-1 exact match of the shown first candidate after self-rescoring.
ime-pinyin-zh-v1-r1 test (576 sentences from CrossWOZ, RiSAWOZ, KdConv and CPED; 3,436 inputs)
| Input kind | Inputs | Shipped v1 path (Rime 16 + v1 rerank) | kd-cont |
v2-20m | v2-20m Top-10 coverage |
|---|---|---|---|---|---|
| All | 3,436 | 31.0 | 49.1 | 51.4 | 67.9 |
| Full pinyin | 576 | 81.6 | 82.6 | 84.4 | 96.0 |
| Mixed abbreviation | 2,284 | 23.7 | 47.4 | 49.8 | 68.0 |
| All initials | 576 | 9.2 | 22.2 | 24.7 | 39.2 |
The v1 path and kd-cont were measured in the first opening (2026-11-20; v2-20m over the v1 path +18.1 points, p 5e-5). v2-20m was measured in the second opening (2026-11-23), where this split served as a guard: +2.3 points over kd-cont, p 0.0002.
ime-pinyin-zh-colloq-v1-r1 test (775 colloquial sentences from chat and spoken-style text; 4,560 inputs)
| Input kind | Inputs | kd-cont |
v2-20m | v2-20m Top-10 coverage |
|---|---|---|---|---|
| All | 4,560 | 39.0 | 42.3 | 60.9 |
| Full pinyin | 775 | 74.6 | 76.1 | 91.2 |
| Mixed abbreviation | 3,010 | 35.7 | 39.5 | 59.5 |
| All initials | 775 | 16.3 | 19.1 | 36.4 |
This was the primary hypothesis of the colloquial confirmation: +3.2 points, +217/−69, sentence-clustered sign-flip p 5e-5.
ime-standard-zh-v1-r1 blind, full-pinyin rerank of Rime candidates (1,445 items): v2-20m Top-1 94.3%, against v1's 93.8%. That is net +7 items (+21/−14), exact McNemar p 0.31, so the two are not significantly different.
The two pinyin sets keep a sentence only when three automatic readers (pypinyin, pypinyin over jieba words, g2pM) agree on every character; the readings were not reviewed by hand. The Standard labels are AI-reviewed.
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.89e-5 (gate 3e-4), 5/5 |
| KV v4 source against PyTorch, all functions | max 2.57e-5, 0 rows outside tolerance |
| KV v4 INT8 against stateless INT8 | step 1.62e-5, score sums 1.69e-5, same order 8/8 |
| INT8 search against the FP32 fixture (125 cases) | shown top 1 equal in 122/125; the three differences are long all-initials inputs where the INT8 beam takes another path; scores of shared texts differ by at most 0.21 |
int8-merged package |
23,271,109 bytes |
The release gate for the INT8 search was 123/125, and the package passed it at 122/125. The release went ahead anyway, as a recorded decision. The gate guards only sentence generation, which is behind a development switch in the client. Reranking and prediction use score, which aligns at 1.7e-5.
Latency. Mac, p50, batch 16, 48-token prompt: shared prefix 3.5 ms, one-token extension 1.3 ms, beam step 3.5 ms, scoring 16 candidates 17.9 ms. These match kd-cont within noise. kd-cont has the same shape and package format, and on iPhone (2026-11-21) it measured as follows:
- Rime rerank of the first candidate list: p50 4.1 ms on iPhone 13 Pro, 3.0 ms on iPhone 16 Pro Max; every key within 60 ms;
- one-shot sentence generation: p50 91 ms on the 13 Pro, 59 ms on the 16 Pro Max;
- peak memory during one-shot generation 75 MB (13 Pro) and 63 MB (16 Pro Max).
Use
pip install -r source/requirements.txt
python verify_release.py --hashes
python infer.py --keys woxiangchifan --context 今天中午
python infer.py --context 我们明天一起去 --candidate 吃饭 --candidate 迟饭
python infer.py --context 我们明天一起去
In the Vime client, Rime reranking, prediction and keyboard-typo scoring use v2-20m by default. Sentence generation is behind a development switch until key-by-key generation is fast enough on older phones: with kd-cont on iPhone 13 Pro, 57% of keystrokes finished within 60 ms. v1 remains available as a fallback.
Limitations
- Context is limited to 64 characters of the same field, and generation has no memory of the user's own words.
- All-initials input remains hard: one in four inputs on the public test.
- 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. The Vime client does this with its own keyword blocking.
vimeml-zh-v2-200m
The desktop model. It has the same three jobs, prompt format, beam search and self-rescoring as the 20M, at ten times the size, and runs in PyTorch.
Model
| Item | Value |
|---|---|
| Architecture | Decoder-only transformer, d_model 1024, 15 layers, 16 heads, SwiGLU 2560, RMSNorm, learned positions, tied embeddings, context 128 tokens; 193,625,088 parameters |
| Tokenizer | The 20M's: SentencePiece unigram, 12,288 pieces, SHA256 68bd37c4…7e5a; task ids CTX 4, READ 5, OUT 6 |
| Checkpoint | zh200m-12k-pinyin-pt step 844,730, SHA256 90e48fe4cbaeacf5c58774ded243e57d94c86923a51d191555fbbfc7954150f8; 200m/inference/model.pt holds its FP32 weights, and its logits equal the checkpoint's exactly |
Training
Trained from random weights for 844,730 updates on the vimeml-tiny-zh-v1 corpus (FineWeb2 cmn_Hani and LCCC). Pinyin-to-sentence examples (full pinyin, mixed abbreviation, all initials and keyboard errors) were mixed into pretraining from the start, so one model learns language modeling and pinyin generation together. It is the teacher that the 20M was distilled from. It has no colloquial post-training.
Test results
Opened once under a preregistered plan, on the same ime-pinyin-zh-v1-r1 test split as the 20M (576 sentences, 3,436 inputs). Self-rescored Top-1:
| Input kind | Inputs | Shipped v1 path | kd-cont |
v2-20m | v2-200m | v2-200m Top-10 coverage |
|---|---|---|---|---|---|---|
| All | 3,436 | 31.0 | 49.1 | 51.4 | 54.7 | 69.2 |
| Full pinyin | 576 | 81.6 | 82.6 | 84.4 | 86.5 | 95.8 |
| Mixed abbreviation | 2,284 | 23.7 | 47.4 | 49.8 | 53.3 | 69.0 |
| All initials | 576 | 9.2 | 22.2 | 24.7 | 28.5 | 42.9 |
- The preregistered hypothesis was against
kd-cont: +5.6 points, +343/−150, sentence-clustered sign-flip p 5e-5. - Against the released v2-20m, paired input by input: +3.3 points (+280/−165, p 0.0002). This comparison is descriptive.
ime-standard-zh-v1-r1blind, full-pinyin rerank of Rime candidates: Top-1 95.2% (1,376 / 1,445) against v1's 93.8%. That is net +21 (+32/−11), exact McNemar p 0.002.
Latency
PyTorch on a Windows laptop GPU, CUDA graphs in FP16. Search plus rescoring per input, p50/p95:
| Input kind | p50 / p95 |
|---|---|
| All | 83 / 205 ms |
| Full pinyin | 100 / 264 ms |
| Mixed abbreviation | 84 / 194 ms |
| All initials | 61 / 113 ms |
FP16 and FP32 give the same top 1 on 579 of 580 inputs. On a CPU with 8 threads the same pipeline takes 795 / 1,900 ms, so the 200M is meant for a GPU. There is no Core ML package; the desktop models are not built for phones.
Use
python infer.py --model 200m --device cuda --keys woxiangchifan --context 今天中午
python infer.py --model 200m --device cuda --context 我们明天一起去 --candidate 吃饭 --candidate 迟饭
infer.py runs in FP32. The latency above uses the FP16 CUDA-graph backend in source/src/vimeml/deployment/zh_torch_graph.py.
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.
- Downloads last month
- -