The Changing Geometry of Grammar: Dimensionality and Neighborhood Reorganization across Transformer Layers

Samuele Vallisa, Federico Ravenda, Claudio Palominos, Rui He, Andrea Raballo +3 more
8/25/2026
cs.CL

No confident code implementation found for this paper.

Abstract

Transformer representations describe trajectories through high-dimensional vector spaces, which are shaped dynamically as tokens incorporate relational context across layers. Such data tend to concentrate on lower-dimensional sub-manifolds, a form of compression quantified by the Intrinsic Dimensionality (ID), the minimum number of independent variables needed to represent them without significant information loss. In this work, we ask whether the grammatical role of tokens, as marked by their part-of-speech (PoS) tag, shapes the local geometry of this manifold. To this end: (1) We investigate the layer-wise evolution of ID, finding that closed-class items expand earlier and collapse sooner than open-class ones; (2) We show its expansion and contraction to be explained by changes in the neighborhood structure, and hence in the relations between words within a sentence; (3) We compare encoders (ModernBERT, bigbird-roberta-large) and decoders (gemma-2-2B, Llama-3.2-3B), finding that the two families evolve differently across layers, consistently with how each integrates context;(4) We show that geometric features alone recover a token's grammatical role, and use them to interpret how the semantic content of each PoS evolves across layers in a downstream classification task.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{vallisa2026changing,
  title  = {The Changing Geometry of Grammar: Dimensionality and Neighborhood Reorganization across Transformer Layers},
  author = {Samuele Vallisa and Federico Ravenda and Claudio Palominos and Rui He and Andrea Raballo and Antonietta Mira and Philipp Homan and Wolfram Hinzen},
  year   = {2026},
  eprint = {2608.25166},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.25166v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.25166.svg)](https://codeofpaper.com/paper/2608.25166)

Discussion