Understanding AI · lesson 45 of 60 · about 5 minutes
Learning from the Internet
Large language models learn from a huge share of the world's text. See what that training actually teaches them.
What you'll learn
- Explain what a large language model is
- Describe how it learns from huge amounts of text
- Explain what it picks up along the way
A giant next-word guesser
A large language model (LLM) is the giant neural network behind a chatbot. Large means billions of weights, trained on a huge amount of text: books, websites, articles, code.
The training task is simply our next-word game, played trillions of times: hide the next token, guess it, adjust the weights to guess better.
What it picks up
To get good at guessing the next word in everything people write, the model has to pick up grammar, facts that are written down often, styles of writing, even patterns of reasoning. Nobody teaches these directly: they're whatever helps predict text.
This first stage is called pre-training.
A training game made from one sentence: for each position, the words so far and the word to guess.
words = "the sky is blue".split()
for i in range(1, len(words)):
print(words[:i], "->", words[i])Output
['the'] -> sky
['the', 'sky'] -> is
['the', 'sky', 'is'] -> blueTip
Pre-training teaches language and facts, but not yet how to be a helpful assistant.
Now try it yourself
This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.