# 🟢 Session 2 — Exercises: How does AI learn?

**Applied AI — Yann Isola · Beginner Level**
Three exercises, to do alone, in pairs or in groups. No computer required (unless noted). Corrections at the end of the document — don't cheat... or just a little. 😉

---

## Exercise 1 — 🎲 The ranking game: what way to learn?

**Duration: 15 min · Format: pairs then sharing**

An AI can learn in 3 ways:

- 👩‍🏫 **Supervised**: we give him examples WITH the correct answers (the teacher who corrects).
- 🍬 **Unsupervised**: we give her examples WITHOUT answers, she finds groups on her own (sorting candy).
- 🎮 **Reinforcement**: she tries, gains or loses points, and improves (the video game).

**For each situation below, indicate the learning mode (👩‍🏫, 🍬 or 🎮) and justify in one sentence:**

| # | Location | Fashion ? |
|---|---|---|
| 1 | We show an AI 100,000 photos of fruits, each with its name (“apple”, “banana”…), so that it learns to recognize them. | |
| 2 | An AI plays 10 million games of chess against itself; she gains points when she puts checkmate. | |
| 3 | A streaming site gives an AI the listening history of millions of users, without any instructions, and it discovers “families” of listeners with similar tastes. | |
| 4 | A bank shows an AI thousands of transactions labeled “fraud” or “normal” so it can learn to spot fraud. | |
| 5 | A virtual vacuum robot bumps into walls (-10 points) and covers a clean surface (+1 point per m²), and improves its route over time. | |
| 6 | An AI receives 50,000 press articles in bulk and automatically groups them by theme, without being given the list of themes. | |
| 7 | We train an AI to translate by showing it millions of French sentences with their English translation. | |
| 8 | 🌶️ *(Trap!)* A conversational AI is first trained on huge amounts of text, then humans rate its responses (👍/👎) to improve it. | |

**Bonus thought question:** for situation 1, what would happen if 10% of the labels were false (bananas labeled "apple")? Answer with the teacher's analogy.

---

## Exercise 2 — 🔍 Hunting for overfitting: the “by heart” student detector

**Duration: 15 min · Format: individual then collective correction**

**Reminder:** **overfitting** is when the AI learns its training examples “by heart” instead of understanding. Result: excellent on what she knows, poor on what is new. To detect it, we compare:
- the **training score** (on the exercises already seen)
- the **test score** (on exercises kept secret)

### Part A — Diagnosis

Four AIs were trained to recognize road signs. Here are their scores. For each, make your diagnosis: ✅ **good learning**, 🧠 **overfitting** (by heart), or 😴 **underfitting** (not learned enough).

| AI | Training score | Test score | Diagnosis? |
|---|---|---|---|
| A | 95% | 93% | |
| B | 99.9% | 61% | |
| C | 55% | 54% | |
| D | 88% | 85% | |

**Questions:**
1. Which would you choose to equip a real car? For what ?
2. AI B has the highest training score of all. Why is this a trap?
3. What advice should I give to the IA C team? (Hint: Think about the student who didn't work hard enough.)### Part B — The curves that speak

Here is the evolution of an AI's scores during its training:```
Score
100 %|                        ______ Entraînement
     |                ______/
  90 %|         _____/
     |       _/   ...•••••••...
  80 %|     _/ ..••            ••..
     |    /..•                     ••..  Test
  70 %|  /.•                           ••..
     |  /•                                 ••
  60 %| •
     +---------|---------|---------|---------→
     Début   Étape 1   Étape 2   Étape 3   Temps
```1. At the beginning, the two curves rise together. What is happening?
2. When does overfitting start? How do you see it?
3. If you were the engineer, when would you have stopped training?
4. 🌶️ **Transfer question:** tell the same story but with a human student who prepares for a test by doing THE SAME exercises 50 times. What is he good at doing? What is he missing?

---

## Exercise 3 — 🏗️ Build your own training dataset

**Duration: 20-25 min · Format: small groups of 3-4 · The most creative of the three!**

You are a team of AI engineers. Mission: **design the dataset on paper** to train an AI (supervised learning). You don't collect the real data — you write the **collection plan**, like the pros.

### Step 1 — Choose your project (or invent one)

- 🐶 An AI that recognizes whether a photo shows a dog or a cat
- 🎵 An AI that guesses whether a song is “happy” or “sad”
- ✉️ An AI that detects nasty messages on a social network
- 🍅 An AI that spots ripe tomatoes for a picking robot
- 💡 Your idea: ______________________

### Step 2 — Complete the design sheet

1. **Inputs**: what do we give to the AI? (photos? sounds? texts?)
2. **Labels**: what are the response categories? (2 minimum)
3. **Quantity**: how many examples per category? Justify. (Hint: 10 is too few. Why?)
4. **Diversity**: list **at least 5 variations** that must absolutely be included for the AI to generalize. *(Ex. for dogs: different breeds, indoor/outdoor, day/night, front/back, puppies/adults, etc.)*
5. **Who labels?** Who will give the correct answers, and what if two people disagree? *(Ex.: is this song happy or sad? Not so simple!)*
6. **Test Data**: How much do you keep secret for the final exam? Why should the AI ​​NEVER see them during training?

### Step 3 — The crash test 😈

Exchange your sheet with another group. Each group looks for **the flaws** in the others' plan:

- “And if we show your AI a fox, what does it say? » (ambiguous cases)
- “Are your photos all from the same phone? » (lack of diversity)
- “Who decided what is “bad”? Would everyone agree? » (bias and subjectivity)
- “Would your AI work in another country? In winter? » (generalization)

Write down the top 2 flaws found, then **correct your plan** accordingly.

### Step 4 — Final pitch (1 min per group)

Present: your AI, your data plan, the worst flaw found by the other group, and your fix.

> 💡 **What this exercise teaches you:** In real AI projects, collecting and preparing data is often THE biggest part of the work — much more than the training itself. The best AI engineers are obsessed with data quality first.

---
---

# 🔑 Fixed

## Exercise 1

| # | Answer | Rationale |
|---|---|---|
| 1 | 👩‍🏫 Supervised | Examples + correct answers (fruit names = labels). |
| 2 | 🎮 Strengthening | Trials + reward (victory) / punishment (defeat). |
| 3 | 🍬 Unsupervised | No labels: the AI ​​discovers groups alone. |
| 4 | 👩‍🏫 Supervised | Transactions labeled "fraud"/"normal".|
| 5 | 🎮 Strengthening | Points gained/lost according to actions, improvement by trials. |
| 6 | 🍬 Unsupervised | Bulk articles, themes discovered without instructions. |
| 7 | 👩‍🏫 Supervised | Each sentence has its “right answer”: translation. |
| 8 | 🌶️ Mix! | Pre-training on texts, THEN reinforcement based on human notes (👍/👎 = rewards). Real AI often combines several modes. |

**Bonus:** it's like a teacher who corrects with a wrong answer 1 time out of 10: the student partly learns from the mistakes. AI will sometimes confuse apples and bananas — false labels “poison” learning. Quality > quantity.

## Exercise 2

**Part A:**

| AI | Diagnosis | Why |
|---|---|---|
| A | ✅ Happy learning | High AND close scores: it generalizes. |
| B | 🧠 Overfitting | Almost perfect on the training, catastrophic on the new one: she learned by heart. |
| C | 😴Underfitting | Bad everywhere: she didn't learn enough (not enough data, training, or too simple model). |
| D | ✅ Happy learning | A little weaker than A, but healthy (close scores). |

1. **AI A**: best score on NEW data — and on the road, everything is new.
2. Practice score only measures recitation. Only the test score measures true competence. B is the student who memorized the workbook.
3. For C: more data, more training, or a stronger model. It’s the student who simply has to work harder.

**Part B:**
1. The AI learns general regularities, useful everywhere: both scores go up.
2. Towards stage 1-2: the test curve peaks and then **comes down** while the training curve continues to rise. The divergence of the curves = signature of overfitting.
3. At the top of the TEST curve (around step 1-2). The pros call this **early stopping**.
4. The student becomes unbeatable… on these 50 precise exercises (he knows the answers by heart). But he fails every new exercise: he has memorized answers instead of understanding methods. This is exactly AI B.

## Exercise 3

No single answer key — evaluation grid for the facilitator:

| Criterion | We are waiting… |
|---|---|
| Entries/labels | Consistent and precise (categories without fuzzy overlap) |
| Quantity | Hundreds/thousands per category, AND balanced between categories |
| Diversity | ≥ 5 relevant variations (conditions, angles, styles, populations, etc.) |
| Labeling | Awareness of subjectivity; idea of ​​having several people vote in case of disagreement |
| Test data | A part (often ~10-20%) kept secret; if the AI ​​sees them, the exam is rigged (it could "recite" them) |
| Crash test | Relevant flaws found AND concrete fixes |

**Discussion points to bring up:** ambiguous cases (fox? bittersweet song?), bias ("bad" according to whom?), and the fact that data decides EVERYTHING the AI ​​will know — and everything it will ignore.

---
*Applied AI — Yann Isola · Beginner Level 🟢 · Session 2 — Exercises*