Concepts / Engineering Considerations in Training Large Models

Engineering Considerations in Training Large Models

Self-supervision lets a model infer labels from the input itself, which helps overcome the data labeling bottleneck.

  • Programming

Teaching a Model Without Writing Answers

Suppose you want a model to predict the next word in a sentence. The most direct approach is to collect many examples and have people write down the correct answer for each one. That approach works, but it is slow, expensive, and hard to scale. Every new task seems to demand a new round of human annotation. Researchers call this the data labeling bottleneck, and it is one of the main reasons machine learning projects stall before they reach useful performance.

This lesson follows one idea from start to finish. Self-supervision avoids most of that annotation cost by letting the model work out its own labels from the input data. The raw text already contains the answers. Training only has to be arranged so that those answers are revealed to the model in the right way. We will trace what happens to a single unlabeled sentence, then look at why bigger models raise the question of how much data is enough.

Where the Labels Come From

In manual labeling, a person looks at each example and attaches the correct output. The labels are an extra product that someone has to create, and the process has to be repeated for each new task. In self-supervision, no separate annotation step is required. The model is set up so that it can derive the correct output from the input it already has.

The difference matters for scale. Manual labeling grows with the number of examples someone has to annotate, which is why it is described as slow and hard to scale. Self-supervision draws its labels from text that is already available, so the labeling step does not have to be repeated by people for every new example.

Splitting Input into Context and Target

The key idea is to split each piece of input into two roles. One part serves as the context that the model is allowed to look at. The other part serves as the target that the model must predict. Because the target comes from the input itself, no separate annotation step is needed. The same text that feeds the model also tells you what the correct output should have been.

Language modeling fits this pattern naturally. Each input sequence provides two things at once: the tokens the model should predict, and the surrounding tokens the model can use as context when making that prediction. Nobody needs to write the answers down, because the sequence already contains them.

Tracing One Sentence Into Samples

Take the sentence 'The cat sat down.' and treat each word and the final period as a token. Starting from the first token, every position after the first gives one training sample. The words before that position form the context, and the current token is the target. Each token after the first is therefore a target exactly once.

Worked example

Turning 'The cat sat down.' into training samples

Starting from the first token, list each training sample as a pair of context and target for the sentence 'The cat sat down.' with tokens The, cat, sat, down, and the period.

  1. 1
    Identify the tokens

    The tokens are The, cat, sat, down, and the final period.

  2. 2
    Skip the first token as a target

    The first token has no preceding words to act as context, so it does not produce a sample on its own.

  3. 3
    Build sample 1

    The context is only The, and the target is cat.

  4. 4
    Build sample 2

    The context is The cat, and the target is sat.

  5. 5
    Build sample 3

    The context is The cat sat, and the target is down.

  6. 6
    Build sample 4

    The context is The cat sat down, and the target is the period. The pattern ends here because the period is the last token.

Result

Four training samples come from one unlabeled sentence, and no human wrote any of the four labels.

Notice what changes from one sample to the next. The context grows by one token each time, and the target moves one position to the right. The label for each sample is simply the token that comes next in the original text. The same rule applies to any sentence, so the number of samples depends on how many tokens the sentence contains after the first one.

Predict Before You Count

What do you think happens?

Using the rule that every token after the first gives one sample, how many training samples does 'The cat sat down.' produce?

  • Three

  • Four

  • Five

  • Six

Reveal answer
Answer:

Four

There are five tokens: The, cat, sat, down, and the period. Every token after the first is a target once, which gives four targets and therefore four samples.

Why Bigger Models Need More Data

Once models can be trained without labels, a second question follows: how much data does a model need? The source material points out that model size changes what counts as small or large. At the time of writing, a model with 100 billion parameters was considered large, and the source expects that such a figure may one day seem modest. Size is therefore relative, but the relationship between size and data stays the same.

Definition

Capacity is the room a model has to absorb patterns from its training material. A model with more capacity can represent more detail.

Capacity is only useful if it is filled. A model with more capacity can represent more detail, but it can only use that room if it is given enough examples. Without enough data, the extra capacity has nothing to learn from, so it contributes little to performance. For that reason, larger models need more training data to reach their best results.

Compute Waste on Small Datasets

Training is not free. When a large model is trained on a small dataset, the compute spent on it is not matched by the amount of material it can learn from. The unused part of the model's capacity sits idle, and the compute budget that paid for it is spent on a model that a smaller model could have used well.

Common Mistakes With Self-Supervised Samples

  • Common mistake

    Assuming the first token becomes a target

    What it looks like

    Treating 'The' as a target in 'The cat sat down.'

    Why it fails

    The first token has no words before it to serve as context, so it does not produce a sample.

    Do this instead

    Start producing samples from the second token onward.

  • Common mistake

    Counting words instead of tokens

    What it looks like

    Counting three words in 'The cat sat down.' and expecting three samples

    Why it fails

    The rule works on tokens, and the final period is also a token that serves as a target.

    Do this instead

    List the tokens first, including punctuation, then count the positions after the first one.

  • Common mistake

    Believing a label must be written by a person

    What it looks like

    Waiting for annotators to attach the next word before training can start

    Why it fails

    In self-supervision the target comes from the input itself, so no separate annotation step is required.

    Do this instead

    Split the existing text into context and target.

  • Common mistake

    Believing that more parameters always improve results regardless of data size

Practice Tracing a New Sentence

EASY

Take the sentence 'Birds fly.' Treat each word and the period as a token. List every training sample as a context and target pair, then state how many samples the sentence produces.

Hints
  • Count the tokens first: Birds, fly, and the period.
  • The first token never becomes a target, so start with the second token.
  • Each sample's context is every token that comes before its target.

Mechanism Recap

Self-supervision removes the need for a separate annotation step by splitting each input into context and target. In language modeling, one unlabeled sentence yields a training sample for every token after the first. Larger models have more capacity, so they need more training data to use that capacity well, and training a large model on a small dataset wastes compute.

Key Takeaways

  • Self-supervision lets a model infer labels from the input itself, which helps overcome the data labeling bottleneck.
  • In language modeling, each input sequence supplies both the context and the target tokens to predict.
  • Every token after the first in a sentence serves as a target once, so one sentence yields several training samples.
  • Larger models have more capacity and need more training data; training a large model on a small dataset wastes compute.

Related concepts

More concepts starting with E