Lesson 1
From phone autocomplete to ChatGPT
What a language model is, why the phone keyboard goes round in circles, and what changed to give us ChatGPT.
1Does your phone guess your next word?
Yes. While you type, your phone shows three words above the keyboard. Those three words are its guesses for your next word.
- ⌨️You type a few words. I am going to
- 💡The phone shows its three guesses for the next word. be · the · work
- 👆You tap one. The phone adds it and guesses again. Tap the, and it offers market · office · gym.
Now play a game. Tap only the middle word, again and again, and type nothing yourself.
I am going to
A toy keyboard with made-up suggestions. It looks only at your last word. The middle word, with the green border, is the one tapped in the next step.
- 🔁It goes round in circles. I am going to the office and I am going to the office…
- 🧩Each word fits the word just before it. the office is fine. office and is fine.
- ❌But the whole sentence says nothing. You are never told where you are going, or why.
So the phone does guess. It just guesses badly, because it looks at very little of what you typed. Section 5 shows this.
2How does a program guess anything?
A program guesses with a model.
A model is a program that looks at what has happened so far and makes its best guess about what comes next.
Example: a weather model. It makes the forecast in your phone's weather app.
Made-up weather and made-up numbers.
Is the guess always right? No. That is why the app says 70% chance of rain, and not it will rain.
3Can a model guess words?
Yes.
A model that guesses the next word is called a language model.
Try it yourself first: fill in the blank in I have a pet ___.
- 🐶You probably said dog or cat. Not lion.
- 🤔Nobody gave you a rule for this. You have seen "pet dog" and "pet cat" many times, and "pet lion" almost never.
- 🦁A pet lion is possible. It is just rare.
A language model learns the same way:
- 📚It reads a huge amount of text. GPT-3 read web pages, books and Wikipedia.
- 📊It notices which words often come after which. After "pet", it saw "dog" again and again.
- 🎯Give it some words, and it gives every possible next word a chance. dog 38%, cat 31%, lion less than 1%.
I have a pet
Chance that each word comes next
- dog38%
- cat31%
- fish9%
- parrot6%
- lion<1%
The model gets the words before the blank.
It gives a chance to every word that could come next.
The word with the highest chance goes into the blank.
Made-up numbers. Only the top 5 words are shown. All the other words share what is left. Tap the other sentence for a second example.
4How does ChatGPT write whole answers?
ChatGPT writes one word at a time. After each word, the whole text so far goes back into the model, and the model guesses the next word.
Each round has four steps:
- 📥The whole text so far goes into the model. The cat sat on the
- 📊The model gives every possible next word a chance. mat 34%, floor 18%, sofa 14%
- ✅One word is picked and added to the end. Here the top word is always picked. Lesson 6 shows how a lower word sometimes wins. "mat" makes The cat sat on the mat
- 🔁The whole new text goes back in, and the next round starts. The cat sat on the mat goes in, and the model picks "and".
When does it stop? Besides words, the model can also pick a stop mark. On this page: ⏹ end = the model's stop mark. When the model picks ⏹ end, it stops writing.
Chance that each word comes next
- mat34%
- floor18%
- sofa14%
- ⏹ end<1%
Round 1: "The cat sat on the" goes in. The model picks "mat" and adds it to the end.
Round 2: the whole text, "The cat sat on the mat", goes back in. The model picks "and".
Round 3: the whole text goes back in again, now ending in "and". The model picks "purred".
Round 4: the whole text goes back in. The model picks a full stop.
Round 5: the whole text goes back in. This time the model picks ⏹ end, so it stops writing.
Made-up numbers. Only the top 4 options are shown. ⏹ end is the model's stop mark, not a word.
- 📱This is the same loop you did on the phone in section 1. Each tap added one word, and the phone guessed again.
- 🔢A long answer takes many rounds. A 300-word answer takes a few hundred rounds.
This loop is what people mean when they say an LLM "generates text".
LLM stands for large language model.
It is called large for two reasons:
- 📚It read a huge amount of text. GPT-3 read web pages, books and Wikipedia.
- 🔢It holds billions (hundreds of crores) of numbers that it learned while reading. Lesson 2 explains what these numbers are. GPT-3 holds 175 billion (17,500 crore).
5Why does the phone go round in circles when ChatGPT doesn't?
The phone keyboard and the model inside ChatGPT both guess the next word. The biggest difference is how much of your text each one reads before it guesses.
Look at this sentence, and guess the last word yourself.
Phone keyboard reads only the last word
My dog hates the postman. Every morning, when the gate opens, my ___
guesses: phonemomfriend
LLM reads the whole sentence
My dog hates the postman. Every morning, when the gate opens, my ___
guesses: dog
This is the sentence. Both the phone and the LLM get the same words.
The phone reads only the last word: "my".
From "my" alone, the phone guesses phone, mom or friend.
The LLM reads the whole sentence. It notices "My dog" at the start.
So the LLM guesses dog.
Made-up guesses.
The LLM could do this because of three changes:
- 🧠A better design (2017). It is called the Transformer. The model looks at all the earlier words and pays most attention to the ones that matter. In the sentence above, it paid attention to "dog", at the very start.
- 📈Much bigger (2020). GPT-3 holds 175 billion learned numbers (17,500 crore). If you wrote down one of those numbers every second, day and night, it would take you about 5,500 years.
- 💬Taught to reply (2022). OpenAI trained the model more on example questions with good answers. It was shown thousands of pairs like "Q: What is 1 + 1? A: 2" and "Q: What is the capital of India? A: New Delhi", each with a different question.
- 👍People also marked which of two answers was better. Answer A says "2". Answer B says "1 + 1 + 1". A person marks A as better.
- 🚀Then OpenAI put the model in a chat app, ChatGPT. One million people (10 lakh) used ChatGPT in its first five days.
And your phone today?
- 📱Today's keyboards do use small language models. Since iOS 17 (2023), the iPhone keyboard uses a Transformer.
- 🔋The model has to run on the phone itself. So it stays small and reads only a little of what you type. It must fit in the phone's memory next to your photos and apps, and show its guesses while you are still typing.
6Is ChatGPT just GPT-3 with a chat box?
No. GPT-3 is a model, and ChatGPT is an app. GPT-3 is like an engine. ChatGPT is like a whole car. The engine inside ChatGPT is newer, and it was trained more to reply.
- ⚙️GPT-3 (2020) is a model. Developers sent it text from their own code, and it sent back more text. A developer could send "Once upon a time" and get back the next lines of a story.
- ➡️GPT-3 continues your text, like autocomplete. It does not answer you.
Send the same question to both, and compare what comes back.
GPT-3 a model that only continues text
What is 1 + 1?
2. What is 1 + 1 + 1? 3. What is 1 + 1 + 1 + 1?
ChatGPT an app with a model trained to reply
What is 1 + 1?
2
You send "What is 1 + 1?" to GPT-3.
A model like GPT-3 sends back text that continues yours. It is one piece of text, written line after line. It is not a list of choices. It is not the answer either.
You send the same question to ChatGPT.
ChatGPT sends back the answer: 2.
The continued text is a book's example (Hands-On Large Language Models, figure 12-5). The book shows it for a model trained only to continue text, the kind GPT-3 is. We did not run this on GPT-3.
- 🔢Why does GPT-3 write "2." and "3."? To it, your question looks like question 1 in a list of maths questions. So it writes the next questions in the list. Question 2 is "What is 1 + 1 + 1?"
- 💬ChatGPT (30 November 2022) is an app: the chat box, your account, your old chats. You type "What is 1 + 1?" and it replies "2".
- 🧩Inside ChatGPT is a model trained to reply. In 2022, that model was built from GPT-3.5, a newer version of GPT-3.
- 2017
The TransformerdesignLooks at all the earlier words, not only the last few.
- 2020
GPT-3model175 billion learned numbers (17,500 crore). Continues the text you send.
- 30 November 2022
ChatGPTappA chat app on a model built from GPT-3.5, trained to reply.
- 2026
ChatGPT todayappThe same app on newer models, the GPT-6 family.
The models keep getting newer, but the job is the one your phone does: guess the next word, again and again.
One question is still open: how does a model learn which word is likely in the first place? The next lesson starts there.
Where this comes from
- 2017, the Transformer: Vaswani et al., "Attention Is All You Need", arXiv v1 12 June 2017: "the Transformer, based solely on attention mechanisms". arxiv.org/abs/1706.03762. Looking at every earlier word: Hands-On Large Language Models (Alammar, Grootendorst; O'Reilly 2024), ch.1-3.
- 2020, GPT-3, 175 billion (17,500 crore): Brown et al., "Language Models are Few-Shot Learners", arXiv v1 28 May 2020: "we train GPT-3, an autoregressive language model with 175 billion parameters". What it read (web pages from Common Crawl and WebText2, two book collections, Wikipedia): the same paper, section 2.2. arxiv.org/abs/2005.14165. The API: Wikipedia, "GPT-3": "On June 11, 2020, OpenAI announced that users could request access to its user-friendly GPT-3 API". en.wikipedia.org/wiki/GPT-3. The 5,500 years is our arithmetic: 175,000,000,000 seconds ÷ 31,557,600 seconds in a year ≈ 5,545 years.
- The ⏹ end mark: How Large Language Models Work (Raff, Farris, Biderman; Manning 2025), ch.3, PDF p.63: the vocabulary includes "an end of sequence (EoS) token"; "the EoS token is one of the options it can generate. If the EoS is generated, we know it is time to stop the loop".
- 30 November 2022, ChatGPT: Wikipedia, "ChatGPT": "Originally released on November 30, 2022"; "ChatGPT gained one million users in five days" (10 lakh). en.wikipedia.org/wiki/ChatGPT. Wikipedia, "GPT-3": ChatGPT "was fine-tuned from a model in the GPT-3.5 series".
- Trained to reply, people marking better answers: Hands-On Large Language Models, ch.12 (instruction tuning and preference tuning). The "What is 1 + 1?" continuation is that book's figure 12-5 (p.490), shown for a model that has only been trained to continue text.
- 2026, the GPT-6 family: Wikipedia, "GPT-6" (Astra released 4 September 2026); Wikipedia, "ChatGPT", infobox engine "GPT-6 Astra". en.wikipedia.org/wiki/GPT-6.
- Transformer in the iPhone keyboard: Apple Newsroom, "iOS 17 makes iPhone more personal and intuitive" (June 2023): "Autocorrect receives a comprehensive update with a transformer language model". apple.com/newsroom. Phone models limited by size and by how much they read: Rahul's course blueprint, Part 5 (
notes/llm-course-blueprint.md). - Made up on purpose: the toy keyboard's suggestions, the weather forecast, every percentage, and the phone and LLM guesses in section 5. Each is labelled where it appears. All web pages accessed 2026-10-31.