基于合并的词汇扩展在预分词器处失效:尼泊尔语的保英文修复方案,在持续预训练中进行测试
Merge-Based Vocabulary Extension Stalls at the Pre-Tokenizer: An English-Preserving Repair for Nepali, Tested in Continued Pretraining
AI总结:
针对Llama-3等开源LLM预分词器拆分尼泊尔语导致token溢价的问题,提出正则表达式修改方案,经测试可大幅减少尼泊尔语token消耗,相关分词器与代码已公开。
摘要:
Llama-3、Qwen3及众多其他开源大语言模型(LLM)采用仅允许Unicode字母的正则表达式对文本进行预分词。天城文元音符号属于组合标记,因此该正则表达式会在尼泊尔语单词的每个元音符号处进行拆分,使用该正则表达式的模型在尼泊尔语文本上消耗的token数量是相同英文文本的2.6至5.8倍。基于合并的词汇扩展无法将拆分后的片段重新合并:对于Llama-3和Qwen3,无论添加多少新合并规则,该token溢价都无法降至约2.2以下,且已发布的10种扩展方案的token数量仍处于该预分词下限的4%范围内。我们对已部署的正则表达式进行了小幅修改,该修改可确保不含组合标记或天城文字符的文本的每个token ID保持不变。通过添加32000个新合并规则,尼泊尔语的token数量降至英文的1.01倍,比标准扩展方案减少约54%的尼泊尔语token。在Llama-3.2-1B和Qwen3-0.6B的小预算持续预训练中,我们测试的所有方案里,原始分词器在保留的尼泊尔语文本上实现了最低的每字节比特数。将修复方案的训练步骤与标准扩展方案匹配,重复约35%的数据后,在Qwen上反转了两者的性能顺序,但在Llama上未出现该情况。token节省是否能在生成任务中带来延迟与质量的有利权衡仍未得到验证。我们发布了相关分词器和代码。
英文摘要:
Llama-3, Qwen3 and many other open LLMs pre-tokenize text with a regular expression whose word class admits only Unicode letters. Devanagari vowel signs are combining marks, so this regex splits Nepali words at every vowel sign, and models that use it spend 2.6 to 5.8 times as many tokens on Nepali as on the same English text. Merge-based vocabulary extension cannot join the split pieces: for Llama-3 and Qwen3 no number of new merges brings this premium below about 2.2, and ten released extensions already end within 4% of this pre-token floor. We give a small edit to the deployed regex that provably keeps every token id of text without combining marks or Devanagari characters. With 32,000 new merges it brings Nepali to 1.01 times English, about 54% fewer Nepali tokens than standard extension. In small-budget continued pretraining of Llama-3.2-1B and Qwen3-0.6B, the original tokenizer gave the lowest held-out Nepali bits per byte under every recipe we tested. Matching the repair's training steps to standard extension, with about 35% of the data repeated, reversed their order on Qwen but not on Llama. Whether the token savings give a favourable latency and quality trade-off in generation remains untested. We release the tokenizers and code.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。