Skip to content
ImagineWorld

How Much Data Do You Need?

node_idnode-book_llm-systems-engineering_module-18-how-much-data-do-you-need
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num18
chapter_titleHow Much Data Do You Need?
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

The question of how much training data a large language model requires is among the most frequently asked in the field, and it is also among the most difficult to answer with a single number. Data requirements depend on the development pathway being pursued and the size of the model being trained. A team fine-tuning a pretrained model for a narrow task may need only a few thousand carefully curated examples, while a team training a model from scratch may need trillions of tokens drawn from diverse sources. Empirical research over the past several years has produced scaling laws that formalize some of these relationships, offering guidance that was previously available only through expensive trial and error. This module examines how data quantity interacts with model scale and pathway choice to determine what “enough data” actually means in practice.

One of the most common mistakes teams make when planning an LLM project is assuming that data requirements can be expressed as a fixed number. In practice, the amount of data a model needs is determined by several interacting factors, and changing any one of them can alter the requirement significantly. The most important of these factors are the model’s parameter count and the development pathway the team has chosen.

A model with 7 billion parameters requires a fundamentally different volume of training data than a model with 70 billion parameters. Larger models have more capacity to absorb information from data, which means they need more tokens to fully realize that capacity. Training a large model on too little data leads to underfitting, where the model fails to learn the patterns its architecture is capable of representing. Training a smaller model on too much data, conversely, yields diminishing returns, as the model’s limited capacity prevents it from benefiting further from additional examples (Kaplan et al., 2020).

The development pathway adds another dimension to this question. Fine-tuning, continued pretraining, and training from scratch each impose different data requirements in terms of both volume and composition. Fine-tuning a pretrained model for a specific task can be accomplished with datasets measured in thousands of examples. Continued pretraining, which aims to extend a model’s knowledge into a new domain, typically requires billions of tokens of domain-relevant text. Training from scratch demands the largest datasets by far, often measured in trillions of tokens. These differences are so large that treating data requirements as a single number, without specifying the pathway, produces guidance that is essentially meaningless.

Development path ↓ / Model scale →1B–7B parameters7B–30B parameters30B+ parameters
Fine-tuning1K–10K examples10K–100K examples100K–1M+ examples
Continued Pretraining0.5B–5B tokens5B–50B tokens50B–200B tokens
Training from Scratch100B–1T tokens1T–5T tokens5T–15T+ tokens

Figure 3-10. Data Requirements by Development Pathway and Model Scale

The intended capability profile of the model also plays a role. A model designed for general-purpose conversation across many topics needs broad coverage of linguistic knowledge and reasoning patterns. A model designed for a single specialized task, such as clinical note summarization, can achieve strong performance with a narrower dataset, provided that dataset is well matched to the target domain. The interaction between model size, pathway, and purpose means that data planning must always be context-specific.

Empirical research has made substantial progress in quantifying the relationship between dataset size and model parameters under varying compute budgets. The most influential contributions in this area are the scaling laws established by Kaplan et al. (2020) and the revised estimates provided by Hoffmann et al. (2022), which together form the foundation for modern data planning.

Kaplan et al. (2020) demonstrated that language model performance, measured by cross-entropy loss, follows predictable power-law relationships with model size and dataset size. Their findings indicated that larger models are more sample-efficient, meaning they extract more learning signal per token of training data. This led to the practical recommendation that, given a fixed compute budget, teams should prioritize training larger models on relatively modest amounts of data, stopping well before convergence.

Hoffmann et al. (2022) revisited this conclusion and arrived at a meaningfully different recommendation. By training over 400 language models ranging from 70 million to over 16 billion parameters on varying quantities of data, they found that model size and training token count should be scaled in roughly equal proportion. For every doubling of model parameters, the number of training tokens should also double to achieve compute-optimal performance. Their key empirical result was that many existing large models were significantly undertrained, having been given too few tokens relative to their parameter count. To validate this finding, they trained Chinchilla, a 70 billion parameter model, using the same compute budget as the much larger 280 billion parameter Gopher model but with four times more training data. Chinchilla outperformed Gopher across a wide range of benchmarks, demonstrating the practical consequences of data-compute balance (Hoffmann et al., 2022).

These scaling laws provide a useful starting point for data planning, but they apply most directly to training from scratch under idealized conditions. In practice, teams often face constraints on the amount of unique data available, which introduces additional considerations. Muennighoff et al. (2023) investigated what happens when models are trained with repeated data under a fixed compute budget. Their experiments, spanning up to 900 billion training tokens and 9 billion parameter models, showed that training with up to four epochs of repeated data yields negligible degradation in loss compared to using entirely unique data. Beyond four epochs, however, the benefit of additional compute diminishes toward zero. This finding has direct practical relevance for teams working with domain-specific corpora, where unique high-quality data may be limited in supply.

Raw token count, while important, provides an incomplete picture of whether a dataset is sufficient for a given training objective. Two datasets of identical size can produce models with very different capabilities if they differ in how topics and linguistic forms are distributed across their contents. A dataset containing one trillion tokens drawn entirely from web forum posts will train a very different model than one trillion tokens drawn from a balanced mixture of books and scientific literature.

The concept of token coverage captures this distinction. Coverage refers to how thoroughly a dataset represents the range of language patterns and reasoning structures that the model will be expected to handle at inference time. A dataset with poor coverage may be large in absolute terms but leave significant gaps in the model’s capabilities, particularly in domains or styles that are underrepresented in the training distribution.

Based on the findings of Penedo et al. (2024) discussed in Module 16, coverage planning should begin with the model’s intended use cases. If a model is expected to handle medical terminology, the training data must contain sufficient medical text for the model to learn the relevant vocabulary and reasoning patterns. If a model is expected to write formal prose, it needs exposure to well-structured writing. Identifying gaps in coverage before training begins, and addressing them through targeted data acquisition, is one of the most effective ways to improve model performance without increasing the total dataset size.

Data Requirements Across the Three Pathways

Section titled “Data Requirements Across the Three Pathways”

The data volume and composition required for each development pathway differ by orders of magnitude, and understanding these differences is essential for realistic project planning.

Fine-tuning is the least data-intensive pathway. Because a pretrained model already possesses broad linguistic knowledge and general capabilities, fine-tuning primarily adjusts the model’s behavior for a specific task or style. Zhou et al. (2023) demonstrated this dramatically with LIMA, a 65 billion parameter model fine-tuned on only 1,000 carefully curated prompt-response pairs. Despite this small dataset, LIMA outperformed models trained with reinforcement learning from human feedback on larger datasets in human preference evaluations. The study provided strong evidence that the quality and diversity of fine-tuning examples matters far more than their quantity, and that a few thousand well-chosen examples can be sufficient for meaningful behavioral alignment.

Continued pretraining occupies a middle ground. It aims to extend a pretrained model’s knowledge into a new domain while preserving its existing capabilities, and this requires substantially more data than fine-tuning. The data volumes involved in continued pretraining typically range from hundreds of millions to tens of billions of tokens, depending on the breadth of the target domain and the degree of specialization required. Gupta et al. (2023) further demonstrated that continued pretraining with large domain corpora can outperform training from scratch on downstream tasks, even when the downstream dataset is substantial in size.

Training from scratch demands the largest data investments. Models trained from scratch begin with randomly initialized weights and must learn everything, from basic syntax to world knowledge, entirely from the training data. The LLaMA models released by Touvron et al. (2023) were trained on approximately 1.4 trillion tokens of publicly available text, with the data drawn from a mixture of web crawls and curated sources. Meta’s subsequent Llama 3 models pushed this further, training on over 15 trillion tokens, a dataset seven times larger than its predecessor (Dubey et al., 2024). The Llama 3 team also observed that performance continued to improve log-linearly well beyond the compute-optimal point predicted by Chinchilla scaling laws, suggesting that for production-grade models, teams may benefit from training on significantly more data than theoretical optimality would suggest.

A team pursuing fine-tuning can often assemble a suitable dataset in weeks through manual curation. A team pursuing serious continued pretraining must plan for months of data acquisition and processing. A team training from scratch faces the most demanding pipeline of all, requiring infrastructure for filtering and deduplicating data at web scale. Matching data planning to the chosen pathway is one of the most important early decisions in any LLM development effort. There are of course data sets online that are readily available, but if domain specialization is the goal, these will often not suffice.