Scaffold-BPE: Enhancing Byte Pair Encoding for Large Language Models with Simple and Effective Scaffold Token Removal

Authors

  • Haoran Lian Beihang University
  • Yizhe Xiong Tsinghua University BNRist
  • Jianwei Niu Beihang University State Key Laboratory of Virtual Reality Technology and Systems, Beihang University Zhongguancun Laboratory Zhengzhou University Research Institute of Industrial Technology, Zhengzhou University
  • Shasha Mo Beihang University
  • Zhenpeng Su Chinese Academy of Sciences
  • Zijia Lin Tsinghua University
  • Hui Chen Tsinghua University BNRist
  • Jungong Han Tsinghua University
  • Guiguang Ding Tsinghua University BNRist

DOI:

https://doi.org/10.1609/aaai.v39i23.34633

Abstract

Byte Pair Encoding (BPE) serves as a foundation method for text tokenization in the Natural Language Processing (NLP) field. Despite its wide adoption, the original BPE algorithm harbors an inherent flaw: it inadvertently introduces a frequency imbalance for tokens in the text corpus. Since BPE iteratively merges the most frequent token pair in the text corpus to generate a new token and keeps all generated tokens in the vocabulary, it unavoidably holds tokens that primarily act as components of a longer token and appear infrequently on their own. We term such tokens as Scaffold Tokens. Due to their infrequent occurrences in the text corpus, Scaffold Tokens pose a learning imbalance issue. To address that issue, we propose Scaffold-BPE, which incorporates a dynamic scaffold token removal mechanism by parameter-free, computation-light, and easy-to-implement modifications to the original BPE method. This novel approach ensures the exclusion of low-frequency Scaffold Tokens from the token representations for given texts, thereby mitigating the issue of frequency imbalance and facilitating model training. On extensive experiments across language modeling and even machine translation, Scaffold-BPE consistently outperforms the original BPE, well demonstrating its effectiveness.

Downloads

Published

2025-04-11

How to Cite

Lian, H., Xiong, Y., Niu, J., Mo, S., Su, Z., Lin, Z., … Ding, G. (2025). Scaffold-BPE: Enhancing Byte Pair Encoding for Large Language Models with Simple and Effective Scaffold Token Removal. Proceedings of the AAAI Conference on Artificial Intelligence, 39(23), 24539–24548. https://doi.org/10.1609/aaai.v39i23.34633

Issue

Section

AAAI Technical Track on Natural Language Processing II