细胞自动机第一原理 cover
Programmer.ie 图书 In development

细胞自动机第一原理

从最小的局部规则构建细胞自动机,然后跟随其进入度量、计算、连续的人工生命、学习到的动态与可复现工程。对简单局部系统能做什么,以及如何判定证据真能支持什么,作第一原理的考察。

一个细胞几乎什么都不知道。它看到一个小邻域,应用一个局部规则,然后改变状态。在所有地方重复这一点,一遍又一遍,令人惊讶的丰富世界就能出现。

从一整行细胞开始。

每个细胞要么开、要么关。

它只看邻居。

每个细胞遵循相同规则。

然后整个世界更新。

局部状态
    ↓
局部邻域
    ↓
局部规则
    ↓
下一状态
    ↓
重复

这看起来太小,不够有意思。

然而,由如此简单的规则构建的系统能产出稳定结构、振荡器、移动模式、交通流、扩散的火灾、反应-扩散场、通用计算、连续的人工生命系统与学习到的局部动态。

本书的问题不只是这些东西能不能发生。

它还有:

多少全局结构能从局部规则中涌现,以及我们如何知道自己究竟看到了什么?

后半句要紧。

一幅 striking 的图不是解释。一个看起来随机的模式并不一定随机。一个持久的对象不一定是活的。一个在若干例题上求解的系统并不一定学会了算法。一个更快的实现不一定是与慢的等价的。

所以本书从第一原理构建细胞自动机,然后在全程把它们 subjected to 同样的 discipline:

构造
→ 观察
→ 度量
→ 挑战
→ 验证
→ 证据失败时拒绝

这种 methodology Eventually becomes more important than any particular automaton.

局部规则与全局世界

细胞自动机始于几样 ingredient。

状态是细胞当前所含的东西。

格 (lattice) 是细胞所住的空间。

邻域决定细胞能观察到哪些附近细胞。

规则把局部邻域映射到细胞的下一状态。

调度决定更新何时发生。

边界条件决定模拟世界的边缘发生什么。

这些 ingredient 是局部的。

我们通常关心的现象却不是。

我们问的是跨越成千上万个细胞持续存在的结构、移动的信号、重复的循环、扩散的扰动、能计算的配置、受损后恢复的形态,或超出训练例子而 generalizes 的规则。

因此本书 recurring 的张力是:

规则是局部的。我们关心的行为是全局的。

在这两层之间的工作,才是细胞自动机变得有用之处。

简单并不等于可预测

细胞自动机的吸引力之一,是描述与行为之间的差距规模。

一个基本的一维自动机只有:

  • 两种 cell state,
  • 每个邻域三个细胞,
  • 八种可能的 neighborhood configurations,
  • 以及 256 条可能规则。

这小到完全可以枚举。

但这些规则的轨迹并非同等容易理解。

有的很快死掉。

有的安定成重复结构。

有的产生长而无规律的历史。

有的在精心构造下支持计算。

于是从规则表走向 resulting world,常常不是更仔细地读一遍规则就行。

那是我们随本书反复遭遇的 theme:

简单的描述
≠ 简单的行为

但反向错误同样危险:

看起来复杂的 behavior
≠ 复杂的 mechanism

细胞自动机为我们提供一个 unusual 紧凑的 laboratories,在其中两样错误都可被 examined。

有类似词的不是相同 claim

这个 subject 吸引了 strong language。

模式被描述成混沌的、涌现的、智能的、活的、自组织的、通用的、adaptive 或有 creative 的。

有时这些词有用。

有时它们把结论走私进描述。

本书让几组 distinction 保持显式:

无规律
≠ 随机
≠ 混沌

看起来复杂
≠ 计算机可通用

持久
≠ 活着

robust
≠ adaptive

学得的
≠ 智能

高分
≠ 期望的行为现象

更快
≠ 等价

这些不是语义 nicety。

每一组 requires 不同的 evidence。

Rule 30 可以产生极无规律的信号,而并不给我们一个 theorem 说那信号 random。

Rule 110 在合适构造下是 computation-universal,但 universality 不让它容易 program,或 efficient,或 starting 于任意 initial conditions 时 spontaneous 地计算。

神经细胞自动机可以 damaged 后 recovery target,却并不 implies 生物学的 regeneration。

一个 search procedure 的 metric 无它们真正 care about 的 behavior,也可以 optimize。

本书 recurring地返回这些 boundaries,因为它们恰恰是 interesting demonstrations 最易变成 exaggerated explanations 的地方。

证据算什么

章节使用多种 evidence,它们不可互换。

established result 是基于文献 grounding 的:theorem、construction、documented 模型或 known historical result。

book experiment 是由本书 executable examples 示例出来的。

measured observation 是取自 stated 希 run、metric、perturbation 或 comparison 的结果。

interpretation 是我们叠在观察之上的 explanation。

open question 是 evidence 尚未 settle 的事情。

这些 distinction 在 subject 达到 computational universality、artificial life 与 learned systems 时尤其重要。

本书不把 impressive screenshot 的存在当作 interpretation 正确的 evidence。

在可能时,claims 被 made executable。

若两种 implementation 应当等价,我们比较它们。

若某数量 supposedly 被 conserved,我们 measure 它。

若某个模式 supposedly 移动,我们度量 displacement。

若一个系统 supposedly recovery,我们 recovery of mass 与 recovery of morphology separate。

若某模型 supposedly generalizes,我们 test 一个 training example 之外的条件。

若某个 optimization supposed to preserve semantics,我们 verify outputs 然后再为 speedup 庆祝。

本书从规则开始,而非抽象

前几章 deliberate 从 small 开始。

我们直接 build 一个 elementary 自动机。

再发现第一手写 rule 已有名字:Rule 22。

我们 encode 全部 256 elementary rules。

我们检视 Rule 30,学会 deterministic 并不意味着 visually predict 长的 signal。

我们移到 Rule 110,把 computation 的存在与更紧的 computational universality 属性 separate。

Then the Game of Life takes us into two dimensions.

到 foundations 末尾,我们不再只看 images。我们在 building ways 识别 still lifes、oscillators、spaceships 与其他 behavior 作为 data。

这场 transition important。

本书逐步从:

看模式

走向:

度量 behavior

因为 visual inspection sooner than expected 停止 being sufficient。

七个 stage

investigation proceeds through seven parts。

第一部分 —— 基础(第 1–7 章)

我们 construct 基本 machinery:

  • elementary cellular automata,
  • rule encoding,
  • Rule 30,
  • Rule 110,
  • Conway’s Game of Life,
  • pattern categories,
  • pattern detection。

aim 是:在要 local update rule 携带更大 ideas 之前,exact地理解它是什么。

第二部分 —— 更丰富世界(第 8–17 章)

models 变得 less pristine。

我们 explore:

  • 生命类规则族,
  • 概率规则,
  • spreading processes,
  • 交通,
  • diffusion,
  • reaction-diffusion,
  • predator-prey systems,
  • cave generation,
  • terrain,
  • textures。

这个 stage introduce 一个 critical engineering habit:每个 richer model 带来新的 assumptions。

boundary conditions matter。

update order matter。

Conservation may hold in one model and deliberately fail in the next。

A system can resemble 一个 physical or biological process without becoming faithful model of 它。

第三部分 —— 度量与搜索(第 18–27 章)

Looking is no longer enough。

我们 construct observables for:

  • density,
  • activity,
  • spatial variation,
  • entropy,
  • recurrence,
  • sensitivity,
  • fingerprints。

Then we use them to classify、search and evolve rules。

这个 stage also contains one of 本书的 strongest warnings:

度量不是现象。

一个 rule 可以 high score for wrong reason。

一个 novelty measure 可以 reward 东西 useless。

一个 fitness function 可以被 exploited。

这个 stage 结尾 return computational universality,precisely asks 那个 word do —— and does not —— mean。

第四部分 —— 连续人工生命(第 28–36 章)

cell state stops being only zero or one。

我们 introduce:

  • 连续值 state,
  • kernels,
  • growth functions,
  • Lenia,
  • 自动化 discovery,
  • 参数 regimes,
  • 多 channel systems,
  • robustness,
  • Flow-Lenia。

conceptual machinery remains recognizablely cellular:

local perception
→ local update
→ repeated global evolution

but the visual and dynamical possibilities 变得 much richer。

这种 richness 使 disciplined language 更 important。

一个 persistent 的 moving structure 在 artificial-life practice 中或可称 creature,但这 isn’t 生物 claim。

Robustness is not adaptation。

Recovery is not automatically regeneration。

第五部分 —— 学到 rules(第 37–49 章)

Until 这一点,we designed the rules。

现在问:

如果局部规则本身被 learned,会怎样?

这始于 differentiable 与 neural cellular automata。

我们 build:

  • neural update functions,
  • hidden state,
  • 目标 growth,
  • stochastic scheduling,
  • persistence,
  • damage recovery,
  • generalization tests。

Then the substrate 被 asked 执行 algorithmic task:在 mazes 中的 pathfinding。

这个 progression 让我们问 progressively harder questions。

Did 模型 merely fit training examples?

Did 它 generalize 到 harder mazes?

Does 信息 propagate locally?

Do hidden channels matter causally?

Has 系统 learned 一个 iterative computation,还是 we’re 只是 placing 那解释 onto successful outputs?

本书 holds 这些 questions open 一直到 experiments justify stronger language。

第六部分 —— 工程(第 50–58 章)

Interesting dynamics 不够,如果 implementation 是错的。

final technical stage 把这些 automata 变成 reproducible software。

我们 examine:

  • profiling,
  • vectorization,
  • GPU execution,
  • FFT convolution,
  • reusable engines,
  • reproducibility,
  • 参数 sweeps,
  • figure generation,
  • laboratory practice。

Several real errors in 本书 were found only by executing the code:

  • incorrect function signatures,
  • nonexistent metric keys,
  • undefined helpers,
  • FFT kernel-centering errors,
  • zero-padding where toroidal semantics were intended,
  • CPU-only CUDA synchronization failures,
  • batch-shape bugs.

那个经验 earns another recurring rule:

Optimize the verified implementation, not the first implementation that happens to render something plausible.

And:

runs
≠ correct

looks right
≠ equivalent

faster
≠ same semantics

第七部分 —— Capstone(第 59 章)

Final chapter 把 method put together。

它 constructs candidates、观察它们、measure 它们、challenges 最强的一个、并 asks whether 证据 supports 我们 хот的解释。criteria 在 search begins 之前 stated,因此 verdict 来自 method,not from how attractive 结果 looks。

从观察到度量

Throughout 本书 recurring progression:

state
↓
trajectory
↓
observable
↓
measurement
↓
comparison
↓
search
↓
claim

Each arrow can fail。

一个 measure 可以 collapse 两种非常 different behaviors into the same number。

一个 classifier 可以 mistake 一个 heuristic category for a theorem。

一个 search objective 可以 reward an unintended shortcut。

一个 learned model,可以在 unseen conditions 之外 successful; on held-out examples without generalizing。

An optimized implementation 可以 silently change the boundary semantics。

因此本书 does not stop at obtaining 一个 result。

It asks 生成 result 的 mechanism 是谁、the measurement actually detects 什么、whether the conclusion survives 一个 stronger test。

人工生命 without Pretending

连续与 learned chapters 把本书 close 于 artificial life,文献 reports compelling results:Lenia 中 persistent and moving 的 patterns, neural cellular automata 中 recovery after damage。Those results invite anthropomorphic language。

因此本书 treats words such as creature、species、regeneration and self-organization carefully。Sometimes 是 established terminology within artificial-life literature。Sometimes 它们 describe 一种任务 setup。它们 aren’t by themselves evidence 一个 system alive、adaptive or intelligent。

问题总是:

什么 property was actually demonstrated?

学习改变谁写规则

The transition to neural cellular automata changes something fundamental。

Earlier chapters ask:

What happens when we design this local rule?

The learned chapters ask:

What local rule does optimization discover for this objective?

结构 remains local。

Cells still receive nearby information and update local state。

But the rule now parameterized 和 optimized through training。

这引入一种 new separation:

training
≠ rollout

During training,parameters change。

During rollout,those parameters are frozen and the learned dynamics execute。

一个在 rollout 期间 apparently adaptive 的 system 可能因此展示 earlier learned 的 dynamics 而不是 real-time learning。

这个 distinction 变得 central to 本书 interprets regeneration、persistence、hidden state and generalization。

失败是方法的一部分

本书 does not hide unsuccessful results。

Some examples homogenize。

Some parameter choices collapse。

Some metrics are gamed。

Some configurations that look promising fail robustness tests。

Some implementations disagree until a bug is found。

Some learned models succeed only within narrow distribution。

Those failures useful because 它们 tell us mechanism 或 explanation 停止 working 的 places。

研究-throughout

Every chapter ends with a ## Research section。

These are not decorative bibliographies。

They identify the papers、technical references 和 primary sources materially changed or grounded 那章。

Across 库它们 range from primary papers(Wolfram、Cook、Pearson、Drossel and Schwabl、Shannon、Chan、Mordvintsev and collaborators、Earle and collaborators、Lehman and Stanley) through encyclopedic overviews(Stanford Encyclopedia of Philosophy、Scholarpedia、MathWorld) to software documentation and a reproducibility guide。Von Neumann、Ulam、Conway and Langton appear 作为 history and context,reached through those sources。

这些 sources 被 differently used:

Some 提供 theorem。

Some 提供 historical provenance。

Some 定义 a model。

Some motivate an experiment。

Some establish 一个 claim remains open。

文本 tries to make 那个 distinction visible。

阅读之后你应能做什么

By the end:

  • implement elementary cellular automata from first principles;
  • encode and decode Wolfram rules;
  • build two-dimensional cellular systems;
  • reason about synchronous、asynchronous and stochastic updates;
  • distinguish periodic and fixed boundaries;
  • measure behavior instead of relying only on images;
  • use entropy、recurrence、sensitivity and fingerprints carefully;
  • search larger rule spaces;
  • evolve candidate rules without confusing fitness with truth;
  • explain what computational universality actually establishes;
  • build continuous-state and Lenia-style systems;
  • train 一个 neural cellular automaton;
  • distinguish training、rollout、persistence and regeneration;
  • test generalization rather than assume it;
  • investigate hidden-state propagation;
  • optimize CPU/GPU/FFT implementations while preserving semantics;
  • build reproducible experiments;
  • 并 reject compelling interpretation when 证据 does not support it。

最后一个 skill 或许是 the most important。

更大的想法

细胞自动机通常被介绍为 demonstration simple rules 可以 create complex behavior。

那是真的,但 not enough。

更 interesting 的 lesson 是 surprising pattern 出现 after what happens。

We have to decide 该叫 it 什么。

We have to measure 它。

We have to test 它是否 persists。

We have to perturb 它。

We have to distinguish visual analogy from mathematical result。

We have to know implementation whether actually matches 我们 think we ran 的 rule。

And when 证据 fails,we have to let 那个 explanation fail with it。

So the deeper progression of 本书 isn’t:

simple rules
→ amazing complexity

It is:

simple rules
→ surprising behavior
→ measurement
→ explanation
→ challenge
→ evidence

一个微小的局部 rule 可以 create 远超 description 的 rich world。

但 complexity 不给 we excuse from explaining what we see。

构建规则。运行世界。度量行为。挑战解释。只保留 survive 的东西。

Continue with How Can Tiny Rules Build Complex Worlds?.

目录

章节