cond-mat.dis-nnOct 23, 2026

Generalization properties of the token perceptron: the role of embedding and vocabulary

Authors: Dario Bocchi, Matteo Negri, Flavio Nicoletti, Francesco D'Amico

Organizations: Physics Department, University of Rome Sapienza, Rome, Italy · Institute of Nanotechnology, CNR-NANOTEC, Rome, Italy · Laboratoire de Physique Théorique et Modélisation, CY Cergy Paris Université · Department of Computer Science and Engineering Chalmers University of Technology and University of Gothenburg, Sweden

Abstract

Large language models are trained to predict tokens from a finite vocabulary, each represented by a vector in a dd-dimensional embedding space. Therefore, token prediction is a classification problem whose classes have a geometry determined by the embedding. We study how this geometry affects learning in a minimal solvable model: a linear predictor that maps a sequence of NN embedded tokens to a dd-dimensional output through one d×dd\times d matrix per position, trained in the teacher--student setting. We call this the token perceptron. We compute its generalization error with the replica method, taking N→∞N\to\infty at fixed number of examples per position α=P/Nα=P/N and keeping dd and the vocabulary size DD finite. As a first reference case, we consider continuous embeddings on the sphere, which isolate the role of the embedding dimension. The natural load is then α/dα/d, and for d>1d>1 a normalized label fixes the direction of the teacher output, so the problem becomes a noiseless regression: the teacher is recovered exactly above αrec=d2/(d−1)α_{\rm rec}=d^2/(d-1), and spherical cross-entropy reaches this threshold at large inverse temperature. In the same setting the storage capacity of random associations scales as d2d^2 for margins O(1/d)O(1/\sqrt{d}). We then turn to vocabulary embeddings, where a label only identifies the Voronoi cell of the teacher output, so that each example imposes inequalities rather than equations, as in the classical perceptron. We compute the Bayes-optimal error for a given embedding matrix through an approximate spectral closure and show that the optimal learner first resolves the directions in which the vocabulary has the largest variance, even when the teacher is isotropic.

Figures & tables

Appendix figures & tables1 asset

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Learning Representations through Token Prediction: Geometry, Approximation, and Downstream Guarantees

    Aug 30, 2026Shulei WangLanguage Model PretrainingNext-Token Prediction