大型语言模型内部表示中的令牌几何学
The Geometry of Tokens in Internal Representations of Large Language Models
January 17, 2025
作者: Karthik Viswanathan, Yuri Gardinazzi, Giada Panerai, Alberto Cazzaniga, Matteo Biagetti
cs.AI
摘要
我们研究了标记嵌入的几何形状与在Transformer模型中下一个标记预测中的作用之间的关系。这种联系的一个重要方面使用了经验测度的概念,它编码了跨Transformer层中的标记点云的分布,并推动了标记表示在均场相互作用图中的演变。我们使用固有维度、邻域重叠和余弦相似度等度量来观察这些经验测度在各层之间的情况。为了验证我们的方法,我们将这些度量与一个标记被打乱的数据集进行比较,这会破坏句法和语义结构。我们的研究结果显示了标记嵌入的几何特性与下一个标记预测的交叉熵损失之间的相关性,这意味着具有更高损失值的提示在更高维空间中表示标记。
English
We investigate the relationship between the geometry of token embeddings and
their role in the next token prediction within transformer models. An important
aspect of this connection uses the notion of empirical measure, which encodes
the distribution of token point clouds across transformer layers and drives the
evolution of token representations in the mean-field interacting picture. We
use metrics such as intrinsic dimension, neighborhood overlap, and cosine
similarity to observationally probe these empirical measures across layers. To
validate our approach, we compare these metrics to a dataset where the tokens
are shuffled, which disrupts the syntactic and semantic structure. Our findings
reveal a correlation between the geometric properties of token embeddings and
the cross-entropy loss of next token predictions, implying that prompts with
higher loss values have tokens represented in higher-dimensional spaces.Summary
AI-Generated Summary