The rapid development of large language models such as GPT family has shown that the self-supervised next-token prediction task can produce systems with re- markable generative and problem-solving capabilities. Nevertheless, there is not yet a bottom-up theoretical framework for this task comparable to the one developed for supervised learning, starting from a simple model such as the perceptron. The aim of this thesis is to take a step in this direction by isolating the elementary self-supervised task behind language modeling and studying simplified models in which the dataset, the architecture, the training rule, and the relevant observables can be controlled analytically. A general introduction to these concepts and to methods from statistical mechanics can be found in Chapter 1. In Chapter 2, the first step is to interpret self-attention as an interaction between vector-valued tokens, where each token is updated using a local field generated by the others. By considering a simplified self-attention layer with position-dependent couplings, the update of each token can be written as the derivative of a local cost. The sum of these local contributions has a structure analogous to a negative pseudo-likelihood, and not to an energy function as proposed in other studies. Nu- merical experiments on image data show that the resulting recurrent dynamics can reconstruct masked or noisy inputs and that test examples appear as transient states of the dynamics, both for recurrent transformer block and simplified self-attention trained via pseudo-likelihood maximization. To obtain analytical control, in Chapter 3 the focus shifts to a simple model of self-supervision: a set of independent perceptrons, each trained to predict one binary variable from all the others. In this setting, maximizing pseudo-likelihood is equiva- lent to training the rows of a recurrent coupling matrix independently. The replica method is then used to predict typical learning curves, stability distributions, and generalization errors. From the results, the fixed-norm solution reveals that the norm of the weights acts as an effective measure of training time. The picture obtained is that during training the model moves from an early Hebbian-like regime to an optimal generalization regime and finally towards the maximum-margin solution. This phenomenon is described as an implicit bias acting throughout the training trajectory, rather than only at convergence. Then, we show that in this model pseudo-likelihood training produces associative memories. For small datasets, training creates stable attractors around individ- ual examples, corresponding to memorization. As the amount of structured data increases, the model can instead extract correlations shared by many examples, producing attractors associated with latent features and previously unseen test data. This memorization-to-generalization transition is studied numerically using uncorrelated patterns, synthetic random-feature data, binarized MNIST images, protein sequences, and configurations of an Edwards–Anderson spin glass. Afterwards, the neural scaling laws are studied as another application of results from 6 replica computation. For the perceptron, the learning curves at different dataset sizes collapse after suitable rescalings, and the usual power-law dependence of the final error on the number of data can be decomposed into two dynamical scaling laws. The same analysis is repeated numerically for convolutional networks, residual networks, and vision transformers, using a spectral-complexity norm to parametrize training progress. This suggests that part of the regularity observed in empirical scaling laws may originate from the implicit organization of the learning trajectory, and offers a new mechanism to study and explain neural scaling laws. Finally, in Chapter 4 associative memories with vector spins are studied, moti- vated by the fact that transformer tokens are represented as high-dimensional vectors rather than scalar binary variables. With another version of the replica method, the equilibrium retrieval and spin-glass phases are characterized. It is shown then that stable retrieval becomes more difficult as the spin dimension increases, but above saturation the dynamics displays a transient denoising regime in which corrupted patterns are initially reconstructed before being lost. This result shows that a vector-spin associative-memory model under typical conditions, usually found in a machine learning setting, undergoes the same transient reconstruction observed in recurrent self-attention.
Statistical mechanics for token prediction
D'AMICO, FRANCESCO
2026
Abstract
The rapid development of large language models such as GPT family has shown that the self-supervised next-token prediction task can produce systems with re- markable generative and problem-solving capabilities. Nevertheless, there is not yet a bottom-up theoretical framework for this task comparable to the one developed for supervised learning, starting from a simple model such as the perceptron. The aim of this thesis is to take a step in this direction by isolating the elementary self-supervised task behind language modeling and studying simplified models in which the dataset, the architecture, the training rule, and the relevant observables can be controlled analytically. A general introduction to these concepts and to methods from statistical mechanics can be found in Chapter 1. In Chapter 2, the first step is to interpret self-attention as an interaction between vector-valued tokens, where each token is updated using a local field generated by the others. By considering a simplified self-attention layer with position-dependent couplings, the update of each token can be written as the derivative of a local cost. The sum of these local contributions has a structure analogous to a negative pseudo-likelihood, and not to an energy function as proposed in other studies. Nu- merical experiments on image data show that the resulting recurrent dynamics can reconstruct masked or noisy inputs and that test examples appear as transient states of the dynamics, both for recurrent transformer block and simplified self-attention trained via pseudo-likelihood maximization. To obtain analytical control, in Chapter 3 the focus shifts to a simple model of self-supervision: a set of independent perceptrons, each trained to predict one binary variable from all the others. In this setting, maximizing pseudo-likelihood is equiva- lent to training the rows of a recurrent coupling matrix independently. The replica method is then used to predict typical learning curves, stability distributions, and generalization errors. From the results, the fixed-norm solution reveals that the norm of the weights acts as an effective measure of training time. The picture obtained is that during training the model moves from an early Hebbian-like regime to an optimal generalization regime and finally towards the maximum-margin solution. This phenomenon is described as an implicit bias acting throughout the training trajectory, rather than only at convergence. Then, we show that in this model pseudo-likelihood training produces associative memories. For small datasets, training creates stable attractors around individ- ual examples, corresponding to memorization. As the amount of structured data increases, the model can instead extract correlations shared by many examples, producing attractors associated with latent features and previously unseen test data. This memorization-to-generalization transition is studied numerically using uncorrelated patterns, synthetic random-feature data, binarized MNIST images, protein sequences, and configurations of an Edwards–Anderson spin glass. Afterwards, the neural scaling laws are studied as another application of results from 6 replica computation. For the perceptron, the learning curves at different dataset sizes collapse after suitable rescalings, and the usual power-law dependence of the final error on the number of data can be decomposed into two dynamical scaling laws. The same analysis is repeated numerically for convolutional networks, residual networks, and vision transformers, using a spectral-complexity norm to parametrize training progress. This suggests that part of the regularity observed in empirical scaling laws may originate from the implicit organization of the learning trajectory, and offers a new mechanism to study and explain neural scaling laws. Finally, in Chapter 4 associative memories with vector spins are studied, moti- vated by the fact that transformer tokens are represented as high-dimensional vectors rather than scalar binary variables. With another version of the replica method, the equilibrium retrieval and spin-glass phases are characterized. It is shown then that stable retrieval becomes more difficult as the spin dimension increases, but above saturation the dynamics displays a transient denoising regime in which corrupted patterns are initially reconstructed before being lost. This result shows that a vector-spin associative-memory model under typical conditions, usually found in a machine learning setting, undergoes the same transient reconstruction observed in recurrent self-attention.| File | Dimensione | Formato | |
|---|---|---|---|
|
Tesi_Dottorato_DAmico.pdf
accesso aperto
Licenza:
Creative Commons
Dimensione
7.73 MB
Formato
Adobe PDF
|
7.73 MB | Adobe PDF | Visualizza/Apri |
I documenti in UNITESI sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/20.500.14242/386759
URN:NBN:IT:UNIROMA1-386759