Part II · Chapter 7
Learning to See and Hear
Much of what a nurse knows is not in words: what a worrying rash looks like, how a heart trace should look. Can the same recipe learn to see? It can, spectacularly well. It can also learn to see the wrong thing, and do so perfectly.
A learner sees, and hears, through features it invents itself. That is its power, and it is also why it can be right for the wrong reason.
The purple ink
Before a doctor removes a suspicious mole, they often draw around it with a purple surgical marker. That small habit caused a big problem for a skin-cancer program.
The program was a neural network trained on more than 120,000 close-up skin images to tell melanoma, a dangerous skin cancer, from harmless moles. It was approved for medical use in Europe. In 2019 a team in Heidelberg tested it on 130 moles, photographed three ways: unmarked, marked with purple ink, and cropped so that the ink was out of the frame.
| Images | Melanomas caught | Harmless moles correctly cleared |
|---|---|---|
| Unmarked | 96% | 84% |
| With purple ink | 100% | 46% |
| Ink cropped out | 100% | 97% |
On the harmless moles, the network’s average “melanoma score” rose from 0.16 to 0.54 when ink was present. The network had learned something about purple marks. The authors’ suggested reason is that in its training images, melanomas more often carried such markings, because suspicious lesions are the ones marked for removal. Nobody told it to look at the ink. Nobody told it not to.
Figure 7.1. The same harmless moles, unmarked and marked with surgical ink. Average melanoma scores from Winkler et al. (2019); the reason for the shift is the authors’ hypothesis.
This chapter is about how a network learns to see, and why both halves of that story, the 96% and the 46%, come from the same mechanism.
Seeing without rules
Much of what a nurse knows is not in words. What does a worrying rash look like? How does a healthy heart trace look? Try writing rules for it, as in Chapter 4: if the spots are round, and purple, and less than two millimeters across… You will fail faster than with the parent’s message, because an image is not even made of words. To a computer it is a grid of numbers, one per tiny square (pixel), saying how much red, green and blue is there. A phone photo has millions of them.
The recipe of Chapter 5 does not care. Give a network many labeled images and let gradient descent adjust its weights. What it learns turns out to be organized in layers:
- The first layers learn to respond to edges and colors: a dark line here, a shift from pink to purple there.
- Middle layers combine those into textures and shapes: a speckle, a ring, a blotch.
- Later layers combine those into parts and whole things: a mole, an eye, a face.
Nobody designed these features. They are what gradient descent found useful for getting the labels right. This set of learned features is called a representation: the machine’s own vocabulary for describing what it sees.
One design choice helps a lot. A spot is a spot wherever it appears in the picture. So instead of learning a separate spot-detector for every position, a convolutional network learns one small detector and slides it across the whole image. That is an inductive bias (Chapter 6): an assumption, built in, that the same pattern means the same thing anywhere. It is true of most images, and it is part of why these networks learn so well from limited data.
Meaning as position
A representation does something more than detect features. It places things in a kind of space. Each image, after passing through the network, becomes a long list of numbers: a point in a space with hundreds or thousands of directions. Images the network treats as similar end up near each other. Different ones end up far apart.
This idea, a concept stored as a pattern across many units rather than in one box, is called a distributed representation. It is what lets a network handle cases it has never seen: a new rash that lands near known dangerous rashes is treated like them. It is generalization (Chapter 6) made geometric. Chapter 8 shows the same idea applied to words, with striking results.
Shortcuts
Now the cost. A network learns whatever best separates its labeled examples. If something easier than the disease reliably goes with the label, it will learn that instead. This is called shortcut learning.
The purple ink is one example. A larger one comes from chest X-rays. In 2018 researchers trained a network to detect pneumonia on X-rays from two American hospital systems and tested it on a third. It did clearly worse at the new hospital. The network could tell almost perfectly which hospital an X-ray came from, using technicians’ metal markers and scanner settings. And pneumonia was far more common at one hospital than another. A “model” that knew only the hospital, and nothing about lungs, already did well. So part of what looked like seeing pneumonia was seeing the hospital. Inside the original hospitals that shortcut works. Move to a new one and it fails. Nobody would notice by testing on more images from the same place.
Shortcuts are Goodhart’s law (Chapter 10) arriving early. The label was supposed to stand for the disease. The network optimized the label, and found a cheaper route to it.
Learning to hear
Many parents phone instead of typing. At two in the morning the voice may shake, the line may crackle, and a child may be crying in the background. A nurse hears through the noise and catches the words that matter. Can a machine?
Speech followed vision. Programs built on what experts knew about words, sounds and the vocal tract lost to programs that learned from data. The winners follow this chapter’s recipe. A recording is a long list of numbers, the rise and fall of air pressure thousands of times a second. It can be redrawn as a picture: time runs from left to right, pitch runs from bottom to top, and the brightness of each spot shows how much sound there is at that pitch at that moment. This picture is called a spectrogram. Each vowel and consonant leaves its own shape in it, the way each object leaves its own shape in a photo. So the methods that learned to see can learn to hear. The early layers pick out simple patterns of sound, later layers combine them into speech sounds, then syllables and words.
As with images, what changed was scale. In 2022 OpenAI trained a network called Whisper on 680,000 hours of audio from the internet, about 77 years of listening, with the rough transcripts that came with it. There were so many that it learned to transcribe speech in many languages, accents and noisy rooms, approaching human accuracy.
Writing down the words is only half of understanding them. “She’s floppy and won’t wake up properly” has to be recognized as words, and then understood as a danger sign. The second half is the subject of Chapter 8: the transcribed words go to a language model, which treats them like a typed message. Some newer systems join the two halves. They turn slices of sound directly into the units Chapter 8 introduces, so one model can listen and answer out loud. Such a model can keep some of what writing throws away, such as the urgency in a voice. Speaking back is the reverse step. Many systems pass the written answer to a separate model that turns text into speech; joined models such as Moshi produce pieces of sound alongside the text, so they can answer out loud as they go.
The costs of seeing carry over to hearing, unchanged. A recognizer knows the voices it was trained on. In 2020 a Stanford team tested the speech systems of five large companies on interviews with Black and white Americans. On average the systems got about 35% of the words wrong for Black speakers and about 19% for white speakers. The gap falls along accent and dialect, and so along who the speaker is. And a learner trained to produce fluent text can produce fluent text that was never said. A 2024 study found whole phrases that were never said in about 1% of Whisper’s transcriptions, some of them harmful. They were more common for speakers with aphasia, a condition that causes long pauses. A transcript that reads smoothly is not proof that anyone said it.
At this step, the machine is the software in your phone that recognizes faces in photos and turns your speech into text, but cannot hold a conversation about either.