Lesson 01.03
What is a language model?
You will be able to explain how a language model uses patterns learned from text to predict possible continuations.
What you’ll do
- RelateYour phone already does something familiar
- ExplainTry predicting what comes next
- ExperimentEarlier words change the prediction
- ApplyWhat this means when building an app
- ReflectRemember the idea
- Check3 questions, with feedback
Your phone already does something familiar
Remember the fruit experiment? Before moving on, think: did the computer start with a rule for every fruit, or did it learn from examples?
Quick check
Now imagine texting a friend. You type “See you” and your phone offers a few suggestions. Which one would you pick?
Text description
An unfinished message on an illustrated phone reads See you, with three possible suggestions: soon, later and tomorrow.
You can probably imagine several endings without thinking hard. You have seen and heard similar phrases before. That experience helps you anticipate what might come next.
Try predicting what comes next
PredictFinish the message
Pick the continuation that feels most natural in each situation. These are authored examples, not measured model probabilities.
Case 1 of 3
It's raining outside. Don't forget your …
You have just used familiar patterns in language to anticipate what comes next.
A language model is a computer model that learns patterns in language. A typical generative language model uses the text it receives to predict possible continuations.
A large language model (LLM) is a language model built and trained at large scale. It can produce much more than a phone suggestion, such as explanations and code. The phone example helps us understand prediction, not all the abilities of modern models or how they work internally.
Earlier words change the prediction
Imagine a friend says, “I put on my…” You might need more information to guess the next word. Try the same ending with two different situations.
PredictChange the situation
Pick the best everyday fit. There can be other reasonable continuations; the choices here are illustrative.
Case 1 of 2
Before going outside in the rain, I put on my …
The information already supplied is called context. The two situations ended with the same words, but the earlier words changed what made sense.
Remember this: change the context, and the likely continuation can change.
What this means when building an app
Imagine our learning app receives the question “Explain arrays.” If we also tell the model “Explain to someone who has never programmed,” we provide different context from “Explain to an experienced JavaScript developer.” That can change the explanation it generates.
These are example answers written for the lesson, not actual model outputs. In an application, you can give a model useful context, but you still need to check whether the response is correct.
Remember the idea
Common misconception
MisconceptionA language model must store a separate answer for every question.
A better understandingA generative language model uses learned patterns to produce text. It may memorize some training material, but it does not need a separate predefined answer for every question. A plausible answer is not a guarantee of truth.
Exercise
Explain it to a friend
Without looking back, explain a language model using the phone-suggestion example. Then explain why the earlier words in a message matter.
What you might observe
A language model learns patterns in language and uses the text it receives to predict possible continuations. Different context can change what comes next.