Data Quality in Model Training
Data diversity is the variety of training data, covering topics, speaking styles, and formats, and it is needed so the model's training covers the problems it will face.
The Chatbot That Looked Strong in Testing
Imagine you build a chatbot and test it carefully. It answers polished, well-formed questions beautifully. Then real users arrive. Some write long messages stuffed with background details. Others type two-word commands. Some misspell every third word, and some ask questions in a programming language the team never considered. The model may suddenly look much weaker than it did in testing. This article is about why that happens and what a team can do about it.
What do you think happens?
What do you think is the most likely cause of the drop in performance?
Reveal answer
The training data did not reflect the variety of the people who would actually use the model.
The source states that the problem is often not the model architecture. It is the data the model learned from, which did not reflect the messy variety of real users.
The central question is how much variety a training set needs in order for a model to handle the situations it will meet after deployment. The answer leads to a concept called data diversity, and to two neighboring ideas that are easy to confuse with it: data quality and data mix.
Tracing What the Model Has Seen
A model can only generalize from what it was trained on. Training data is therefore the model's entire experience of language. If that experience contains only one way of asking for things, the model has no evidence that other ways of asking refer to the same problem.
Real users rarely ask questions in one standard form. The same request can arrive as a careful paragraph with references or as a terse fragment, and it can contain typos. If the training data only contains the polished version, the model has seen one style of asking and may not recognize the others as the same kind of problem. Coverage therefore depends on sufficient diversity in the data, and that requirement is why the attribute is commonly named data diversity.
Data Diversity Defined
Data diversity is the variety of training data, covering topics, speaking styles, and formats, and it is needed so the model's training covers the problems it will face.
Diversity is not a single fixed target. It depends on the application. Not every application needs the same kind of variety, and two systems show why.
A tool that translates French into English has a fixed language pair, so it does not need variety in languages. It can still benefit from variety in topics, in sentence lengths, and in speaking styles, because the sentences it translates may be formal, casual, short, or long. By contrast, a chatbot that recommends products to customers around the world may not need broad topic coverage within a narrow shopping domain, but linguistic and cultural diversity matter a great deal, because customers differ in how they write and what they expect.
The question to ask is not how much diversity is good in general. The question is which kinds of variety the specific application will actually encounter.
Measuring Diversity Along Several Axes
Diversity can be measured along several axes. One of them is domain diversity, which concerns how topics or domains are represented in the data. The source notes that its meaning shifts across the phases of building a model, so a single fixed mix is not automatically right at every stage.
- Domain diversity: how topics or domains are represented in the data
- Context and response length: the number of tokens in the context and in the response
- Conversational depth: the number of conversational turns
- Source mix: the proportion of human-written data compared with AI-generated data
The source's table of high-level domains across training phases shows that the best mix differs by phase. General English knowledge stays large in every phase but climbs sharply during preference finetuning, while math, reasoning, and coding shrink. The table lists only high-level domains, so finer topics such as geometry within math do not appear in it.
Diversity Versus Quality
Data quality and data diversity are separate properties. Quality concerns accuracy and cleanliness. Diversity concerns variety. A dataset can score high on one and low on the other, and the two need not move together.
Dataset A is a set of carefully checked, accurate answers that all address the same narrow kind of question. It is high in quality but low in diversity. Dataset B is a large pile of varied but sloppy text, with many errors and irrelevant fragments. It is diverse but low in quality. Neither set alone is ideal. A model needs data that is varied enough to cover its users and accurate enough to teach correct behavior.
Diagnosing a dataset that is accurate but narrow
A team has 2,000 support answers. Every answer is correct, reviewed, and clean. Every question in the set is a formal, complete sentence about billing. Does the dataset have high quality, high diversity, or both?
- 1Check quality
The answers are correct, reviewed, and clean, so quality is high.
- 2Check topics
All questions concern billing, so topic variety is low.
- 3Check styles
All questions are formal, complete sentences, so style variety is low.
- 4Conclude
The dataset resembles Dataset A: high quality with low diversity. A model trained on it may fail when customers write short, informal, or misspelled questions.
High quality and low diversity. The team should add varied phrasings and topics without giving up the accuracy of the answers.
The Controlled Comparison Behind the Claim
The clearest evidence for needing both properties comes from a controlled comparison. Researchers Zhou and colleagues, reported in 2023, finetuned a 7-billion-parameter language model on three datasets. Each dataset contained the same number of examples, 2,000, but they differed in character. The first was high-quality but not diverse. The second was diverse but low-quality. The third was both diverse and high-quality. Because the size was held fixed, any difference in the resulting models could be attributed to the character of the data.
The model finetuned on the dataset that was both high-quality and diverse outperformed the models finetuned on either of the other two. Holding the example count constant is what makes this result informative. Quality and diversity each contributed something different, and the combination mattered more than either property alone.
Choosing the Right Data Mix
Once a team accepts that diversity and quality both matter, the next question is how to combine different kinds of data in practice. The combination is called the data mix. The right data mix depends on the specific application and use case, so no universal recipe exists.
The diagram is a generated reasoning aid, not a fixed rule from the source. The source describes two broad approaches to filling in the data mix, and the first is the simplest. Choose a mix that accurately reflects how the application is really used. If most real traffic is customer-service questions, the mix should look like customer-service questions.
The more principled approach uses experiments to find the best mix. Meta ran scaling law experiments for Llama 3. For each candidate mix, the team trained several small models on that mix and used their results to predict how a large model would perform on it. The final mix was the best estimate suggested by those experiments.
How Many Examples Are Enough
A common question is how many examples a team needs. The source answers by analogy: asking how much data you need is like asking how much money you need. The answer varies enormously. At one extreme, a fun experiment by Jeremy Howard and Jonathan Whitaker showed that a language model can learn something useful from a single example. At the other extreme, some teams have finetuned models with millions of examples.
Pre-training a foundation model from scratch uses far more text. The source gives Llama 2 as trained on 2 trillion tokens and Llama 3 on 16 trillion tokens. If each example were 2,000 tokens long, those totals would correspond to about 1 billion and 15 billion examples, respectively. A dataset of millions of examples is therefore small by comparison, which is one reason finetuning on top of a pre-trained model is popular.
Converting tokens to examples
How many 2,000-token examples would correspond to Llama 2's 2 trillion training tokens?
- 1Write the total
The total is $2 \times 10^{12}$ tokens.
- 2Write the example length
Each example is $2{,}000 = 2 \times 10^{3}$ tokens.
- 3Divide
$\frac{2 \times 10^{12}}{2 \times 10^{3}} = 10^{9}$
About 1 billion examples, which is far more than a finetuning dataset of millions of examples.
Finetuning Versus Training From Scratch
It is tempting to assume that a team with millions of examples should simply start from a pre-trained model and finetune it. The source cautions that the team should evaluate whether training from scratch would improve performance. Finetuning on top of a pre-trained model is typically more efficient, but there are situations where finetuning can be worse, especially when a team has a large amount of training data.
In the typical case, the pre-trained weights adjust to the finetuning data. In the ossification case, the pre-trained weights resist adjustment and end up adapting poorly. The source adds that smaller models are more susceptible to ossification than larger ones, so model size is one factor a team should weigh when choosing between finetuning and training from scratch.
Mistakes Teams Make With Training Data
Common mistake Treating diversity and quality as the same property
What it looks likeA team assumes that a large, clean, correct dataset must also cover the variety of its users.
Why it failsThe source states that data quality and data diversity are separate properties, and a dataset can score high on one and low on the other.
Do this insteadAssess each property separately, and check the dataset for both accuracy and variety of topics, styles, and formats.
Common mistake Including only polished examples
What it looks likeTraining data contains only formal, complete sentences, while real users send terse fragments with typos.
Why it failsThe model sees one style of asking and may not recognize other styles as the same kind of problem.
Do this insteadInclude variation in style, length, and format that matches the messiness of real usage.
Common mistake Assuming one fixed data mix fits every stage
Why it failsThe source's table shows that the best mix differs by phase, and general English knowledge climbs sharply during preference finetuning while math, reasoning, and coding shrink.
Do this insteadReason about the mix separately for each phase of building the model.
Common mistake Assuming finetuning always beats training from scratch
Why it failsThe source notes that finetuning can be worse, especially with a large amount of training data, and that smaller models are more susceptible to ossification.
Do this insteadEvaluate whether training from scratch would improve performance before committing to finetuning.
Common mistake Asking how many examples are needed without considering what the application will encounter
Practice Reasoning About a Dataset
A team is building a chatbot that answers questions about a company's shipping policy for customers in several countries. Their training data contains 5,000 carefully checked answers, all written in formal English, all about shipping costs. List one diversity gap and one quality concern the team should check, and explain which property each one belongs to.
Hints
- Ask whether the data covers the topics customers will raise, not only shipping costs.
- Ask whether the examples reflect how customers in different countries write, as the source describes for global chatbots.
- Remember that quality concerns accuracy and cleanliness, while diversity concerns variety.
Summary of the Key Ideas
- 1Data diversity is the variety of training data, covering topics, speaking styles, and formats, and it is needed so training covers the problems the model will face.
- 2Diversity depends on the application. A fixed-language tool still needs variety in topics and styles, while a global chatbot also needs linguistic and cultural variety.
- 3Data quality and data diversity are separate properties. The strongest results in the cited experiment came from data that was both diverse and high-quality.
- 4The right data mix is found by reflecting real usage and, where possible, by experiments that predict how candidate mixes affect performance.
- 5Finetuning a large pre-trained model is not always better than training from scratch, so a team should evaluate both options, especially with large training data.
At a glance
- Data diversity is the variety of training data across topics, speaking styles, and formats, and it lets training cover the problems a model will meet after deployment.
- Diversity and quality are separate properties. The cited controlled experiment found that data both diverse and high-quality gave the best results.
- The right data mix depends on the application and is reasoned from real usage, optionally refined by experiments that predict performance of candidate mixes.
- Finetuning a pre-trained model is usually efficient but is not always better, since ossification can make pre-trained weights adapt poorly, especially in smaller models and with large training data.