Data Preparation
摘要
Pre-training represents the first and most critical phase in building large language models (LLMs). This phase, when done properly, establishes the core capabilities of the model. By engaging with extensive datasets, LLMs gain a deep comprehension of language and absorb vast amounts of knowledge, preparing them to tackle a variety of downstream tasks effectively. This chapter centers on the preparation of pre-training data, encompassing methods for data collection, preprocessing, tokenization, and scheduling. First, we provide a concise overview of representative data types and examine their influence on pre-training performance. Next, we comprehensively outline the key steps in the data preprocessing pipeline, including quality filtering, sensitive content filtering, and data deduplication. We delve into feasible processing algorithms, spanning from rule-based to model-based approaches, and analyze the strengths and limitations of each method. Following data cleaning, we present tokenization techniques for transforming text strings into fundamental units. In particular, we explore three classic subword tokenization algorithms: BPE, WordPiece, and Unigram. After discussing tokenization, we continue to introduce data scheduling strategies for pre-training, focused on data mixing and data curriculum strategies. Finally, we show a complete training process by integrating all related steps, using the YuLan model as a case study.