---
title: How Do Large Language Models Learn? | Large Programs
description: LLMs learn by reading huge piles of text and practising next-word guesses over and over. A step-by-step explanation without jargon.
canonical: https://www.largeprograms.com/how-do-llms-learn/
---

[Home](/) / [How LLMs Work](/category/how-llms-work/)

How LLMs Work

# How Do Large Language Models Learn?

LLMs learn by reading huge piles of text and practising next-word guesses over and over. A step-by-step explanation without jargon.

26 November 2026 · 2 min read

Imagine a student who never goes to class. Instead, they read a giant library and play one game over and over: **cover the next word and guess it.**

![The learning loop: read, guess, check, nudge, repeat.](/img/learning-loop.svg)

*The learning loop: read, guess, check, nudge, repeat.*

## Step 1: Collect text

Engineers gather a very large collection of writing. This is called **training data**.

## Step 2: Break it into tokens

The computer cannot read letters like we do. Text is cut into small pieces called [tokens](/what-is-a-token/) and turned into numbers.

## Step 3: Play the guessing game

The model sees the start of a sentence and guesses the next token. At first its guesses are poor.

## Step 4: Check and adjust

After each guess, the computer checks the real answer. If the guess was bad, it nudges the model's parameters a tiny bit so next time it does better. This happens over and over, a very large number of times.

## Step 5: Fine-tuning

After the first stage, the model is often trained further with examples of good answers and with feedback from people, so it is more helpful and polite.

## An everyday comparison

Think of learning to ride a bike. Nobody hands you a rulebook. You wobble, correct, wobble less, and slowly get better. An LLM learns patterns in a similar way, only with numbers instead of muscles.

## What this means

The model does not memorise a book like a photocopier. It learns patterns, which is why it can write new sentences. It also means it can pick up mistakes and unfair ideas that were in the text it read.

## A tiny pretend training run

Suppose the whole library contains only these three sentences:

1. The cat sat on the mat.
2. The cat sat on the sofa.
3. The dog sat on the mat.

After "sat on the", the word "mat" appeared twice and "sofa" once. A very simple model would learn: after "sat on the", say "mat" about two times out of three, "sofa" about one time out of three. Real models are much more complex, and they handle a huge number of different contexts, but the heart of it is the same: **learn how likely each next word is, given the words before.**

## What this tiny example teaches

- The model repeats patterns it saw. If the library had a mistake, the model would learn the mistake.
- It can only say what fits the patterns. It has no way to know the real cat unless the text told it.
- More text gives more patterns, which is why training sets are so large.

## Questions to ask

If our little library had never contained the word "sofa", could the model ever say it? What if we added a hundred more sentences about sofas?

## Sources

- [https://en.wikipedia.org/wiki/Large_language_model](https://en.wikipedia.org/wiki/Large_language_model)
- [https://arxiv.org/abs/2005.14165](https://arxiv.org/abs/2005.14165)

[Read this page as Markdown (.md)](/how-do-llms-learn.md)

## Keep reading

[![](/img/hero/art-ai-art-and-music-basics.svg)](/ai-art-and-music-basics/)

How LLMs Work

### [How AI Makes Music: A Beginner's Look](/ai-art-and-music-basics/)

Models can generate melodies and songs by learning patterns in sound. What that means for musicians.

[![](/img/hero/art-backpropagation-how-neural-networks-learn-from-mistakes.svg)](/backpropagation-how-neural-networks-learn-from-mistakes/)

How LLMs Work

### [Backpropagation: How a Network Learns From Its Mistakes](/backpropagation-how-neural-networks-learn-from-mistakes/)

Backpropagation is the method that works out how to adjust each weight in a neural network after it makes an error. A simple explanation with a team analogy.

[![](/img/hero/art-chain-of-thought-prompting-showing-your-working.svg)](/chain-of-thought-prompting-showing-your-working/)

How LLMs Work

### [Chain-of-Thought Prompting: Showing the Steps](/chain-of-thought-prompting-showing-your-working/)

Asking a language model to show intermediate steps can improve its answers to hard problems. What the research found and how it is like showing your working in maths.
