The Geometry of Tokens in Internal Representations of Large Language Models

Karthik Viswanathan, Yuri Gardinazzi, Giada Panerai, Alberto Cazzaniga, Matteo Biagetti · Submission to ICLR 2025 · Rejected

Abstract

We investigate the relationship between the geometry of token embeddings and their role in next token prediction within transformer models. Toward this goal, previous studies have utilized metrics such as intrinsic dimension and neighborhood overlap to probe the geometry of internal representations, where prompts are summarized as a single point in representation space. We expand single points to point clouds by investigating how models geometrically distribute tokens in their internal representations. We measure the intrinsic dimension, neighborhood overlap, and cosine similarity on these point clouds for a large number of prompts. To validate our approach, we compare these metrics to a dataset where the tokens are shuffled, which disrupts the syntactic and semantic structure. Our analysis reveals 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.
BibTeX
@misc{viswanathan2025geometry,
  author = {Karthik Viswanathan and Yuri Gardinazzi and Giada Panerai and Alberto Cazzaniga and Matteo Biagetti},
  title = {{The Geometry of Tokens in Internal Representations of Large Language Models}},
  year = {2025},
  eprint = {2501.10573},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.10573},
}
Figure