What is an AI actually doing when it answers?
A chat assistant runs one loop: a neural network turns the words so far into odds for the next word, one word is picked, and the loop starts again. This is a tiny network you can teach and watch.
Pick a text for the network to learn from, or write your own:
Teaching so far
Passes over the text. Each pass nudges every number a little.
How surprised it is
Lower is better. The best a plain count can reach here: –.
Words it knows
Different words in the text it learned from.
Numbers it learned
All its knowledge is these numbers. A real model has billions.
How to read the picture
A word goes in on the left. The circles in the middle are numbers the network works out from it. On the right come the odds for each next word. The lines are the connections, and what the network learned is how strong each one is.
What a neural network is
A pile of numbers on connections, plus a way to combine them. Teaching it means nudging the numbers until the odds match the text. Nothing is stored as sentences: the knowledge is spread across the numbers.
The trap
The network picks words that tend to follow each other, whether or not the result is true. A smooth sentence can describe something that never happened, and the sentences below are made that way.
Open Under the hood to see the steps inside the network, with the numbers for the word it is on.
- 1. hidden value = tanh( connection from the word + a small bias )
- 2. score for each next word = sum of ( hidden value × connection ) + a small bias
- 3. odds = each score turned into a share of the total (softmax)
Teaching: for every pair of words in the text, nudge every number a little in the direction that makes the right next word likelier (gradient descent). Repeat over the whole text many times.
A real model has billions of these numbers, reads far more than the last word, and is taught on far more text. Its parts are arranged differently (transformers, with attention), and it is still a set of numbers nudged until the odds fit the text. It reads word pieces called tokens, from a list of tens of thousands to a few hundred thousand (151,936 for Qwen3), learns with an optimizer called Adam over large batches, and chat assistants get further training on conversations, which teaches them to answer questions.
Why knowing this helps you
Everything an assistant writes comes out of this loop. Knowing it explains most of the surprises.
It continues your text
Your message is the start of the text the model keeps writing. How you begin shapes where it goes.
Likely can still be wrong
It picks words that tend to follow, so a smooth sentence can still be wrong. Check the things that matter.
It picks from odds
Each word is chosen from odds, which is why the same question can get different answers.
It reuses what it has seen
A model can only reuse patterns from its training text. Rare, new or very specific things are where it is least likely to be reliable.
Checked on 2026-10-06 for Qwen3: about 36 trillion tokens of training text in 119 languages, 0.6 to 235 billion numbers, and 32,768 tokens read at once (131,072 with YaRN); rare facts are least reliable (Kandpal et al. and Mallen et al., 2023).
Where this goes next
Next: why answers vary
If it picks from odds, why does the same question give different answers, and what can you do about it?
Then: errors in long tasks
Every pick can go a little wrong. Over a long task, those add up.
The network and its teaching run in a C engine compiled to WebAssembly. This one reads a single word and has a few hundred numbers, while a real model reads far more and has billions.