Finetuning Versus Training from Scratch
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.
A Chatbot That Works 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. The problem is often not the model architecture. It is the data the model learned from, which did not reflect the messy variety of the people who would actually use it.
This article looks at that gap. 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 the Coverage Gap
Before defining anything, trace what the model actually saw. In the chatbot story, the training data contained only the polished version of each request. The model therefore learned one style of asking. When a long, rambling, or misspelled request arrives, the model may not recognize it as the same kind of problem it already handles well. The gap is between the situations represented in training and the situations the model meets after deployment.
Notice what the diagram leaves out. The model's architecture is not the variable here. The same architecture trained on a different set of examples would behave differently on the messy requests. This is why the source locates the problem in the data.
Defining Data Diversity
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 reasoning behind the definition is simple. 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.
Diversity can be measured along several axes. One of them, domain diversity, concerns how topics or domains are represented in the data. Other axes also exist beyond domains. These include the number of tokens in the context and the response, the number of conversational turns, and the proportion of human-written data compared with AI-generated data.
Diversity Depends on the Application
Not every application needs the same kind of variety. The right amount and kind of diversity is determined by what the system is supposed to do. The source contrasts two systems to make this concrete.
Diversity Versus Quality
Diversity is not the same as quality. Quality concerns properties such as accuracy and cleanliness of the data. Diversity concerns the variety of what the data covers. A dataset can score high on one and low on the other. The two properties are separate, and a team should check both.
Consider a thought experiment. Take a set of carefully checked, accurate answers that all address the same narrow kind of question. The data is high in quality but low in diversity. Now take a large pile of varied but sloppy text, with many errors and irrelevant fragments. That data is diverse but low in quality. Neither set alone is ideal. A model needs data that is both varied enough to cover its users and accurate enough to teach correct behavior.
What do you think happens?
Three models are each finetuned on 2,000 examples. One dataset is high-quality but not diverse, one is diverse but low-quality, and one is both. Which model generates the best output?
Reveal answer
The model trained on data that is both diverse and high-quality.
Because the dataset size was held fixed, the difference in results can 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.
Reading the Controlled Comparison
Three Datasets, One Fixed Size
Researchers Zhou and colleagues, reported in 2023, finetuned a 7-billion-parameter language model on three datasets. Each contained 2,000 examples. What does the comparison show about diversity and quality?
- 1Hold size constant
All three datasets contain 2,000 examples, so the number of examples cannot explain differences in the resulting models.
- 2Vary the character of the data
The first dataset is high-quality but not diverse. The second is diverse but low-quality. The third is both diverse and high-quality.
- 3Compare the generation quality
The model finetuned on the third dataset outperformed the models finetuned on either of the other two.
- 4Draw the conclusion
Quality and diversity contribute different things, and the combination matters more than either property alone.
Diversity and quality are separate properties, and the strongest results came from data that had both.
Reasoning About the 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 source describes two broad approaches. The simplest is to 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. A more principled approach uses experiments to find the best mix.
In one example, 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.
- 1Describe the application and the real usage it receives, including the topics, styles, and formats that appear in practice.
- 2Choose a candidate mix whose proportions reflect that real usage.
- 3Where possible, train small models on each candidate mix and compare how they perform.
- 4Use those results to predict which mix will serve the application best, then select it.
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.
Put the millions of examples in perspective. Pre-training a foundation model from scratch uses far more text. The source gives Llama 2 as trained on 2 trillion tokens. If each example were 2,000 tokens long, that total would correspond to about 1 billion examples. The source gives Llama 3 a much larger token count, which points the same way. 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.
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.
The two paths start from different places. Finetuning begins with a pre-trained model, and the question is how its existing weights adjust to the application data. Training from scratch begins with an untrained model, and all of what it learns comes from the data it consumes. In the typical finetuning 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.
Mistakes Teams Make With Data
Common mistake Treating diversity and quality as the same property
What it looks likeA team cleans a narrow set of answers very carefully and assumes the resulting dataset is ready for a varied audience.
Why it failsThe two properties are separate. Accurate data can still cover only one style or topic, and diverse data can still be sloppy.
Do this insteadCheck both properties separately and aim for data that is both diverse and high-quality.
Common mistake Assuming one fixed data mix fits every stage
Why it failsThe best mix differs by phase of building a model, and the share of general English knowledge climbs sharply during preference finetuning while math, reasoning, and coding shrink.
Do this insteadReason about the mix separately for each stage, reflecting the real usage the stage is meant to serve.
Common mistake Building training data only from polished examples
What it looks likeA chatbot is trained only on well-formed questions and then receives long, terse, or misspelled requests.
Why it failsThe model has seen one style of asking and may not recognize other styles as the same kind of problem.
Do this insteadInclude the variety of styles, lengths, and formats that real users actually produce.
Common mistake Finetuning by default whenever a lot of data exists
Why it failsFinetuning is typically more efficient, but it can be worse, especially when a team has a large amount of training data.
Do this insteadEvaluate whether training from scratch would improve performance before choosing finetuning.
Practice: Planning a Recipe Assistant
A team is building a recipe assistant that will be used by home cooks in many countries. Users ask about ingredients, substitutions, and cooking times, sometimes in full sentences and sometimes in short fragments, and in several languages. The team has a large set of carefully checked answers about baking, but almost no examples in other cooking styles or languages. Describe which kinds of diversity the team should examine, explain why the baking-only set is not sufficient even though its answers are accurate, and outline how the team could reason about the right data mix.
Hints
- Think about the application: which kinds of variety does a global, multi-language product need, based on the chatbot discussion?
- Separate the two properties: the baking answers are accurate, but what does that say about their diversity?
- Consider the two approaches to a data mix: reflecting real usage, and running experiments on candidate mixes.
Key Takeaways
- 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 depends on the application. A fixed-language tool may need topic and style variety, while a global chatbot also needs linguistic and cultural variety.
- Data quality and data diversity are separate properties. In the cited controlled comparison, the strongest results came from data that was both diverse and high-quality.
- The right data mix depends on the application. Teams reflect real usage and, where possible, run experiments that predict how candidate mixes affect performance.
- Finetuning on a pre-trained model is typically more efficient than training from scratch, but it is not always better. Evaluate both options, and remember that smaller models are more susceptible to ossification.