Seven Mental · 心智七篇
← Knowledge Atlas · Source

Language Models Represent Space and Time

Gurnee & Tegmark (ICLR 2024):Llama-2 内部自发形成线性时空表征,空间神经元/时间神经元,世界模型基本成分的实证证据
SOURCE · GURNEE & TEGMARK · ICLR 2024 · spatiotemporal world model · R²=0.911/0.835

Language Models Represent Space and Time

Gurnee & Tegmark (MIT, ICLR 2024) — first systematic validation that LLMs encode continuous space-time coordinates linearly

Full-layer sweep over Llama-2 models on 6 spatiotemporal datasets (180K+ samples): space probes reach R²=0.911, time probes R²=0.835 — linear probes match non-linear MLP probes (0.911 vs 0.926), proving space-time is encoded linearly, not hidden behind complex non-linear decoders.

Six spatiotemporal datasets
World places39,585R²=0.911
US places29,997
NYC places19,838R²=0.359 (hardest)
Historical figures (death year)37,539R²=0.835
Artworks (release year)31,321
News headlines (publish year)28,389NYT 2010–2020
Key findings
Individual space/time neurons
Cosine-similarity search locates highly aligned single neurons (Spearman >0.7); ablation confirms causal role
Middle layers stabilize
Representations peak around 60% depth, robust to prompt, larger models consistently outperform smaller
Cross-entity-type unity
The same probe generalizes across entity types — one unified representation, not category-specific encodings
→ Spatiotemporal World Model · Linear Representation · Wes Gurnee · Max TegmarkICLR 2024 arXiv:2310.02207

Language Models Represent Space and Time

来源: sources/arxiv_papers/2310.02207-language-models-represent-space-and-time.md URL: https://arxiv.org/abs/2310.02207 作者: Wes Gurnee、Max Tegmark(MIT) 发表时间: 2023-10-03(ICLR 2024 录用)


论文核心问题

LLM 到底学到了什么?

有两种对立假说:

  1. 统计相关性假说:LLM 只是在堆砌天文数字量级的表面统计模式,缺乏对现实世界的任何连贯理解。
  2. 世界模型假说:LLM 在压缩训练数据的过程中,涌现出了对现实世界生成过程的紧凑、连贯表征。

Gurnee & Tegmark 的答案倾向于后者——他们用地理坐标和历史时间两种连续量的线性可解码性作为关键证据。


实验设计

六个时空数据集

数据集规模示例
世界地点39,585”Los Angeles”、“Caspian Sea”
美国地点29,997”Fenway Park”、“Columbia University”
纽约市地点19,838”Borden Avenue Bridge”
历史人物(死亡年)37,539”Cleopatra”、“Carl Sagan”
艺术品(发布年)31,321”Stephen King’s It”
新闻标题(发表年)28,389NYT 标题,2010-2020

方法

在 Llama-2(7B/13B/70B)的每一层保存实体名称最后一个 token 的激活(residual stream),用线性岭回归探针(probing classifiers)预测真实的空间坐标(经纬度)或时间坐标(时间戳)。


核心发现

1. 线性时空表征存在

Llama-2-70B 对世界地点坐标的预测 R² = 0.911(线性探针),NYC 最难,为 0.359。历史人物死亡年 R² = 0.835。

2. 线性性得到验证

线性探针 vs 非线性 MLP 探针性能几乎持平。例如,Llama-2-70B 世界地点:线性 0.911,MLP 0.926。非线性不带来显著提升,说明时空信息确实以线性方式编码。

3. 表征在模型前半段形成并在中间层稳定

探针性能随层数增加,在模型约 60% 深度处达到峰值并趋于稳定。大模型持续优于小模型。

4. 对提示词鲁棒

显式要求模型回忆坐标、或给出上下文提示,对探针性能几乎无影响——说明时空表征是在不依赖 prompt 的情况下自发形成的。但随机干扰 token 会降低性能。

5. 跨实体类型统一

同一个探针可以泛化到不同实体类型(城市与自然地标、歌曲与电影)。表征是统一的,而非每类实体分别编码。

6. 个体”空间神经元”和”时间神经元”

通过余弦相似度搜索,发现了与探针方向高度一致的单个神经元。这些神经元:

  • 对真实坐标高度敏感(Spearman 相关 > 0.7)
  • 对所有实体类型均有响应
  • 消融实验验证:将时间神经元 L19.3610 的激活固定到特定值,可定向改变模型对”XX 年代”的预测概率
  • 神经元失活实验:零激活空间神经元后,模型预测”某地最大""某地最活跃”类型的 token 的 loss 显著上升

理论意义

线性表征假说的连续量扩展

此前”线性表征假说”(LRH)的证据几乎全部来自类别特征(如情感极性、词性)。本文是首次对连续量(经纬度、时间戳)进行系统验证,将 LRH 的适用范围大幅扩展。

世界模型的初步证据

仅凭 next-token prediction 训练的 LLM,内部自发形成了真实世界的空间和时间坐标表征,具备世界模型的”基本成分”(basic ingredients)。但作者明确指出:这还不是完整的动态因果世界模型,仅是一个必要条件。

与神经科学的类比

大脑中的位置细胞(place cells)和网格细胞(grid cells)负责空间编码。LLM 的”空间神经元”是否在功能上与之类似?作者提出这是未来重要的探索方向。


关键词与关联概念


References

  • sources/arxiv_papers/2310.02207-language-models-represent-space-and-time.md