通过动态合并令牌提升字节级模型效率,大幅缩短序列长度。
MrT5: Dynamic Token Merging for Efficient Byte-level Language Models
- 引入可学习删除门,动态压缩输入序列,保留关键信息。
- 推理速度提升显著,序列长度最多减少75%,性能损失极小。
- 适合需要高效字节级建模的多语言任务与低资源场景。
基于子词分词的模型存在对拼写错误敏感、跨语言压缩率不一致等问题。尽管字节级模型如ByT5能缓解这些问题,但因处理原始字节流导致序列过长,训练和推理效率低下。本文提出MrT5(MergeT5),在ByT5编码器中引入动态令牌删除机制:经过固定层数编码后,通过可学习的删除门决定哪些令牌保留、哪些删除,将被删令牌的信息融合进剩余序列。实验表明,持续预训练下,MrT5在比特每字节指标几乎不变的前提下显著提升推理速度;多语言训练中,模型能自适应不同语言的书写特征,学习语言特定压缩率。在下游任务如XNLI、TyDi QA和字符级任务上,准确率与ByT5相当,但序列长度最多缩短75%。该方法有效解决了现有字节级模型的实用性瓶颈。
原文摘要 · Abstract (English)
Models that rely on subword tokenization have significant drawbacks, such as sensitivity to character-level noise like spelling errors and inconsistent compression rates across different languages and scripts. While character- or byte-level models like ByT5 attempt to address these concerns, they have not gained widespread adoption -- processing raw byte streams without tokenization results in significantly longer sequence lengths, making training and inference inefficient. This work introduces MrT5 (MergeT5), a more efficient variant of ByT5 that integrates a token deletion mechanism in its encoder to dynamically shorten the input sequence length. After processing through a fixed number of encoder layers, a learned delete gate determines which tokens are to be removed and which are to be retained for subsequent layers. MrT5 effectively "merges" critical information from deleted tokens into a more compact sequence, leveraging contextual information from the remaining tokens. In continued pre-training experiments, we find that MrT5 can achieve significant gains in inference runtime with minimal effect on performance, as measured by bits-per-byte. Additionally, with multilingual training, MrT5 adapts to the orthographic characteristics of each language, learning language-specific compression rates. Furthermore, MrT5 shows comparable accuracy to ByT5 on downstream evaluations such as XNLI, TyDi QA, and character-level tasks while reducing sequence lengths by up to 75%. Our approach presents a solution to the practical limitations of existing byte-level models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。