Геометрия токенов во внутренних представлениях крупных языковых моделей
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
Аннотация
Мы исследуем взаимосвязь между геометрией вложений токенов и их ролью в предсказании следующего токена в моделях трансформера. Важным аспектом этой связи является использование понятия эмпирической меры, которая кодирует распределение облаков точек токенов по слоям трансформера и управляет эволюцией представлений токенов в картине взаимодействия в среднем поле. Мы используем метрики, такие как внутреннее измерение, перекрытие соседей и косинусное сходство, чтобы наблюдательно исследовать эти эмпирические меры по слоям. Для проверки нашего подхода мы сравниваем эти метрики с набором данных, в котором токены перемешаны, что нарушает синтаксическую и семантическую структуру. Наши результаты показывают корреляцию между геометрическими свойствами вложений токенов и потерей перекрестной энтропии при предсказании следующего токена, что подразумевает, что подсказки с более высокими значениями потерь имеют токены, представленные в пространствах более высокой размерности.
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