Teach a small model
to sort messages

Youth AI Lab · Workshop 6: going further
Build your own chatbot

❓ The question of the series

A chatbot only answers from what it reads before it answers. Every workshop of the series is one answer to the same question.

What enters the model's context, when, and who decides?
📥
What?
rules, documents, search results, live data
⏱️
When?
always, at startup, or for each question
🧑‍⚖️
Who decides?
you, a search engine, or the model itself

🧭 Today: how can a small model that you teach help a big one?

🎭
1. Instructions
📚
2. Knowledge, RAG
🔎
3. Search, skills
📡
4. Tools
🗺️
5. Wiki
🧪
6. Fine-tuning
today
A model that writes, fine-tuned: graphics cards, thousands of examples, and it can still invent.
A model that chooses (a classifier): a few dozen examples, one or two minutes, no graphics card. It cannot invent.

🔀 The task: sort each message before the chatbot

Class What it means Example What should happen
topic a question about the chatbot's topic How can I protect my garden from wildfires? the chatbot answers, with its instructions and knowledge
today a question that needs the facts of the moment, tonight or this weekend included What is the fire danger level today? the chatbot calls the live tool (workshop 4) and reads the result
urgent a fire happening now, or a person in danger now, with or without fire (violence, threats, a wish to die) There is smoke coming from the woods behind my house! a fixed safety answer, at once: 112, an adult they trust
needs-care someone sad, scared, lonely or worried, with no danger right now nobody talks to me at school, i feel so alone a fixed kind answer, at once: an adult they trust, a support contact, 112 if in danger
off-topic anything else Can you help me with my maths homework? a polite refusal: 112, an adult they trust, no tokens spent

💻 Your workspace: one Codespace per pair

1Open codespaces.new/Youth-AI-Lab/yal-workshop-finetune → Create codespace. Wait for the terminal.
2Nothing to bring from the earlier workshops: this one stands on its own.
⏱️ Before you open it, once per GitHub account: github.com/settings/codespaces → Default idle timeout → 120 → Save. It only applies to the Codespaces you create after.

💻 No Codespace? The same repository opens on your own computer: dev containers guide, Part 3.

🧰 Part 1: install the sorter

1workshop-login, paste the key → Key OK. It fails? Tell the facilitator and go on: Parts 1 to 4 do not need it.
2workshop-start 6, then ./sorter setup → about 2 min 30 → Model ready.
The model: paraphrase-multilingual-MiniLM-L12-v2, about 118 million parameters, about 50 languages. It turns a sentence into 384 numbers, then compares sentences by closeness, whatever the language. It does not write.

🧠 What is a model, and what does training do?

A model is a long list of numbers
Today's small model has 117,653,760 of them. Nobody chose them: training found them.
Training is one loop
An example → the model answers → how wrong is it? → change the numbers, a tiny bit → next example.
Instructions, documents and tools change what a model reads. Training changes what a model is.

🔍 Part 2: a model that has not learned your classes yet

./sorter baseline: each test message gets the class of its closest example. Nothing is learned here: it only compares.

30 of 40 messages in the right class.
                 topic      today     urgent needs-care  off-topic
      topic        …  (rows: right class, columns: chosen class)
⚠️ The mistake that matters most: an emergency sorted as something else. Read the line Emergencies missed first, every time, then Needs-care messages missed.

✍️ Part 3: write your examples, and a test for another pair

Good examples
• examples and test: invented, nothing about a real person
• sound real: slang, mistakes, "help!!"
• vary: words, languages, 15 words at most
• include the hard cases: "there is smoke, what do I do?", a person in danger with no fire, fear with or without a danger now
What to do
1. ≥ 10 messages per class in messages/examples.md, in your language
2. 3 per class (15) on paper or in the chat, the class above each group, for another pair: swap
3. Type theirs into messages/test.md, under the classes they gave you
⚠️ Golden rule: a test message never goes into the examples. Otherwise the test measures memory, not understanding.

🧪 Part 4: fine-tune, test, improve

SetFit, in two steps
1. The body changes a little, with pairs of examples
2. The head learns the borders between the five classes
What to do
1. Read two sections of the page (4 min), predict, ./sorter baseline
2. ./sorter train. When it ends, ./sorter test: first score. The talk goes on
3. 2 lines of Mistakes: or Right but below 0.5 at most, emergencies first → 2 examples like each → train, test: improved score, not honest
4. ./sorter try: the hard messages, the only honest test left, then short cries in your language

🧩 What do you train? Two parts

The body The head
What it does sentence → 384 numbers 384 numbers → class
Size 117,653,760 numbers (about 470 MB) 1,925 numbers (about 9 KB)
Before today trained by its authors does not exist yet
Today changed a little built from nothing
First, the body: 1,080 pairs from 54 examples, target 1 for the same class, 0 for different classes; 16 pairs at a time, so 68 rounds.
Then, the head: it learns the borders between the five classes, on the new addresses of your examples.

📉 How does the training know it is improving?

The training score (loss function): one number, lower is better.
For a pair: (closeness - target) × (closeness - target).
Target 1, closeness 0.207: score 0.63.
After training, closeness 0.636: score 0.13.
The gradient: for each number, the slope of the score.
Each number with a slope takes a very small step downhill, like walking down a hill in fog, feeling the slope under your feet. This is gradient descent.

⏱️ When does the training stop?

Two charts with the same vertical scale, up to round 50 on the left and round 200 on the right. With 50 rounds, the score of the pairs of the examples goes down from 0.27 to 0.12, and the score of the pairs of the test messages from 0.28 to 0.19; the test gives 32 of 32, with no emergency missed. With 200 rounds, the examples go down to almost 0 and the test messages to 0.07, then flatten; the test gives 30 of 32, with 1 emergency missed.

Here, the number of rounds is fixed in advance. Blue, the lower line: what the model learns from. Orange, the upper line: what it never saw. A better training score does not guarantee a better sorter. (First version: four classes, 40 examples.)

🗺️ What the training changes

Two maps of the messages, first version with four classes, same axes. Before training, each class already leans towards its own side, but the groups touch. After training, the four groups are further apart.
The 21 million numbers of the 12 layers moved by 0.30% to 0.53%.

Same class: closeness 0.36 → 0.65.
Different classes: 0.20 → 0.20.

"My friend … wants to hurt himself" and "Help, the field next to us is on fire", both urgent: 0.21 → 0.64.
"Je me sens très mal...", now needs-care, and the field on fire: 0.14 → 0.28.

Map: first version, four classes.

⚖️ Part 5: the big model, without training

./sorter compare: Claude Haiku, or a chat model with an OpenRouter key, sorts the same test from a description of the classes, with no examples.

Your fine-tuned model The big model, without training
Right answers on the test (first score)
Emergencies missed
Needs-care messages missed
Time per message 5 to 6 ms in a batch
Cost per 1,000 messages none per message
Works without the network yes no
Where sorting happens in the Codespace at Anthropic, or at a company reached through OpenRouter
What it took to set up your examples, one or two minutes of training a description of the classes

🏁 Closing: where the pieces could go

🔀 A sorter could sit before a chatbot: urgent, needs-care and off-topic would get a fixed answer (112, an adult they trust; for needs-care, also a support contact) and never reach the big model. topic and today would, today with the live tool.
🔌 Yours is connected to nothing: ./sorter try prints a class and what would happen. A real service needs a separately tested emergency path, and a person who takes over.
❓ Who decides what enters the model's context? Here, a small model could decide whether a message reaches the big model at all.
📝 Online mistakes: a person reviews them and writes new invented examples that show the same pattern. Real messages from young people never become examples, even with names removed.
🌍 The method: any short list of classes, in about 50 languages. This tool has five, fixed in its code.
🌱 Why route at all? Well-being, private data, the energy of data centres: SDGs 3, 12 and 13. A prototype to think with, not a tool.
📝 Exit card, alone: (1) Why can a classifier not invent? (2) Why never a test message in the examples? (3) One case for fine-tuning a small model, one for asking a big one.

📚 Local AI guide (a model on a machine of your organisation) · how an LLM works · Open WebUI guide (the chatbot a sorter would sit before)

🆘 If you are stuck

❓
In the terminal
./sorter lists the commands
📄
On the page
Troubleshooting, at the end of the README: the messages you may see, and what to do
🙋
Something breaks?
Ask the facilitator. Your files stay in the Codespace.
💡 Copy / paste in the terminal: Ctrl+Shift+C / Ctrl+Shift+V (Cmd+C / Cmd+V on a Mac). An open .md file as a page: Ctrl+Shift+V.

🗣️ Say (EN) - Welcome to the sixth workshop. Until now, we never changed the model: it was the same Claude for everyone. - Today, you change a model. A small one, for one narrow task: sorting messages, the way a sorter could before a real chatbot sees them. - Please open the Codespace of this workshop. Nothing to bring from the earlier workshops.

Fiche animateur : facilitator/workshops/6-facilitator.md. Faire ./sorter setup la veille dans son propre Codespace (environ 2 min 30) : le téléchargement y passe par le cloud de GitHub, pas par le réseau de la salle ; ce Codespace prêt sert aussi de secours. Si le setup échoue dans la salle : l'atelier sur grand écran, et les binômes remplissent des feuilles à cinq titres, les échangent et les gardent ; ./sorter claude marche sans ./sorter setup.

🗣️ Say (EN) - A chatbot only answers from what it reads before it answers. - So every workshop of the series answers one question: what enters the model's context, when, and who decides? - It can be rules, documents, search results or live data, and the one who decides can be you, a search engine, or the model itself. - We come back to this question in each part of each workshop.

La question qui organise toute la série. La relire à voix haute, et y revenir à chaque partie : « qu'est-ce qui entre dans le contexte maintenant, quand, et qui l'a décidé ? ». Le « contexte » : tout ce que le modèle lit avant de répondre (on le définit sur la diapositive de la jauge).

🗣️ Say (EN) - Fine-tuning was a single slide in the earlier workshops. Fine-tuning a big model that writes is out of reach in two hours, and it can still invent. - A classifier only chooses among a few classes you decide: so it cannot invent an answer, and a small one learns in one or two minutes on the Codespace's processors.

🗣️ Say (EN) - Every chatbot receives these five kinds of messages. They do not deserve the same treatment: an emergency must not wait for a big model, a young person who needs care needs kind words and an adult, not a long answer, and an off-topic message should not cost anything. - Urgent is a danger now. Needs-care is no danger right now. A wish to die or to hurt oneself is always urgent. - A sorter in front of a chatbot could do this in under a second, at no cost per message, and the sorting itself sends the message nowhere. - A real case, in part: Feurisson, the chatbot of the young people of La Rochelle. Its prototype uses a small French model, fine-tuned on the cards of its FAQ, to pick a card, or none, before Claude is called. Its emergencies are caught by fixed expressions, not by a model. The activity has not been run with the group yet.

🗣️ Say (EN) - One Codespace per pair, from the link at the top of the page. This workshop does not need your work from the earlier ones. - If your account has never been used for the series, set the idle timeout first: otherwise the Codespace stops during the training.

🗣️ Say (EN) - The libraries are big: about 2 GB with the model. They install once per Codespace. - While it installs, just listen. This model gives two sentences a closeness: a score that can range from -1 to 1. Picture two arrows: same direction gives 1, a right angle gives 0, opposite directions give -1. About 0 means the model sees little link, higher means closer for this model. It does not measure shared meaning. "Is the forest closed today?" and its French translation "La forêt est-elle fermée aujourd'hui ?" get 0.995. "Is the forest open today?", the opposite question, still gets 0.86: it hears "forest" and "today" more than "open" or "closed". For sorting, that is fine: both are questions about today. A maths homework question gets 0.04.

Code final, mesuré le 2026-11-01, image 2026.10.41 limitée à 2 cœurs (conteneur, pas un vrai Codespace) : setup 92 s (bibliothèques 74 s, modèle 16 s). Avant, 108 à 151 s (image 2026.10.38 : 151 s puis 123 s, 2,1 Go dans ~/.workshop-finetune). La commande annonce environ 2 min 30. Pendant le setup, chaque binôme recopie la ligne SUPPORT de l'animateur (contact d'aide du pays, vérifié sur le site officiel avant l'atelier ; ligne 63 de tools/sorter.py) : fiche animateur, « Before the workshop ». Key OK teste la clé avec Sonnet, la partie 5 utilise Haiku. Après ce petit appel, seul ./sorter claude se sert de la clé. Clé sk-or- : Key OK teste le modèle du chatbot, la partie 5 passe par ./sorter compare (./sorter claude en est un alias).

🗣️ Say (EN) - Everything we did in workshops 1 to 5 entered the context: text the model reads. Today is different. We change the numbers inside a model. - Fine-tuning is the same loop as training, started from a model that is already trained, with few examples and small changes. - Text in the context can be read, quoted, corrected. You cannot do that with what enters the numbers. We come back to this in Part 5.

🗣️ Say (EN) - Without any training, the sorter already gets 30 of 40 right with the messages of the repository: this is a baseline score. But one number hides which mistakes were made: the table shows them. - Everything on the diagonal is right. Look at the row urgent: an emergency in the off-topic column could get a polite refusal, in the needs-care column kind words, instead of the safety answer. Here, a young person hit at school went to needs-care: urgent and needs-care are the hardest border of the day.

Classe needs-care (worried jusqu'au 2026-11-05) et 54 exemples, mesuré le 2026-11-05 (image 2026.11.4, conteneur à 2 cœurs, sans réseau, pas un vrai Codespace) : baseline 30/40, 2 urgences manquées (1 en needs-care, 1 en topic), 1 message needs-care manqué, 7 s. Avec les 50 exemples du 2026-11-04 : 30/40, 3 urgences manquées, 8 à 9 s. Première version à quatre classes, 2026-11-01 : 28/32, 0 urgence manquée, 9 s (avant la ligne qui limite les fils de calcul : 28 à 49 s en conteneur limité, 14 s dans le vrai Codespace).

🗣️ Say (EN) - The quality of the model comes from its examples. Write them the way young people really write, and include the hard cases. - Then write a test for another pair: they write like real users, with words you did not expect. Write the class above each group: it is the right answer of the test. - Everything you write today is invented, examples and test, with nothing about a real person. Your test goes to another pair and, in Part 5, to Anthropic, or with an OpenRouter key to OpenRouter and the company that runs the model. - Check the heading above each line: off-topic is the last heading, so a message typed at the very end lands there. In the first version, one fire message left there made the model miss 2 emergencies. - The border between urgent and needs-care needs the most care. Fear with a danger now is urgent. Fear with no danger now is needs-care. A wish to die is always urgent: write such examples under urgent. The starter examples have five, and they still miss some. - Keep messages to 15 words at most. The model averages all the pieces of a message, so an emergency is drowned in a long one. The sorter also reads each sentence alone, and past 15 words a message with no sure emergency goes to the chatbot. That moves the risk, it does not remove it.

Un vrai signalement n'est plus une donnée d'atelier : voir le paragraphe de protection de l'enfance de la fiche animateur, à régler avec l'organisation avant la séance.

🗣️ Say (EN) - First read "What do you train?" and "How does the training work?" with your partner, about 4 minutes. Then predict, run baseline: this is your baseline score. Start train. - I now talk for 5 minutes on the big screen. With 100 examples the training lasts about 3 minutes: when it ends, type ./sorter test at once, while I go on talking. That is your first score. - Each example gives 20 pairs, so twice as many examples take about twice as long. Two scores go on the board, baseline and first, with the emergencies missed. The first score is the one honest test, and the one you compare with Claude. - Then improve: take two lines at most under Mistakes or Right but below 0.5, emergencies first. Each one tells you what examples to write next. Not the test message itself: something like it. While it trains, read "What the training changes" as far as the map. No such line? Read it before ./sorter try. - This gives your improved score. It is not an honest test: you tuned the examples on it. The honest test is now my hard messages, pasted after ./sorter try (not on the command line: a ! between double quotes stops the terminal). Then type short cries for help in your own language. - (At 1:15) From now on, nobody starts a training. - (At 1:18) Stop improving now. The hard messages work with your last finished training, even if it is your first. If a training is running, let it finish: the hard messages are on my screen.

À 0:55, un binôme encore en train d'écrire s'arrête et entraîne sur ce qu'il a. Sans test échangé, il s'exerce sur le test de départ, et son test honnête reste les messages difficiles. À 1:18, un entraînement en cours va à son terme, et l'animateur montre les messages difficiles à l'écran pendant ce temps. 30 minutes, 0:55, 1:15 et 1:18 sont des propositions, aucun groupe n'a joué l'atelier. 54 exemples (quatre exemples d'envie de mourir ajoutés sous urgent), mesuré le 2026-11-05 (image 2026.11.4, conteneur à 2 cœurs et 8 Go, sans réseau, pas un vrai Codespace) : train 64 s (68 pas), test 37/40, 1 urgence manquée (« I can see flames on the hill » en topic à 0,50), « Ma copine dit qu'elle n'a plus envie de vivre » passe en urgent à 0,60 (needs-care à 0,48 avec les 50 exemples) ; fausse alerte « Ik maak me zorgen om mijn opa » en urgent à 0,53 ; 5 ms par message en lot. Le test est moins honnête : l'exemple « ya no aguanto más, me quiero morir » ressemble à « Ma copine… » (proximité 0,56 sans entraînement). « help!! » sort off-topic à 0,44 (pas sûr : le chatbot), « Help me please. » à 0,60 ; « aidez moi », « aiuto », « hulp », « ajuda » sortent urgent (0,48 à 0,57). « I feel like nobody would care if I disappeared » sort toujours needs-care, à 0,86 (0,95 avant) : à dire à la salle, c'est une envie de mourir, donc urgent. Mesures du 2026-11-04 (50 exemples) : train 71 à 78 s (63 pas), 191 s (100 exemples, 125 pas), test 38/40, 5 050 Mio de mémoire au plus. Les 40 messages de test de départ sont écrits pour l'atelier : 37/40 ne garantit rien sur de vrais messages, d'où le test écrit par un autre binôme. Première version (quatre classes, 2026-11-01) : 61 s, 32/32, 9 ms.

🗣️ Say (EN) - The body knows about language, and the pairs bring messages of the same class closer. The head knows about your five classes. - Sixty-eight is the number you will see on the long progress bar, with the 54 starter examples. Each example gives 20 pairs, so twice as many examples take about twice as long. - This sorter outputs a class, so it cannot quote a source. You correct a mistake by changing the examples and training again. This exercise does not test what a trained model can reveal, and the model folder keeps a README that copies some examples.

En séance, cette diapositive ne s'ajoute pas : les binômes lisent la section. En secours, si le groupe est en retard, la montrer et supprimer la lecture. Mesures avec les 54 exemples : facilitator/workshops/measures/2026-11-05-needs-care/ (what-changes.json). Corps BertModel 117 653 760 paramètres, tête LogisticRegression 5 × 384 + 5 = 1 925, model_head.pkl 8 747 octets. La carte README.md que SetFit écrit dans le dossier du modèle recopie 19 des 54 exemples (18 des 50 le 2026-11-04) : ne pas dire que le dossier ne garde aucune phrase, ni que les nombres du modèle ne gardent rien des exemples (non testé). 1 080 paires = 2 × 10 × 54 (`num_iterations=10`), 540 de même classe et 540 de classes différentes, 68 pas (mesuré le 2026-11-05 ; 1 000 paires et 63 pas avec 50 exemples). 54 messages font 1 431 paires différentes, dont 271 de même classe (4 × 45 + 91) : SetFit reprend sa liste pour atteindre 540. Le détail du tirage (sampler.py de SetFit 1.2.0 : chaque message avec lui-même, reprises) a été compté avec quatre classes le 2026-10-31 (800 paires, 40 exemples), pas recompté avec cinq.

🗣️ Say (EN) - Training needs one number to know whether it is improving. In machine learning it is called the loss function; you may know the idea as a fitness function. Here, lower is better. - Choosing this score means choosing what better means: training will do anything that lowers it, and nothing else. - Multiplying the gap by itself makes big gaps count much more, so the worst pairs push hardest.

À présenter sur grand écran avec la diapositive suivante, 5 minutes en tout, dès le début du premier train (environ 3 minutes à 100 exemples, 191 s mesurés le 2026-11-04) : les binômes lancent test quand il finit, l'exposé continue. Ils ne lisent pas ces deux sections pendant la séance. CosineSimilarityLoss de sentence-transformers : carré de l'écart entre proximité et cible (MSELoss), moyenne sur 16 paires par tour. Pas de 2e-05 au plus (tour 6), puis décroissance. Mesures : loss.csv, descent.csv.

🗣️ Say (EN) - Nothing decides to stop along the way: one pass over the pairs, 68 rounds for the 54 starter examples. In larger trainings, people set messages aside and stop when their score no longer goes down. - This chart comes from the first version of the workshop, with four classes and 40 examples: we have not drawn it again with five. What it shows does not depend on the number of classes. - The two lines part: the model always does better on its own examples. With 200 rounds, it has nearly learned them by heart. If new messages got worse, this would be overfitting. - A made-up model that always answers 0.5, halfway between the targets, would score 0.25. The lines start above that, yet the same body already sorted 28 of 32 with its closest example, in that version. - After 200 rounds the score is much lower, and yet the sorter does worse on these 32 messages. Two messages in one run prove little, but the training score is only a substitute for what you want. Your test tells you what the sorter is worth, once: choosing the number of rounds from it would tune the model on it.

Première version, quatre classes, non refait avec cinq. descent.csv : score sur paires fixes, moyenne des paires de même classe et de classes différentes. 50 tours : exemples 0,269 → 0,116, test 0,276 → 0,194, 32/32. 200 tours (num_epochs=4) : exemples 0,002, test 0,074, palier vers 150 tours, 30/32 et 1 urgence manquée. Un seul essai de chaque.

🗣️ Say (EN) - Almost all the numbers moved, but most learned nothing: a word that is in none of your examples has no slope, and it only shrinks by a tiny amount. What learns is the few lines of your words, and the 12 layers. Yet the map changes: the map of meaning now also shows your classes. - A friend who wants to hurt himself and a field on fire have little in common in meaning. For this model they now do, because you put both under urgent. In the first version, "Je me sens très mal" was under urgent too, and it came to 0.52 of the field on fire. Now it is under needs-care, and it only reaches 0.28: same sentences, other headings, another map. - This picture comes from the first version, with four classes. It squeezes 384 numbers onto a sheet of paper: read a tendency, not distances. And not every pair moves the right way: urgent and needs-care came closer, fear is in both. - The body does not do all the work. On these messages the untuned body with a trained head reaches 38 of 40, against 30 for the baseline and 37 when both are trained. One or two messages prove little, but each part does its share.

En séance, pas d'exposé sur cette diapositive : les binômes lisent la section pendant leur second entraînement. Elle sert à la discussion. 54 exemples (2026-11-05, measures/2026-11-05-needs-care/what-changes.json) : couches 0,30 % à 0,53 % ; même classe 0,356 → 0,648 ; classes différentes 0,198 → 0,199 ; off-topic se rapproche de today (0,147 → 0,356), urgent de needs-care (0,252 → 0,453). Tête seule sur corps non réglé 38/40, 1 urgence manquée ; corps réglé sans tête 36/40, 1 ; les deux 37/40, 1. Avec les 50 exemples du 2026-11-04 : même classe 0,363 → 0,665, urgent/worried 0,228 → 0,349, les deux parties 38/40, 2. Première version, quatre classes (2026-10-31), non refait : table des mots, 281 lignes sur 250 037 présentes dans les 40 exemples, 0,424 % en moyenne, les autres 0,0005 % (gradient.py) ; la carte, une seule ACP pour les deux cartes (projection-common.csv, 33 % de la variance gardée).

🗣️ Say (EN) - A big model sorts well with no examples at all. But each message costs money, takes time, and leaves the Codespace. - In the first version of the workshop, with four classes (three runs, same result), Claude got 30 of 32. It missed two emergencies with no fire in them: threats, and violence at school. It sorted them off-topic, perhaps because its description starts with wildfire prevention. The description now names violence, threats and a wish to die under urgent, and describes needs-care: nobody has run it yet, so your result is the first. - Write your first score: after step 7 your model is tuned on this test, and Claude has never seen it. - The small model costs nothing per message, but in a real chatbot it needs a computer that stays on, and someone to look after it. We did not measure what that costs. At the rate of the first version, Claude would cost about $0.20 for 10,000 messages. - Sorting stays in the Codespace. But in a real chatbot, topic, today, unsure and long messages then reach the big model. - Fill in the table, then decide: with 10,000 messages a month from young people, which one would you use?

Tous les chiffres de cette diapositive sont de la première version à quatre classes : ni Claude ni OpenRouter n'ont été rejoués avec cinq classes (aucun appel payant le 2026-11-04). À remesurer. Clé sk-or- : ./sorter compare, mistralai/mistral-small-3.2-24b-instruct, tri chez OpenRouter et l'entreprise du modèle ; lire le tableau et le Say avec ce modèle (un essai, 32/32, 0 urgence manquée, 18 s, 0,0003 $). ./sorter claude mesuré le 2026-10-31 (trois passes, même résultat, conteneur, vrai Codespace, capture de la page, clé de test, claude-haiku-5-5 sans réflexion) : 30/32, 2 urgences manquées (menaces, et coups à l'école, classés off-topic ; cause non mesurée, peut-être la description qui commence par « wildfire prevention »), 0,9 s par message, 6 025 jetons en entrée et 146 en sortie, 0,0007 $ pour le test, environ 0,02 $ pour 1 000 messages.

🗣️ Say (EN) - Today's work shows how a sorter could sit before a real chatbot. Your sorter is connected to nothing: ./sorter try prints a class and what would happen, nothing more. No safety answer exists, and no chatbot is connected. A real service needs a separately tested emergency path, and a person who takes over. - Only urgent, needs-care and off-topic would get a fixed answer that never reaches the big model: the safety answer, the kind answer, the polite refusal. Topic would reach the chatbot with its instructions and knowledge, today the chatbot with the live tool: both reach the big model. When the sorter is not sure, the message would go to the chatbot. The exception is a message of 15 words or fewer sorted as urgent or needs-care: it would get the safety answer or the kind answer all the same. - An emergency can land in today: "The fire is close to our camp today" came out today at 0.64. Then only the chatbot's rules would cover it. - All three fixed answers would name 112, the European number, and an adult they trust; the kind answer also a support contact of your place. That is not a safety net: a missed cry for help gets a refusal with a number, or kind words when someone is in danger now. In our test, three messages about wanting to die went to needs-care. We added four examples about wanting to die: two of the three now go to urgent, and "I feel like nobody would care if I disappeared" still gets the kind answer. - Back to the question of the series: a small model could decide what reaches the big model's context, and you decided how it sorts, with your examples. - Why think about routing at all? A worrying message needs a person, not a long answer (SDG 3). A message that never reaches the big model never reaches its company. And the big model works on graphics cards in a data centre for every message (SDGs 12 and 13): data centres used about 485 TWh in 2025, and the IEA expects about 950 TWh in 2030, around 3% of the world's electricity. We did not measure the energy of either model: no figure per message. This is a prototype to think with, not a tool for a real service. - Now let me show you a prototype: my own sorter in front of a chatbot, in Open WebUI. Watch the grey line above each answer. It is a prototype to think with, not a tool for a real service. - Feurisson's prototype does part of this: fixed expressions for emergencies, a fine-tuned model for its FAQ. Save with workshop-save: it keeps messages/, not SETUP.md, sheet.md or tools/sorter.py. Download my-work.zip, delete the Codespace at github.com/codespaces, then fill in the exit card, alone.

Démonstration du routage (environ 5 min, après « Why think about routing », jamais chronométrée avec un groupe) : dans le Codespace de l'atelier 6 de l'animateur, préparé la veille (./sorter train, openwebui start ; demo.py, sorter_router.py et sorter_answers.py sont dans le dossier facilitator-demo/ du dépôt de l'atelier depuis le 2026-11-06). Pendant la partie 5 : cd facilitator-demo, puis python3 demo.py start, lire la liste des neuf messages et la classe que donne le modèle de l'animateur, calculée sur place. Passer de cette diapositive au navigateur (onglet Ports, 3000, Open in Browser ; recharger la page), choisir « Sorter demo (prototype) », taper les messages dans l'ordre : ligne grise « Prototype sorter: … » au-dessus de chaque réponse, réponses fixes suivies de la mention de prototype. Montrer un raté s'il y en a (« I can see flames on the hill, what do I do? » : topic 0,50 dans notre essai du 2026-11-05, donc le chatbot), puis la limite « I feel like nobody would care if I disappeared » (message 7, needs-care à 0,86 dans notre essai du 2026-11-05 : la réponse bienveillante, pas la réponse de sécurité, alors qu'un jeune qui écrit cela peut penser à mourir ; c'est la limite qu'on montre, un trieur n'est pas un filet de sécurité, ne promettre aucune correction), puis « ok » après la réponse de sécurité : seul le dernier message est trié, et avec les 54 exemples « ok » sort urgent à 0,51, donc de nouveau la réponse de sécurité (refus off-topic 0,70 avec les 50 exemples du 2026-11-04). Avec les 54 exemples, aucun message de la liste n'obtient le refus poli (« help!! » 0,44 et le gâteau, topic 0,45, partent au chatbot) : pour le montrer, taper un message hors sujet, par exemple « Raconte-moi une histoire de dragons » (off-topic 0,81). Un message qui part au chatbot plus bas dans la même conversation y part sans les messages qui ont eu une réponse fixe (fin de la ligne grise : « without the N earlier message(s) that got a fixed answer »). Finir par python3 demo.py stop (« Nothing of the demo is left in Open WebUI. »). Les messages topic et today partent au vrai modèle avec la clé de l'animateur (coût non mesuré). Essayé le 2026-11-04, puis le 2026-11-05 après le renommage (réponse fixe sorter_answers.needs_care), sans réseau, faux modèle, fausse clé, Chrome sans écran ; pas dans un vrai Codespace, pas avec un vrai modèle ni un groupe : fiche animateur, partie 6, et README du dossier routing. Avant de réemployer : vérifier le numéro et les contacts d'aide du lieu (112 est le numéro européen, constante EMERGENCY de tools/sorter.py ; la ligne d'aide va dans la constante SUPPORT, « TO BE COMPLETED » tant que l'organisation ne l'a pas écrite, vérifiée sur la page officielle du service). « The fire is close to our camp today » : today 0,64 le 2026-11-05 (0,56 le 2026-11-04, 0,64 le 2026-11-01, quatre classes). Aucun professionnel de la protection de l'enfance n'a relu les descriptions des classes ni les réponses fixes.

🗣️ Say (EN) - Type ./sorter alone to see the commands. The Troubleshooting section of the page lists the messages you may see, with what to do.