How Large Language Models Are Pretrained
A token is a unit of text that a model reads, and dataset sizes are commonly reported as token counts, which roughly track the number of words and punctuation characters.
Size Is Not the Whole Story
When people describe a large language model, they often talk about its size in parameters or about the amount of computing used to build it. A second question matters just as much: what did the model see during training? Before a model can learn anything, someone has to decide which text goes into its training collection, how much of each kind of text is included, and how that collection is measured.
The GPT-3 model gives a concrete case study. Its pretraining collection was assembled from several sources, and the way those sources were combined shows a great deal about what the model learned to imitate. This article follows one dataset table through three questions: what unit the table measures the data in, where the data came from, and how much of it the model actually consumed. Each question changes how you read the numbers, so we will take them in order.
What do you think happens?
The GPT-3 dataset table totals 499 billion tokens, and the model was trained on 300 billion tokens. Do you think the model read every token in the collection?
Reveal answer
No, the model read only 300 billion of the 499 billion tokens.
The collection contains more tokens than the model was trained on. The source reports both numbers but does not explain the difference, so keep the two figures separate in your head as you read on.
Tokens as the Unit of Measure
A token is a unit of text that a model reads. Dataset sizes are commonly reported as token counts, and a token count roughly tracks the number of words and punctuation characters in the text.
Why count tokens instead of documents? A document can be a single sentence or a very long article, so counting documents says little about how much text a model has seen. Counting tokens measures the text itself. A collection of ten short documents and a collection of ten long ones may differ enormously in volume, and the token count captures that difference while the document count does not.
The source gives a helpful rule of thumb: the number of tokens in a dataset is roughly equal to the number of words and punctuation characters in that text. Treat this as an estimate of text volume rather than an exact word count, because the rule is approximate.
The step that turns raw text into these units is called tokenization, the process of converting text into tokens. This article does not cover its detailed mechanics, which come in a later chapter. The important idea is the direction of the transformation: human-readable text goes in, a sequence of token units comes out, and only that sequence is what the model reads.
Estimating the token count of one question
Estimate how many tokens the sentence Is this a question? contributes, using the rule that tokens roughly equal words plus punctuation characters.
- 1Count the words
The words are Is, this, a, and question, which gives 4 words.
- 2Count the punctuation
The sentence ends with one question mark, which gives 1 punctuation character.
- 3Add them together
4 words plus 1 punctuation mark gives an estimate of 5 tokens.
The sentence contributes roughly 5 tokens. This is an estimate, not an exact count, because the rule is approximate.
Where the Pretraining Data Came From
The GPT-3 pretraining collection drew on five named datasets, which fall into two broad families. Some are web crawl data, gathered by automatically collecting pages from the internet. Others are internet-based book collections or high-quality text. The table lists each dataset with a short description, its size in tokens, and its share of the training data.
- CommonCrawl (filtered): web crawl data, led the mix at 60 percent of the sampled training data
- First book collection: internet-based book collection, 8 percent of the training data
- Second book collection: internet-based book collection, 8 percent of the training data
- Remaining two sources: the other two datasets in the table, which together account for the rest of the mix. The pack gives no separate names or shares for them, so their combined share is worked out in a later section.
The two book collections are given equal weight at 8 percent each, even though their token counts differ. This is the key lesson of reading the table: the share column reflects the mix of the sampled data, while the token column reports sizes. Reading the two columns side by side reveals differences that either column alone would hide, so always check both.
Available Tokens Versus Tokens Trained On
The token column totals 499 billion, but the model was trained on 300 billion tokens. These are two different claims. The 499 billion figure describes what the collection contains, while the 300 billion figure describes what the training run consumed. A model can be trained on only part of a collection.
This distinction matters whenever you compare datasets from published papers. A figure describing what a collection contains is a different claim from a figure describing what a training run consumed. When you read a composition table, ask which of these two numbers the author is reporting.
Checking a Composition Table
The proportion column describes the mix of the sampled data and sums to 100 percent once rounding is allowed for. You can use that fact as a check. If the listed shares add up to something far from 100, the table is internally inconsistent, or it is describing something other than a complete mix.
Checking the known rows of the GPT-3 table
CommonCrawl (filtered) is 60 percent, and each book collection is 8 percent. Do these three rows leave a sensible share for the other two sources?
- 1Add the known shares
60 plus 8 plus 8 gives 76 percent.
- 2Find the remainder
The whole mix must reach 100 percent, so 100 minus 76 leaves 24 percent.
- 3Interpret the result
The other two sources must together account for 24 percent. That is a plausible remainder, so these three rows are consistent with a full mix.
The two remaining sources must together hold 24 percent of the training data. The pack does not give their individual shares.
A composition table lists five sources with shares of 60, 8, 8, 20, and 10 percent. Add the five shares. Is the table internally consistent, and what would you check next?
Hints
- Add all five numbers before deciding anything.
- Compare your total with 100 percent, allowing only a small amount for rounding.
- If the total is wrong, check whether one row was copied incorrectly or whether the table describes a different quantity.
Mistakes When Reading Token Counts
Common mistake Treating a token count as an exact word count
What it looks likeReading 5 tokens for Is this a question? and assuming there are exactly 5 words.
Why it failsThe rule that tokens roughly track words and punctuation is approximate.
Do this insteadTreat token counts as estimates of text volume.
Common mistake Counting documents instead of tokens to measure dataset size
What it looks likeJudging two collections by their document counts alone.
Why it failsDocuments vary widely in length, so a document count does not measure how much text is present.
Do this insteadUse token counts when comparing how much text a dataset holds.
Common mistake Assuming the whole collection was used in training
What it looks likeReading 499 billion tokens and concluding the model saw 499 billion tokens.
Why it failsThe source reports 300 billion tokens of training, which is less than the collection total.
Do this insteadKeep the available total and the trained-on total as separate numbers.
Common mistake Reading only one column of a composition table
What it looks likeRanking sources by token count and assuming that ranking matches their share of the mix.
Why it failsThe two book collections have equal shares of 8 percent even though their token counts differ.
Do this insteadRead the token and share columns side by side.
Key Takeaways
- A token is a unit of text a model reads, and dataset sizes are reported as token counts that roughly track words plus punctuation characters.
- The GPT-3 pretraining collection combined five sources in two broad families, led by CommonCrawl (filtered) at 60 percent, with two book collections at 8 percent each.
- The dataset total of 499 billion tokens describes what the collection contains, while the model was trained on 300 billion tokens, and the source does not explain the difference.
- A composition table's proportions should sum to 100 percent once rounding is allowed for, so add the shares to check consistency before trusting the table.