Data Mixture Inference: What do BPE Tokenizers Reveal about their Training Data?

LLM PTSAD
2024年07月23日
本文的最后一段介绍了一种名为“数据混合推断”的任务,旨在揭示语言模型训练数据的分布构成,以解决当前最强语言模型的预训练数据不透明的问题,特别是对于各种领域或语言的比例了解甚少。作者提出了一种新颖的攻击方法,基于一种先前被忽视的信息源——字节对编码(BPE)分词器,该分词器被现代大多数语言模型使用。作者的关键洞察力是,BPE分词器学习到的有序合并规则列表自然地揭示了其训练数据中的词频信息:第一个合并是最常见的字节对,第二个是在合并第一个令牌后最常见的对,依此类推。作者通过给定一个分词器的合并列表以及每个感兴趣类别的数据样本,制定了一个线性规划,解决了分词器训练集中每个类别的比例。在受控实验中,作者展示了他们的攻击方法可以高精度地恢复出在自然语言、编程语言和数据源混合的已知分词器中的混合比例。然后,作者应用他们的方法于最近发布的语言模型中的预训练分词器,确认了公开披露的信息,并作出了一些新的推断:GPT-4o的分词器比其前身更多地支持多语言,训练了39%的非英文数据;Llama3主要用于多语言(48%)的扩展GPT-3.5的分词器;GPT-3.5和Claude的分词器主要训练于代码(~60%)。作者希望他们的工作能够揭示当前预训练数据设计实践的一些问题,并激发对于语言模型数据混合推断的进一步研究。
The pretraining data of today's strongest language models is opaque; in particular, little is known about the proportions of various domains or languages represented. In this work, we tackle a task which we call data mixture inference, which aims to uncover the distributional make-up of training data. We introduce a novel attack based on a previously overlooked source of information -- byte-pair encoding (BPE) tokenizers, used by the vast majority of modern language models. Our key insight is that the ordered list of merge rules learned by a BPE tokenizer naturally reveals information about the token frequencies in its training data: the first merge is the most common byte pair, the second is the most common pair after merging the first token, and so on. Given a tokenizer's merge list along with data samples for each category of interest, we formulate a linear program that solves for the proportion of each category in the tokenizer's training set. Importantly, to the extent to which tokenizer training data is representative of the pretraining data, we indirectly learn about pretraining data. In controlled experiments, we show that our attack recovers mixture ratios with high precision for tokenizers trained on known mixtures of natural languages, programming languages, and data sources. We then apply our approach to off-the-shelf tokenizers released with recent LMs. We confirm much publicly disclosed information about these models, and also make several new inferences: GPT-4o's tokenizer is much more multilingual than its predecessors, training on 39% non-English data; Llama3 extends GPT-3.5's tokenizer primarily for multilingual (48%) use; GPT-3.5's and Claude's tokenizers are trained on predominantly code (~60%). We hope our work sheds light on current design practices for pretraining data, and inspires continued research into data mixture inference for LMs.
许愿