Guided project · How chatbots work
Look inside a chatbot: tokens, temperature and hallucinations
Run five small experiments that show what really happens when a chatbot answers you.
What you'll build
An experiment log you can use to explain how LLMs work to anyone.
What you'll learn
- Tokens and why they matter
- How randomness (temperature) changes answers
- Why hallucinations happen and how to reduce them
You'll need
Any AI chatbot, a free online tokenizer, and optionally LM Studio
Create a free account to unlock this project
The step-by-step instructions, copy-ready prompts, progress tracker and portfolio texts are for members. It's free, takes under a minute, and unlocks all guided projects.
Want to try first? These projects are open to everyone: Prompt lab and One idea, five posts.
Before you start
- Create a doc called "Chatbot experiments" to record what you see.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.
Step by step
Count tokens
Search for OpenAI tokenizer, open it, and paste a sentence in English and the same sentence in Hindi or Arabic.
You should see: The non-English version uses many more tokens, so it costs more and fills memory faster.
Watch next-word prediction
Ask a chatbot to continue a sentence 5 different ways.
Copy this textContinue this sentence in 5 different ways, one line each: "The best thing about Mondays is..."You should see: Several plausible endings: the model is choosing likely next words.
Feel the temperature
Ask the same creative question in 3 new chats, then a factual one in 3 new chats.
You should see: Creative answers vary each time; factual ones stay the same.
Fill the context window
In one chat, tell it a code word. Then paste several long articles and chat for a while. Finally ask for the code word.
You should see: In very long chats it may forget early details.
Trigger and fix a hallucination
Ask for 3 research papers on a very niche topic with authors and years. Check them online. Then ask again with the extra line below.
Copy this textOnly list papers you are certain exist. If you're not sure, say so instead of guessing.You should see: Some made-up references the first time; more honest answers when you allow "I don't know".
Write your explanation
In 5 lines, explain to a friend how a chatbot answers a question, using what you saw.
You should see: Your own clear explanation of LLMs.
Brilliant work. Share it below, then pick your next project.
Level up
- Run a small open model in LM Studio with Wi-Fi off and compare its answers.
- Upload a photo and test what a multimodal model notices and misses.
Lessons behind this project
Show it off
Finished? Post about it on LinkedIn. Here's a starting point; add a screenshot and your own words.
I ran 5 experiments on chatbots today: tokens, next-word prediction, temperature, memory limits and hallucinations. Understanding the machine makes me use it much better! Learned with AI From Zero.Add it to your portfolio
Employers love seeing what you've built. Use these ready-made texts, then add your own results and a screenshot.
1. A line for your CV or LinkedIn "Projects" section
Look inside a chatbot: tokens, temperature and hallucinations: An experiment log you can use to explain how LLMs work to anyone. Skills: Tokens and why they matter, How randomness (temperature) changes answers, Why hallucinations happen and how to reduce them. Tools: Any AI chatbot, a free online tokenizer, and optionally LM Studio.2. A README for GitHub
Create a free GitHub account, make a new repository, add a file called README.md and paste this in along with screenshots of your work.
# Look inside a chatbot: tokens, temperature and hallucinations
Run five small experiments that show what really happens when a chatbot answers you.
## What I built
An experiment log you can use to explain how LLMs work to anyone.
## What I learned
- Tokens and why they matter
- How randomness (temperature) changes answers
- Why hallucinations happen and how to reduce them
## Tools
Any AI chatbot, a free online tokenizer, and optionally LM Studio
## How it works
1. Count tokens
2. Watch next-word prediction
3. Feel the temperature
4. Fill the context window
5. Trigger and fix a hallucination
6. Write your explanation
## Results
(Add a screenshot and 2–3 sentences about what you found. Never include API keys or personal data.)
## Next steps
- Run a small open model in LM Studio with Wi-Fi off and compare its answers.
- Upload a photo and test what a multimodal model notices and misses.
---
Built by following the free guided project at https://learnaifromzero.com/projects/inside-a-chatbot.html