﻿---
title: "Ilya 的论文清单在讲什么：从 30u30 说起"
description: "30u30 是一个按天带读“Ilya Sutskever 推荐的 30 篇论文”的开源仓库。我们先查这份清单从哪来，发现它其实有三个版本；再看它的构成，里面除了 Transformer、ResNet，还有咖啡自动机、一本数学专著的第 14 章和一篇 200 页的博士论文。顺着这几篇往下读，清单的另一条主线是压缩：预测就是压缩，学习就是把数据拆成规律和噪声。最后用三个自己复现的小实验检验这条线，也顺带看看 30u30 的实现。"
pubDate: 2026-10-25
tags: ["AI", "论文", "信息论", "开源项目"]
hero: "./hero.svg"
refs:
  - id: repo
    title: "Ojhaharsh/30u30"
    url: https://github.com/Ojhaharsh/30u30
    site: GitHub
    note: "本文依据 2026-02-19 的最新提交 `0edf4bf`。清单在 `ilya_30_papers.md`，每天的内容在 `papers/<NN>_*/`。"
  - id: gonzo
    title: "Deep Learning Legends: Ilya's List, or 90% of Everything That Matters in AI"
    url: https://gonzoml.substack.com/p/deep-learning-legends-ilyas-list
    site: Substack
    note: "转引 Carmack 2023 年访谈里的原话：约 40 篇、90%、邮件被 Meta 的两年自动删除策略删掉。"
  - id: punkx
    title: "Ilya Sutskever's reading list（27 条存档）"
    url: https://punkx.org/jackdoe/30.html
    site: punkx.org
    note: "2024 年流传版本的存档，第 26 条原文是 “PAGE 434 onwards: Komogrov Complexity”；页面写明 “It is not confirmed if this is the actual list.”"
  - id: lesswrong
    title: "The 27 papers"
    url: https://www.lesswrong.com/posts/t4ZBjAjXk2NqqAqJ7/the-27-papers
    site: LessWrong
    date: 2024-05-30
  - id: kcbook
    title: "Kolmogorov Complexity and Algorithmic Randomness"
    url: https://www.lirmm.fr/~ashen/kolmbook-eng-scan.pdf
    author: A. Shen, V. A. Uspensky, N. Vereshchagin
    site: AMS Mathematical Surveys and Monographs 220
    date: "2017"
    note: "清单链接的扫描版，共 519 页。PDF 第 434 页是第 14 章 Algorithmic statistics 的开头（书页码 425）。"
  - id: karpathy
    title: "The Unreasonable Effectiveness of Recurrent Neural Networks"
    url: https://karpathy.github.io/2015/05/21/rnn-effectiveness/
    author: Andrej Karpathy
    date: 2015-05-21
  - id: shakespeare
    title: "char-rnn 的 tiny shakespeare 数据"
    url: https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt
    site: GitHub
    note: "图 2 的实验文本，1,115,394 个字符。"
  - id: hinton93
    title: "Keeping Neural Networks Simple by Minimizing the Description Length of the Weights"
    url: https://www.cs.toronto.edu/~hinton/absps/colt93.pdf
    author: Geoffrey Hinton, Drew van Camp
    site: COLT 1993
  - id: grunwald
    title: "A Tutorial Introduction to the Minimum Description Length Principle"
    url: https://arxiv.org/abs/math/0406077
    author: Peter Grünwald
    date: 2004-06-04
    note: "80 页。两部分码在第 1 章，边学边编码（prequential）的形式也在这里讲。"
  - id: kaplan
    title: "Scaling Laws for Neural Language Models"
    url: https://arxiv.org/abs/2001.08361
    author: Jared Kaplan 等
    site: OpenAI
    date: 2020-01-23
  - id: vlae
    title: "Variational Lossy Autoencoder"
    url: https://arxiv.org/abs/1611.02731
    author: Xi Chen 等
    date: 2016-11-08
  - id: aaronson
    title: "The First Law of Complexodynamics"
    url: https://scottaaronson.blog/?p=762
    author: Scott Aaronson
    date: 2011-09-23
  - id: coffee
    title: "Quantifying the Rise and Fall of Complexity in Closed Systems: The Coffee Automaton"
    url: https://arxiv.org/abs/1405.6903
    author: Scott Aaronson, Sean Carroll, Lauren Ouellette
    date: 2014-05-27
  - id: legg
    title: "Machine Super Intelligence"
    url: https://www.vetta.org/documents/Machine_Super_Intelligence.pdf
    author: Shane Legg
    site: 博士论文
    date: "2008"
  - id: chinchilla
    title: "Training Compute-Optimal Large Language Models"
    url: https://arxiv.org/abs/2203.15556
    author: Jordan Hoffmann 等
    site: DeepMind
    date: 2022-03-29
  - id: ilya2023
    title: "An Observation on Generalization"
    url: https://simons.berkeley.edu/news/observation-generalization
    author: Ilya Sutskever
    site: Simons Institute
    date: 2023-08
    note: "演讲用压缩来解释无监督学习：Kolmogorov 复杂度是理想的压缩器，大网络是它的近似。"
---

30u30 是 GitHub 上一个 1.6k star 的学习仓库[^repo]，README 第一行写着：

> *"If you really learn all of these, you'll know 90% of what matters today"* - Ilya Sutskever

下面是 30 天的课表，一天一篇论文，每篇配从零写起的实现、笔记和练习。第 1 天是 Karpathy 的字符级 RNN，第 13 天是 Attention Is All You Need，最后两天是 PPO 和 RLHF。看起来就是一份现代 AI 的必读清单。

可是第一周的七篇里，后四篇讲的都不是网络怎么搭：两篇讲“最小描述长度”，一篇是 Scott Aaronson 的博客，讲一个封闭系统的“复杂程度”为什么会先升后降，还有一篇用一杯咖啡加奶油的模拟来量化这件事。一份 AI 清单为什么要读咖啡？这真的是 Ilya 开的清单吗？“90%”又指什么？

我们先从清单的来历查起，再看它到底由什么组成。

## 一、清单的来历

### 原单已经不存在

这份清单的出处是 John Carmack。他在一次访谈里说，他当年向 Ilya Sutskever 要一份入门深度学习的阅读清单，Ilya 给了他“大约 40 篇论文”，并说了 README 里那句话。但是邮件丢了：Meta 有两年自动删除邮件的策略，他手里只剩一个夹子，里面打印了其中一部分[^gonzo]。Ilya 和 OpenAI 都没有公开过这份清单。

### 流传的是 27 条

2024 年，一份 27 条的清单开始在 X 和 LinkedIn 上流传，有人说它是一位 OpenAI 研究员给新人的阅读材料[^gonzo]，在网上转了好几周[^lesswrong]。保存这份清单的存档页写得很直白：“It is not confirmed if this is the actual list.”[^punkx] 有人认为它缺了一节元学习，这一点我没有找到原始出处。

这 27 条里有一条很特别。第 26 条不是一篇论文，原文是：

```text
PAGE 434 onwards: Komogrov Complexity
```

它链接到 Shen、Uspensky、Vereshchagin 的数学专著《Kolmogorov Complexity and Algorithmic Randomness》的扫描版[^kcbook]。这本书 500 多页，清单只让人从第 434 页读起。我们下载了这份 PDF 去翻：第 434 页正好是第 14 章“算法统计”（Algorithmic statistics）的第一页，后面跟着两篇讲随机性的附录，到参考文献为止一共不到 60 页。**清单要的不是“Kolmogorov 复杂度是什么”，而是这本书最后讲的那一章。** 这一章讲什么，后面会用到。

### 30u30 又补了三篇

30u30 的 30 篇，是这 27 条再加上三篇：Dropout（第 12 天）、PPO（第 29 天）和 RLHF（第 30 天）。仓库的清单文件仍然叫“Ilya Sutskever's 30 Papers Reading List”，第 26 条则写成了整本书，“从 434 页起”这几个字没有了。

<figure class="dd dd-figure">
<div class="dd-scroll">
<svg class="dd-svg" viewBox="0 0 800 376" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="i3-origin-title i3-origin-desc">
<title id="i3-origin-title">30 篇清单的三个版本</title>
<desc id="i3-origin-desc">左边是 Carmack 收到的约 40 篇原单，已经丢失；中间是 2024 年流传的 27 条，第 26 条写着从 434 页起读 Kolmogorov 复杂度那本书；右边是 30u30 的 30 篇，补了 Dropout、PPO、RLHF，第 26 条变成了整本书。</desc>
<defs>
<marker id="i3-origin-arrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path class="dd-head" d="M1 1 L7 4 L1 7"/></marker>
<marker id="i3-origin-arrow-acc" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path class="dd-head-acc" d="M1 1 L7 4 L1 7"/></marker>
</defs>
<rect class="dd-frame" width="800" height="376" rx="10"/>
<rect class="dd-zone" x="16" y="16" width="240" height="344" rx="8"/>
<rect class="dd-zone" x="272" y="16" width="248" height="344" rx="8"/>
<rect class="dd-zone" x="536" y="16" width="248" height="344" rx="8"/>
<text class="t-zone" x="32" y="44">Carmack 收到的原单</text>
<text class="t-zone" x="288" y="44">2024 年流传的版本</text>
<text class="t-zone" x="552" y="44">30u30 仓库</text>
<rect class="dd-derived" x="32" y="64" width="208" height="136" rx="6"/>
<text class="t-name" x="48" y="92">约 40 篇</text>
<text class="t-val" x="48" y="114">“学会这些，就知道今天</text>
<text class="t-val" x="48" y="136">  重要内容的 90%”</text>
<text class="t-val" x="48" y="158">邮件被 Meta 两年自动</text>
<text class="t-val" x="48" y="180">  删除策略删掉了</text>
<text class="t-say" x="32" y="232">虚线：这份原单已经不存在，</text>
<text class="t-say" x="32" y="252">只剩 Carmack 口述和一夹子打印件。</text>
<text class="t-note" x="32" y="340">来源：Carmack 的访谈</text>
<rect class="dd-card" x="288" y="64" width="228" height="214" rx="6"/>
<path class="dd-card-head" d="M289 96 V71 Q289 65 295 65 H509 Q515 65 515 71 V96 Z"/>
<text class="t-name" x="300" y="85">条目</text>
<text class="t-mono" x="504" y="85" text-anchor="end">27 条</text>
<text class="t-mono" x="300" y="113">1</text>
<text class="t-val" x="328" y="113">The Annotated Transformer</text>
<line class="dd-hair" x1="288" y1="122" x2="516" y2="122"/>
<text class="t-mono" x="300" y="139">2</text>
<text class="t-val" x="328" y="139">Complexodynamics</text>
<line class="dd-hair" x1="288" y1="148" x2="516" y2="148"/>
<text class="t-mono" x="300" y="165">…</text>
<text class="t-val" x="328" y="165">…</text>
<line class="dd-hair" x1="288" y1="174" x2="516" y2="174"/>
<text class="t-mono" x="300" y="191">25</text>
<text class="t-val" x="328" y="191">Machine Super Intelligence</text>
<line class="dd-hair" x1="288" y1="200" x2="516" y2="200"/>
<text class="t-mono" x="300" y="217">26</text>
<text class="t-mono t-acc" x="328" y="217">PAGE 434 onwards:</text>
<line class="dd-hair" x1="288" y1="226" x2="516" y2="226"/>
<text class="t-mono" x="300" y="243"></text>
<text class="t-mono t-acc" x="328" y="243">Komogrov Complexity</text>
<line class="dd-hair" x1="288" y1="252" x2="516" y2="252"/>
<text class="t-mono" x="300" y="269">27</text>
<text class="t-val" x="328" y="269">CS231n</text>
<text class="t-say" x="288" y="296">存档页原话：“It is not</text>
<text class="t-say" x="288" y="316">confirmed if this is the actual list.”</text>
<rect class="dd-card" x="552" y="64" width="216" height="214" rx="6"/>
<path class="dd-card-head" d="M553 96 V71 Q553 65 559 65 H761 Q767 65 767 71 V96 Z"/>
<text class="t-name" x="564" y="85">条目</text>
<text class="t-mono" x="756" y="85" text-anchor="end">30 天</text>
<text class="t-mono" x="564" y="113">7</text>
<text class="t-val" x="592" y="113">The Coffee Automaton</text>
<line class="dd-hair" x1="552" y1="122" x2="768" y2="122"/>
<text class="t-mono" x="564" y="139">12</text>
<text class="t-val" x="592" y="139">Dropout  ＋</text>
<line class="dd-hair" x1="552" y1="148" x2="768" y2="148"/>
<text class="t-mono" x="564" y="165">…</text>
<text class="t-val" x="592" y="165">…</text>
<line class="dd-hair" x1="552" y1="174" x2="768" y2="174"/>
<text class="t-mono" x="564" y="191">26</text>
<text class="t-mono t-acc" x="592" y="191">Kolmogorov Complexity</text>
<line class="dd-hair" x1="552" y1="200" x2="768" y2="200"/>
<text class="t-mono" x="564" y="217"></text>
<text class="t-mono t-acc" x="592" y="217">（整本 500 页的书）</text>
<line class="dd-hair" x1="552" y1="226" x2="768" y2="226"/>
<text class="t-mono" x="564" y="243">29</text>
<text class="t-val" x="592" y="243">PPO  ＋</text>
<line class="dd-hair" x1="552" y1="252" x2="768" y2="252"/>
<text class="t-mono" x="564" y="269">30</text>
<text class="t-val" x="592" y="269">RLHF  ＋</text>
<text class="t-say" x="552" y="296">＋ 是仓库补的三篇，原单里没有；</text>
<text class="t-say" x="552" y="316">第 26 条丢了“从 434 页起”。</text>
<path class="dd-edge" d="M240 132 H280" marker-end="url(#i3-origin-arrow)"/>
<path class="dd-edge-acc" d="M516 197 H544" marker-end="url(#i3-origin-arrow-acc)"/>
</svg>
</div>
<figcaption>图 1 · “Ilya 的 30 篇”其实是三个版本：丢失的约 40 篇、来源未确认的 27 条、再由 30u30 补成的 30 篇</figcaption>
</figure>

所以“Ilya 的 30 篇”至少要打两个折扣：27 条本身来源没有确认，30 篇里有 3 篇是仓库作者补的。“90%”是 Carmack 转述的一句口头话，也不是谁量出来的数字。

不过 27 条的内容本身很有意思。它不像是一个人凭印象列出的“经典论文”，因为里面有几条怎么看都不像入门读物。**这份清单到底由什么组成？**

## 二、清单的构成

把 27 条按内容分一下组：

<figure class="dd dd-figure dt-figure">
<div class="dt-panel">
<div class="dt-title" id="i3-compose-title">流传的 27 条，按内容分组</div>
<div class="dt-scroll">
<table class="dt" aria-labelledby="i3-compose-title">
<colgroup><col style="width:22%"><col><col style="width:12%"></colgroup>
<thead>
<tr><th scope="col">分组</th><th scope="col">条目</th><th scope="col" class="num">条数</th></tr>
</thead>
<tbody>
<tr><th scope="row">循环网络与注意力</th><td>Karpathy 的 RNN 博客、Olah 的 LSTM 博客、RNN Regularization、Bahdanau 注意力、Attention Is All You Need、The Annotated Transformer</td><td class="num mono">6</td></tr>
<tr><th scope="row">卷积网络与视觉</th><td>AlexNet、ResNet、ResNet v2（Identity Mappings）、空洞卷积、CS231n 课程</td><td class="num mono">5</td></tr>
<tr><th scope="row">集合、指针、记忆、关系</th><td>Pointer Networks、Order Matters、Neural Turing Machines、Relational Reasoning、Relational RNN、消息传递网络（量子化学）</td><td class="num mono">6</td></tr>
<tr><th scope="row">工程与应用</th><td>GPipe（流水线并行）、Deep Speech 2（语音识别）</td><td class="num mono">2</td></tr>
<tr><th scope="row">规模</th><td>Kaplan 的 Scaling Laws（2020，清单里最新的一篇）</td><td class="num mono">1</td></tr>
<tr class="dt-group"><th colspan="3" scope="rowgroup">压缩、复杂度与智能的定义</th></tr>
<tr><th scope="row" class="acc">最小描述长度</th><td>Hinton &amp; van Camp 1993；Grünwald 的 MDL 教程（80 页）</td><td class="num mono acc">2</td></tr>
<tr><th scope="row" class="acc">复杂度</th><td>Aaronson 的博客 The First Law of Complexodynamics；咖啡自动机论文</td><td class="num mono acc">2</td></tr>
<tr><th scope="row" class="acc">算法信息论</th><td>Kolmogorov 复杂度专著，从第 434 页（第 14 章“算法统计”）起，约 57 页</td><td class="num mono acc">1</td></tr>
<tr><th scope="row" class="acc">生成模型</th><td>Variational Lossy Autoencoder</td><td class="num mono acc">1</td></tr>
<tr><th scope="row" class="acc">智能的定义</th><td>Shane Legg 的博士论文 Machine Super Intelligence（200 来页）</td><td class="num mono acc">1</td></tr>
</tbody>
</table>
</div>
<p class="dt-note">没有的：GPT 系列、BERT、扩散模型、强化学习、对齐、指令微调。</p>
</div>
<figcaption>表 1 · 27 条里有 7 条讲压缩和复杂度，篇幅最重的几条都在这一组</figcaption>
</figure>

有两点和“AI 必读清单”的印象不一样。

**第一，它停在 2020 年。** 最新的一篇是 Kaplan 的 Scaling Laws。GPT-2、GPT-3、BERT 都不在里面，强化学习、对齐、指令微调也不在。30u30 补上的 PPO 和 RLHF，正是大众心目中“ChatGPT 是怎么来的”那一段，原单里没有。

**第二，理论部分篇数少，篇幅却最重。** 架构类的 19 条大多是十几页的会议论文；理论类的 7 条里有一篇 80 页的教程、一篇 200 来页的博士论文、一本专著的最后一章。如果真按“一天一篇”读，这几天会远远超出一天。

这 7 条理论分别出自神经网络（Hinton）、统计学（Grünwald）、计算理论（Aaronson、Kolmogorov 那本书）和通用人工智能（Legg）几个不同的圈子，放在一起读，它们其实在回答同一个问题。我们从清单里最“正常”的一篇说起：第 1 天的字符级 RNN。

## 三、预测与压缩

### 现象：语言模型的损失是一个比特数

Karpathy 那篇博客[^karpathy]训练的是一个字符级 RNN：读入前面的字符，输出下一个字符的概率分布。训练时最小化的是交叉熵，也就是模型给真实下一个字符的概率取负对数，再求平均。

这个数有一个很具体的含义。如果对数以 2 为底，它的单位是比特。假设模型给真实字符的概率是 1/4，$-\log_2 \frac14 = 2$，这个字符就“花了 2 个比特”。

为什么能这样说？因为有一种编码方法叫**算术编码**：只要发送方和接收方手里有同一个预测模型，就能把每个字符编码成大约 $-\log_2 p$ 个比特，整段文本的总长度和所有字符的 $-\log_2 p$ 之和只差几个比特。接收方用同一个模型逐字解码，就能还原原文。

换句话说，**一个预测模型加上算术编码，就是一个无损压缩器**。交叉熵越低，压缩出来的文件越小。

### 实验：字符模型和 gzip 比一比

光说不够直观，我们拿 Karpathy 用过的同一份数据做个实验[^shakespeare]：111 万个字符的莎士比亚文本。

预测模型用最简单的那种：看前面 $k$ 个字符，按这个上下文以前出现过的次数来估计下一个字符的概率（$k$ 叫“阶”）。模型边读边更新计数，解码端也能按同样的顺序重建出同样的计数，所以把每个字符的 $-\log_2 p$ 加起来，就是这个压缩器真实的码长。和它比的是 gzip、xz、bzip2 三个通用压缩器的实际文件大小。

<figure class="dd dd-figure">
<div class="dd-scroll">
<svg class="dd-svg" viewBox="0 0 800 440" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="i3-bits-title i3-bits-desc">
<title id="i3-bits-title">字符模型的码长与通用压缩器对比</title>
<desc id="i3-bits-desc">同一份 111 万字符的莎士比亚文本。自适应字符模型从 0 阶到 6 阶，每字符平均码长依次为 4.78、3.55、2.81、2.36、2.23、2.29、2.41 比特；gzip、xz、bzip2 分别为 3.11、2.61、2.36 比特。</desc>
<rect class="dd-frame" width="800" height="440" rx="10"/>
<rect class="dd-zone" x="16" y="16" width="768" height="408" rx="8"/>
<text class="t-zone" x="32" y="44">tiny shakespeare 1,115,394 个字符，每字符平均要几个比特</text>
<line class="dd-hair" x1="224.0" y1="64" x2="224.0" y2="356"/>
<text class="t-note" x="224.0" y="372" text-anchor="middle">0</text>
<line class="dd-hair" x1="312.0" y1="64" x2="312.0" y2="356"/>
<text class="t-note" x="312.0" y="372" text-anchor="middle">1</text>
<line class="dd-hair" x1="400.0" y1="64" x2="400.0" y2="356"/>
<text class="t-note" x="400.0" y="372" text-anchor="middle">2</text>
<line class="dd-hair" x1="488.0" y1="64" x2="488.0" y2="356"/>
<text class="t-note" x="488.0" y="372" text-anchor="middle">3</text>
<line class="dd-hair" x1="576.0" y1="64" x2="576.0" y2="356"/>
<text class="t-note" x="576.0" y="372" text-anchor="middle">4</text>
<line class="dd-hair" x1="664.0" y1="64" x2="664.0" y2="356"/>
<text class="t-note" x="664.0" y="372" text-anchor="middle">5</text>
<text class="t-name" x="212" y="87" text-anchor="end">0 阶（只看字符频率）</text>
<rect class="dd-dot" x="224" y="75" width="420.6" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="652.6" y="87">4.78</text>
<text class="t-name" x="212" y="115" text-anchor="end">1 阶</text>
<rect class="dd-dot" x="224" y="103" width="312.2" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="544.2" y="115">3.55</text>
<text class="t-name" x="212" y="143" text-anchor="end">2 阶</text>
<rect class="dd-dot" x="224" y="131" width="247.1" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="479.1" y="143">2.81</text>
<text class="t-name" x="212" y="171" text-anchor="end">3 阶</text>
<rect class="dd-dot" x="224" y="159" width="207.6" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="439.6" y="171">2.36</text>
<text class="t-name t-acc" x="212" y="199" text-anchor="end">4 阶</text>
<rect class="dd-fill-acc" x="224" y="187" width="196.6" height="16" rx="2"/>
<text class="t-mono t-acc" x="428.6" y="199">2.23</text>
<text class="t-name" x="212" y="227" text-anchor="end">5 阶</text>
<rect class="dd-dot" x="224" y="215" width="201.4" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="433.4" y="227">2.29</text>
<text class="t-name" x="212" y="255" text-anchor="end">6 阶</text>
<rect class="dd-dot" x="224" y="243" width="212.0" height="16" rx="2" fill-opacity=".55"/>
<text class="t-mono" x="444.0" y="255">2.41</text>
<text class="t-name" x="212" y="295" text-anchor="end">gzip -9</text>
<rect class="dd-bar" x="224" y="283" width="273.9" height="16" rx="2"/>
<rect class="dd-edge" x="224" y="283" width="273.9" height="16" rx="2"/>
<text class="t-mono" x="505.9" y="295">3.11</text>
<text class="t-name" x="212" y="323" text-anchor="end">xz -9</text>
<rect class="dd-bar" x="224" y="311" width="229.8" height="16" rx="2"/>
<rect class="dd-edge" x="224" y="311" width="229.8" height="16" rx="2"/>
<text class="t-mono" x="461.8" y="323">2.61</text>
<text class="t-name" x="212" y="351" text-anchor="end">bzip2 -9</text>
<rect class="dd-bar" x="224" y="339" width="207.3" height="16" rx="2"/>
<rect class="dd-edge" x="224" y="339" width="207.3" height="16" rx="2"/>
<text class="t-mono" x="439.3" y="351">2.36</text>
<line class="dd-hair" x1="32" y1="274" x2="768" y2="274"/>
<text class="t-say" x="32" y="400">上面七行：边读边学的字符模型，码长 = 它给每个字符的概率取 −log₂ 再相加。</text>
<text class="t-say" x="32" y="422">下面三行：通用压缩器的实际文件大小。4 阶模型配上算术编码，比三者都小。</text>
</svg>
</div>
<figcaption>图 2 · 预测得越准，码长越短：4 阶字符模型 2.23 比特 / 字符，胜过 gzip、xz、bzip2；但上下文再加长，码长反而变长</figcaption>
</figure>

4 阶模型每个字符只要 2.23 比特，比 gzip 的 3.11 少了 28%，也胜过 bzip2 和 xz。我们没有写任何关于压缩的代码，只是把“预测下一个字符”做得更准，压缩率自己就上来了。

这也是 Karpathy 这篇值得放进清单的理由之一：**“预测下一个 token”和“压缩数据”是同一件事的两种说法。** 一个模型对数据理解得越好，就越能把数据压短。

### 问题：上下文更长，为什么反而变差

图 2 里还有一个反常的地方：5 阶、6 阶模型比 4 阶差。看的上下文更长，预测本应更准才对。

原因在于“边读边学”。6 阶模型的上下文有几十万种，每一种都要从零开始积累计数，在攒够计数之前，它的预测都很差，这些差的预测都算进了码长里。4 阶模型的上下文少，学得快，总账反而更划算。

这里出现了一笔我们之前没有算的账：**模型本身也要花比特。** 更复杂的模型能把数据压得更短，但它自己的“学费”也更贵。总码长 = 描述模型的代价 + 用模型描述数据的代价。这笔账怎么算，就是清单里那两篇“最小描述长度”在讲的事。

## 四、两部分码：规律和噪声

### 最小描述长度

Hinton 和 van Camp 1993 年那篇[^hinton93]的标题就是答案：通过最小化权重的描述长度，让神经网络保持简单。他们把一个网络的总代价写成两部分：把权重发出去要多少比特，加上用这些权重描述训练数据的误差要多少比特。权重记得越精确越费比特，所以他们给权重加噪声，只保留真正需要的精度。

Grünwald 的教程[^grunwald]把这个想法一般化，叫**两部分码**：

$$L(D) = L(H) + L(D \mid H)$$

$L(H)$ 是描述假设（模型、规律）本身的长度，$L(D \mid H)$ 是知道这条规律之后，再描述数据还需要的长度。最好的假设是让两部分之和最短的那个。规律太简单，第二部分很长；规律太复杂，把噪声也当成规律记下来，第一部分就会膨胀。上一节 6 阶模型输掉的，正是第一部分。

清单指向的 Kolmogorov 那本书第 14 章“算法统计”[^kcbook]，讲的是同一件事的严格版本。那一章开头第一句就是：数理统计要解决的问题是，给定一些实验数据，找一个合理的理论来解释它。它把“理论”定义为一个包含这份数据的集合 $A$，描述长度是“写出这个集合的程序长度”加上“在集合里指出是哪一个”的 $\log_2|A|$ 比特。好的理论让数据在集合里看起来像一个毫无特点的“典型成员”，也就是说，剩下的那部分是纯噪声，再也压不下去了。

### 一个刚好只有规律和噪声的例子

这套说法听起来抽象，但 30u30 的第 25 天恰好提供了一个完美的例子。那一天讲 Scaling Laws，训练脚本用的合成数据是这样生成的：64 个从 0 到 127 均匀随机抽取的数，然后把每第 4 个数改成和前一个一样。

<figure class="dd dd-figure">
<div class="dd-scroll">
<svg class="dd-svg" viewBox="0 0 800 468" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="i3-two-title i3-two-desc">
<title id="i3-two-title">一条训练序列的两部分描述</title>
<desc id="i3-two-desc">上面是 30u30 Day 25 合成数据里的一条序列，每第 4 个数字照抄前一个，其余是随机数。下面把它拆成两部分：规律只需一句 x[4k+3]=x[4k+2]，剩下 47 个随机目标每个 7 比特，共 329 比特，折合每个目标平均 3.62 nats。</desc>
<rect class="dd-frame" width="800" height="468" rx="10"/>
<rect class="dd-zone" x="16" y="16" width="768" height="248" rx="8"/>
<text class="t-zone" x="32" y="44">30u30 Day 25 的一条训练序列（64 个 token，词表 128）</text>
<text class="t-note" x="68" y="77" text-anchor="end">1</text>
<rect class="dd-card" x="80" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="97" y="76" text-anchor="middle">120</text>
<rect class="dd-card" x="120" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="137" y="76" text-anchor="middle">80</text>
<rect class="dd-card" x="160" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="177" y="76" text-anchor="middle">87</text>
<rect class="dd-card" x="200" y="60" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="217" y="76" text-anchor="middle">87</text>
<path class="dd-edge-acc" d="M177 86 Q197 98 217 87"/>
<rect class="dd-card" x="252" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="269" y="76" text-anchor="middle">74</text>
<rect class="dd-card" x="292" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="309" y="76" text-anchor="middle">99</text>
<rect class="dd-card" x="332" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="349" y="76" text-anchor="middle">106</text>
<rect class="dd-card" x="372" y="60" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="389" y="76" text-anchor="middle">106</text>
<path class="dd-edge-acc" d="M349 86 Q369 98 389 87"/>
<rect class="dd-card" x="424" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="441" y="76" text-anchor="middle">7</text>
<rect class="dd-card" x="464" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="481" y="76" text-anchor="middle">38</text>
<rect class="dd-card" x="504" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="521" y="76" text-anchor="middle">36</text>
<rect class="dd-card" x="544" y="60" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="561" y="76" text-anchor="middle">36</text>
<path class="dd-edge-acc" d="M521 86 Q541 98 561 87"/>
<rect class="dd-card" x="596" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="613" y="76" text-anchor="middle">116</text>
<rect class="dd-card" x="636" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="653" y="76" text-anchor="middle">0</text>
<rect class="dd-card" x="676" y="60" width="34" height="24" rx="3"/>
<text class="t-mono" x="693" y="76" text-anchor="middle">63</text>
<rect class="dd-card" x="716" y="60" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="733" y="76" text-anchor="middle">63</text>
<path class="dd-edge-acc" d="M693 86 Q713 98 733 87"/>
<text class="t-note" x="68" y="117" text-anchor="end">17</text>
<rect class="dd-card" x="80" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="97" y="116" text-anchor="middle">16</text>
<rect class="dd-card" x="120" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="137" y="116" text-anchor="middle">102</text>
<rect class="dd-card" x="160" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="177" y="116" text-anchor="middle">15</text>
<rect class="dd-card" x="200" y="100" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="217" y="116" text-anchor="middle">15</text>
<path class="dd-edge-acc" d="M177 126 Q197 138 217 127"/>
<rect class="dd-card" x="252" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="269" y="116" text-anchor="middle">104</text>
<rect class="dd-card" x="292" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="309" y="116" text-anchor="middle">38</text>
<rect class="dd-card" x="332" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="349" y="116" text-anchor="middle">43</text>
<rect class="dd-card" x="372" y="100" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="389" y="116" text-anchor="middle">43</text>
<path class="dd-edge-acc" d="M349 126 Q369 138 389 127"/>
<rect class="dd-card" x="424" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="441" y="116" text-anchor="middle">92</text>
<rect class="dd-card" x="464" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="481" y="116" text-anchor="middle">32</text>
<rect class="dd-card" x="504" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="521" y="116" text-anchor="middle">126</text>
<rect class="dd-card" x="544" y="100" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="561" y="116" text-anchor="middle">126</text>
<path class="dd-edge-acc" d="M521 126 Q541 138 561 127"/>
<rect class="dd-card" x="596" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="613" y="116" text-anchor="middle">61</text>
<rect class="dd-card" x="636" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="653" y="116" text-anchor="middle">64</text>
<rect class="dd-card" x="676" y="100" width="34" height="24" rx="3"/>
<text class="t-mono" x="693" y="116" text-anchor="middle">74</text>
<rect class="dd-card" x="716" y="100" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="733" y="116" text-anchor="middle">74</text>
<path class="dd-edge-acc" d="M693 126 Q713 138 733 127"/>
<text class="t-note" x="68" y="157" text-anchor="end">33</text>
<rect class="dd-card" x="80" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="97" y="156" text-anchor="middle">65</text>
<rect class="dd-card" x="120" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="137" y="156" text-anchor="middle">127</text>
<rect class="dd-card" x="160" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="177" y="156" text-anchor="middle">103</text>
<rect class="dd-card" x="200" y="140" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="217" y="156" text-anchor="middle">103</text>
<path class="dd-edge-acc" d="M177 166 Q197 178 217 167"/>
<rect class="dd-card" x="252" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="269" y="156" text-anchor="middle">89</text>
<rect class="dd-card" x="292" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="309" y="156" text-anchor="middle">79</text>
<rect class="dd-card" x="332" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="349" y="156" text-anchor="middle">43</text>
<rect class="dd-card" x="372" y="140" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="389" y="156" text-anchor="middle">43</text>
<path class="dd-edge-acc" d="M349 166 Q369 178 389 167"/>
<rect class="dd-card" x="424" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="441" y="156" text-anchor="middle">59</text>
<rect class="dd-card" x="464" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="481" y="156" text-anchor="middle">27</text>
<rect class="dd-card" x="504" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="521" y="156" text-anchor="middle">108</text>
<rect class="dd-card" x="544" y="140" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="561" y="156" text-anchor="middle">108</text>
<path class="dd-edge-acc" d="M521 166 Q541 178 561 167"/>
<rect class="dd-card" x="596" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="613" y="156" text-anchor="middle">109</text>
<rect class="dd-card" x="636" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="653" y="156" text-anchor="middle">78</text>
<rect class="dd-card" x="676" y="140" width="34" height="24" rx="3"/>
<text class="t-mono" x="693" y="156" text-anchor="middle">14</text>
<rect class="dd-card" x="716" y="140" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="733" y="156" text-anchor="middle">14</text>
<path class="dd-edge-acc" d="M693 166 Q713 178 733 167"/>
<text class="t-note" x="68" y="197" text-anchor="end">49</text>
<rect class="dd-card" x="80" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="97" y="196" text-anchor="middle">56</text>
<rect class="dd-card" x="120" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="137" y="196" text-anchor="middle">4</text>
<rect class="dd-card" x="160" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="177" y="196" text-anchor="middle">18</text>
<rect class="dd-card" x="200" y="180" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="217" y="196" text-anchor="middle">18</text>
<path class="dd-edge-acc" d="M177 206 Q197 218 217 207"/>
<rect class="dd-card" x="252" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="269" y="196" text-anchor="middle">124</text>
<rect class="dd-card" x="292" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="309" y="196" text-anchor="middle">59</text>
<rect class="dd-card" x="332" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="349" y="196" text-anchor="middle">103</text>
<rect class="dd-card" x="372" y="180" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="389" y="196" text-anchor="middle">103</text>
<path class="dd-edge-acc" d="M349 206 Q369 218 389 207"/>
<rect class="dd-card" x="424" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="441" y="196" text-anchor="middle">105</text>
<rect class="dd-card" x="464" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="481" y="196" text-anchor="middle">80</text>
<rect class="dd-card" x="504" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="521" y="196" text-anchor="middle">56</text>
<rect class="dd-card" x="544" y="180" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="561" y="196" text-anchor="middle">56</text>
<path class="dd-edge-acc" d="M521 206 Q541 218 561 207"/>
<rect class="dd-card" x="596" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="613" y="196" text-anchor="middle">34</text>
<rect class="dd-card" x="636" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="653" y="196" text-anchor="middle">63</text>
<rect class="dd-card" x="676" y="180" width="34" height="24" rx="3"/>
<text class="t-mono" x="693" y="196" text-anchor="middle">48</text>
<rect class="dd-card" x="716" y="180" width="34" height="24" rx="3"/>
<text class="t-mono t-acc" x="733" y="196" text-anchor="middle">48</text>
<path class="dd-edge-acc" d="M693 206 Q713 218 733 207"/>
<text class="t-say" x="32" y="248">强调色的格子：每第 4 个 token 照抄前一个。其余 48 个是均匀随机数，没有任何规律可学。</text>
<rect class="dd-zone" x="16" y="280" width="376" height="172" rx="8"/>
<rect class="dd-zone" x="408" y="280" width="376" height="172" rx="8"/>
<text class="t-zone" x="32" y="308">第一部分：规律</text>
<text class="t-zone" x="424" y="308">第二部分：按规律之后剩下的</text>
<rect class="dd-card" x="32" y="328" width="344" height="36" rx="6"/>
<text class="t-mono t-acc" x="48" y="351">x[4k+3] = x[4k+2]</text>
<text class="t-say" x="32" y="392">一句话就写完，几个比特，与序列多长无关。</text>
<text class="t-say" x="32" y="414">模型学会这一条，16 个位置的损失降到 0。</text>
<rect class="dd-card" x="424" y="328" width="344" height="36" rx="6"/>
<text class="t-mono" x="440" y="351">47 个预测目标 × log₂128 = 329 bit</text>
<text class="t-say" x="424" y="392">每个随机 token 必须原样记下，压缩不了。</text>
<text class="t-say" x="424" y="414">平均到 63 个目标：47/63 × ln128 = 3.62 nats。</text>
</svg>
</div>
<figcaption>图 3 · 两部分码：一份数据 = 规律（短）+ 按规律编码后剩下的噪声（长）。模型能学走的只有第一部分</figcaption>
</figure>

这份数据的两部分码可以直接写出来。规律只有一条，几个比特就够；剩下的 47 个随机数（第 1 个数不需要预测，16 个照抄位置不用记），每个要 7 比特，一共 329 比特，再怎么压也压不掉。换成训练时用的自然对数单位，平均每个预测目标至少要 3.62 nats。**无论模型多大，损失都不可能低于 3.62。**

### 实验：这份数据上能看到规模定律吗

30u30 用这份数据训练 4 个尺寸的模型，想“验证 Kaplan 的 L(N) 幂律”。Kaplan 的规模定律[^kaplan]说，模型参数量 $N$ 增大时，损失按幂律下降：

$$L(N) = L_\infty + \left(\frac{N_c}{N}\right)^{\alpha}$$

$L_\infty$ 是不可约的损失，正是两部分码里压不掉的噪声部分；$(N_c/N)^\alpha$ 是模型还没学到的规律。幂律意味着数据里的规律有一条很长的尾巴：模型每大一倍，就能多学到一批更细、更少见的规律。

而第 25 天的数据只有一条规律。我们按同样的设定写了一个同构的小 Transformer，4 个尺寸，先按 30u30 的默认训练 50 步，再训练 3000 步，并且额外拿新抽的同分布序列测一次：

<figure class="dd dd-figure">
<div class="dd-scroll">
<svg class="dd-svg" viewBox="0 0 800 452" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="i3-loss-title i3-loss-desc">
<title id="i3-loss-title">第 25 天合成数据上，模型大小与损失的关系</title>
<desc id="i3-loss-desc">横轴是 4 个模型的参数量。训练 50 步时，损失依次为 4.53、4.02、3.65、3.63，逼近 3.62 的下限。训练 3000 步后，训练集损失降到 3.05、1.27、0.06、0.06，但在新抽的同分布序列上，损失是 4.26、7.16、10.33、9.14，远高于下限。</desc>
<rect class="dd-frame" width="800" height="452" rx="10"/>
<rect class="dd-zone" x="16" y="16" width="768" height="420" rx="8"/>
<text class="t-zone" x="32" y="44">四个尺寸的模型，损失（nats）对参数量（横轴对数）</text>
<line class="dd-hair" x1="96" y1="352.0" x2="560" y2="352.0"/>
<text class="t-note" x="86" y="356.0" text-anchor="end">0</text>
<line class="dd-hair" x1="96" y1="301.1" x2="560" y2="301.1"/>
<text class="t-note" x="86" y="305.1" text-anchor="end">2</text>
<line class="dd-hair" x1="96" y1="250.2" x2="560" y2="250.2"/>
<text class="t-note" x="86" y="254.2" text-anchor="end">4</text>
<line class="dd-hair" x1="96" y1="199.3" x2="560" y2="199.3"/>
<text class="t-note" x="86" y="203.3" text-anchor="end">6</text>
<line class="dd-hair" x1="96" y1="148.4" x2="560" y2="148.4"/>
<text class="t-note" x="86" y="152.4" text-anchor="end">8</text>
<line class="dd-hair" x1="96" y1="97.5" x2="560" y2="97.5"/>
<text class="t-note" x="86" y="101.5" text-anchor="end">10</text>
<text class="t-note" x="96.0" y="372" text-anchor="middle">d=64 · 9.8万</text>
<text class="t-note" x="275.5" y="372" text-anchor="middle">d=128 · 39万</text>
<text class="t-note" x="455.0" y="372" text-anchor="middle">d=256 · 157万</text>
<text class="t-note" x="560.0" y="372" text-anchor="middle">d=384 · 354万</text>
<line class="dd-edge-acc dd-dash" x1="96" y1="259.9" x2="560" y2="259.9"/>
<path class="dd-edge" d="M96.0 236.7 L275.5 249.8 L455.0 259.0 L560.0 259.5"/>
<circle class="dd-dot" cx="96.0" cy="236.7" r="3.5"/>
<circle class="dd-dot" cx="275.5" cy="249.8" r="3.5"/>
<circle class="dd-dot" cx="455.0" cy="259.0" r="3.5"/>
<circle class="dd-dot" cx="560.0" cy="259.5" r="3.5"/>
<path class="dd-edge dd-dash" d="M96.0 274.3 L275.5 319.6 L455.0 350.5 L560.0 350.6"/>
<circle class="dd-dot" cx="96.0" cy="274.3" r="3.5"/>
<circle class="dd-dot" cx="275.5" cy="319.6" r="3.5"/>
<circle class="dd-dot" cx="455.0" cy="350.5" r="3.5"/>
<circle class="dd-dot" cx="560.0" cy="350.6" r="3.5"/>
<path class="dd-edge" d="M96.0 243.6 L275.5 169.9 L455.0 89.2 L560.0 119.3"/>
<circle class="dd-dot" cx="96.0" cy="243.6" r="3.5"/>
<circle class="dd-dot" cx="275.5" cy="169.9" r="3.5"/>
<circle class="dd-dot" cx="455.0" cy="89.2" r="3.5"/>
<circle class="dd-dot" cx="560.0" cy="119.3" r="3.5"/>
<text class="t-mono" x="108.0" y="233.6" text-anchor="start">4.26</text>
<text class="t-mono" x="275.5" y="159.9" text-anchor="middle">7.16</text>
<text class="t-mono" x="455.0" y="79.2" text-anchor="middle">10.33</text>
<text class="t-mono" x="560.0" y="109.3" text-anchor="middle">9.14</text>
<text class="t-mono" x="455.0" y="340.5" text-anchor="middle">0.06</text>
<text class="t-mono" x="560.0" y="340.6" text-anchor="middle">0.06</text>
<text class="t-name" x="600" y="93.2">训练 3000 步</text>
<text class="t-note" x="600" y="111.2">新抽的同分布序列</text>
<text class="t-name" x="600" y="245.5">训练 50 步（默认）</text>
<text class="t-note" x="600" y="263.5">训练集，停在下限</text>
<text class="t-mono t-acc" x="600" y="281.9">下限 3.62</text>
<text class="t-name" x="600" y="346.6">训练 3000 步</text>
<text class="t-note" x="600" y="364.6">训练集（虚线）</text>
<text class="t-say" x="32" y="408">50 步：大模型只是更快学会复制规律，四个点挤在 3.62 附近。3000 步：训练损失一路降到 0.06，</text>
<text class="t-say" x="32" y="430">看上去“越大越好”，其实是把 2048 条序列里的随机数背了下来；换新序列一测，损失升到 9 以上。</text>
</svg>
</div>
<figcaption>图 4 · 损失压不过噪声下限：训练集上“越大越好”的曲线，是模型把随机数背下来了</figcaption>
</figure>

按 30u30 的默认设定训练 50 步，四个模型的损失是 4.53、4.02、3.65、3.63。把损失拆开看，大模型在照抄位置上的损失降到了 0.02，在随机位置上仍然是 4.86，约等于 $\ln 128 = 4.85$。也就是说，大模型只是更快学会了那条复制规律，然后停在 3.62 的下限上。四个点之间的差别是“学得快慢”，不是幂律。

训练到 3000 步，情况更有意思。训练集上的损失变成 3.05、1.27、0.06、0.06，模型越大越低，甚至远远低于 3.62 的下限，乍看像是规模定律在起作用。但换一批同样方式生成的新序列去测，损失是 4.26、7.16、10.33、9.14，比瞎猜（4.85）还差。训练数据只有 2048 条序列，大模型把里面的随机数全背了下来。

用两部分码的话说：背下来的随机数被塞进了模型的“规律部分”，第一部分膨胀，换到新数据上毫无用处。这正是 Hinton 要给权重“计费”的原因。

所以这份数据画不出规模定律，原因不在模型或训练步数，而在数据本身：**规模定律是数据性质的反映。** 自然语言里的规律有长长的尾巴，模型越大，学到的越多；一份只有一条规律的数据，学会那一条就到头了。

### 同一条线上的另外两篇

用这个视角回头看清单，另外两篇也落在同一条线上。

**VLAE**[^vlae]（变分有损自编码器）研究的是信息该放在哪：给图像学一个隐变量编码时，故意限制解码器只能看局部，让隐变量只存全局结构，纹理这类局部细节交给解码器按概率补上。标题里的“有损”，就是有意识地决定哪些比特属于“规律”、哪些属于可以随机生成的“细节”。

**Legg 的博士论文**[^legg]给“智能”下了一个形式化定义：一个智能体在所有可计算环境里的平均表现，每个环境按 $2^{-K(\mu)}$ 加权，$K(\mu)$ 是描述这个环境的最短程序长度。越简单的环境权重越大。也就是说，智能被定义成“在简单规律主导的世界里表现好”，又回到了描述长度。

到这里，“压缩”这条线在清单里已经很清楚了。剩下两篇 Aaronson 的文章看上去离 AI 最远，**为什么讲咖啡的论文也在里面？**

## 五、复杂度的先升后降

### 现象：熵一直在涨，有意思的东西却在中间

Aaronson 2011 年的博客[^aaronson]从一个观察出发：往咖啡里倒奶油，一开始奶油浮在上面，界线分明；搅一会儿，出现了漂亮的卷须和漩涡；最后整杯变成均匀的浅褐色。熵从头到尾都在增加，这是热力学第二定律。但我们直觉上觉得“复杂”“有意思”的，是中间那个阶段，开头和结尾都很无聊。

熵描述不了这个“有意思”。Aaronson 要的是另一个量，它在开始和结束时都小，只在中间大。他用的正是上一节的两部分码：一个状态的“复杂度”，是它两部分描述里第一部分（规律部分）的长度。开头的状态规律很简单（上面奶油、下面咖啡），结尾的状态是纯噪声（规律部分也很短，“均匀随机”），只有中间的卷须需要很长的规律去描述。

### 尝试：用 gzip 量出来

2014 年他和 Sean Carroll 等人把这个想法做成了实验[^coffee]：一个 100×100 的网格，上半是奶油、下半是咖啡，每一步随机交换相邻两个不同的格子。

两个量都用 gzip 估计：**熵**是整个细网格压缩后的大小；**表观复杂度**是先把网格“粗粒化”（每个格子取周围一片的平均值，再分成“咖啡 / 混合 / 奶油”三档）之后的压缩大小。粗粒化相当于眯着眼看杯子，看不清单个分子的随机位置，只看得见宏观的形状，压缩后的大小就近似那个“规律部分”。

我们按论文的设定自己实现了一遍：

<figure class="dd dd-figure">
<div class="dd-scroll">
<svg class="dd-svg" viewBox="0 0 800 492" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="i3-coffee-title i3-coffee-desc">
<title id="i3-coffee-title">咖啡自动机里熵和表观复杂度随时间的变化</title>
<desc id="i3-coffee-desc">上排是互作用模型在 t=0、691、6437、60000 时粗粒化后的样子：奶油和咖啡先分层，中间出现一条起伏的混合带，最后整片变成均匀的混合。下排两条曲线：细网格的 gzip 大小（熵）一路上升到 1723 字节后持平；粗粒化图的 gzip 大小（表观复杂度）从 48 升到 645 再降回 56。</desc>
<rect class="dd-frame" width="800" height="492" rx="10"/>
<rect class="dd-zone" x="16" y="16" width="768" height="196" rx="8"/>
<style>
.dd-svg .i3-coffee-cream{fill:#f4ead6}
.dd-svg .i3-coffee-mix{fill:#c19a6b}
.dd-svg .i3-coffee-coffee{fill:#5a3d2b}
html.dark .dd-svg .i3-coffee-cream{fill:#e6d7b9}
html.dark .dd-svg .i3-coffee-mix{fill:#a07a52}
html.dark .dd-svg .i3-coffee-coffee{fill:#3b271b}
</style>
<text class="t-zone" x="32" y="44">粗粒化后的样子（100×100 网格，9×9 窗口平均，分 3 档）</text>
<rect class="dd-card" x="51" y="59" width="127" height="127" rx="2"/>
<rect x="52" y="60" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="65" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="70" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="75" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="80" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="85" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="90" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="95" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="100" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="105" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="110" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="115" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="52" y="120" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="52" y="125" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="130" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="135" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="140" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="145" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="150" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="155" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="160" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="165" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="170" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="175" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="52" y="180" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<text class="t-mono" x="52" y="205">t = 0</text>
<text class="t-val" x="52" y="223">复杂度 48 B</text>
<rect class="dd-card" x="235" y="59" width="127" height="127" rx="2"/>
<rect x="236" y="60" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="65" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="70" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="75" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="80" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="85" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="90" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="95" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="100" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="105" width="125" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="110" width="15" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="251" y="110" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="256" y="110" width="70" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="326" y="110" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="341" y="110" width="20" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="236" y="115" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="241" y="115" width="30" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="271" y="115" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="276" y="115" width="85" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="236" y="120" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="236" y="125" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="236" y="130" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="251" y="130" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="261" y="130" width="25" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="286" y="130" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="291" y="130" width="65" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="356" y="130" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="135" width="65" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="301" y="135" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="306" y="135" width="40" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="346" y="135" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="351" y="135" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="140" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="145" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="150" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="155" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="160" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="165" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="170" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="175" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="236" y="180" width="125" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<text class="t-mono" x="236" y="205">t = 691</text>
<text class="t-val" x="236" y="223">复杂度 174 B</text>
<rect class="dd-card" x="419" y="59" width="127" height="127" rx="2"/>
<rect x="420" y="60" width="20" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="440" y="60" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="445" y="60" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="450" y="60" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="455" y="60" width="15" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="470" y="60" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="485" y="60" width="10" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="495" y="60" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="510" y="60" width="15" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="525" y="60" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="535" y="60" width="10" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="420" y="65" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="435" y="65" width="35" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="470" y="65" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="475" y="65" width="20" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="495" y="65" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="505" y="65" width="40" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="420" y="70" width="20" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="440" y="70" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="445" y="70" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="455" y="70" width="90" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="420" y="75" width="25" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="445" y="75" width="25" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="470" y="75" width="45" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="515" y="75" width="25" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="540" y="75" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="420" y="80" width="40" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="460" y="80" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="470" y="80" width="40" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="510" y="80" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="525" y="80" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="530" y="80" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="85" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="425" y="85" width="35" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="460" y="85" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="475" y="85" width="35" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="510" y="85" width="35" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="90" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="430" y="90" width="15" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="445" y="90" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="90" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="455" y="90" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="460" y="90" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="465" y="90" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="470" y="90" width="15" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="485" y="90" width="60" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="95" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="435" y="95" width="5" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="440" y="95" width="20" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="460" y="95" width="10" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="470" y="95" width="60" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="530" y="95" width="10" height="5" class="i3-coffee-cream" shape-rendering="crispEdges"/>
<rect x="540" y="95" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="100" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="105" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="110" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="115" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="120" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="125" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="130" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="135" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="140" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="145" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="425" y="145" width="120" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="150" width="20" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="440" y="150" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="445" y="150" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="460" y="150" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="470" y="150" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="485" y="150" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="490" y="150" width="55" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="155" width="20" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="440" y="155" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="445" y="155" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="455" y="155" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="460" y="155" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="470" y="155" width="20" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="490" y="155" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="500" y="155" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="505" y="155" width="25" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="530" y="155" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="535" y="155" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="160" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="430" y="160" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="435" y="160" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="160" width="15" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="465" y="160" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="470" y="160" width="15" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="485" y="160" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="500" y="160" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="505" y="160" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="510" y="160" width="25" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="535" y="160" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="165" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="430" y="165" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="440" y="165" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="165" width="20" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="470" y="165" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="475" y="165" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="485" y="165" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="490" y="165" width="40" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="530" y="165" width="15" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="170" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="430" y="170" width="10" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="440" y="170" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="170" width="95" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="420" y="175" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="425" y="175" width="20" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="445" y="175" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="175" width="80" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="530" y="175" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="535" y="175" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="540" y="175" width="5" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="420" y="180" width="20" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="440" y="180" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="450" y="180" width="15" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="465" y="180" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="475" y="180" width="60" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="535" y="180" width="10" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<text class="t-mono" x="420" y="205">t = 6437</text>
<text class="t-mono t-acc" x="420" y="223">复杂度 645 B</text>
<rect class="dd-card" x="603" y="59" width="127" height="127" rx="2"/>
<rect x="604" y="60" width="25" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="629" y="60" width="5" height="5" class="i3-coffee-coffee" shape-rendering="crispEdges"/>
<rect x="634" y="60" width="95" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="65" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="70" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="75" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="80" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="85" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="90" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="95" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="100" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="105" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="110" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="115" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="120" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="125" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="130" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="135" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="140" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="145" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="150" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="155" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="160" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="165" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="170" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="175" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<rect x="604" y="180" width="125" height="5" class="i3-coffee-mix" shape-rendering="crispEdges"/>
<text class="t-mono" x="604" y="205">t = 60000</text>
<text class="t-val" x="604" y="223">复杂度 56 B</text>
<text class="t-note" x="768" y="44" text-anchor="end">浅 = 奶油，深 = 咖啡，中间色 = 混合</text>
<rect class="dd-zone" x="16" y="228" width="768" height="248" rx="8"/>
<text class="t-zone" x="32" y="256">gzip 后的字节数随时间（横轴对数）</text>
<line class="dd-hair" x1="88" y1="440.0" x2="744" y2="440.0"/>
<text class="t-note" x="80" y="444.0" text-anchor="end">0</text>
<line class="dd-hair" x1="88" y1="386.7" x2="744" y2="386.7"/>
<text class="t-note" x="80" y="390.7" text-anchor="end">600</text>
<line class="dd-hair" x1="88" y1="333.3" x2="744" y2="333.3"/>
<text class="t-note" x="80" y="337.3" text-anchor="end">1200</text>
<line class="dd-hair" x1="88" y1="280.0" x2="744" y2="280.0"/>
<text class="t-note" x="80" y="284.0" text-anchor="end">1800</text>
<text class="t-note" x="88.0" y="458" text-anchor="middle">0</text>
<text class="t-note" x="231.0" y="458" text-anchor="middle">10</text>
<text class="t-note" x="363.2" y="458" text-anchor="middle">100</text>
<text class="t-note" x="499.9" y="458" text-anchor="middle">1000</text>
<text class="t-note" x="637.2" y="458" text-anchor="middle">10000</text>
<text class="t-note" x="744.0" y="458" text-anchor="middle">60000</text>
<line class="dd-hair" x1="477.9" y1="280" x2="477.9" y2="440"/>
<line class="dd-hair" x1="610.9" y1="280" x2="610.9" y2="440"/>
<line class="dd-hair" x1="744.0" y1="280" x2="744.0" y2="440"/>
<path class="dd-edge" d="M88.0 435.9 L129.3 431.2 L153.5 427.9 L170.7 426.0 L184.0 425.8 L194.8 425.7 L204.0 426.0 L212.0 425.9 L219.0 425.5 L225.3 425.8 L236.2 424.9 L245.4 423.6 L253.3 423.0 L263.6 423.3 L272.3 420.4 L279.9 419.7 L288.8 418.0 L298.3 418.3 L307.9 417.3 L317.6 416.6 L326.9 414.1 L336.0 413.8 L345.4 413.5 L355.0 411.8 L364.3 411.3 L373.9 409.2 L383.1 408.2 L392.4 406.2 L402.1 403.8 L411.5 401.6 L420.9 401.9 L430.4 397.2 L439.9 394.2 L449.4 389.5 L458.9 386.1 L468.4 383.4 L477.9 380.3 L487.4 374.5 L496.9 367.8 L506.4 366.0 L515.9 360.8 L525.4 355.1 L534.9 349.4 L544.4 343.1 L553.9 337.2 L563.4 329.9 L572.9 323.4 L582.4 316.8 L591.9 312.9 L601.4 306.0 L610.9 301.4 L620.4 298.2 L629.9 294.9 L639.4 293.7 L648.9 291.7 L658.4 290.5 L667.9 289.2 L677.5 288.0 L687.0 286.5 L696.5 288.0 L706.0 287.1 L715.5 287.5 L725.0 287.6 L734.5 289.3 L744.0 286.8"/>
<path class="dd-edge-acc" d="M88.0 435.7 L129.3 435.7 L153.5 435.7 L170.7 433.8 L184.0 432.5 L194.8 432.5 L204.0 432.9 L212.0 433.1 L219.0 432.6 L225.3 433.2 L236.2 432.8 L245.4 431.8 L253.3 431.5 L263.6 430.8 L272.3 431.6 L279.9 431.5 L288.8 432.1 L298.3 431.8 L307.9 431.6 L317.6 433.3 L326.9 430.8 L336.0 431.0 L345.4 430.1 L355.0 430.0 L364.3 429.6 L373.9 428.9 L383.1 428.2 L392.4 429.0 L402.1 430.1 L411.5 427.9 L420.9 427.7 L430.4 427.7 L439.9 425.9 L449.4 426.8 L458.9 426.0 L468.4 425.9 L477.9 424.5 L487.4 422.6 L496.9 421.2 L506.4 417.8 L515.9 422.0 L525.4 419.9 L534.9 419.3 L544.4 417.2 L553.9 414.0 L563.4 415.6 L572.9 407.7 L582.4 403.4 L591.9 403.1 L601.4 390.8 L610.9 382.7 L620.4 389.2 L629.9 398.0 L639.4 415.3 L648.9 424.9 L658.4 431.3 L667.9 432.3 L677.5 435.4 L687.0 434.5 L696.5 435.7 L706.0 434.4 L715.5 435.3 L725.0 434.5 L734.5 435.6 L744.0 435.0"/>
<text class="t-name" x="740.0" y="276.8" text-anchor="end">熵：细网格 gzip，一路上升到 1723</text>
<text class="t-name t-acc" x="596.9" y="380.7" text-anchor="end">表观复杂度：粗粒化后 gzip，48 → 645 → 56</text>
<text class="t-note" x="744" y="474" text-anchor="end">sweep 次数</text>
</svg>
</div>
<figcaption>图 5 · 熵一路上升，表观复杂度先升后降：最“有结构”的时刻在中间</figcaption>
</figure>

熵从 46 字节涨到 1723 字节后持平；表观复杂度从 48 字节升到 645 字节，又降回 56 字节。先升后降复现出来了。

### 问题：这个量有多可靠

“复杂度先升后降，所以生命和智能出现在宇宙的中间阶段”是这篇论文最常被转述的结论，30u30 的清单文件也是这么写的。但论文本身要谨慎得多，而且我们的复现也暴露了它的软肋。

**第一，峰值很尖，而且和分档的门槛有关。** 图 5 的峰值只出现在 t = 6437 附近一个很窄的区间。从图上看，那时大片区域的平均浓度正落在两档的分界附近，一点点随机涨落就让格子在两档之间来回跳，gzip 把这些跳动也算成了“结构”（这是我们根据图的判断）。论文第 6 节专门讨论了这种“阈值伪影”，改用 7 档加按行取多数的修正。我们用修正后的量再算一遍，互作用模型的复杂度只从 57 升到 87，起伏小了很多。

**第二，对照组没有复现出来。** 论文还有一个对照模型：奶油粒子各自独立随机游走、可以重叠。论文的结论是，修正之后这个模型的复杂度一直很小，并且在附录里给了证明，由此说明“粒子之间的相互作用才产生宏观复杂度”。我们的小规模复现里，修正后的对照模型复杂度反而比互作用模型还高（最高 265 字节），换成更大的窗口也是如此。可能的原因是重叠计数的涨落比 0/1 网格大，更容易跨档，论文用的网格也更大。

这两点说明，表观复杂度这个量很依赖“怎么眯眼”：窗口多大、分几档、怎么修正。作者自己也把“为互作用模型证明先升后降”留作了开放问题。这篇论文在清单里的价值，恐怕不在“解释了生命为什么存在”，而在它把“结构”这个模糊的直觉落成了一个可以计算的量，也就是两部分码的第一部分，同时诚实地展示了这样做有多难。

### 回到清单

现在回头看第一节那个“PAGE 434 onwards”。算法统计这一章讲的是怎样给数据找到合理的规律部分；Aaronson 的复杂度用的就是这个规律部分的长度；MDL 用它来选模型；Kaplan 的公式里，它是那一项会随模型变大而减少的损失。清单的理论部分像是有意按这条线挑出来的。

2023 年，Ilya 在 Simons Institute 做过一个演讲，题目叫《An Observation on Generalization》[^ilya2023]。他用压缩来解释无监督学习为什么有效：Kolmogorov 复杂度是理想的压缩器，用梯度下降训练的大网络是它的一个近似。这和清单的理论部分是同一个视角。需要说明的是，把清单和这次演讲联系起来是我们的推断，Ilya 本人并没有这样解释过这份清单。

## 六、清单之外的东西

清单停在 2020 年，这一点在“规模”这条线上最明显。

Kaplan 2020 年的论文除了给出 $L(N)$，还回答了一个实际问题：算力增加时，钱该花在更大的模型上，还是更多的数据上？他的答案是模型增长得更快，算力每增加 10 倍，模型大约扩大 5 倍，数据只增加约 2 倍。两年后 DeepMind 的 Chinchilla[^chinchilla]重新做了这组实验，得出的结论是两者应该同比例增长，大约每个参数配 20 个 token。按这个结论，GPT-3 这一代模型普遍“模型太大、数据太少”。

30u30 第 25 天的笔记里提到了这个修正，README 末尾还写着下一天是“Day 26: Chinchilla”，但仓库里的第 26 天实际是 Kolmogorov 复杂度，Chinchilla 被放进了“即将推出”的附加篇。这个链接大概是调整课表时留下的。

同样不在清单里的，还有 30u30 补上的强化学习和 RLHF。仓库在第 29 天特意注明：“与 InstructGPT、ChatGPT 的联系是我们事后加的，不是 2017 年论文里的内容。”这个说明很有必要。如果把补上的三篇去掉，原清单讲的几乎全是“怎样从数据里学到规律”，也就是预训练这一半；至于怎样让模型听话、对齐，原清单没有涉及。

## 七、30u30 作为学习材料

最后简单看一下仓库本身。每一天的目录结构相同：一份讲解 README、一份论文笔记、一个从零写起的实现（大多是 NumPy，后面几天用 PyTorch）、5 道带答案的练习和一个 Jupyter notebook，全仓库的实现代码约 1.5 万行。许可证是 CC BY-NC-ND 4.0，可以阅读和转发，不能商用，也不能发布改编版本。

我们读了和本文主线相关的几天，讲解部分写得认真，比如第 7 天把论文第 6 节的阈值伪影讲得很清楚。实现里也有几处值得注意：

<figure class="dd dd-figure dt-figure">
<div class="dt-panel">
<div class="dt-title" id="i3-checks-title">和本文主线相关的几天，实现里值得注意的地方</div>
<div class="dt-scroll">
<table class="dt" aria-labelledby="i3-checks-title">
<colgroup><col style="width:18%"><col><col style="width:34%"></colgroup>
<thead>
<tr><th scope="col">位置</th><th scope="col">现象</th><th scope="col">影响</th></tr>
</thead>
<tbody>
<tr><th scope="row">第 7 天<br>咖啡自动机</th><td>为了提速，一次抽 n²/4 个格子各配一个邻居，挑出值不同的对后一次性交换，没有排除同一格同时出现在两对里。按同样逻辑重写测试（50×50）：奶油格数第 0、10、100、1000 步依次为 <span class="mono">1250、1254、1230、1241</span></td><td class="bad">奶油会凭空增减，粒子数不守恒；注释里写的是 non-conflicting swaps</td></tr>
<tr><th scope="row">第 25 天<br>规模定律</th><td>合成数据只有一条复制规律，其余是均匀随机数；默认训练 50 步</td><td class="warn">原理上画不出 L(N) 幂律，见第四节</td></tr>
<tr><th scope="row">第 26 天<br>Kolmogorov</th><td>清单条目去掉了“从 434 页起”，内容是 Huffman 编码、算术编码和压缩距离聚类</td><td class="warn">没有覆盖清单真正指向的第 14 章算法统计</td></tr>
<tr><th scope="row">清单文件</th><td>AlexNet 条目下多了一个无关链接 arXiv 1211.5063（《On the difficulty of training recurrent neural networks》）；第 25 天 README 链接的“Day 26: Chinchilla”不存在</td><td>编辑残留，不影响内容</td></tr>
</tbody>
</table>
</div>
<p class="dt-note">30u30 的代码我们没有直接运行，表中第一行是照它的逻辑重写后测的。</p>
</div>
<figcaption>表 2 · 讲解写得认真，但实现里有一处会让咖啡自动机的粒子数不守恒</figcaption>
</figure>

如果想顺着本文的主线读原文，可以按这个顺序：Karpathy 的博客，Hinton 1993，Grünwald 教程的第 1 章，Kolmogorov 那本书的第 14 章，Aaronson 的博客，咖啡自动机论文，最后是 Legg 论文里定义通用智能的那一章。

## 小结

1. **“Ilya 的 30 篇”是哪来的？** Carmack 收到过约 40 篇，原单已丢；流传的 27 条来源没有确认；30u30 又补了 Dropout、PPO、RLHF 三篇。
2. **清单由什么组成？** 19 条架构和技巧，1 条规模定律，7 条压缩和复杂度理论。它停在 2020 年，没有 GPT、强化学习和对齐；理论部分篇数少，篇幅最重。
3. **为什么从字符级 RNN 开始？** 预测下一个字符就是压缩：4 阶字符模型配上算术编码，每字符 2.23 比特，胜过 gzip、xz、bzip2。
4. **模型越复杂越好吗？** 不一定，模型本身也要花比特。两部分码把数据拆成规律和噪声，最好的模型让两部分之和最短。
5. **规模定律来自哪里？** 来自数据里规律的长尾。30u30 第 25 天的合成数据只有一条规律，所有模型都停在 3.62 nats 的噪声下限，画不出幂律；训练久了，大模型只会把噪声背下来。
6. **为什么读咖啡？** 熵一路上升，但“结构”先升后降；Aaronson 用粗粒化后的压缩大小去量它。这个量很依赖粗粒化的选择，我们的复现只复现了一半。
7. **这份清单的主线是什么？** 除了架构史，它还有一条压缩的主线：学习就是找到数据的规律部分。这和 Ilya 2023 年的演讲一致，但这是我们的读法。

## 参考资料
