让语言模型自适应分词,解决新数据下分词碎片化问题
FLEXITOKENS: Flexible Tokenization for Evolving Language Models
- 用可学习的字节级分词器动态切分文本,不再依赖固定规则
- 在多语言、多形态任务中减少分词过度碎片化,性能提升最高达10个百分点
- 无需额外约束,适配性强,适合快速部署到新领域或低资源语言
通过简单微调将语言模型适配到新数据分布面临挑战,根源在于子词分词器的刚性——通常在适应过程中保持不变。这种僵化常导致分布外领域、未见语言或书写系统中出现分词过度碎片化。本文提出FLEXITOKENS,采用可学习的字节级语言模型,其分词模块能根据输入字节序列动态预测分隔边界,生成变长段落。不同于多数免分词方法使用固定压缩率辅助损失引入的新刚性,我们设计了简化训练目标,显著提升适应灵活性。在多个多语言基准、形态复杂任务及不同领域上评估表明,FLEXITOKENS持续降低分词碎片化程度,在分词分类与生成任务中相比BPE及其他基于梯度的分词基线最高提升10个百分点。验证覆盖不同规模模型,效果跨尺度一致。代码与数据将开源于https://github.com/skai-research/flexitokens。
原文摘要 · Abstract (English)
Adapting language models to new data distributions by simple finetuning is challenging. This is due to the rigidity of their subword tokenizers, which typically remain unchanged during adaptation. This inflexibility often leads to inefficient tokenization, causing overfragmentation of text in out-of-distribution domains, unseen languages, or scripts. In this work, we develop byte-level LMs with learnable tokenizers to make tokenization adaptive. Our models include a submodule that learns to predict boundaries given the input byte sequence, encoding it into variable-length segments. Most tokenizer-free methods train this boundary predictor using an auxiliary loss that enforces a fixed compression rate across the training corpus, introducing a new kind of rigidity. We propose FLEXITOKENS, a simplified training objective that enables significantly greater flexibility during adaptation. Evaluating across multiple multilingual benchmarks, morphologically diverse tasks, and domains, we demonstrate that FLEXITOKENS consistently reduces token over-fragmentation and achieves up to 10% point improvements on token classification and generative tasks compared to BPE and other gradient-based tokenizer baselines. We validate our findings using models of varying sizes, and our method demonstrates consistent improvements across scales. Code and data for our experiments will be released at https://github.com/skai-research/flexitokens
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。