Open any messaging app on your phone and start typing. Before you finish the sentence, the keyboard offers you a next word. You tap it, and it offers another one. Most of us stopped noticing this years ago, but it is a surprisingly good way to understand what an LLM is.
A large language model does the same job as that keyboard suggestion, just on a far bigger scale and with far better guesses. If you have ever wondered how tools like ChatGPT manage to write whole paragraphs, the answer starts with that one small trick, repeated over and over.
One quick note before we go further, because the letters are shared. In this course, LLM means large language model, the kind of AI behind modern chatbots. It has nothing to do with the Master of Laws degree, which uses the same abbreviation.
This is Lesson 1 of a free course where you will build your own LLM from scratch, a small one, and then use an existing AI model to automate real tasks. Before any of that, you need a clear picture of what an LLM actually is. And we are not going to stop at reading. By the end of this lesson you will have run a tiny next-word predictor yourself, in your browser, even if you are doing this on a phone.
In This Lesson You'll Learn
- What an LLM is, in your own words.
- How an LLM writes text, one small piece at a time.
- The difference between an LLM and a chatbot such as ChatGPT.
- Why LLMs sometimes say false things with total confidence.
- How big our own model will be compared with the famous ones.
- How to run a tiny next-word predictor in Google Colab.
Time: about 25 minutes. Cost: free. What you need: a phone or computer with a browser, and a Google account. You do not need any coding experience.
Core Concept: What Is an LLM?
An LLM, short for large language model, is a type of AI model trained on a huge amount of text so that it can work with human language. Cloudflare's learning page puts it in similar terms, describing an LLM as a type of AI model trained on enormous datasets of text.
The name is actually a decent explanation if you take it one word at a time:
- Language means the model works with words and sentences. It reads text and it writes text.
- Model means a mathematical system that has learned patterns from examples. It is not a database full of stored answers, and it is certainly not a person sitting inside your phone.
- Large means two things at once: a lot of training text, and a lot of adjustable numbers inside the model. Those numbers are called parameters. A simple way to picture them is as millions, or even billions, of tiny dials. Training slowly turns those dials until the model gets good at its one job.
That is the whole definition, and you will notice there is nothing mysterious in it. The rest of this lesson is about how those dials end up producing sentences.
How Does an LLM Work?
At its core, an LLM does one simple thing again and again: it predicts the next piece of text. Answers, stories, emails and summaries are all built by repeating that single step. Here is how one round of it goes.
- Split the text into tokens. The model does not read letters or whole words the way you do. It chops text into small pieces called tokens. A token can be a whole word, a part of a word, or even a single character. A long word like "unbelievable" might be split into a few pieces, while a short word like "cat" is usually one. In Lesson 6 you will write your own tokenizer, so you will see exactly how this works.
- Turn tokens into numbers. Computers only work with numbers, so every token is swapped for a number. From this point on, the model never sees words, only numbers.
- Score every possible next token. The model looks at the tokens so far and gives every token in its vocabulary a score for how likely it is to come next. Those scores are then turned into probabilities.
- Pick one and repeat. The model picks a token, adds it to the text, and goes back to step 3 with the slightly longer text. It keeps going until the text is finished.
The picture below shows one round of that loop.
Now look at what is missing from those four steps. There is no moment where the model looks something up, and no moment where it checks whether its answer is true. It only asks one question: which token is most likely to come next? Everything impressive an LLM does comes from asking that question extremely well. In Lessons 9 and 10 you will build attention, the technique that lets a model look back at earlier tokens so a long sentence stays coherent.
Where Does an LLM's "Knowledge" Come From?
An LLM learns during a stage called training. The model reads a very large amount of text and tries to predict each next token. Then it checks its guess against the real text. When the guess is bad, a small calculation nudges its parameters so the next guess comes out a little better. Repeat that an enormous number of times, and the parameters end up holding patterns: how sentences are built, which words travel together, which facts tend to show up near each other.
This is worth pausing on, because it changes how you should think about these tools. An LLM does not keep facts in neat rows the way a spreadsheet does. It keeps patterns, spread across all its parameters. That is exactly why it can sound fluent and sure of itself while being completely wrong.
The problem has a name: hallucination. In September 2025, researchers at OpenAI and Georgia Tech argued that language models hallucinate partly because training and testing reward guessing over admitting uncertainty. They describe hallucinations as plausible yet incorrect statements. The takeaway for you is simple: a smooth, confident answer is not proof of a true answer. In Lesson 14 you will test your own model for this, and you will see it happen for yourself.
What Is the Difference Between an LLM and ChatGPT?
People use these two words as if they meant the same thing. They do not, and the difference is useful to know.
An LLM is the model itself: the trained parameters plus the code that runs them. ChatGPT, like any chatbot, is a product built around a model. The product adds a chat screen, saved conversations, safety rules and extra steps that turn a text predictor into something that feels like it answers your questions.
A good way to remember it is that the LLM is the engine and the chatbot is the whole car. In this course we build an engine first, because that is where the real understanding is. Later, we plug into someone else's finished engine to build practical tools on top of it.
How Big Is "Large"?
Size matters here, so let us put real numbers on it. The GPT-3 paper, presented at NeurIPS in 2020, describes GPT-3 as an autoregressive language model with 175 billion parameters. That model is several years old now. We use it as our yardstick because its size is published in a paper you can check yourself, not because it is the biggest model today. Newer models change quickly.
The model we build will have roughly five to fifteen million parameters. That is our own design target, and we will confirm the real number when we train it in Lesson 12.
| Model | Parameters | Source |
|---|---|---|
| Our course model | about 5 to 15 million | Our design target, confirmed in Lesson 12 |
| GPT-3 (2020) | 175 billion | Brown et al., NeurIPS 2020 |
| Gap | over 11,000 times | 175 billion divided by 15 million is about 11,667 |
Even at the top of our range, 175 billion divided by 15 million is more than 11,000. Our model will be over ten thousand times smaller than GPT-3. So please do not expect ChatGPT-quality answers from it. What you get instead is something better for learning: a model small enough that you can understand every part of it.
Tool Walkthrough: Build a Tiny Next-Word Predictor
Now for the fun part. You are going to build the smallest possible version of what an LLM does. This little program reads a short text, counts which word follows which, and then writes new text by picking next words. It is not a real LLM, but it runs on the same basic idea.
Do not worry if you cannot follow every line yet. Lessons 3 and 4 teach Python properly. For now, the job is simple: copy, run, and read the result.
Step 1: Open Google Colab
Google Colab is a free notebook that runs Python right in your browser, so there is nothing to install. Open your browser and go to colab.research.google.com. Sign in with your Google account, then start a new notebook. Lesson 2 explains Colab in detail, so it is fine if the screen looks unfamiliar for now.
Step 2: Paste the code
In the new notebook you will see an empty box called a cell. Tap inside it and paste the code below. The Copy button at the top right of the box does the work for you.
Step 3: Run the cell
Tap the play button on the left side of the cell. The first run can take a few seconds because Colab is starting up in the background, so give it a moment.
Step 4: Check your output
You should see exactly the text below. If yours matches, congratulations: you just ran your first piece of AI-style code.
Step 5: Make it write something different
Find the line random.seed(5) and change the 5 to another number, such as 3. Run the cell again. You will get different new text from the very same training sentence. The seed is just a starting number for the random choices. Keeping it fixed is what lets everyone see the same result, and changing it is how you get a fresh one.
What This Tiny Predictor Teaches You
Let us look at what you just did, because it is more than it seems.
The first half of the code counted. For every word in the training text, it recorded which words came right after it. Look at the first line of your output: after the word "the", the text had "cat", "mat", "cat", "fish", "dog" and "rug". That list is the predictor's entire knowledge. Counting like this is a small version of training.
The second half of the code generated. It started at "the", picked one of the words that followed it, moved to that word, and repeated. That is a small version of how an LLM writes text. It is the same loop from the four steps earlier in this lesson.
Now look closely at the result. The text "the dog sat on the fish the rug" never appears in the training sentence. "On the fish" is a brand new combination. The predictor built something new from patterns, and the result is not very sensible. That is a good preview of how a small model behaves: fluent in form, shaky in meaning.
This tiny predictor also has a big weakness. It only looks at the single word before. Everything earlier is forgotten. A real LLM looks at a long stretch of text, which is exactly what attention solves in Lessons 9 and 10. A real LLM also does not count word pairs. It uses a neural network whose parameters are trained. Lesson 7 builds this same idea as a PyTorch model, and you will see the step from counting to a trained network.
Real Example: What Can Our Small Model Do?
Let us be honest about what you are signing up for, so there are no surprises later.
It can:
- Learn patterns from the books we give it and write new text in a similar style.
- Produce sentences that look plausible, and sometimes charming.
- Teach you how every part of a real LLM works, because the design is the same, only smaller.
It cannot:
- Answer general questions the way ChatGPT does.
- Remember facts reliably or reason through hard problems.
- Compete with large models in quality.
So why build something this small? Because the goal here is understanding. Once you have written a tokenizer, an attention layer and a training loop yourself, an LLM stops feeling like magic. It becomes a machine you can explain to someone else. We do not promise a job or an income from this course, only skills you can see, run and show.
What We Will Build in This Course
The course has 24 lessons in four phases. Everything runs in Google Colab, so you can follow along on a phone. Nothing is published as a product, you simply build projects and show them, so there are no hosting costs to worry about.
- Phase 1, Foundation (Lessons 1 to 5): understand LLMs, set up Colab, learn Python and the basic math.
- Phase 2, Build your LLM (Lessons 6 to 15): tokenizer, attention, transformer, training, sampling, evaluation and saving your model.
- Phase 3, Automations (Lessons 16 to 22): use Google's Gemini API to automate files, Sheets, email, scheduled jobs, a Telegram bot and a mini agent.
- Phase 4, Put it together (Lessons 23 and 24): a capstone Daily Digest Bot, then showing your work.
Free tiers of the tools we use can change over time, so we check their current limits in the lessons where they matter.
Common Mistakes
- Thinking an LLM thinks like a human. It predicts text from patterns. It does not understand things the way you do.
- Assuming an LLM looks facts up. It does not search a database unless a product adds that feature around it.
- Believing bigger is always better. Bigger models are usually stronger, but they cost far more to build and run, and a small model is perfect for learning.
- Mixing up the model and the chatbot. The chatbot is the product. The model is the engine inside it.
Skipping the hands-on step. Reading about next-word prediction is not the same as running it. Do the walkthrough above, even if you do not follow every line yet.
Try This Yourself
- Change the training text. In the code, replace the sentence inside text = "..." with one of your own, around ten to twenty words. Run the cell and see what your predictor writes. Notice that it can only ever use words it has already seen.
- Do the phone keyboard test. Open any notes app, type "I", then tap the middle suggestion ten times in a row. What repeats? What sounds oddly natural? You are watching a small next-word predictor at work.
Take the quiz. Answer without looking back, then check the answers below.
a.What single task does an LLM repeat to produce a whole answer?
b. What are the adjustable numbers inside a model called?
c. Is a fluent answer from an LLM always a true one?
Answers: (1) It predicts the next token. (2) Parameters. (3) No. LLMs can state false things in a confident, fluent way.
Key Takeaways
- An LLM is a large language model: an AI trained on lots of text to predict the next token.
- It writes by repeating one step, predicting the next token, many times over.
- Its knowledge is stored as patterns in parameters, not as a list of checked facts, so it can hallucinate.
- A chatbot such as ChatGPT is a product built around an LLM.
- Our model will be small, more than ten thousand times smaller than GPT-3, and we build it to understand how LLMs work.
- You already built a tiny next-word predictor. Lesson 7 turns that idea into a real PyTorch model.
Frequently Asked Questions
What is an LLM in simple words?
An LLM is a large language model: an AI trained on a huge amount of text that works by predicting the next piece of text, again and again, to write sentences, answers and summaries.
How do LLMs work?
They split text into tokens, turn the tokens into numbers, score every possible next token, pick one, and repeat. Training adjusts the parameters so those scores get better over time.
Is an LLM the same as ChatGPT?
No. An LLM is the underlying model. ChatGPT is a chatbot product built around a model, with a chat screen, safety rules and other features added on top.
Can I really build my own LLM?
Yes, a small one. You can write the tokenizer, the transformer and the training loop yourself and train it on a free Colab GPU. It will be far smaller and weaker than ChatGPT, but it works on the same principles.
Do I need to know how to code for this course?
No. Lessons 3 and 4 teach the Python basics you need, and every step after that is explained as we go.
Next Lesson Preview
In Lesson 2, we set up Google Colab properly: how notebooks and cells work, how to switch on the free GPU, and how to save your work. Everything we build from then on happens in that notebook, so it is worth getting comfortable with it.
Next: Lesson 2, Set Up Google Colab and Run Your First Code (coming soon)
Sources
All sources were checked on 1 November 2026.
- Cloudflare: What is a large language model (LLM)? (no date shown on the page)
- Wikipedia: Master of Laws (LL.M.), used only to confirm the other meaning of the abbreviation
- Our own design target of five to fifteen million parameters for the course model, to be confirmed in Lesson 12.





