Your Pinyin Replaces the LLM’s Random Number Generator
An experiment that turns a 0.6B model into a Chinese IME by letting the user’s pinyin handle the token sampling.

What it does
LIME is a Chinese pinyin input method backed by a small language model—specifically Qwen3-0.6B running at 4-bit quantization. It runs as a local server that accepts keystrokes from a RIME frontend (or a web demo), asks the model to predict likely next tokens, and uses the user’s actual pinyin to narrow down the candidates. The result is an IME that generates text through autoregression, but with the user’s keystrokes acting as the sampling filter instead of randomness.
The interesting bit
The clever part is the inversion of control: instead of the model stochastically picking its own next token, the user’s pinyin constrains the probability space. The author notes this creates odd token-granularity artifacts—for example, “他的” as a single token may rank lower than the product of “他” and “的,” so the engine currently prefers longer words even when confidence scores disagree. It’s a rare case where an LLM’s tokenizer quirks directly shape UX decisions.
Key highlights
- Uses a 0.6B-parameter model (Qwen3) quantized to IQ4_XS; the author claims typing speed feels comparable to conventional engines.
- Supports fuzzy pinyin, multiple double-pinyin schemes (自然码, 搜狗, 小鹤, etc.), and apostrophe splitting.
- Can swap in Ollama-hosted models if you prefer not to use the bundled GGUF.
- Includes a web-based demo interface and built-in typing statistics (KPM, candidate lookup time).
- Ships with a test harness that simulates long-sentence input to benchmark character-per-minute efficiency.
Caveats
- The README carries a loud warning: traffic between frontend and server is currently plaintext, so keystrokes (and thus passwords) are exposed; the author explicitly says not to use this for daily typing or expose it to a network.
- Long-sentence intelligence is still weak, fast typing can drop letters, and restarting the server wipes all learned context because there is no persistence layer.
- It cannot integrate with other RIME schemas; it must stand alone as a separate
llmschema.
Verdict
Worth a look if you’re curious about unconventional LLM applications or building open-source IMEs. Avoid if you need a secure, production-ready typing experience—this is explicitly labeled experimental.
Frequently asked
- What is xushengfeng/lime?
- An experiment that turns a 0.6B model into a Chinese IME by letting the user’s pinyin handle the token sampling.
- Is lime open source?
- Yes — xushengfeng/lime is open source, released under the GPL-3.0 license.
- What language is lime written in?
- xushengfeng/lime is primarily written in TypeScript.
- How popular is lime?
- xushengfeng/lime has 783 stars on GitHub.
- Where can I find lime?
- xushengfeng/lime is on GitHub at https://github.com/xushengfeng/lime.