Episode 6 of 8 · 7 min
How do chatbots work?
A chatbot is an LLM plus instructions plus a short memory.
The bubble is the costume
How do I poach an egg?Simmer water, then swirl it.For how long?
repacked as text
YOU: How do I poach… AI: Simmer water… YOU: For how long? → predict reply
About 3 minutes.
The history is sent again for every reply.
Tap first
Why does a bank's chatbot refuse to write you a poem?
Step 1
Three parts
The LLM, the system prompt (hidden role, tone and rules) and the conversation so far.
1The LLM2System prompt: role, tone, rules3The conversation so farStep 2
The context window
It can only see a limited amount of text. In long chats the early parts fall out, so it seems to forget.
Early messages fall outWhat it can see nowYour newest messageStep 3
Saved memory
Saved memory is a separate notebook the app keeps, not the model learning.
The model
- Doesn't change
The app's notebook
- Saved notes added to the chat
Step 4
Answering from documents
Companies attach documents so it answers from them (RAG — Season 5).
Your questionFind the right documentAnswer from it
Check yourself
Your chatbot forgot your name after a long conversation. Why?
Takeaway
Change the instructions or the context, and you change the chatbot.
Watch the explainer
Words in this episode