今天起我将不定期更新论文阅读笔记。

论文所属领域一般是流形上的机器学习/深度学习、强化学习、组合优化以及视觉生成模型或多模态生成模型。

在这些笔记中,我将写出我个人对本文献的理解或评论,并尽自己最大能力保证可读性和完整性,以飨读者。

The Origins of Representation Manifolds in Large Language Models

Alexander Modell, Patrick Rubin-Delanchy and Nick Whiteley

https://arxiv.org/abs/2505.18235

摘要

There is a large ongoing scientific effort in mechanistic interpretability to map embeddings and internal representations of AI systems into human-understandable concepts. A key element of this effort is the linear representation hypothesis, which posits that neural representations are sparse linear combinations of ‘almostorthogonal’ direction vectors, reflecting the presence or absence of different features. This model underpins the use of sparse autoencoders to recover features from representations. Moving towards a fuller model of features, in which neural representations could encode not just the presence but also a potentially continuous and multidimensional value for a feature, has been a subject of intense recent discourse. We describe why and how a feature might be represented as a manifold, demonstrating in particular that cosine similarity in representation space may encode the intrinsic geometry of a feature through shortest, on-manifold paths, potentially answering the question of how distance in representation space and relatedness in concept space could be connected. The critical assumptions and predictions of the theory are validated on text embeddings and token activations of large language models.

  • 前人对解释 Embedding 的努力:线性表示假说(Linear Representation Hypothesis)

“A key element of this effort is the linear representation hypothesis, which posits that neural representations are sparse linear combinations of ‘almostorthogonal’ direction vectors, reflecting the presence or absence of different features.” 神经网络将实体表示为几乎垂直的向量(代表不同抽象特征)的稀疏线性组合

  • 本文猜想:模型还可以进一步地编码 “潜在连续” 、多维度的特征

“Moving towards a fuller model of features, in which neural representations could encode not just the presence but also a potentially continuous and multidimensional value for a feature, has been a subject of intense recent discourse.”

  • 本文提出:特征可被表示在某个流形上,余弦相似度与流形上的测地线距离、抽象样本空间中的相似度有所联系

“We describe why and how a feature might be represented as a manifold, demonstrating in particular that cosine similarity in representation space may encode the intrinsic geometry of a feature through shortest, on-manifold paths, potentially answering the question of how distance in representation space and relatedness in concept space could be connected”

1 引入和文献综述

  • 线性表示假说(Linear Representation Hypothesis, LRH) (Smolensky, 1990; Arora et al., 2018; Elhage et al., 2022).

  • 离散自编码器(Sparse Autoencoders) (Elhage et al., 2022; Bricken et al., 2023)

  • 上面这些方法的核心目标是将特征拆解成不可再分的最小原子概念的 0 - 1 线性组合,但大家都认为模型的表示不止于此。

“This model and methodology reflect a radical goal of breaking representations down into basic, irreducible, atomic concepts which are meaningfully only described as present or absent” “It is generally accepted that this breakdown of representation space into purely atomic features does not tell the whole story”

  • 充足证据表明模型将复杂特征(集合)编码为多维空间中的非线性连续的复杂结构。例如曲线、瑞士卷流形、圈、环面、(带层次结构的)树、分形等等。但 SAE 依旧有它的作用 (Bussmann et al., 2025; Engels et al., 2025),而 LRH 也因此被推广以对 LRH 作出更加灵活的解释

“There is overwhelming empirical evidence that neural networks represent complex features in structures which unfold across multiple directions in potentially continuous, nonlinear ways: examples of curves (Hanna et al., 2023; Chang et al., 2022), swiss-roll-like manifolds (Cai et al., 2021), loops (Engels et al., 2025; Gorton, 2024), tori (Chang et al., 2022), hierarchical trees (Park et al., 2024) in real language models; topologically circular representations of numbers in toy models trained to perform modular arithmetic (Liu et al., 2022; Nanda et al., 2023a; Zhong et al., 2023; He et al., 2024) or simulated angular data (Olah and Batson, 2024), fractal geometry in simulated hidden Markov models (Shai et al., 2024); and broader phenomenology from local finite-state-automata (Bricken et al., 2023), to spatial ‘brain-like’ modularity (Li et al., 2025), to behaviour, such as deception (Templeton et al., 2024).” “SAEs are not made defunct by these discoveries, and in fact have often facilitated them through recombination of SAE directions (Bussmann et al., 2025; Engels et al., 2025)”

定义 1 多维线性表示假说 存在标签为 f∈F ,对应子空间为 Vf∈RD 的一族特征,使得输入 x∈X 和其表示 Ψ(x) 满足

Ψ(x)=∑f∈Fρf(x)vf(x),vf(x)∈Vf,∥vf(x)∥2=1.

其中 ρf 是表示特征 f 在 x 中出现 “强度” 的非负数, F(x)={f:ρf>0} 是 x 中蕴含的所有特征, vf(x) 是特征 f 在特征空间中的单位向量表示,而在 LRH 中, vf(x) 是标量( Vf∼R1 )

2 连续对应假说

定义 2 特征类 一个特征类 f 是一个度量空间 (Zf,df)

这其实是因为我们所说的特征往往有时指的是一个大类的特征,例如颜色,而颜色内部的各种不同的颜色组成一个度量空间,我们可以利用这个度量来衡量不同颜色之间的距离。

假说 1 连续对应假说 特征类 zf(x) 和其对应的单位表示向量 vf(x) 之间存在连续的一一映射。严谨的说,存在一个同胚 ϕf:Zf→SD−1 ,其中 Zf 在 ϕf 下的像是 Mf=ϕf(Z) ,并对所有的 x∈X ,有 vf(x)=ϕf(zf(x)) 。

这里取 D−1 是有原因的:token embedding 的维度是 D ,在我们的上面的多维线性表示假说里面,将 token 表示为向量的线性组合,因此特征方向向量 vf 是在 RD 中的单位向量,因此所有单位向量和超球面 SD−1 有一个双射(这些向量的终点就在这个超球面上),因此选的是 SD−1 。假说中提到的同胚映射保持了拓扑性质(例如连通性等拓扑不变量)。

这里我有一个疑问,这里的特征如果是带有等级的特征,我们应该如何选取度量空间?似乎双曲空间是一个不错的选择(考虑 Hyperbolic Cone)

(这张图只存在本地 Obsidian,mdnice 上没有副本,未能取回) (这张图只存在本地 Obsidian,mdnice 上没有副本,未能取回) 本段中讲到所谓 Superposition,我的理解为是上文中线性无关的加强版:表示特征的向量在空间中正交,或几乎正交;因此我们就可以像做 Fourier 变换一样把每个特征向量对应的分量的大小用内积的形式算出来。

3 表示流形上距离的解释

  • “feature manifolds many be embedded in more complex ways than their topology suggests” (Modell et al., 2025, p. 6) (pdf)
  • 我问LLM之后的理解:虽然上文中的理想很好,一些空间到超球面(的一个子空间)上是一个同胚映射,但这个超球面可能是一个极度扭曲,皱皱巴巴的球面(就和纸团子一样)。

假说 2 余弦相似度反映特征点在特征类度量空间中的距离 局部尺度下,特征表示向量的余弦相似度和对应特征(在空间中)的距离负相关。具体而言,存在一个函数 gf ,满足 gf′(0)<0 ,和某个 ϵ>0 ,对任意距离小于等于 ϵ 的特征点对 z,z′∈Zf 满足

CosSim[ϕf(z),ϕf(z′)]=gf[df(z,z′)2]

这意味着特征点在特征类的度量空间到超球面中的流形之间不仅是同胚,而且还保持了一定的局部几何性质。这就是论文中所说的 “a feature and its representation are geometrically indistinguishable.” 。进而作者提出, Zf 中的一个路径 η (闭区间 [a,b] 到 Zf 的连续映射)的长度 L 可以写为

L(η)=supT∑i=1ndf(ηti,ηti−1)

其中 T=(t0,…,tn) 是一个不降的序列,也即 a=t0⩽t1⩽⋯⩽tn=b 。特征类空间中的一个路径对应着 Mf 上的一个路径。 不连续的度量空间也可以定义path吗?还是我不应该拘泥于Euclid空间中所谓“连续性”的定义(毕竟这不是Euclid空间了,它也可以定义开集,因此也可以定义“连续”)

定理 1 给定 Zf 上一个有限长度的路径 η ,根据假说1,令 γ 是其对应的在 Mf 上的路径。再根据假说 2,有

L(γ)=−2gf′(0)L(η)

证明见论文附录。这个定理也反映了 Zf 上的最短路径和 Mf 上的最短路径是对应的。

作者对上述结论进行了验证:绘制对应同一特征类的特征向量的余弦相似度和其对应抽象特征点在特征空间的距离之间的关系,可验证假说2;另一验证方式是验证定理1,即流形上的测地线距离(通过KNN构建的邻接图的加权图上最短距离模拟)和度量空间中距离的关系 (这张图只存在本地 Obsidian,mdnice 上没有副本,未能取回)

实验观察同一特征类的嵌入向量和抽象度量空间的关系时,最好进行降维,但被降维所牺牲的“噪声”并非一无是处,它们也许揭示着更加深层的结构。

“The routine “low-rank” explanation that the remaining components are mostly noise seems disputable; these components often show clear structure.”

但从右图来看,“流形距离”和年份之间差距的关系并非线性:图上的颜色越浅,表示其中一个年份距离现在越近,可以看到越近的年份在流形上的距离似乎被拉长了。不过在直觉上,这个也是合理的;距离现在人们所在时间越远的时间和事件会被“压缩”,而最近的事件因为记录比较细密,因此在embedding space中的流形距离会被拉长。另外我怀疑是否是因为KNN本身的问题,毕竟抽象的度量空间是离散的

4 讨论、局限和未来方向

  • 本文给出了解释 LLM 中表示流形的一个初步理论框架,提出特征类实为度量空间的论断,随后通过获取主流 LLM 的激活数据,验证度量空间和表示空间中局部几何结构的相似性

  • 文中对特征类度量空间的构造是手动的,而且选取的特征类也较为简单。更困难的问题是如何scale up,且对不那么明显的特征如何自动构造对应特征空间的问题。论文 Mixed curvature decision trees and random forests 中也以某种方式触及到了这个问题,需要人为从特征中辨识出具有特定几何结构的组分(例如地理位置应该归为 S2 )以构造所谓的 “乘积流形”

  • 另一个问题是从带噪声的离散数据点中重构流形结构的困难(众所周知)。在先前分享的一篇文章 Recovering manifold structure using ollivier-ricci curvature 中提出了一个解决方案:通过 Graph Ricci Curvature 判定拒绝潜在的 Bridging Edge;另外在实践上的一个问题是,KNN中 k 的选择会影响重构出来流形的质量,但同时也会影响重构后整个图的连通性,而且似乎并不存在某个一定能生成连通图的 k

  • 可以在对表示空间中特征的规律了解之后人为干预以控制模型的输出。这可以通过学习特征度量空间到表示流形的映射 ϕf 实现

  • 基于本文关于特征类的“离散”和“无关”的假设,SAE可以学习到一个特征类字典,具有一定的应用前景。可以构建 “Manifold-aware” 的 SAE 模型(这里没看明白)

  • 本文提出的特征类的度量空间定义也许在未来会有用