# Teacher's guide — Session 3: The language of machines 🟢

**Program:** Applied AI — Beginner Level
**Instructor:** Yann Isola
**Recommended duration:** 2 hours (adaptable 1h30 – 2h30)
**Public:** general public from 12 years old, no technical prerequisites
**Previous session:** Session 2 (discovery of chatbots)
**Next session:** Session 4

---

## 🎯 Educational objectives

At the end of the session, each participant should be able to:

1. Explain in your own words that a computer **does not understand** the text: it **calculates with numbers**.
2. Define what a **token** is and break a simple word into plausible tokens.
3. Explain the idea of ​​**embedding**: words transformed into coordinates, where words close in meaning are close on the map.
4. Describe the **context window** as limited “working memory”.
5. Recognize an AI **hallucination** and cite 2 reflexes to spot it.
6. Explain the effect of **temperature** on an AI's responses.

---

## 🧭 Common thread of the session

> **The big idea:** when you write to an AI, it doesn't "read" your words like you do. She cuts them into pieces, transforms them into numbers, calculates... then converts numbers back into words. All the magic — and all the limits — come from there.

Yarn metaphor to use throughout the session: **the AI ​​is a tourist with a dictionary of numbers.** It doesn't speak our language, but it has a huge book of correspondences and an awesome calculator.

---

## ⏱️ Unfolded minute by minute

| Time | Activity | Format |
|-------|----------|--------|
| 0–10 mins | Home + session 2 reminder + shocking question | Plenary |
| 10–25 mins | Part 1 — The computer understands nothing (and yet…) | Interactive presentation |
| 25–45 mins | Part 2 — Tokens and vocabulary | Presentation + mini-game |
| 45–60 mins | Part 3 — Embeddings: the word map | Presentation + webpage demo |
| 60–70 mins | ☕ Break | — |
| 70–85 mins | Part 4 — The context window (working memory) | Presentation + telephone game |
| 85–100 mins | Part 5 — Hallucinations: when AI invents | Presentation + examples |
| 100–110 mins | Part 6 — Temperature: the creativity slider | Webpage demo |
| 110–115 mins | Final activity — The parameters laboratory | Pair workshops |
| 115–120 mins | Quiz + summary + teaser session 4 | Plenary |

---

## 📖 Detailed content per game

### Part 0 — Opening (0–10 min)

**Shocking question to ask at the start:**
> “When you send “Hello, how are you?” to ChatGPT… is he *reading* your message? »

Leave to discuss for 2 minutes. Most will say yes. Answer to reveal:
> “No. He never sees your words. He sees a sequence of numbers. Today, we are discovering the secret language of machines. »

**Express reminder session 2** (2 min): we learned to chat with a chatbot. Today we open the hood.

---

### Part 1 — The computer doesn't understand anything (10–25 min)

**Key message:** a computer only manipulates numbers. Always. The text, the images, the music: everything becomes numbers.

**To say:**
- A computer, basically, is an ultra-fast calculator.He only knows numbers.
- When you type the letter "A", the computer actually stores a number (for example 65 in the ASCII code — *American Standard Code for Information Interchange*, an old American standard which gives a number to each letter).
- AI (Artificial Intelligence) does the same, but much smarter: instead of numbering letters, it numbers **pieces of words**.

**Board demonstration:**
Write “CHAT” → show that the machine sees something like `[67, 72, 65, 84]` (letter codes) or, for modern AI, a single token number, e.g. `9846` ⚠ *(exact numbers vary by model — give this as an illustrative example, not an official value)*.

**Analogy for 12 year olds:**
> “Imagine a friend who only speaks the language of telephone numbers. To talk to him, you have to translate each word into a number. To understand his answer, you have to translate his numbers back into words. AI is that friend. »

**Trap to avoid:** not saying “the AI understands the meaning”. Say instead: “AI calculates relationships between numbers, and these relationships *mimic* understanding — often very well.”

---

### Part 2 — Tokens and vocabulary (25–45 min)

**Simple definition:**
> A **token** = a piece of text that the AI processes at once. Sometimes a whole word, sometimes a piece of a word, sometimes just punctuation or a space.

**Examples to write on the board** ⚠ *(the exact cut-outs vary depending on the model; these are illustrative and realistic)*:

| Text | Possible division into tokens |
|-------|------------------------------|
| cat | `chat` (1 token) |
| intelligence | `intelli` + `gence` (2 tokens) |
| today | `aujourd` + `'` + `hui` (3 tokens) |
| unconstitutionally | `anti` + `constitution` + `nellement` (3–5 tokens) |
| 😀 | 1 to 3 tokens (the emojis are also cut out!) |

**Why cut?** Three reasons to explain:
1. **There are too many words.** In French alone: hundreds of thousands of forms (conjugations, plurals, etc.). Impossible to number them all.
2. **The pieces recombine.** With “anti”, “constitution” and “nelment”, we can make many other words. It's like LEGO bricks.
3. **Unknown words become manageable.** A never-before-seen word (“smurfology”) will be cut into small known pieces.

**Vocabulary:**
- The AI has a large list of tokens: its **vocabulary**. Typically between 30,000 and 200,000 tokens ⚠ *(order of magnitude in 2025–2026, varies depending on models)*.
- Each token has a **fixed number**. “cat” = always the same number for a given model.
- The template NEVER sees your letters. He sees the list of numbers.

**Mini-game “The human tokenizer” (8 min):**
In pairs, cut these words into “logical” pieces (like an AI would do):
`ordinateur`, `incroyablement`, `parapluie`, `chatbot`, `refaire`
Compare the divisions between pairs. Key point: **There is no single right answer** — each model has its own breakdown, learned automatically based on the frequency of pieces in its training texts.

**Fun fact to share:** French often “costs” more tokens than English to say the same thing (around 1.2× to 2× ⚠), because most models were trained primarily on English. This is why some services charge by token!

**Transition:** “OK, each token has a number.But number 9846 doesn't say anything about the *meaning* of "cat". How does the machine know that "cat" looks more like "dog" than "wheelbarrow"? Answer: embeddings. »

---

### Part 3 — Embeddings: the word map (45–60 min)

**Simple definition:**
> An **embedding** (English word that can be translated as “embedding” — especially remember: **meaning coordinates**) = transform each token into a point on a map. Words with a close meaning are **neighbors on the map**.

**Analogy of the map of France:**
> “On a map, Paris has coordinates, Lyon has coordinates. We can measure the distance between the two. Embeddings are the same, but instead of geography, the map represents MEANING. “Cat” and “dog” are neighbors. “Chat” and “bill” are opposites. »

**To draw on the board (2D map):**```
        roi •        • reine
        homme •      • femme

   chien •  • chat
        • hamster            • pizza
                             • sushi
```**The magic of word arithmetic:**
Write the famous equation on the board:
> **king − man + woman ≈ queen** 👑

Explanation: if we take the coordinates of “king”, remove the “man” direction and add the “woman” direction, we land near “queen”. The direction “masculine → feminine” is an **arrow** on the map, the same for many pairs of words.

Other examples to guess:
- Paris − France + Italy ≈? (**Rome**)
- eat − food + drink ≈ ? (**drink**)

⚠ *Honest precision: this arithmetic works well on old word models (like word2vec, 2013) and serves as intuition here. Modern AIs use more complex embeddings, but the idea “direction = position on a map” remains valid.*

**Technical point to simplify:** in reality, the “map” does not have 2 dimensions but hundreds, even thousands ⚠. Say: “Imagine a map not in 2D but in 1000D. Impossible for us to visualize, easy for the machine to calculate. We crush it in 2D to look at it. »

**Webpage demo:** open `webpage/index.html`, “Word map” tab. Slide words, show groups (animals, food, royalty, emotions). Test the “magic equation” mode.

---

### ☕ Break (60–70 min)

---

### Part 4 — The context window (70–85 min)

**Simple definition:**
> The **context window** = everything that the AI can “keep in mind” at once: your conversation, your documents, its own responses. Measured in tokens.

**Key message:** the AI ​​has NO permanent memory of your conversation. For each message, it **reads the entire conversation from the beginning** (everything that fits in the window) and calculates what happens next.

**Work table analogy:**
> “Imagine that you are doing your homework on a small table. You can place 10 sheets maximum on it. If an 11th leaf arrives, one must fall off — usually the oldest. The context window is this table: everything that is on it, the AI ​​sees; everything that fell, she forgot. »

**Concrete consequences to be given:**
1. In a **very long conversation**, the AI may forget what you said at the beginning.
2. If you open a **new conversation**, it starts from scratch (except special memory functions of certain apps ⚠).
3. Recent models have increasingly large windows — from a few thousand to more than a million tokens ⚠ *(figures that change very quickly, to be checked at the time of the course)*. One million tokens ≈ several big novels.

**Reverse telephone game (5 min):**
Ask a volunteer to memorize a list of 15 races read once. He retains ~7. Conclusion: “You have a window of context, too! That of AI is bigger, but it exists and it has a limit. »

**Practical tip to give:** if a conversation becomes very long and the AI “loses the thread”, two reflexes:
- give him a **summary** of the important points;
- or open a **new conversation** with a good summary.

---

### Part 5 — Hallucinations (85–100 min)

**Simple definition:**
> A **hallucination** = when the AI confidently asserts something **false or invented**: a false date, a book that does not exist, a fabricated quote.

**Why does this happen? (the explanation that follows from the whole session):**
- The AI does not consult a fact base.It **calculates the next most probable token**.
- She is trained to produce *plausible* text, not *real* text.
- When she doesn't know, she doesn't always say "I don't know": she produces what *resembles* the most like a good answer. Like a student who has not revised but who writes with confidence.

**Formula to remember:**
> “AI is a machine for producing **plausible**, not **real**. Often the two coincide. Not always. »

**Typical examples of hallucinations to cite:**
- An **invented bibliography**: titles of books and authors that do not exist (very common).
- A **false quote** attributed to a famous person.
- A **distorted historical detail**: good story, wrong date.
- **Precise figures out of nowhere** (“73.4% of French people…” without source).

**How to spot them — the 4 reflexes to display:**
1. 🔍 **Check important facts** elsewhere (search engine, official source) — especially dates, numbers, names, quotes.
2. 🎯 **Be wary of being too precise**: the more precise and unverifiable a detail is, the more you should be wary.
3. 🔗 **Ask for sources**: “Where does this information come from? Give me the source. » (Warning: AI can also invent sources ⚠ — you have to click and check.)
4. ⚖️ **Rule of stakes**: the more important the decision (health, money, graded homework), the more it is necessary to check.

**Point of nuance:** hallucinations are decreasing with the new models and integrated search tools ⚠, but they have not disappeared. The verification reflex remains essential.

---

### Part 6 — Temperature (100–110 min)

**Simple definition:**
> The **temperature** = a slider which adjusts the randomness in the choice of tokens. Low = the AI ​​almost always chooses the most likely token (wise, predictable responses). High = it gives less likely tokens a chance (surprising, creative… or incoherent answers).

**Final vending machine analogy:**
Write on the board: “The sky is…” and the imaginary probabilities:
- blue: 60%
- gray: 25%
- magnificent: 10%
- in cheese: 0.1%

> “Low temperature: the AI almost always says “blue”. Average temperature: sometimes "gray" or "magnificent". Very high temperature: one day, she will say “cheese”. »

**When to use what (practical table):**

| Location | Temperature |
|----------|-------------|
| Summary, translation, code, math | Bass 🧊 |
| Balanced writing, emails | Average 🌤️ |
| Brainstorming, poetry, crazy ideas | High 🔥 |

⚠ *Note: in most consumer chatbots, you cannot adjust the temperature directly — it is set by the service. Some developer interfaces allow this. But we can imitate it with instructions: “answer in a very classic way” vs. “be bold and surprising”.*

**Webpage demo:** “Temperature lab” tab. Same question, cursor at 0 → 1 → 2. Make the room laugh with chaotic mode.

---

### Final activity — The parameters laboratory (110–115 min)

In pairs, on the interactive web page (or on a real chatbot if connection available):
1. Choose a question in the temperature lab.
2. Test in cold/medium/hot. Note the preferred answer and why.
3. In the tokenizer, find **the French word that costs the most tokens**.
4. On the word map, find the most surprising pair of words (close even though you didn't expect it).Flash restitution: each pair gives their favorite discovery in one sentence.

---

### Closing (115–120 min)

**The 6 sentences to remember (repeat or display):**
1. The computer does not understand words: it **calculates with numbers**.
2. The text is divided into **tokens**, each has a **number**.
3. **embeddings** place words on a meaning map: close in meaning = close in coordinates.
4. The **context window** is the AI's working memory — large, but limited.
5. AI produces **plausible**, not **real**: beware of **hallucinations**, we check.
6. **Temperature** sets the slider between predictable and creative.

**Teaser session 4:** “Now that we know HOW the machine reads… next time, we learn to TALK to it to get exactly what we want.” »

10-question quiz (see `quiz/quiz.md`) — whole class or individual.

---

## ⚠️ Educational pitfalls and anticipated FAQ

**“But then the AI doesn’t understand anything at all? »**
Nuanced answer: it doesn't have understanding like ours, but its calculations capture so many relationships between words that the result *works* like understanding in many cases. The philosophical debate “is it understanding?” » is open — and it's a great question.

**“Why did the AI ​​lie to me then?” »**
She does not “lie” (lying presupposes an intention). It produces the most probable text. Avoid moral vocabulary; prefer “she was wrong” or “she was hallucinating”.

**“ChatGPT remembers me every time! »**
Some apps add a memory function (notes stored separately and reinjected into the context) ⚠. It's not the model that remembers: it's the application that pastes notes into the window.

**“What are the real token numbers? »**
They depend on the model. Emphasize: the examples in the course are illustrative. What matters is the principle.

**Number sensitivity:** everything marked ⚠ (vocabulary sizes, window sizes, hallucination rate) evolves quickly. Check before each session.

---

## 📦 Material

- Video projector + `slides/slides.md`
- Interactive page `webpage/index.html` (works **offline**, no account required)
- Printed or projected exercises (`exercises/exercises.md`)
- Quiz (`quiz/quiz.md`)
- Whiteboard + markers for the word map and the tokenizer game
- Optional: access to a real chatbot for the final activity