The model remembers nothing: the app re-sends the conversation
The fake model can only know your name if the app sends the earlier message again.
A large language model (LLM) is a program that reads text and predicts what text should come next, one small piece at a time. Chat assistants are an ordinary app wrapped around that one ability.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Extend the toy model so predict returns the single most likely word (or None if the text is unknown), and print it for the three prompts.
Write trim_history(history, keep) that returns the last keep messages but always keeps the first message if its role is system.
Explain it without notes
Explain what a large language model does, in two sentences, to someone who has never programmed.
Why does a chat app need to send the earlier messages again on every call?
What is the difference between training and inference, and which one does an LLM engineer usually do?
Why can an LLM state something false with confidence?
Expected output
App A sends the whole conversation every time:
you: Hi, I'm Asha.
bot: Hello Asha! How can I help? (sent 1 message(s))
you: What is my name?
bot: Your name is Asha. (sent 3 message(s))
App B sends only the newest message:
you: Hi, I'm Asha.
bot: Hello Asha! How can I help? (sent 1 message(s))
you: What is my name?
bot: I don't know your name yet. (sent 1 message(s))