Concepts / How Language Models Learn from Text

How Language Models Learn from Text

Large training datasets for GPT- and BERT-like models are diverse, comprehensive text corpora measured in billions of words.

  • Programming

What Did the Model Get to See?

A large language model does not arrive knowing how language works. It learns patterns from text, and the text it learns from is its training dataset. Before asking how a model behaves, it helps to ask what it was shown. The answer shapes a great deal of what the model can do later, so the size and variety of its training material are central to the whole process, not background details.

This article follows one question through the material: why do the datasets behind popular models need to be both enormous and varied? You will see what those datasets contain, how their scale and diversity connect to the range of tasks a model can handle, and how to read a concrete example of one such dataset.

What a Training Corpus Contains

Definition

A corpus is a collection of written material gathered to train a model. The large training datasets used for popular GPT-like and BERT-like models are text corpora that are described as diverse and comprehensive, and they are measured in billions of words.

The contents of these corpora cover a vast array of topics. They also include two broad kinds of language. Natural languages are the human languages used for everyday communication. Computer languages, such as programming languages, are the other kind. A corpus that contains both gives a model exposure to the patterns of human writing and to the structured patterns of code.

Two properties define the corpus described in the reference material. The first is scale: the corpus is measured in billions of words, which is far more text than any single person could read in a lifetime. The second is breadth: the text is not limited to one subject or one kind of writing. A corpus that mixes many topics and many languages shows the model many different ways of arranging words and ideas.

Tracing What the Model Is Shown

Follow a single passage of training text through the pipeline in your head. It starts as raw written material inside a corpus. The model sees it as a stream of words that it uses to learn patterns. Each piece of text the model reads adds to its experience of language. Because the corpus is both large and varied, the model's experience includes many topics, many arrangements of words, and both human and programming languages.

Reads left to rightHides some tokensPredicts the nexttokenFills in maskedtokensthenthen
How a GPT-style model uses a sentence differs from how a BERT-style model uses it: one predicts the next token from left to right, the other fills in masked tokens using context on both sides.

Two Ways a Model Uses a Sentence

The reference material names both GPT-like and BERT-like models as the families whose large training datasets it describes. The two families differ in how they use the same sentence during learning. A GPT-style model reads text from left to right and predicts the next token. A BERT-style model hides some tokens and fills them in using context from both sides of the hidden position.

The difference does not change the core lesson of this article. Either way, the model learns only from the text it is given. A corpus that is large and varied gives either style of model many more chances to observe how words, topics, and languages fit together.

From Dataset Size to Task Range

A corpus on its own is only raw material. What gives it value is what a model can do after learning from it. The reference material states the central takeaway directly: the scale and diversity of the training dataset allow these models to perform well on diverse tasks. The tasks it names are language syntax, which concerns how words are arranged into valid structures; semantics, which concerns meaning; and context, which concerns how meaning shifts with surrounding text. Some of those tasks also require general knowledge.

Training corpusScale: billions ofwordsPerformance on variedtasksSyntaxDiversity: manytopics and languagesSemanticsContextGeneral knowledgehashassupportssupportsincludesincludesincludesincludes
A training corpus is large and varied, and both properties support performance across varied tasks such as syntax, semantics, context, and some tasks requiring general knowledge.
Key point

The source says scale and diversity allow good performance across varied tasks. It does not say they guarantee it, and it does not claim they are the only ingredient in a model. The reasoning chain is: a broad, large body of text gives the model a wide base of experience with language, and that base supports many different kinds of tasks.

Reading the GPT-3 Pretraining Dataset

Abstract descriptions are easier to trust when you can point to a real case. The reference material gives one: the dataset used for pretraining GPT-3. Pretraining is the stage where a model learns from a large corpus before it is applied to particular uses. GPT-3 matters here for a specific reason: it served as the base model for the first version of ChatGPT. That places its dataset at the foundation of a model many people encountered directly.

The composition of that dataset is summarized in Table 1.1, which the reference material places alongside its description of the training corpora. The per-source figures are not reproduced in the material available for this article, so this lesson teaches you how to read the table rather than quoting its numbers.

Worked example

Reading a dataset summary the way the reference does

You are given a summary of the GPT-3 pretraining dataset in Table 1.1. What does its composition tell you about the model?

  1. 1
    Ask how large the corpus is

    Scale is the first property. The reference describes these corpora in billions of words, so look for the total size and confirm it is measured on that scale.

  2. 2
    Ask what range of topics it covers

    Breadth is the second property. A table that lists many different kinds of sources suggests the text spans many subjects and styles rather than one narrow area.

  3. 3
    Ask which languages it includes

    The reference says these corpora include both natural languages and computer languages. Check whether the summary shows both kinds.

  4. 4
    Connect the three answers to task range

    Together, the size, topic range, and languages describe the scale and diversity that the reference links to good performance on varied tasks such as syntax, semantics, context, and some general knowledge tasks.

Result

A summary like Table 1.1 tells you how much text the model learned from, how broad that text is, and which languages it covers. Those three facts give you a grounded way to explain why the model can handle many kinds of tasks, without assuming the dataset alone guarantees any particular result.

Mistakes Readers Make About Training Data

  • Common mistake

    Treating a large corpus as automatically giving good performance on every task

    Why it fails

    The source says scale and diversity allow good performance across varied tasks. It does not say they guarantee it, and it names them as one part of what matters.

    Do this instead

    Describe scale and diversity as enabling broad capability, and keep in mind that they are not the only ingredient in a model.

  • Common mistake

    Thinking diversity only means many topics

    Why it fails

    The reference describes diversity as covering a vast array of topics and including both natural languages and computer languages.

    Do this instead

    When you check a dataset, look at both the subjects covered and the kinds of language included.

  • Common mistake

    Quoting the GPT-3 table figures from memory

    Why it fails

    The per-source figures in Table 1.1 are not reproduced in the material for this article, so any specific share would be invented.

    Do this instead

    Read the table directly and use the three questions of size, topic range, and languages to interpret it.

  • Common mistake

    Assuming the words in a corpus are all the same kind of writing

Checking Your Reading of a Dataset

MEDIUM

A training corpus is described as measured in billions of words, covering many topics, and including both natural languages and computer languages. Using only that description, explain in two or three sentences why this corpus could support good performance on varied tasks such as syntax, semantics, and context. Then state one thing the description does not prove.

Hints
  • Start with the two properties the reference names: scale and breadth.
  • Link each property to the kinds of tasks the reference lists.
  • Remember the source uses the word allow, not guarantee.

Key Takeaways

  • Large training datasets for GPT-like and BERT-like models are corpora of diverse, comprehensive text measured in billions of words, covering many topics and including both natural and computer languages.
  • Scale and diversity are described as allowing these models to perform well on varied tasks, including syntax, semantics, context, and some tasks requiring general knowledge.
  • The scale and diversity are described as enabling good performance, not guaranteeing it, and they are not the only ingredient in a model.
  • The GPT-3 pretraining dataset, summarized in Table 1.1, is a concrete case: it was the base for the first version of ChatGPT, and reading it means asking how large it is, what topics it covers, and which languages it includes.

More concepts starting with H