On the Geometry of Semantics in Next-token Prediction

Yize Zhao, Christos Thrampoulidis · DOI

Abstract

Large Language Models (LLMs) demonstrate a remarkable ability to capture linguistic meaning, yet the geometric principles underlying this emergence remain poorly understood. This paper investigates the optimization process of Next-Token Prediction (NTP), revealing that models implicitly perform a Singular Value Decomposition (SVD) on the co-occurrence patterns of training data. We show that interpretable semantic categories emerge from the sign patterns of learned embeddings, with broad concepts mastered earlier in training than fine-grained nuances. Our findings bridge distributional semantics and neural collapse, suggesting that the geometry of internal representations is fundamentally dictated by the structure of the training data.

Introduction

While the efficacy of LLMs in capturing semantic relationships is well-documented, the specific mathematical mechanisms by which gradient descent organizes internal representations remain elusive. Most interpretability research relies on post-hoc evaluations, such as linear probes or sparse autoencoders. This work shifts the focus to the optimization process itself, exploring how the structure of natural language forces models to organize knowledge into semantically meaningful clusters. We propose that LLMs implicitly perform a Singular Value Decomposition (SVD) on the data's co-occurrence structure, leading to a predictable "geometry of semantics."

Theoretical Framework: NTP-UFM and SVD

To analyze the learning process, we utilize the Unconstrained Features Model (UFM) applied to Next-Token Prediction. In this abstraction, word and context embeddings are free to move in space during training. We prove that the learned embeddings converge to the SVD factors of a centered data-sparsity matrix, $\tilde{S}$, which represents the support of the training data (i.e., which words follow which contexts).

Figure 1: Singular value decomposition of co-occurrence data and the resulting semantic emergence over training steps.

As shown in Figure 1, the singular vectors $U$ and $V$ correspond to subjects and attributes, respectively. The sign patterns within these vectors act as binary switches for latent concepts. For instance, a positive sign in a specific singular vector might indicate an association with "plants," while a negative sign indicates "animals."

Orthant-based Clustering

A key contribution of this work is the introduction of orthant-based clustering. Rather than examining individual dimensions, which are often uninterpretable, we analyze the sign patterns across the top $p$ singular vectors. This method allows for the recovery of hierarchical linguistic categories.

Figure 2: Visualization of embedding geometry and orthant-based clustering derived from training data sparsity.

Figure 2 illustrates how the sparsity of the training data (C) manifests as distinct clusters in the embedding geometry (A). By partitioning the space into orthants based on the signs of the principal components (B), we can uniquely identify fine-grained categories like "felines" or "canines" through combinations of broader semantic indicators.

Learning Dynamics and Semantic Emergence

The "speed" at which a model learns a concept is directly proportional to its associated singular value. Broad, frequent distinctions (e.g., parts of speech) possess larger singular values and are mastered early in training. More subtle nuances emerge later as the model optimizes for smaller singular values. Empirical validation using confusion matrices across training steps (Figure 1, bottom) confirms this hierarchy: models distinguish "Animals" from "Plants" long before they differentiate between specific animal families.

Empirical Validation and Scaling

The theory was validated across diverse datasets, from synthetic toy models to large-scale pretrained transformers like GPT-2, BERT, and Qwen-7B. In Qwen-7B, orthant-based clustering successfully identified functional clusters for programming keywords and UI elements. Notably, the semantic geometry remained consistent across different model depths (e.g., 6-layer vs. 12-layer transformers), reinforcing the idea that the data's inherent structure is the primary driver of representation geometry.

Conclusion

This research provides a theoretical foundation for understanding how LLMs organize semantic knowledge. By linking next-token prediction to implicit SVD, we demonstrate that the geometry of semantics is a predictable consequence of data sparsity and optimization dynamics. Future work will explore how actual word frequencies, beyond simple co-occurrence support, further refine these internal representations.

Summary updated

BibTeX
@inproceedings{zhao2025geometry,
  author = {Yize Zhao and Christos Thrampoulidis},
  title = {{On the Geometry of Semantics in Next-token Prediction}},
  booktitle = {INTERPLAY @ COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=LQ3I5OoroE},
}
Figure