laya-pinyin-2.1 is an open-weight model from Steve, released under Apache License 2.0. Its published files total 250.4 MB.
Laya 拼音输入法(macOS)用的候选词排序模型,基于 convaiinnovations/laya(revision 7b928d82)微调。 prior 对于词来说是词频,对短语来说是词格路径得分。模型看不到用户输入的拼音。 训练样本由输入法自己的引擎(backend/,commit 9d87301)录制,每条样本都对应一次真实的模型调用:上文、按引擎 - 从基座 Laya 开始,除 embedding 以外的全部参数参与训练。 - 损失:对每次调用的候选做 listwise…
Model Card
By Steve, published under apache-2.0, revision 66b589884c9e.
Laya 拼音输入法(macOS)用的候选词排序模型,基于 convaiinnovations/laya(revision 7b928d82)微调。 prior 对于词来说是词频,对短语来说是词格路径得分。模型看不到用户输入的拼音。 训练样本由输入法自己的引擎(backend/,commit 9d87301)录制,每条样本都对应一次真实的模型调用:上文、按引擎 - 从基座 Laya 开始,除 embedding 以外的全部参数参与训练。 - 损失:对每次调用的候选做 listwise cross-entropy,得分为 logit + betakind prior,每种调用类型各学一个 beta;每个 epoch 打乱候选顺序。 - AdamW,LR 3e-5,weight decay 0.01,bf16 autocast,gradient clipping 1.0。 - 学习率:1,000 step warmup,之后保持不变,最后 20% 线性衰减到 0。 - 166,432 step,batch 100(1,664 万条,约 1.15 轮),单张 RTX 5090 约 6 小时。 bootstrap 区间。对照为未公开的上一个版本 w28。 - 依赖本引擎: 模型针对本引擎的候选列表和 prior 微调,不是通用语言模型,不能单独当输入法用。 权重为 Apache 2.0,是 convaiinnovations/laya(Apache 2.0)的衍生作品。inference/、scripts/ 和 eval/ 中的代码为 MIT,与输入法仓库相同。
Read Steve's full model card
Laya 拼音输入法(macOS)用的候选词排序模型,基于
convaiinnovations/laya(revision 7b928d82)微调。
它不生成文字。输入法的词典先把按键变成候选词,模型读取上文(最多 32 个字)和这些候选词,给每个候选一个概率。 引擎最终按下式排序:
log p_model + alpha_kind * log prior
prior 对于词来说是词频,对短语来说是词格路径得分。模型看不到用户输入的拼音。
文件
| 路径 | 内容 |
|---|---|
laya_ime.safetensors |
微调后的权重,fp16,1.251 亿参数:22 层编码器、决策头和打分层。词向量未训练,从基座加载。 |
blend.json |
按调用类型学到的先验权重:alpha 0.515(词列表)、phrase_alpha 0.384、step_alpha 0.380。 |
inference/laya_mlx.py |
输入法实际使用的 MLX 推理代码。 |
scripts/ |
数据生成和训练脚本,与实际运行的版本一致(见 training-manifest.txt)。 |
eval/ |
评测脚本、150 条盲测集、结果表(eval/results/)。 |
在输入法中使用(会一并下载基座模型):
scripts/setup.sh --model stevelikesrhino/laya-pinyin-2.1
训练数据
训练文本来自上面列出的九个中文语料:聊天、问答、微博、新闻、维基和网页文本。
训练样本由输入法自己的引擎(backend/,commit 9d87301)录制,每条样本都对应一次真实的模型调用:上文、按引擎
顺序排列的候选和它们的先验。输入方式是模拟出来的:全拼、首字母、末音节不完整,以及用混合方式输入的 2–4 词短语。
短语调用的候选由未公开的上一个版本 w28 提议。
生成样本之前,先按文档哈希抽出 1/40 作为评测集。上文和答案在训练集中也出现过的评测样本已剔除。
| 样本类型 | 条数 |
|---|---|
| 单词(全拼) | 7,902,958 |
| 首字母缩写 | 1,979,537 |
| 短语逐词步 | 1,992,534 |
| 短语调用(单词答案) | 1,439,312 |
| 短语调用(多词答案) | 815,686 |
| 补全 | 299,831 |
| 合计 | 14,429,858 |
未使用任何个人输入数据。
训练
- 从基座 Laya 开始,除 embedding 以外的全部参数参与训练。
- 损失:对每次调用的候选做 listwise cross-entropy,得分为
logit + beta_kind * prior,每种调用类型各学一个beta;每个 epoch 打乱候选顺序。 - AdamW,LR 3e-5,weight decay 0.01,bf16 autocast,gradient clipping 1.0。
- 学习率:1,000 step warmup,之后保持不变,最后 20% 线性衰减到 0。
- 166,432 step,batch 100(1,664 万条,约 1.15 轮),单张 RTX 5090 约 6 小时。
- 训练内评测分数:训练前 0.439,第 4,000 步 0.765,结束时 0.854。
评测
端到端评测:在留出样本上运行真实引擎,看正确答案落在 45 个候选的第几位。区间为按文档聚类的 95% 配对 bootstrap 区间。对照为未公开的上一个版本 w28。
| 首选正确率 | 条数 | w28 | 2.1 | 差值 |
|---|---|---|---|---|
| 多词短语 | 11,000 | 0.410 | 0.506 | +0.096 [+0.09, +0.10] |
| 首字母缩写 | 11,000 | 0.685 | 0.738 | +0.052 [+0.04, +0.06] |
| 补全 | 7,149 | 0.894 | 0.924 | +0.030 [+0.02, +0.04] |
| 全拼单词 | 11,000 | 0.925 | 0.935 | +0.010 [+0.01, +0.01] |
| 盲测集(由 Fable 5.1 编写) | 150 | 0.89 | 0.92 | 正确答案都在候选中 |
局限
- 单独输入 zh/ch/sh 打单字: 901 条中首选正确率 0.618,低于 w28 的 0.684。这类引擎调用晚于训练数据,训练中没有见过,下一步会尝试。
- 评测与训练同分布: 留出样本和训练数据来自同样的语料。唯一独立的检查是盲测集,而它很小(一条约 0.67 个百分点)。
- 依赖本引擎: 模型针对本引擎的候选列表和 prior 微调,不是通用语言模型,不能单独当输入法用。
许可
权重为 Apache 2.0,是 convaiinnovations/laya(Apache 2.0)的衍生作品。inference/、scripts/ 和 eval/ 中的代码为 MIT,与输入法仓库相同。
Identity and Version
- Repository
- stevelikesrhino/laya-pinyin-2.1
- Publisher
- Steve
- Task
- Not stated by the source
- Modality
- Other
- Library
- mlx
- Parameters
- Not stated by the source
- Languages
- zh
- Revision
- 66b589884c9e5918738bdaeb19943d27c54a556d
- First published
- 2026-10-14
- Last updated
- 2026-10-14
Files and Weights
33 files, 250.4 MB in total. The weights are 1 file totalling 250.2 MB in safetensors.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| laya_ime.safetensors | Weights | 250.2 MB | bd03d06a869b |
| blend.json | Configuration | 78 B | — |
| eval/build_digraph.py | Configuration | 2.2 KB | — |
| eval/e2e_eval.py | Configuration | 9.4 KB | — |
| eval/score_blind.py | Configuration | 4.2 KB | — |
| inference/laya_mlx.py | Configuration | 10.3 KB | — |
| scripts/gen_phrase.py | Configuration | 3.8 KB | — |
| scripts/gen_v4.py | Configuration | 14.8 KB | — |
| scripts/ime_prompt.py | Configuration | 259 B | — |
| scripts/make_top_jobs.py | Configuration | 3.0 KB | — |
| scripts/mix_v4.py | Configuration | 6.5 KB | — |
| scripts/rows.py | Configuration | 12.9 KB | — |
| scripts/torch_laya.py | Configuration | 6.6 KB | — |
| scripts/train_v4.py | Configuration | 17.0 KB | — |
| LICENSE | Documentation | 11.4 KB | — |
| README.md | Documentation | 4.6 KB | — |
| MANIFEST.txt | Other | 2.8 KB | — |
| eval/blind-4.0.jsonl | Other | 10.4 KB | — |
| eval/results/blind-4.0-ver2-vs-ver2.1.txt | Other | 1.3 KB | — |
| eval/results/blind-4.0-w28-vs-ver2.1.txt | Other | 1.3 KB | — |
| eval/results/digraph-ver2-vs-ver2.1.txt | Other | 3.5 KB | — |
| eval/results/digraph-w28-vs-ver2.1.txt | Other | 3.5 KB | — |
| eval/results/e2e-data4-ver2-vs-ver2.1.txt | Other | 13.0 KB | — |
| eval/results/e2e-data4-w28-vs-ver2.1.txt | Other | 13.0 KB | — |
| eval/results/train-eval-log.txt | Other | 6.8 KB | — |
| eval/run_compare.sh | Other | 1.4 KB | — |
| eval/run_digraph.sh | Other | 774 B | — |
| eval/run_quick.sh | Other | 1.4 KB | — |
| scripts/b_run.ps1 | Other | 1.9 KB | — |
| scripts/run_gen.sh | Other | 712 B | — |
| scripts/run_train_b.cmd | Other | 670 B | — |
| training-manifest.txt | Other | 1.0 KB | — |
| .gitattributes | Repository | 1.5 KB | — |
License and Download
- License
- apache-2.0
- Access
- Open weights, no gate
- Download size
- 250.2 MB
Released by Steve through its official repository on Hugging Face. Read the license.
Built From
- Derived from convaiinnovations/laya
- Trained on (disclosed) C-MTEB/LCQMC
- Trained on (disclosed) Hello-SimpleAI/HC3-Chinese
- Trained on (disclosed) SirlyDreamer/THUCNews
- Trained on (disclosed) dirtycomputer/weibo_senti_100k
- Trained on (disclosed) opencsg/chinese-fineweb-edu-v2
- Trained on (disclosed) pleisto/wikipedia-cn-20230720-filtered
- Trained on (disclosed) silver/lccc
- Trained on (disclosed) thu-coai/kdconv
- Trained on (disclosed) wangrui6/Zhihu-KOL
Memory Requirements
| Precision | Weights in memory |
|---|---|
| As published | 250.2 MB |
Weights only, from the published parameter count; the key-value cache and runtime add to this.
Questions About laya-pinyin-2.1
Can I use laya-pinyin-2.1 commercially?
Yes. laya-pinyin-2.1 is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.