Your phone can tell a cat from a dog in a photo — yet nobody ever wrote it a rule for “cat”. So how does it know? It looked at thousands of examples and found the pattern itself. That is machine learning (机器学习). Today, you are the trainer.
Your mission: train a fruit-sorting AI until it scores well on test fruit it has never seen; catch bias and bad labels in its training data; then build a tiny next-word chatbot and find out why it can sound confident and still be wrong.
The AI can’t see fruit. It only gets two numbers — features (特征): size and colour. Each dot is one fruit. You label examples; when a new fruit arrives, the AI finds the k closest examples and lets them vote. That is the k-nearest-neighbour algorithm (k-NN). The background colours are its “map” of what it would guess anywhere.
Training data (训练数据) are the labelled examples you give the AI to learn from. The test set is 64 other fruit it has never seen. Only a good score on the test set shows it really learned — and didn’t just memorise.
With k = 1 the AI trusts only its single closest example — one mislabelled dot can fool it. With k = 5, five neighbours vote, so a few mistakes get outvoted. But if k is too big, borders blur and small groups get swamped by big ones.
Same idea: features + labelled examples → model → prediction. Real image AIs use neural networks (神经网络) that find thousands of features in each photo by themselves and train on millions of pictures. But they, too, only learn what is in their data.
If a group of people or things is missing or rare in the training data, the AI makes more mistakes on them — not on purpose, but because the data was incomplete. Some face-recognition systems were less accurate for darker-skinned faces because their training photos had too few of them. The fix: more complete, diverse data — and check accuracy group by group.
The ImageNet challenge: show a computer 100,000 photos it has never seen and ask it to name the object out of 1,000 categories (five guesses allowed). Drag the slider to read each year’s winning error rate. In 2012 a neural network (deep learning) won for the first time — and errors dropped sharply.
Data: ImageNet Large Scale Visual Recognition Challenge (ILSVRC) winning results 2010–2017 (Russakovsky et al., 2015, and published yearly results), rounded — approximate. The human “about 5%” is one researcher’s own 2014 test, an estimate rather than a precise measurement.
No. You saw two or three cats and can recognise every cat — and you know cats get hungry and scared. An AI needs thousands of examples and only knows statistical patterns, not understanding. It can beat people at narrow tasks like chess or labelling photos, but it can’t switch to a new task the way you can.
People are. Those who design, train and use an AI must check that it is fair, safe and respects privacy. That’s why many countries, including China and the US, are writing rules for AI.
Chatbots (large language models) keep doing one thing: given the words so far, guess the most likely next word. Our tiny model read just 14 sentences and only remembers which word follows which. Pick a start word, look at its predicted probabilities, then let it write.
It only knows how words link, not what sentences mean or whether they’re true. “The moon is a planet” is a smooth chain of likely words — and false. Real chatbots learned from trillions of words, so they sound far more human, but they can still invent confident, wrong answers — called hallucination (幻觉). Check important facts in reliable sources.
Ours looks back one word and stores a few dozen pairs. A large language model uses a neural network that looks back over thousands of tokens (词元) with billions to trillions of parameters. Same core job: predict the next token.
Pick the best answer and read the explanation.
Drag each item (or tap it, then tap a box) into the right group.
US standards: CSTA K-12 CS Standards (2017) 2-IC-20 (compare tradeoffs of computing technologies in everyday life and careers), 2-IC-21 (discuss bias and accessibility in the design of existing technologies), 2-DA-09 (refine computational models based on the data they generate), 2-AP-17 (systematically test and refine programs using a range of test cases). Georgia K-12 Computer Science Standards (6–8), e.g. CSS.CT.6-8.40.1 (distinguish human from machine intelligence), CSS.CT.6-8.40.2 (describe how computers model intelligent behaviour — robot motion, speech, vision — and how that differs from human reasoning), CSS.KC.6-8.20.3 (how computers represent data). Codes as listed in GaDOE’s 6–8 CS framework (via CodeHS); check wording against the GaDOE document.
China’s curriculum: Compulsory Education Information Technology Curriculum Standards (2022), stage 4 (grades 7–9), grade-9 module “Artificial intelligence and the smart society” (how AI works, training data and models, uses, safety and ethics); learning strand “Artificial intelligence”, linked to the “Data” and “Algorithms” strands. Both countries ask students to understand that AI learns from data, and to discuss bias and ethics.
Notes: the fruit data are invented teaching data (two features so the space can be seen on a flat map); the classifier is a real k-NN and the 64-fruit test set is fixed. The next-word model is a real bigram model. ImageNet values are the published yearly winners (approximate); the ~5% human figure is a single-person estimate. Milestone years and the face-recognition bias example were written from the author’s knowledge — teachers may wish to check them.
Suggested use: have students train on red apples only and predict what a green apple will be called before testing; discuss “Who might be the ‘green apples’ missing from real datasets?”; finally generate a false sentence with the word model and discuss why AI answers need checking.