Chapter 5. Learning from Mistakes第五章 从错误里学
A manga for grown-ups. Read it in English or Chinese.给大人看的漫画。可以用中文或英文读。































































































Some ideas in this chapter were left to the pictures, so the stairs, the kitchen and the airport could stay quiet. Here they are in words.
Papa's shortbread lid is a loss, one number for how wrong he was. Choosing the loss is choosing what "good" means. Mama's loss was "how far is Dad from me, and how safe". Grandpa's was "how far am I from my lake". A machine trained on a loss does exactly what the loss rewards, whether or not it was the thing people really wanted. That is why choosing the loss is one of the most careful jobs in building AI.
On page 6 Haoran's foggy hill is a picture of every way a machine's knobs could be set. Each setting is a spot on the hillside, and its height is the loss. Feeling the slope and stepping down it is called gradient descent. Augustin Cauchy described it in 1847.
On pages 13 and 16 Xiaoyu does what gradient descent does. She cannot see the answer, but she can feel which way each try went wrong. Three tries, three no's, and every one pointed down the same slope, towards the lake. A machine never knows why it was wrong. It gets a number and a direction, nothing more. Xiaoyu did something no machine does. She asked why.
On page 12 Haoran's laptop works all night. The ideas behind his program were all known by 1986, so why did learning machines take until 2012 to become powerful? Several things came together. Deep networks used to lose the blame signal on its way back through many layers, so their early layers barely learned. Better tricks fixed this. Big collections of labelled pictures appeared on the internet, such as ImageNet, with over a million training images. And graphics chips built for games turned out to be very good at the sums. In 2012 a network called AlexNet, trained on two gaming graphics cards for five or six days, beat every other entry in the ImageNet picture contest by a wide margin. A small group of researchers had kept going through the years when hardly anyone believed in these machines.
On page 11 the box says several people found backpropagation. Seppo Linnainmaa described the method in 1970. Paul Werbos suggested using it for neural networks in 1974. The 1986 paper by David Rumelhart, Geoffrey Hinton and Ronald Williams made it famous, because it showed that hidden layers trained this way learn useful pieces by themselves. In 1989 Yann LeCun and his colleagues used a network trained this way to read handwritten postcodes on letters, the same job Haoran's program does for Xiaoyu.
The program on Xiaoyu's phone at the airport has stopped learning. Most real networks are frozen after training. They do not change their knobs while you use them.
A real loss landscape is not one smooth bowl. It has dips, flat plains and passes. People worried that a machine walking downhill would get stuck in a small dip. In very large networks this turns out to matter less than feared, though nobody can fully prove why. Whether the brain learns anything like backpropagation is still an open question.
A loss is a single number that says how far a network's answers are from the right ones. Zero means perfect. Papa's scores on the shortbread lid are a loss of this kind.
A common loss is the squared error. Squaring makes every error positive, and it punishes a big error much more than a small one. When a network has to choose between answers, such as which character a drawing shows, it usually uses a different loss called cross-entropy.
Augustin-Louis Cauchy described stepping downhill, gradient descent, in 1847. Networks use a version that looks at only a small random handful of examples at each step. That idea has its roots in work by Herbert Robbins and Sutton Monro in 1951.
The size of each step, the learning rate, is chosen by people, often by trying. Too small and training crawls. Too big and the knobs bounce across the valley or fly off the hill. Refined methods such as one called Adam adjust the step for each knob separately.
People long worried that a machine walking downhill would get stuck in a small dip. In very large networks most flat places turn out to be saddles, like a mountain pass, where some direction still leads down. And most of the real dips are nearly as low as the best one.
Backpropagation finds the slope for every knob in one sweep backwards through the network. It uses the chain rule from calculus. The error at the output is passed back layer by layer, and each knob gets its share of the blame.
The method has more than one inventor. Seppo Linnainmaa described it in 1970 and published it in 1976. Henry Kelley used a related method for flight paths in 1960, and Shun-ichi Amari's work of 1967 is also counted among the early gradient methods. Paul Werbos proposed it for neural networks in 1974. In 1986 David Rumelhart, Geoffrey Hinton and Ronald Williams made it famous.
Training is one small loop, repeated a very great number of times. Take a few examples. Get the answers. Measure the loss. Pass the blame back. Nudge every knob a little. One pass through all the examples is called an epoch, and training takes many. Nobody tells the network what to look for. Useful pieces, like the four dots in 雨, grow out of the nudges by themselves.
The blame signal used to fade on its way back through many layers. Sepp Hochreiter studied this in 1991, and Yoshua Bengio and his colleagues in 1994. A simpler way for each neuron to turn its total into an answer, called ReLU, helped the signal get through. Big labelled collections such as ImageNet appeared. Graphics chips made the sums fast, and in 2012 AlexNet was trained on two of them in five or six days.
The growth since has been steep. From about 2010, the computing used to train the largest models has doubled roughly every six months.
Bridge City, Xiaoyu, Grandpa Chen, Mama, Papa, Haoran, Lili, Uncle Wu, Auntie Zhang, the nurse and the care home, the card game and its scores, and Haoran's handwriting program. A small program like his, with some thousands of weights, really could learn to read one person's handwriting overnight on an old laptop, but his is made up, and so is the moment it finds the four dots. Grandpa's memory is drawn from no one in particular, and the story makes no medical claim.
Yingying Fu created this manga. She chose the story and its people, directed every page, and edited every word and picture. The words were drafted with Claude, an AI by Anthropic. The pictures are made with AI image generation, painted panel by panel from her direction and checked and corrected by hand.
这一章有些道理交给了画面,好让楼梯、厨房和机场那几页安安静静的。这里再用文字讲一遍。
爸爸那个饼干盒盖,就是一个"损失",用一个数说他错了多少。选什么当损失,就是选什么叫"好"。妈妈的损失是"爸离我多远,安不安全"。外公的损失是"我离我的湖有多远"。机器按哪个损失训练,就只管把那个数变小,不管那是不是人真正想要的。所以选损失,是做人工智能最要小心的活儿之一。
第六页浩然说的雾里那座山,其实是机器旋钮所有的拧法。一种拧法是山坡上的一个点,这个点有多高,损失就有多大。摸着坡往下走,叫梯度下降。早在一八四七年,柯西就写下了这个办法。
第十三到十六页,小雨做的正是梯度下降。答案她看不见,可每回错在哪边,她摸得出来。问了三次,三个"不",都指着同一面坡,坡底就是那个湖。机器从来不知道自己为什么错,它只拿到一个数和一个方向。小雨做了一件机器不会做的事。她问了为什么。
第十二页,浩然的电脑跑了一整夜。他的程序靠的那些道理,一九八六年就齐了,可会学习的机器为什么要等到二〇一二年才厉害起来?因为好几样东西凑到了一块儿。以前网络一深,错往回传的时候,信号一层比一层弱,前面几层几乎学不到东西,后来才有了更好的办法。网上有了成堆标好答案的图片,比如ImageNet,光训练用的就有一百多万张。给游戏做的显卡,算起这种题来又快又好。二〇一二年,一个叫AlexNet的网络,在两块游戏显卡上训练了五六天,在ImageNet看图比赛里把别人远远甩在后面。在几乎没人相信这种机器的那些年里,有一小群研究者一直没放弃。
第十一页的方框说,好几个人都想到过反向传播。林纳因马一九七〇年就写出了这个方法,韦尔博斯一九七四年提出拿它训练神经网络。一九八六年,鲁梅尔哈特、辛顿和威廉斯的论文让它出了名,因为论文证明,这样训练出来的隐藏层,会自己学出有用的小零件。一九八九年,杨立昆和同事用这样训练的网络认信封上手写的邮编,跟浩然的程序替小雨干的是同一件事。
机场里小雨手机上那个程序,已经不再学了。真正用起来的网络,大多训练完就"冻住"了,你用它的时候,旋钮不会再动。
真的损失地形不是一个光溜溜的碗,有小坑,有平地,也有山口。人们担心机器往下走会卡在小坑里。可在特别大的网络里,这事没大家怕的那么严重,只是为什么,还没人能完全证明。大脑学东西是不是也靠反向传播,到现在也没有定论。
损失是一个数,说的是网络的答案离正确答案有多远。零就是全对。爸爸写在饼干盒盖上的分数,就是这样一种损失。
常用的一种损失叫"平方误差"。一平方,每个误差都成了正数,大错也比小错罚得重得多。要是网络得在几个答案里挑一个,比如认出纸上画的是哪个字,一般就换另一种损失,叫"交叉熵"。
顺着坡往下走,就是梯度下降,柯西1847年就讲过。神经网络用的是它的一个变种,每一步只看随手抓来的一小把例子。这个想法可以追到罗宾斯和门罗1951年的研究。
每一步迈多大,叫学习率,是人定的,常常要一次次试。太小,训练慢得像爬。太大,旋钮就在山谷两边来回蹦,甚至蹦出山去。像 Adam 这样改进过的办法,会给每个旋钮各自调步子。
人们一直担心,机器往下走,会困在一个小坑里出不来。可在特别大的网络里,平的地方大多其实是"鞍点",像山口一样,总还有一个方向能往下走。真正的坑,也大多跟最深的那个差不多深。
反向传播把网络从后往前扫一遍,就算出了每个旋钮的坡度,用的是微积分里的"链式法则"。输出那头的错一层层往回传,每个旋钮分到自己那份责任。
这个办法不止一个发明人。林纳因马1970年就描述过它,1976年正式发表。凯利1960年在计算飞行路线时用过相近的办法,甘利俊一1967年的工作也被算在早期的梯度方法里。韦尔博斯1974年提出把它用在神经网络上。1986年,鲁梅尔哈特、辛顿和威廉斯让它出了名。
训练就是一个小圈,转上非常非常多遍。拿几个例子,得出答案,算出损失,把责任往回传,每个旋钮轻轻拧一下。所有例子过一遍叫一"轮",训练要过很多轮。没人告诉网络该看什么。有用的小零件,比如"雨"里那四个点,是从这些小调整里自己长出来的。
从前,责任信号往回穿过很多层,越传越弱。霍赫赖特1991年研究过这个问题,本吉奥和同事1994年也研究过。后来有了一种更简单的办法,叫 ReLU,让每个神经元把加起来的总数变成输出,信号就传得过去了。又有了 ImageNet 这样大批标好的图片。显卡让计算快了起来,2012年的 AlexNet,就是在两块显卡上训练了五六天。
从那以后,涨得非常快。大约从2010年起,训练最大的模型用的计算量,差不多每半年就翻一番。
桥城、小雨、陈外公、妈妈、爸爸、浩然、丽丽、吴爷爷、张阿姨、护士和养老院、那种牌和它的分数,还有浩然的手写程序。像他那样有几千个权重的小程序,真的能在一台旧电脑上用一个晚上学会认一个人的字,不过他的程序是编的,它找到那四个点的那一刻也是编的。外公的记性不是照着哪个真人写的,故事也不做任何医学判断。
这本漫画由 Yingying Fu 创作。故事和人物由她决定,每一页由她导演,每一句话、每一幅画由她修改。文字是和 Anthropic 的人工智能 Claude 一起起草的。画面由人工智能生成,按她的要求一格一格地画,再逐张检查、修正。
© 2026 Yingying Fu. All rights reserved.© 2026 傅颖盈。保留所有权利。