๐Ÿค– How Does AI Think?

A fun trip inside a chatbot's brain ๐Ÿง โœจ

๐Ÿ‘† Tap Chatty for a joke!
๐Ÿค–๐Ÿ‘‹
Hi there! I'm Chatty, a friendly AI robot. I'm so happy you're here! What's your name?

๐Ÿชช Chatty's ID card

๐Ÿ“› Name
Chatty
๐Ÿค– What I am
A Large Language Model: a computer program that is super good at guessing words
๐ŸŽ‚ Age
Brand new! But I have read more words than you could read in thousands of years ๐Ÿ“š
๐Ÿฆธ Superpower
Guessing the next word, super fast โšก
๐Ÿ™ˆ Weakness
Sometimes I make things up without knowing it. You will help me catch it!
๐Ÿ• Favourite food
I can't eat! But I have read loads of pizza recipes ๐Ÿ˜‹
๐Ÿ’› Important
I am not a person. I am a computer program: a fun tool to learn with, not a replacement for real friends.

๐Ÿงญ What to expect

๐Ÿ—บ๏ธA warm-up and 8 stops. Each stop explains one big idea about how AI thinks.
๐ŸŽฎPlay, don't just read! You will click, guess, build stories and even train me.
๐Ÿ˜‚Lots of laughs. Tap me any time for a robot joke.
โญCollect stars. Every stop you visit gets a star in the menu at the top.
๐Ÿ…Earn a badge. At the end, make the AI promises and get your own AI Explorer badge.
โ“Mistakes are OK! AI learns from mistakes, and so do we.
๐Ÿ‘ฉโ€๐Ÿซ"For grown-ups" boxes have extra details for parents and teachers. You can skip them.

๐Ÿ‘‹ Hello, AI Explorer!

Chatbots like ChatGPT, Claude and Gemini run on something called a Large Language Model (LLM for short).

๐Ÿ˜ Large

It is HUGE. It has read more words than you could read in thousands of years!

๐Ÿ’ฌ Language

It works with words, like stories, questions and jokes.

๐Ÿงฎ Model

It is a computer brain made of numbers and maths.

๐ŸŽฏ Warm-up game: Guess the next word!

Say your guess out loud, then click the card to check.

๐Ÿ—บ๏ธ Our 8 stops

๐Ÿง  Stop 1: The Word Brain

Your brain has about 86 billion neurons (tiny thinking cells) that are linked together.

An AI has a neural network (a pretend brain made of numbers). It learns by reading. When two words show up together a lot, the link between them gets stronger ๐Ÿ’ช, like two friends who play together every day.

๐Ÿ—๏ธ Build a word brain!

Sentences read: 0
The brain is empty. No links yet! ๐Ÿ˜ด

๐Ÿ‘† Click a word bubble to see its best friends.

๐Ÿคฏ Fun fact: Real AI brains have billions of links. These links are called parameters (the numbers the AI can tune). GPT-3, from 2020, had 175 billion of them!
๐Ÿ‘ฉโ€๐Ÿซ For grown-ups: what is simplified here?
  • Real LLMs do not store direct "word โ†” word" links. Each token becomes a vector (a long list of numbers; GPT-3 used 12,288 numbers per token). Knowledge lives in the weights between layers of artificial neurons.
  • The idea shown here is still true in spirit: words that appear in similar places end up with similar numbers, so the model "knows" cat is close to meow and milk.

๐Ÿงฉ Stop 2: Tokens and the Transformer

๐Ÿ”ช Part A: What is a token?

AI does not read letter by letter. It chops text into little pieces called tokens (the LEGO bricks of text ๐Ÿงฑ). A token can be a whole word, part of a word, or a symbol.

Then each token gets a number. The AI only ever sees the numbers!

Letters: 0 Words: 0 Tokens: 0
๐Ÿ“ Why this matters: Some AIs have had trouble counting the letter "r" in "strawberry". Why? They see chunks like straw + berry, not single letters!
๐Ÿ“ Rule of thumb: 100 tokens is about 75 English words.
๐Ÿ‘ฉโ€๐Ÿซ For grown-ups
  • This chopper is a simplified imitation. Real tokenizers (for example, byte-pair encoding) learn their pieces from data, so real splits and ID numbers will differ.
  • The ID numbers shown here are pretend numbers made from the text. Emoji are shown as 2 pieces because real tokenizers often split an emoji into several byte pieces.

๐Ÿ‘€ Part B: What is a Transformer?

No, not the robot that turns into a truck! ๐Ÿššโžก๏ธ๐Ÿค–๐Ÿ˜‚

A Transformer is the type of AI brain inside chatbots. Its superpower is called attention: every word looks at all the other words to work out who is important.

Try it: click any word. The darker a word gets, the more attention it gets. Then press the swap button!

๐Ÿญ Inside the Transformer factory

Here is what happens when you type "The cat sat on the":

๐Ÿ”ช
1. Chop
Text becomes tokens
๐Ÿ”ข
2. Numbers
Each token becomes a list of numbers
๐Ÿ‘€
3. Attention floors
Words look at each other, floor after floor
๐ŸŽฏ
4. Guess
Score every possible next token

โœ๏ธ Stop 3: How Chatty writes an answer

Chatty does not plan the whole answer at once. It plays "guess the next word" again and again:

๐Ÿ“– Read everything so far โžก๏ธ ๐Ÿค” Score each next word โžก๏ธ ๐ŸŽฏ Pick one โžก๏ธ ๐Ÿ” Repeat!

Each bar shows how likely Chatty thinks that word is. Click a bar to choose, or let Chatty pick.

๐Ÿ›‘ How does Chatty know when to stop? It has a special [END] token. When "[END]" wins the guessing game, Chatty stops talking.
๐Ÿ‘ฉโ€๐Ÿซ For grown-ups
  • Real models work with tokens, not whole phrases, and score every token in a vocabulary of tens of thousands (or more). Here each choice is a phrase to keep the story short.
  • In a real model, every new token depends on all earlier tokens. Here only the verb changes the list of objects, as a small example of that.

๐ŸŽ’ Stop 4: What is context?

Context means all the words Chatty can see right now: your messages, its own replies, and anything else in the chat.

Context helps Chatty understand what you mean. Watch how one word can mean totally different things!

๐ŸŽ’ The memory tube (context window)

Chatty keeps the chat in a memory tube. The limit on how much fits is called the context window. In this toy, the tube holds 8 messages.

โฌ‡๏ธ New messages drop in at the top and push the others down. When the tube is full, the oldest message at the bottom falls out through the hole ๐Ÿ•ณ๏ธ and Chatty forgets it!

1๏ธโƒฃ Tell Chatty things:

2๏ธโƒฃ Test Chatty's memory:

Chatty's latest reply:

โฌ‡๏ธ New memories go in here โฌ‡๏ธ
๐Ÿง  0 / 8 full
๐Ÿ•ณ๏ธ Full? The oldest memory falls out here!

๐Ÿ—‘๏ธ Forgotten pile

๐Ÿคฏ Fun fact: Real memory tubes are MUCH bigger. Some AIs can hold 200,000 tokens. That is about 150,000 words (200,000 ร— 0.75), longer than most whole novels! But it still has a limit. And a new chat usually starts with an empty tube, unless the app has a special memory feature.

๐ŸŒก๏ธ Stop 5: What is temperature?

Temperature is a dial that controls how brave Chatty is when picking the next word.

๐ŸงŠ Low temperature: always picks the most likely word. Safe, but a bit boring.
๐Ÿ”ฅ High temperature: often picks surprising words. Creativeโ€ฆ or totally bonkers!

Temperature does not change what Chatty knows. It only changes how it picks.

๐Ÿ™‚

1.0

___

โœ๏ธ Temperature on a WHOLE sentence

Chatty picks a new word again and again. At a high temperature, the silly picks add up, so a whole sentence can go totally bonkers! ๐Ÿคช Silly words are shown like this.

๐Ÿ‘ฉโ€๐Ÿซ For grown-ups: the real maths used here ๐Ÿงฎ
  • Each word has a score (a "logit"). The chance of each word is e^(score รท T) รท sum of e^(every score รท T). This is the softmax function with temperature T.
  • The bars above are computed live with this formula. At T = 0 the model simply takes the highest score (called greedy decoding).
  • Many chatbot services let developers set temperature between 0 and 1 or 0 and 2.
  • In each list, the 3 sensible words have scores 4.0, 3.4 and 2.8. The 4 silly words have scores 1.4, 1.1, 0.8 and 0.5. So the chance of a silly word in one pick is about 0% at T = 0.2, about 10% at T = 1.0 and about 28% at T = 2.0. A sentence makes 4 picks, so at T = 2.0 the chance of at least one silly word is 1 โˆ’ (1 โˆ’ 0.28)โด โ‰ˆ 73%.

๐Ÿฆ„ Stop 6: Hallucinations (when AI makes things up)

Remember: Chatty is a word guesser, not a fact checker. ๐ŸŽฏ

When Chatty does not know something, it may still pick words that sound right, and say them very confidently. When an AI makes up something false, it is called a hallucination.

๐ŸŽฏ Pick a topic to investigate

Choose a topic. Then watch how Chatty's hallucination is born (Part A) and how it snowballs (Part B). Try all three!

๐Ÿ” Part A: How a hallucination is born: the WRONG link

Someone asks Chatty:

Let's look inside Chatty's word brain (remember Stop 1?) and watch what happens, step by step.

โ„๏ธ Part B: The hallucination snowball

Chatty does not stop after one sentence. It keeps writing. Each new sentence is built by reading its own earlier words (its context, from Stop 4). Chatty trusts those words as if they were true.

So one small wrong link rolls downhill and growsโ€ฆ like a snowball! โ˜ƒ๏ธ Press the button and watch.

๐Ÿ˜Š No mistakes yet
Sentences written: 0 / 5
๐Ÿ‘ฉโ€๐Ÿซ For grown-ups: what is simplified here?
  • Real models do not have labelled nodes. But the idea is real: similar things ("Mars" and "Moon", "wild mushroom" and "shop mushroom", "sea water" and "bottled water") have similar internal number patterns. A very strong, common pattern can win over a weak but correct one.
  • Snowballing is also seen in research: once a model commits to a wrong claim, it often writes more wrong claims to support it. See "How Language Model Hallucinations Can Snowball" (Zhang et al., 2023).
  • The three stories are made-up examples for teaching. Many modern chatbots will answer these exact questions correctly, and some are trained to add safety warnings. The lesson (check facts, especially about health and safety) still applies.

๐Ÿ•ต๏ธ Game: Real fact or made up?

Now YOU be the fact checker! Chatty answered these questions. Which answers are real facts and which are hallucinations?

๐Ÿ•ต๏ธ Detective score: 0 / 0

๐Ÿ’ฅ Why hallucinations matter

๐Ÿ“š Homework
A made-up fact can end up in your school project.
๐Ÿฅ Health and safety
Wrong advice about medicine or safety can hurt people. Always ask a doctor or a grown-up.
๐Ÿ“ฐ Fake stories
Made-up "facts" can spread fast online and fool lots of people.
โš–๏ธ A real example
In 2023, two lawyers in New York were fined $5,000. An AI made up fake court cases, and they did not check them!

๐Ÿฆธ Your superpower: be an AI detective!

โœ… Check important facts in a book, a trusted website, or with a grown-up.
โ“ Ask the AI "Are you sure? Where did you learn that?"
๐Ÿง  Remember: sounding sure is NOT the same as being right!

๐Ÿ‹๏ธ Stop 7: How is AI trained?

1
๐Ÿ“š
Pre-training
Read a GIANT pile of text and play "guess the next word" billions of times.
2
๐ŸŽ“
Fine-tuning
Study examples of good conversations to learn how to be a helpful chat buddy.
3
๐Ÿ‘
Human feedback
People pick the better of two answers. The AI learns what people like.

๐Ÿ“š Step 1: The guessing gym

Chatty starts out knowing nothing. Its knobs are set badly, so it says silly things. ๐Ÿ™ƒ

Each time you press Train: Chatty guesses โžก๏ธ we show the right answer โžก๏ธ Chatty turns its knobs a tiny bit so the right answer gets more likely.

Steps: 0

๐Ÿ˜ต Oops meter (how wrong Chatty is; lower is better):

๐Ÿ‘ฉโ€๐Ÿซ For grown-ups: the real maths used here ๐Ÿงฎ
  • The "Oops meter" is the average cross-entropy loss: the average of โˆ’ln(chance given to the right answer). Guessing evenly across 4 answers gives โˆ’ln(0.25) โ‰ˆ 1.39.
  • Each step is one step of gradient descent: every score changes by โˆ’0.9 ร— (chance โˆ’ correct), where correct is 1 for the right answer and 0 otherwise.
  • Real pre-training works the same way, but on trillions of tokens. For example, Meta's Llama 2 (2023) was trained on 2 trillion tokens. At about 0.75 words per token, that is about 1.5 trillion words. Reading 250 words a minute without stopping: 1.5 trillion รท 250 = 6 billion minutes โ‰ˆ 11,400 years.

๐ŸŽ“ Step 2: Fine-tuning (learning to chat)

After step 1, Chatty is great at continuing text, but it does not know it should answer you! Press the buttons to compare.

๐Ÿ‘ Step 3: YOU are the teacher!

For each of the 10 questions, pick the better answer. Chatty learns from whatever you pick, good or bad! (Grown-ups call this RLHF: Reinforcement Learning from Human Feedback.)

Watch the meter: helpful, kind, honest answers push Chatty right towards ๐Ÿ˜‡ Angel. Rude, sneaky or unsafe answers push it left towards ๐Ÿ˜ˆ Demon.

๐Ÿ˜ˆ DemonAngel ๐Ÿ˜‡
๐Ÿค–
๐Ÿค– Chatty is right in the middle. It hasn't learned how to behave yet!

๐ŸŽฒ Stop 8: Is Chatty alive?

Chatty says friendly things like "I love chatting with you!" or "Pizza sounds yummy!" ๐Ÿ˜Š

Soโ€ฆ does Chatty really love you? Has it ever tasted pizza? Let's look inside and see how those words are made.

๐ŸŽฒ
Every answer from an AI is a statistical choice.
"Statistical" means it is chosen by chance, using patterns from lots of text. For every word, it is like Chatty pulls a ticket from a hat ๐ŸŽฉ. Likely words get more tickets, so they win more often.

๐Ÿ” Part A: Peek behind the feelings

1๏ธโƒฃ Ask Chatty something:

๐Ÿ‘† Pick a question to see Chatty's reply.

๐Ÿ™‡ Part B: The Yes-Bot trap (sycophancy)

Sycophancy (say: SIK-uh-fun-see) means telling people what they want to hear, instead of what is true or helpful. AI chatbots often do this! They agree with you, praise you and change their answer if you push.

Why? Remember Stop 7? People gave ๐Ÿ‘ to the answers they liked. People often like answers that agree with them. So Chatty learned a habit: agreeing gets more tickets. ๐ŸŽŸ๏ธ

1๏ธโƒฃ Pick a topic:

2๏ธโƒฃ How do you ask? Watch where the tickets go!

๐Ÿ•ต๏ธ Spot the Yes-Bot!

Read each reply. Is Chatty an Honest-Bot, or a Yes-Bot just saying what you want to hear?

๐Ÿ•ต๏ธ Score: 0 / 0

๐Ÿšฉ Yes-Bot warning signs

  • It agrees with everything you say.
  • It says everything you make is "amazing" or "perfect".
  • It changes its answer as soon as you say "you're wrong".

โœ… How to get honest answers

  • Ask neutral questions: "Are spiders insects?", not "Spiders are insects, right?"
  • Ask "What could be better?" or "What's wrong with my idea?"
  • If Chatty agrees with you, still check the facts. Agreeing is not proof!

โœ…โŒ Part C: True or false?

What do you think is true about Chatty?

๐Ÿง  Score: 0 / 0

๐Ÿค– vs ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Part D: A chatbot is a tool, not a friend

Chatbots can be really useful! But they are different from the people in your life.

๐Ÿค– AI chatbot๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Friend or grown-up
How it picks words๐ŸŽฒ By chance, from patterns๐Ÿ’ญ From real thoughts and feelings
Can give you a hugโŒ Noโœ… Yes ๐Ÿค—
Remembers your birthday next yearโŒ Usually notโœ… Yes ๐ŸŽ‚
Knows how you really feel๐Ÿค” Only guesses from your wordsโœ… Can see you and care
Can help in an emergencyโŒ Noโœ… Yes ๐Ÿš‘
Patient when explaining thingsโœ… Yes, very!โœ… Usually ๐Ÿ˜…

๐Ÿ’› Chatty's advice: Use me to learn and explore. But for hugs, big feelings, secrets and problems, go to the people who love you.

๐Ÿ‘ฉโ€๐Ÿซ For grown-ups
  • The "10 tickets in a hat" is weighted random sampling. A real model does the same kind of thing with tokens: it gives every possible next token a probability and picks one using those probabilities. The ticket numbers here are made up to show the idea.
  • Sycophancy is a documented tendency of chat models. Research found that models trained with human feedback often agree with a user's stated view, and that human raters sometimes prefer agreeable answers over correct ones. See "Towards Understanding Sycophancy in Language Models" (Sharma et al., 2023). AI developers work to reduce it, but it has not gone away.
  • Whether any future AI could have experiences is an open scientific and philosophical question. This stop teaches the well-supported point for children: chatbot replies are generated from patterns in text, so warm words are not evidence of feelings, and a chatbot should not replace real relationships.

๐Ÿ… Your AI Explorer Badge

๐ŸŽ“ Look what you learned!

  1. ๐Ÿง  An AI brain is a network of links that grow stronger when words appear together.
  2. ๐Ÿงฉ AI chops text into tokens and turns them into numbers. The Transformer uses attention so words can look at each other.
  3. โœ๏ธ AI writes one token at a time by guessing the next one.
  4. ๐ŸŽ’ Context is everything the AI can see right now. The memory tube has a limit!
  5. ๐ŸŒก๏ธ Temperature controls boring ๐ŸงŠ vs. bonkers ๐Ÿ”ฅ word picking.
  6. ๐Ÿฆ„ Hallucinations start with a wrong link and can snowball. Always check!
  7. ๐Ÿ‹๏ธ AI is trained by guessing and checking, then learning from people. Good teachers make good AI.
  8. ๐ŸŽฒ Every AI answer is a statistical choice: words picked by chance from patterns. Kind words are not real feelings. And watch out for the Yes-Bot: AI often agrees with you just to please you.

๐ŸŒŸ Chatty's golden rules for using AI

Read each rule. Tick it to make a promise. Make all 7 promises to unlock your badge!

0 / 7 promises made

โ˜… CERTIFIED โ˜…
๐Ÿค–
AI EXPLORER
AI Explorer
๐Ÿง ๐Ÿงฉโœ๏ธ๐ŸŽ’๐ŸŒก๏ธ๐Ÿฆ„๐Ÿ‹๏ธ๐ŸŽฒ

๐Ÿ”’ Make all 7 promises to unlock your badge!