Skip to content

By PromptFission2 min read

rime-qwen-freq uses a 14B model once, offline, so a Chinese keyboard never has to run it

A tool that turns a language model's judgment into static word-frequency tables for the Rime input method. The author reports Top-1 accuracy rising from 38 to 92 percent on their own test.


Typing Chinese with a pinyin keyboard is a ranking problem: many words share the same spelling, and the input method has to guess which one you meant. rime-qwen-freq, by GitHub user mizorewww, improves the guesses of the Rime input method with a large language model, and then leaves the model out of the keyboard entirely.

How it works

Rime ranks candidates using two static things: dictionaries in which each word carries a frequency, and a .gram file that scores which words tend to follow which. The project regenerates both from an open-weight model, Qwen/Qwen3-14B-Base in the documented commands, as a one-time offline job. The README’s selling point is “Zero runtime inference latency”, because what ships is a table, not a network.

The README names three steps. First, the model calibrates a frequency for every dictionary entry. Second, entries are scored under two prompts, one for a domain (the example is computer science and AI terms) and one for everyday and encyclopedic words, and terms the model favors under the domain prompt get a boost the author calls Bayesian domain log-odds boosting. Third, word-pair statistics are distilled from the model into a .gram file using pointwise mutual information, and a small C++ tool packs it.

The README is brief and gives no formulas or hyperparameters, so that is as far as we can describe the math. The commit history shows the first version, pushed November 24, used a 0.8B Qwen model.

The numbers

These are the author’s, from a test of 142 inputs that ships in the repo, run through native librime with no user history.

Setup Top-1 CS clauses (40) .gram size
Uncalibrated dictionaries, stock .gram 38.03% 22.5% 400.8 MiB
Calibrated dictionaries with CS boost 88.73% 82.5% 400.8 MiB
Plus .gram distilled from the model only 90.85% 85.0% 11.4 MiB
Plus hybrid of cleaned stock and distilled .gram 92.25% 95.0% 385.5 MiB

Most of the gain comes from the dictionaries, not the n-gram file. The row we find most interesting is the third: a distilled .gram about one thirty-fifth the size of the stock one scores slightly higher than it.

Some caution is due. The test set is small, written by the same person who built the tool, and more than half of it is computer science clauses and terms, which is exactly what the boost targets. The baseline is labeled as uncalibrated dictionaries, so part of the jump is the cost of adding dictionaries with no sensible frequencies at all. The README does not say what hardware the 14B scoring pass needs or how long it takes.

Try it yourself

The repo is MIT-licensed Python plus one C++ file. If you only want the result, the README points to a releases page with prebuilt dictionaries and a 9.4 MiB compressed .gram holding 1,031,842 keys. To regenerate them you need the model and a machine that can run it; the tool can also split the work so scoring happens on a remote GPU.

We have not installed the dictionaries or run the pipeline. This is based on the README and the commit log.