用超词分词法提升语言模型效率与性能
SuperBPE: Space Travel for Language Models
- 在BPE中引入预训练课程,先学子词再学跨空格的超词
- 相同词表下减少33%的编码 token,推理省27%算力
- 特别适合需要高效处理多词表达的任务场景
现有语言模型分词普遍采用子词,但这一假设可能限制了模型潜力。我们提出超词分词器 SuperBPE,通过在字节对编码(BPE)中加入简单预训练课程,先学习子词,再学习跨越空格的超词。在固定词表大小为200k时,SuperBPE平均比BPE少33%的编码 token。在80亿参数模型上,仅改变分词算法,不改变模型规模和训练计算量,其在30个下游任务上平均提升4.0%(如MMLU达+8.2%),同时推理阶段节省27%算力。分析显示,超词分词使每个 token 的语义难度更均匀,常能捕捉作为整体使用的多词表达。该方法为分词提供了简单有效的改进。
原文摘要 · Abstract (English)
The assumption across nearly all language model (LM) tokenization schemes is that tokens should be subwords, i.e., contained within word boundaries. While providing a seemingly reasonable inductive bias, is this common practice limiting the potential of modern LMs? Whitespace is not a reliable delimiter of meaning, as evidenced by multi-word expressions (e.g., "by the way"), crosslingual variation in the number of words needed to express a concept (e.g., "spacesuit helmet" in German is "raumanzughelm"), and languages that do not use whitespace at all (e.g., Chinese). To explore the potential of tokenization beyond subwords, we introduce a "superword" tokenizer, SuperBPE, which incorporates a simple pretokenization curriculum into the byte-pair encoding (BPE) algorithm to first learn subwords, then superwords that bridge whitespace. This brings dramatic improvements in encoding efficiency: when fixing the vocabulary size to 200k, SuperBPE encodes a fixed piece of text with up to 33% fewer tokens than BPE on average. In experiments, we pretrain 8B transformer LMs from scratch while fixing the model size, vocabulary size, and train compute, varying *only* the algorithm for learning the vocabulary. Our model trained with SuperBPE achieves an average +4.0% absolute improvement over the BPE baseline across 30 downstream tasks (including +8.2% on MMLU), while simultaneously requiring 27% less compute at inference time. In analysis, we find that SuperBPE results in segmentations of text that are more uniform in per-token difficulty. Qualitatively, this may be because SuperBPE tokens often capture common multi-word expressions that function semantically as a single unit. SuperBPE is a straightforward, local modification to tokenization that improves both encoding efficiency and downstream performance, yielding better language models overall.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。