arXiv:2506.19004cs.CL2025-06NeurIPS被引 16

语言模型其实能默默处理非标准分词,还能提升性能。

Broken Tokens? Your Language Model can Secretly Handle Non-Canonical Tokenizations

  • 用随机或字符级分词测试模型表现,发现性能下降有限。
  • 字符分词可使代码理解任务提升14%,大数计算提升33%。
  • 指令微调让模型更鲁棒,适合推理时动态调整分词策略。

现代分词器将文本映射为单一的‘标准’标记序列,但同一字符串可用分词器词汇表生成多种非标准分词形式。本文研究语言模型对训练中未见的非标准分词的鲁棒性。在20个基准上评估发现,指令微调模型在随机分词下仍保持93.4%原性能,字符级分词下达90.8%。更强模型更鲁棒,且偏离标准分词越远,性能越降。受此启发,我们发现非标准分词可提升性能:字符级分割使字符串操作与代码理解任务最高提升14%,右对齐数字分组使大数算术提升33%。分析表明,这种鲁棒性源于指令微调阶段。基础模型虽理解非标准分词含错字,但试图模仿错误,输出混乱;而指令微调模型坚持生成流畅回应。结果表明,模型对分词器依赖远低于预期,并展示了推理时干预分词以提升性能的潜力。

原文摘要 · Abstract (English)

Modern tokenizers employ deterministic algorithms to map text into a single "canonical" token sequence, yet the same string can be encoded as many non-canonical tokenizations using the tokenizer vocabulary. In this work, we investigate the robustness of LMs to text encoded with non-canonical tokenizations entirely unseen during training. Surprisingly, when evaluated across 20 benchmarks, we find that instruction-tuned models retain up to 93.4% of their original performance when given a randomly sampled tokenization, and 90.8% with character-level tokenization. We see that overall stronger models tend to be more robust, and robustness diminishes as the tokenization departs farther from the canonical form. Motivated by these results, we then identify settings where non-canonical tokenization schemes can *improve* performance, finding that character-level segmentation improves string manipulation and code understanding tasks by up to +14%, and right-aligned digit grouping enhances large-number arithmetic by +33%. Finally, we investigate the source of this robustness, finding that it arises in the instruction-tuning phase. We show that while both base and post-trained models grasp the semantics of non-canonical tokenizations (perceiving them as containing misspellings), base models try to mimic the imagined mistakes and degenerate into nonsensical output, while post-trained models are committed to fluent responses. Overall, our findings suggest that models are less tied to their tokenizer than previously believed, and demonstrate the promise of intervening on tokenization at inference time to boost performance.

分词模型鲁棒性推理优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。