🦜 过拟合:背题 vs 懂规律🦜 Overfitting: Memorizing vs Understanding
上一片里,我们把学习率的步子调得刚好,训练误差一路往下。可是——练得越熟,就学得越好吗?把练习册答案全背下来的小机器人,考试一换题就傻眼。这一片说说这种“背题”毛病。Last leaf we tuned the learning rate just right, and the training error slid steadily down. But does “better on the practice book” really mean “learned more”? A robot that memorizes every answer in the workbook freezes on a fresh exam question. This leaf is about that “memorizer’s” problem.
第 1 步:两个学生,两种学法Step 1: Two students, two ways to study
先看同一个班里的两个学生——他们的学法完全不一样。Meet two students in the same class — their study styles could not be more different.
小明把练习册做了一遍又一遍,连答案在第几页都背下来:练习册次次满分,一换新题就发懵。小红边做边想规律,练习册偶尔错一两道;可新题一来,她照样会做。模型也一样:练习册=训练数据,新题=没见过的数据。把练习册背下来,不等于学会。Ming drills the workbook again and again until he even remembers which page each answer sits on: perfect on the workbook, clueless on a fresh question. Hong thinks about the pattern as she practices and misses a question or two — yet new questions don’t scare her. Models are the same: the workbook is the training data, fresh questions are data it has never seen. Memorizing the workbook is not learning.
怎么知道模型是在“学”还是在“背”?把两条误差曲线画出来就清楚了。How can you tell whether a model is learning or memorizing? Plot two error curves and it becomes obvious.
第 2 步:两条曲线的故事Step 2: A tale of two curves
蓝绿线是训练误差——练习册上的出错率,一路向下,越练越熟。橙线是测试误差——新题的出错率,先跟着降,随后却抬头向上。抬头那一刻,模型从“学规律”滑向“背题”。虚线和小旗标出了翻转点:过拟合从这里开始。The blue-green line is training error — the mistake rate on the workbook; down and down it goes. The orange line is test error — the mistake rate on fresh questions; it falls along at first, then turns and climbs. The moment it turns, the model slips from learning patterns into memorizing answers. The dashed line and little flag mark the flip: overfitting starts here.
把两种学法画在同一张散点图上,一眼就能分出来。Put both study styles on one scatter plot and the difference jumps out.
第 3 步:穿过每个点,还是抓住规律Step 3: Touch every dot, or catch the pattern
歪扭的线硬要精确穿过每一个练习点,连小抖动都背了下来——遇到新题却东倒西歪。平滑的线允许一两个点不在线上,却抓住了整体趋势——新考点落下来,正好接住。所以聪明模型不追求练习满分,它追求的是:换新题,也稳。The wiggly line insists on touching every practice dot, memorizing even the tiny jitters — then flails on new questions. The smooth line lets a dot or two sit off-curve but keeps the overall trend — a new test point lands right on it. A smart model doesn’t chase a perfect practice score; it chases staying steady on new questions.
🎮 你来挑模型(40 秒)🎮 Your turn: pick the model (40 seconds)
下面 4 轮,每轮同一组练习点、两条线。点出“考试型选手”——新考点来了也稳的那条。Four rounds below. Each shows the same practice dots and two lines: tap the “exam-ready” one — the line that stays steady when a new test point appears.
一句话记住它:训练误差很低、测试误差却抬头,就是模型在“背题”——这叫过拟合。Remember it in one line: training error keeps dropping while test error turns upward — the model is memorizing. That’s overfitting.
训练误差:练习册上的出错率,只会一路降Training error: mistakes on the workbook — it only goes down测试误差:新题上的出错率,先降后升=过拟合来了Test error: mistakes on new questions — down then up means overfitting考试型模型:允许小错,抓的是规律Exam-ready model: allows small misses, keeps the pattern
内容参考 OpenStax 等公开教材,多来源核对 · AI 生成、人工审核 · 发现错误欢迎指正,帮这片叶子长得更好。Based on OpenStax and other open textbooks, cross-checked across sources · AI-generated, human-reviewed · Spotted a mistake? Tell us — help this leaf grow.