AI candidate selection: rerank with a Traditional Chinese language model (macOS)

The converter's K best paths are rescored with CKIP gpt2-tiny-chinese (GPL-3.0,
character-level, ~12M parameters, 22 MB as float16):
score = lexicon log-prob + 0.6 x LM log-prob, with the recently committed text
as context. Inference is plain Accelerate (Apple Silicon and Intel).

Modes off / saver (K=3, 15 ms) / standard (K=10, 40 ms) / quality (K=30, 120 ms)
in the input menu. A rerank over its time budget falls back to the lexicon; three
in a row pause AI for a minute. With auto-pause on, AI pauses when the Mac is hot
or the CPU is busy and drops to saver in Low Power Mode. The model loads in the
background and is not loaded at all when off.

Evaluation (training/lm/eval_rerank.py): chat 96.6% -> 97.5% chars,
Wikipedia 92.9% -> 94.7% chars (about 25-30% fewer wrong characters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 16:33:58 +08:00
co-authored by Claude Opus 5.5
parent acafd8f96e
commit fd87da8061
16 changed files with 1653 additions and 2 deletions
+14
View File
@@ -48,3 +48,17 @@ https://github.com/EasyIME/PIME — GNU LGPL 2.1
The Windows version runs as a module inside PIME, which users install
separately. No PIME code is included in this software.
4. CKIP GPT2 Tiny Chinese — AI 選字語言模型 (language model, macOS)
-------------------------------------------------------------------
https://huggingface.co/ckiplab/gpt2-tiny-chinese
https://github.com/ckiplab/ckip-transformers
Author: Mu Yang at CKIP, Academia Sinica (中央研究院 詞庫小組)
License: GNU General Public License v3.0 (full text: GPL-3.0.txt)
lm.bin is the model's weights converted to float16 by training/lm/export_lm.py;
lm-vocab.txt is its vocabulary (from bert-base-chinese). They are used unmodified
otherwise, to rerank conversion candidates ("AI 選字"). The source code of this input
method, including the conversion script and the code that runs the model, is
available from the project repository.