La Geometria dei Token nelle Rappresentazioni Interne dei Grandi Modelli Linguistici
The Geometry of Tokens in Internal Representations of Large Language Models
January 17, 2025
Autori: Karthik Viswanathan, Yuri Gardinazzi, Giada Panerai, Alberto Cazzaniga, Matteo Biagetti
cs.AI
Abstract
Indaghiamo la relazione tra la geometria degli embedding dei token e il loro ruolo nella previsione del token successivo all'interno dei modelli transformer. Un aspetto importante di questa connessione utilizza il concetto di misura empirica, che codifica la distribuzione dei cloud di punti dei token attraverso i livelli del transformer e guida l'evoluzione delle rappresentazioni dei token nell'immagine interagente del campo medio. Utilizziamo metriche come la dimensione intrinseca, l'overlap di vicinato e la similarità coseno per esplorare osservativamente queste misure empiriche attraverso i livelli. Per convalidare il nostro approccio, confrontiamo queste metriche con un dataset in cui i token sono mescolati, interrompendo la struttura sintattica e semantica. Le nostre scoperte rivelano una correlazione tra le proprietà geometriche degli embedding dei token e la perdita di entropia incrociata delle previsioni dei token successivi, implicando che i prompt con valori di perdita più alti hanno token rappresentati in spazi di dimensioni superiori.
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