The Interplay of Data Structure and Imbalance in the Learning Dynamics of Diffusion Models Flavio Nicoletti, Chenxiao Ma, Enrico Ventura, Luca Saglietti, Stefano Sarao Mannelli Abstract Real-world datasets are inherently heterogeneous, yet how per-class structural differences and sampling imbalance shape the training dynamics of diffusion models—and potentially exacerbate disparities—remains poorly understood. While models typically transition from an initial phase of generalization to memorizing the training set, existing theory assumes homogeneous data, leaving open how class imbalance and heterogeneity reshape these dynamics. In this work, we develop a high-dimensional analytical framework to study class-dependent learning in score-based diffusion models. Analyzing a random-features model trained on Gaussian mixtures, we derive the feature-covariance spectrum to characterize per-class generalization and memorization times. We reveal the explicit hierarchy governing these dynamics: class variance is the primary determinant of learning order—consistently favoring higher-variance classes—while centroid geometry plays a secondary role. Sampling imbalance acts as a modulator that can reverse this ordering and, under strong imbalance, forces minority classes to acquire distinct, delayed speciation times during backward diffusion. Together, these results suggest that diffusion models can memorize some classes while others remain insufficiently learned. We validate our theoretical predictions empirically using U-Net models trained on Fashion MNIST. 1 Introduction In generative models, unequal learning across classes or sub-populations translates directly into unequal quality or memorization in the generated samples. Recent empirical work has shown that diffusion models can exacerbate such disparities even on datasets that appear balanced at the class level [ 39 , 56 , 48 ] . The mechanisms behind these effects, however, remain poorly understood. A growing body of theory has begun to characterize the training dynamics of score-based diffusion models. On finite datasets, sufficiently expressive models trained by score matching are naturally driven toward exact reproduction of the training samples, making memorization the asymptotic outcome of training [ 6 ] . The key dynamical phenomenon, however, is that this regime is not necessarily reached immediately: diffusion models can first pass through an initial phase of generalization before eventually memorizing the training set [ 27 , 7 , 4 , 1 ] . In overparameterized models, this separation between generalization and memorization is what allows early stopping to act as an implicit regularizer [ 8 , 15 , 16 ] : there is a window during which the model has learned the distribution but has not yet memorized the training set. Existing analyses of this timescale separation, however, largely characterize learning at the level of the full dataset, implicitly assuming that all sub-populations are structurally identical. Real datasets are not homogeneous: classes can differ substantially in intrinsic variance, geometric organization, and sampling frequency [ 57 , 36 , 39 , 56 ] . Under these conditions, there is no reason to expect a single global schedule for learning or memorization. Different sub-populations may be learned at different stages of training, so that a stopping time that still regularizes one class may already leave another overfit or insufficiently learned. In this work, we develop a high-dimensional theoretical framework for this class-aware setting by studying denoising score matching on Gaussian-mixture data with a random-features model. Our research questions are: In what order are different classes generalized and memorized during training? and How do variance, centroid geometry, and sampling imbalance shape that ordering? The main contributions of this work are the following: • We characterize the effect of class imbalance on backward diffusion via class-specific speciation times (see Result 1 ). While in the weak-imbalance regime, all classes remain inferable at the speciation time for exact models [ 6 , 2 ] , under strong imbalance, minority classes become inferable at distinct earlier diffusion times. • We identify the hierarchy governing class-specific learning dynamics. Class variance is the primary determinant of the order in which classes are generalized and memorized, consistently favouring higher-variance classes, while centroid geometry plays a secondary role, favouring classes with smaller-norm centroids (see Result 2 ). Sampling imbalance acts as a modulating factor that can reverse this ordering in certain regimes (see Result 3 ). • We find strong qualitative agreement between U-Net diffusion models trained on Fashion MNIST and Random Feature models trained on a Gaussian mixture parametrized by class-wise means and variances estimated from the data (see Result 4 ). This agreement supports, on the one hand, the effectiveness of Gaussian score approximations for diffusion models [ 58 ] , and on the other, our theoretical predictions on the roles of variance and sampling imbalance in shaping learning dynamics. A detailed discussion positioning this work within the related literature is deferred to Appendix B . 2 Problem Formulation Score-based diffusion models transport a target data distribution \mathcal{P}_{*}\left(\bm{x}\right) to a standard N -dimensional normal distribution \mathcal{N}(\bm{x};\mathbf{0},\mathbf{I}_{N}) through a forward process. Data generation is then achieved by reversing this trajectory [ 50 , 5 ] . The forward and backward stochastic differential equations are respectively defined as: d\bm{x}(t)=-\bm{x}dt+\sqrt{2}\,d\bm{B}(t) (1) d\bm{x}(t)=-(\bm{x}+\mathbf{s}(\bm{x},t))dt+\sqrt{2}\,d\bm{B}(t) (2) where \bm{B}_{t} is the standard Wiener process and \mathbf{s}(\bm{x},t)=\nabla_{x}\log\mathcal{P}_{t}\left(\bm{x}\right) denotes the score function. The forward process induces a Gaussian transition kernel \mathcal{P}_{t}\left(\bm{x}|\bm{x}_{0}\right)=\mathcal{N}(\bm{x};\bm{x}_{0}e^{-t},\Delta_{t}\mathbf{I}_{N}) , where \Delta_{t}=1-e^{-2t} is the noise variance at time t . In practice, the exact score is inaccessible and is approximated by a model \bm{s}(\bm{x},t|\bm{\Theta}) —in our case, a Random Feature (RF) model [ 42 , 17 ] . The parameters \bm{\Theta} are learned by minimizing the score matching risk [ 22 , 50 ] over a dataset \bm{X}=\{\bm{x}_{\nu}\}_{\nu=1}^{M} : \mathcal{E}_{train}\left(\bm{X},t|\bm{\Theta}\right)=\frac{1}{NM}\sum_{\nu=1}^{M}\mathbb{E}_{\bm{\xi}\sim\mathcal{N}(\mathbf{0},\mathbf{I}_{N})}\left[\left\lVert\sqrt{\Delta_{t}}\,\bm{s}(\bm{x}_{\nu}(t),t|\bm{\Theta})+\bm{\xi}\right\lVert^{2}\right], (3) where \bm{x}_{\nu}(t)=\bm{x}_{\nu}e^{-t}+\sqrt{\Delta_{t}}\bm{\xi} represents the noisy samples at diffusion time t . Score Parameterization. We model the score function using a RF model with P hidden neurons: \bm{s}(\bm{x}|\mathbf{A},\mathbf{W})=\mathbf{A}\,\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}\right), (4) where \mathbf{W}\in\mathbb{R}^{P\times N} is a fixed random projection matrix with i.i.d. standard normal entries W_{ip}\sim\mathcal{N}(0,1) , and \mathbf{A}\in\mathbb{R}^{N\times P} is the learnable weight matrix. The non-linear activation function \phi(\cdot) is applied element-wise to the pre-activations. Throughout this work, we use \phi(\cdot)=\tanh(\cdot) . Data Distribution. We assume the training dataset D=\{\bm{x}_{\nu}\}_{\nu=1}^{M} is sampled from a Gaussian Mixture Model (GMM) with C components: \mathcal{P}_{0}\left(\bm{x}\right)=\sum_{c=1}^{C}b_{c}\,\mathcal{N}(\bm{x};\bm{m}_{c},\sigma_{c}^{2}\mathbf{I}_{N}), (5) where \mathbf{m}_{c} are class centroids, \sigma_{c}^{2} are class-conditional variances, and b_{c}\geq 0 are mixing proportions such that \sum_{c=1}^{C}b_{c}=1 . Unless stated otherwise, we assume \forall\ c,\ ||\bm{m}_{c}||=\mathcal{O}(\sqrt{N}) and \sigma_{c}=\mathcal{O}(1) . Training Dynamics. Under Mean Squared Error minimization, the training dynamics of RF models are exactly solvable. Indeed, the gradient flow equation under the training loss ( 3 ) is a linear ODE for the readout weights \mathbf{A} . Assuming an initialization of \mathbf{A}(0)=\mathbf{0} , the exact solution is given by: \mathbf{A}(\tau)=-\frac{1}{\sqrt{\Delta_{t}}}\mathbf{V}^{\intercal}\mathbf{U}^{-1}\left(\mathbf{I}_{P}-e^{-2\mathbf{U}\,\tau}\right); (6) where \mathbf{U} and \mathbf{V} denote the feature-feature and feature-noise empirical covariance matrices: \displaystyle\mathbf{U}=\sum_{c=1}^{C}b_{c}\mathbf{U}_{c},\qquad\mathbf{U}_{c}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\mathbb{E}_{\bm{\xi}}\left[\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}_{\nu}(t)\right)\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}_{\nu}(t)\right)^{\intercal}\right], (7) \displaystyle\mathbf{V}=\sum_{c=1}^{C}b_{c}\mathbf{V}_{c},\qquad\mathbf{V}_{c}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\mathbb{E}_{\bm{\xi}}\left[\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}_{\nu}(t)\right)\bm{\xi}^{\intercal}\right], (8) and I_{c} is the index set for samples of class c . Full derivations of the dynamics are provided in Appendix C . High-Dimensional Asymptotics and Gaussian Equivalence. The learning dynamics are governed by the eigenspectrum of \mathbf{U} , which dictates the convergence timescales, while the cross-covariance \mathbf{V} determines the scale of the learned weights. Following [ 8 ] , we analyze these training regimes using Random Matrix Theory to characterize the spectrum of \mathbf{U} in the high-dimensional proportional limit where N,P,M\rightarrow\infty with fixed \mathcal{O}(1) ratios \chi_{p}=\frac{P}{N} and \chi_{m}=\frac{M}{N} . We leverage Gaussian equivalence techniques for random feature models in a mixture setting [ 19 , 18 , 12 ] . In particular, we adopt a conditional Gaussian equivalence viewpoint (Appendix D ), where the data are decomposed into a low-dimensional structured component and a high-dimensional Gaussian fluctuation. In the high-dimensional limit, the empirical covariance \mathbf{U} admits the asymptotically equivalent formulation \mathbf{U}\simeq\sum_{c=1}^{C}b_{c}\mathbf{U}_{c}^{(gep)} , where: \mathbf{U}_{c}^{(gep)}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\mathbf{G}_{t}^{(c,\nu)}{\mathbf{G}_{t}^{(c,\nu)}}^{\intercal}+\frac{\Delta_{t}}{N\sigma_{c}^{2}e^{-2t}}\widehat{\mathbf{W}}_{t;c}\widehat{\mathbf{W}}_{t;c}^{\intercal}+\operatorname{diag}\left(\bm{d}_{t}^{(c)}\right). (9) Here, \bm{G}_{t}^{(c,\nu)} are linear functions of the samples pre-activations \bm{u}_{\nu}=\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}_{\nu} with additional gaussian noise, \widehat{\mathbf{W}}_{t;c}\in\mathbb{R}^{P\times N} are cluster-specific random feature matrices, and \operatorname{diag}(\bm{d}_{t}^{(c)}) is a diagonal matrix containing the vector \bm{d}_{t}^{(c)}\in\mathbb{R}^{P} . The first term of Eq.( 9 ) is a linearization of Eq.( 7 ) containing information on the training set and is responsible for the onset of memorization and diffusion-independent generalization; second and third terms, instead, are dataset independent and represent the t -dependent part of generalization. We explain how to derive the GEP in ( 9 ) and how to single out exactly generalization and memorization terms in Eq.( 9 ) in Appendix E . 3 Characterization of the Learning Dynamics We characterize how the Random Feature model learns on an imbalanced, structured dataset by minimizing the score-matching empirical risk. We proceed in three steps: First, in Sec. 3.1 , we analyze the backward diffusion process to identify the class-specific speciation times, formalizing when distinct data structures become inferable. Next, in Sec. 3.2 , we detail how these structural properties are learned during training, leveraging the eigenspectrum of the feature covariance to define global timescales for generalization and memorization. Finally, in Sec. 3.2.1 , we disaggregate these global phases to examine class-specific learning trajectories, demonstrating how the interplay between class variance, centroid norms, and sampling imbalance dictates the exact order in which classes are generalized and memorized. 3.1 Class Speciation in Backward Diffusion Figure 1: Strong imbalance induces separation in speciation times. Root mean square (RMS) overlaps between the projected centroids \bm{\mu}_{c} (Eq.( 10 )) and the top principal components ( \bm{\psi}_{1},\bm{\psi}_{2} ) of \mathbf{U}_{gep} , defined as \operatorname{RMS}_{c}\equiv\operatorname{Mean}(\sum_{i=1}^{2}(\bm{\mu}_{c}\cdot\bm{\psi}_{i})^{2}/\lVert\bm{\mu}_{c}\lVert^{2})^{1/2} , as a function of rescaled diffusion time \widetilde{t}\equiv t/\log N . Left panel correspond to weak imbalance ( b_{1}=0.7,b_{2}=0.3 , Eq.( 12 )), while the remaining panels illustrate instances of strong imbalance ( b_{1}=1-N^{-a} , b_{2}=N^{-a} , Eq.( 13 )). Solid lines denote asymptotic theoretical predictions; markers represent finite-size numerical simulations for N\in\{50,500,5000\} and P\in\{100,1000,10000\} , with increasing system size indicated by darker colors. Simulations show convergence toward the predicted asymptotic limits. Parameter values: \sigma_{1}^{2}=\sigma_{2}^{2}=0.5 , \lVert\bm{m}_{1}\lVert=\lVert\bm{m}_{2}\lVert=\sqrt{N} , \bm{m}_{1}\cdot\bm{m}_{2}=0 , M=2000 , N_{runs}=50 for P=100,1000 and N_{run}=10 for P=10000 . Prior work characterizes the speciation transition as the diffusion time at which the generative sampling process begins to resolve specific data modes [ 43 , 6 , 2 ] . In our framework, we define the class-specific speciation time as the point along the backward diffusion trajectory where a class centroid becomes inferable through the learning of the score function. To precisely characterize these times, we analyze the spectrum of the Gaussian equivalent feature covariance. Expanding Eq.( 9 ) in the large-time regime (small e^{-t} ), we obtain: \mathbf{U}^{(gep)}=\frac{\gamma^{2}}{N}\mathbf{W}\mathbf{W}^{\intercal}+(\widetilde{\beta}-\gamma^{2})\mathbf{I}_{P}+\gamma^{2}e^{-2t}\sum_{c=1}^{C}b_{c}\bm{\mu}_{c}\bm{\mu}_{c}^{\intercal}+\mathcal{O}(e^{-4t}), (10) where \widetilde{\beta}=\mathbb{E}_{z\sim\mathcal{N}(0,1)}\left[\phi^{2}(z)\right] , \gamma=\mathbb{E}_{z\sim\mathcal{N}(0,1)}\left[z\phi(z)\right] , and \bm{\mu}_{c}=\frac{1}{\sqrt{N}}\mathbf{W}\bm{m}_{c} are the projected class centroids. Eq.( 10 ) shows that, in the high-dimensional limit ( N\rightarrow\infty ), a class becomes inferable when its corresponding rank-1 perturbation \bm{\mu}_{c}\bm{\mu}_{c}^{\intercal} produces an isolated eigenvalue that escapes the continuous bulk of the matrix spectrum. This spectral phase transition occurs when the perturbation norm is non-vanishing, yielding the condition: \gamma^{2}e^{-2t}\lVert\bm{\mu}_{c}\lVert^{2}b_{c}=\mathcal{O}(1). (11) Assuming the initial class centroids are extensive, i.e. \lVert\bm{m}_{c}\lVert^{2}=\mathrm{m}_{c}^{2}N , the required diffusion time to trigger speciation scales as t=\mathcal{O}(\log N) . By varying the asymptotic scaling of the sampling weights b_{c} , we can evaluate how class structure dictates the temporal emergence of features: Result 1 (Class-Specific Speciation Times) . Let b_{c} denote the sampling weight of class c . The speciation time t_{s}^{(c)} is governed by two distinct data regimes: • Weak Imbalance: When all classes are proportionally represented ( b_{c}=\mathcal{O}(1) ), class imbalance has no leading-order effect on the backward dynamics. All classes speciate simultaneously at: t_{s}=\frac{1}{2}\log N+\mathcal{O}(1). (12) • Strong Imbalance: When a class is severely undersampled ( b_{c}=\mathcal{O}(N^{-a_{c}}) for 0\tau_{g}^{(c)} , as the threshold where this overfitting causes the test error to degrade back to 1. 1 1 1 Because the readout weights are initialized at zero ( \mathbf{A}(0)=\mathbf{0} , see Sec. 2 ), the network outputs zero at initialization. Therefore, the initial test error is trivially equal to the variance of the standard Gaussian noise: \mathcal{E}_{test}^{(c)}(0)=1 . Formally: \tau_{g}^{(c)}=\operatorname*{argmin}_{\tau}\,\mathcal{E}_{test}^{(c)}(\tau),\qquad\mathcal{E}_{test}^{(c)}(\tau_{m}^{(c)})=1. (15) Fig. 3 shows the test error under three structural ablations relative to a balanced baseline with orthogonal, equal-norm centroids: doubling the variances (left), halving the centroid norms (center), and skewing the sampling weights (right). These perturbations reveal a hierarchy of influence: Result 2 (Hierarchy of Class Learning) . The learning timescales are governed by the following structural properties, in order of dominance: • Class Variance: High-variance classes present smoother and larger score targets, leading to significantly faster generalization and memorization compared to low-variance components. • Centroid Geometry: Classes with smaller-norm centroids are prioritized over those with large-norm centroids. • Sampling Imbalance: While usually a subleading effect, strong imbalance acts as a modulator capable of inverting the learning order established by variance and geometry. For completeness, Appendix H provides analogous results evaluated on the exact score-matching Mean Squared Error. a Generalization gaps. Gap between optimal generalization training time of the two classes against the sampling weight of class 1 (Eq.( 15 )). Panels isolate the impact of variance disparity ( Left , with inset zoom) and the centroid norm disparity ( Right ) introduced in Fig. 3 . b Memorization gaps. Gap between memorization times of the two classes against the sampling weight of class 1 (Eq.( 15 )). As in 4a , the panels show the variance disparity setting ( Left ) and the centroid norm disparity setting ( Right ). Figure 4: Imbalance can reverse the order of learning for classes . In both subfigures, solid lines represent theoretical predictions derived in Appendix G , while crosses represent empirical average gaps from gradient descent simulations. Parameters: \chi_{p}=60.0 , \chi_{m}=30.0 , t=0.01 , N=100 , N_{epoch}=2\times 10^{6} , learning rate \eta=5\times 10^{-5} , N_{run}^{train}=50 . As illustrated in Fig. 4 , class imbalance acts as a modulator capable of inverting the learning order observed in the balanced setting. By studying the memorization and generalization gaps between classes as functions of the mixing proportion b_{1} , we identify a fundamental trade-off: Result 3 (The Generalization-Memorization Trade-off) . Sample imbalance impacts generalization and memorization in opposite directions: 1. Scarcity delays generalization: Undersampling the high-variance class forces the model to generalize the low-variance class first. 2. Scarcity accelerates memorization: Conversely, oversampling the high-variance class deprives the low-variance class of data, causing it to be memorized first. Consequently, adjusting sampling weights to close the generalization gap between classes inevitably widens the memorization gap, and vice versa. 4 Numerical Experiments on Fashion MNIST Model, Training, and Generation. A standard DDPM [ 22 ] was employed on the Fashion MNIST dataset [ 60 ] , with a UNet [ 44 ] serving as the backbone. Each model is trained on a binary subset of Fashion MNIST, pairing the Sneaker class—which exhibits the lowest pixel-wise variance—with the remaining nine classes to yield nine distinct class pairs. Each pair is trained at three Sneaker proportions (25%, 50%, 75%) on 8,000 images. To capture both early and late training dynamics, 32 log-spaced checkpoints are saved per run. At each checkpoint, the DDPM ancestral sampler [ 22 ] is used to generate 500 samples per pair. Further implementation details are deferred to Appendix J.1 . Evaluation. Following [ 61 , 20 , 8 ] , a generated sample \bm{x}_{c} is considered memorized if the distance ratio to its nearest training neighbors satisfies \frac{\|\bm{x}_{c}-\mathrm{nn}_{1}(\bm{x}_{c})\|_{2}}{\|\bm{x}_{c}-\mathrm{nn}_{2}(\bm{x}_{c})\|_{2}}<\frac{1}{3} . The per-class memorization fraction f_{\mathrm{mem}}^{c}(t) is the expected memorization fraction under the data distribution at diffusion time t . We define the threshold-crossing time t_{\mathrm{mem}}^{c}=\inf\{t:f_{\mathrm{mem}}^{c}(t)\geq 1/3\} , yielding the Sneaker-partner memorization gap \Delta t_{\mathrm{mem}}(c_{p})=t_{\mathrm{mem}}^{\mathrm{snk}}-t_{\mathrm{mem}}^{c_{p}} . Samples are assigned to classes using dedicated binary ResNet-18 classifiers [ 21 ] (macro F1 >96.0\% , balanced accuracy >97.3\% ). Results and Discussion. Figure 5: DDPM memorization gaps on Fashion MNIST. ( a ) Per-class memorization fractions for Sneaker-Coat and Sneaker-Bag DDPMs. The horizontal dashed line marks the threshold f_{\mathrm{mem}}^{c}(t)=1/3 used to define t_{\mathrm{mem}}^{c} ; vertical shaded regions show the resulting Sneaker-partner time gap \Delta t_{\mathrm{mem}}(c_{p}) . Within each pair, the higher-variance partner class is memorized before Sneaker. Across pairs, the Bag-Sneaker DDPM exhibits a larger memorization gap than the Coat-Sneaker DDPM. ( b ) Memorization gap versus the empirical mean pixel variance of the balanced partner class. The dashed line is a linear fit, and the gray band is a 95\% bootstrap confidence interval obtained by resampling class points and refitting. ( c ) Memorization gap across partner mixing proportions b_{c_{p}} . The legend reports r_{v}=\widehat{\sigma}_{\mathrm{snk}}^{2}/\widehat{\sigma}_{c_{p}}^{2} . The selected classes are ordered in roughly 0.1 increments of r_{v} ; apart from Bag, they have comparable empirical variances. The trend is consistent with the one in Figure 4b . ( d ) Memorization gap versus partner centroid norm. To isolate centroid effects, we exclude relatively extreme variance cases, computed on the balanced subset; the fit and bootstrap confidence interval are computed as in (b). We first verify if the structural hierarchy predicted by Result 3 and shown in Fig. 4b is observed in Fashion MNIST DDPMs. As shown in Fig. 5 a , in the Sneaker-Bag pairs, the largest variance class attains the memorization threshold before its lowest variance counterpart. This relationship between the largest and smallest variance classes is also corroborated in CIFAR in Appendix J.2 . Moreover, in Fig. 5 b , the memorization time gap \Delta t_{\mathrm{mem}}(c_{p}) is positively correlated with the empirical mean pixel variance of different partner classes. Additionally, imbalance acts as a modulator: Fig. 5 c illustrates that increasing the partner mixing proportion b_{c_{p}} generally reduces the memorization gap. The curves in Fig. 5 c maintain a vertical ordering consistent with the variance ratio r_{v}=\widehat{\sigma}_{\mathrm{snk}}^{2}/\widehat{\sigma}_{c_{p}}^{2} , indicating that variance remains a dominant factor across the tested imbalance regimes. Finally, Fig. 5 d isolates the effect of centroid geometry by excluding extreme-variance cases computed on the balanced subset. It confirms the theoretical prediction that partner classes with a lower centroid norm relative to the Sneaker class exhibit larger memorization gaps, an observation consistent with the comparatively large gap recorded for the Sneaker-Sandal pair. Figure 6: DDPM–RF comparison across three descriptors. For each Sneaker-partner pair (c_{\mathrm{snk}},c_{p}) , we compare the DDPM memorization gap on Fashion MNIST with the corresponding RF memorization gap on Gaussian synthetic data. The RF model uses pair descriptors extracted from the data: partner variance, normalized partner centroid norm, and centroid cosine similarity to Sneaker. The panels plot both gaps as functions of each descriptor; Connecting lines are visual guides only. Insets report linear fits and Pearson correlations in the same raw units as the outer panels. While previous sections isolated specific data properties on synthetic data, in these numerical experiments we are observing their combined effect. Additionally, each class has its own non-null overlap with the reference Sneaker class, reflected by the cosine similarity. To generalise the theory to this case, we construct a synthetic Gaussian mixture model (GMM) using the centroid norms, variances, and cosine similarities extracted from Fashion MNIST. Result 4 (Consistency between RF learning and Real Architectures) . Using only these pair-level statistics, the RF model evaluated on Gaussian synthetic data qualitatively matches the memorization-gap trends of the full DDPM (Fig. 6 ). Despite operating on distinct gap scales, the models share similar descriptor-dependent patterns: • Qualitative agreement: Both models exhibit larger gaps for partner classes with larger variances and smaller centroid norms, matching the theoretical predictions. This similarity emerges despite comparing distinct architectures (RF vs. U-Net) and datasets (synthetic GMM vs. Fashion MNIST). • Pairwise structure: The RF model captures precisely specific geometric relationships. For instance, when the pairs have similar variances and cosine similarities, the one with a smaller centroid norm results in a larger memorization gap in both models (e.g., see the Shirt pair compared to the Pullover pair). Likewise, a partner class exhibiting moderate variance and a very small centroid norm results in a large memorization gap in both settings (see, for example, the Sandal pair). These results indicate that a Gaussian structural representation captures the leading-order effects of the memorization hierarchy in real image data. While first and second-order moments do not fully resolve the complexity of memorization—as evidenced by residual discrepancies—they successfully bridge the high-dimensional theory with empirical practice. 5 Conclusions We developed a high-dimensional analytical framework for class-aware learning dynamics in score-based diffusion models, characterizing the interplay of data structure and sampling imbalance. We showed that strong imbalance splits the speciation transition into distinct class-specific times, and that during score learning—close to sampling time—the statistical properties of the data, especially class variances, are the leading factors governing the order in which classes are learned. Centroid geometry plays a secondary role and imbalance acts as a modulator that can reverse this ordering. We further found that U-Net DDPMs trained on Fashion MNIST qualitatively track these predictions when an RF model is parametrized by empirical class moments, supporting the relevance of Gaussian score approximations to real architectures. A natural practical implication of our results is that a single early-stopping time need not regularize all classes equally under heterogeneous data. Since classes with higher variance or smaller centroid norm are learned earlier, reweighting or rebalancing toward lower-signal classes may offer a way to mitigate per-class disparities. We leave a systematic study of such interventions to future work. Our analysis is limited in two main respects. First, our presentation focused on binary Gaussian mixtures with isotropic covariances, even though the framework naturally extends to multi-class and non-isotropic settings. Second, it is fundamentally restricted to capturing first- and second-order structures. This leaves open the question of how more complex heterogeneities affect generative performance. For example, dataset outliers may act as strong attractors in diffusion dynamics [ 25 ] , and real data classes often have internal multimodal structure that cannot be reduced to a single Gaussian component. Since weaker intra-class modes can also be suppressed by conditional sampling and guidance [ 26 ] , extending the theory to more realistic class structure and conditional settings would be an important next step. Acknowledgments The authors thank Giulio Biroli, Sebastian Goldt, and Bruno Loureiro for their precious feedback. F.N., C.M., and S.S.M. were supported by the Wallenberg AI, Autonomous Systems, and Software Program (WASP). The computations were enabled by resources provided by the National Academic Infrastructure for Supercomputing in Sweden (NAISS) at Alvis and Tetralith (Chalmers Centre for Computational Science and Engineering, C3SE) partially funded by the Swedish Research Council through grant agreement no. 2022-06725, under project NAISS 2024/22-1082. Appendices Appendix A Notations We summarize the nontrivial notation used throughout the paper. Notation Meaning x^{2} vs. x^{(2)} Superscripts without parentheses denote powers, while superscripts in parentheses index elements of a list or sequence. \bm{x},\mathbf{X} Bold lowercase symbols denote vectors and bold uppercase symbols denote matrices, unless stated otherwise. For example, if \bm{x}\in\mathbb{R}^{N} , then \bm{x}=(x_{1},\ldots,x_{N})^{\intercal} . \phi(\bm{x}) For a scalar function \phi:\mathbb{R}\to\mathbb{R} , unless specified otherwise, \phi(\bm{x}) denotes elementwise application, i.e., \phi(\bm{x})=(\phi(x_{1}),\ldots,\phi(x_{N}))^{\intercal} . \odot Hadamard, or elementwise, product between vectors or matrices. \bm{x}^{\odot a} Elementwise power: \bm{x}^{\odot a}=(x_{1}^{a},\ldots,x_{N}^{a})^{\intercal} . \otimes Kronecker product between matrices. \bm{x}\bm{x}^{\intercal} Outer product of a vector with itself. \mathbb{E}_{x\sim\mathcal{P}}\left[\cdot\right] Expectation with respect to x\sim\mathcal{P} . When the distribution is omitted, the expectation is taken over the standard normal distribution \mathcal{N}(0,1) . For the Hadamard product, given \bm{x},\bm{y}\in\mathbb{R}^{N} , \bm{x}\odot\bm{y}=(x_{1}y_{1},\ldots,x_{N}y_{N})^{\intercal}. (16) For matrices \mathbf{X},\mathbf{Y}\in\mathbb{R}^{N\times N} , the product is applied elementwise: (\mathbf{X}\odot\mathbf{Y})_{ij}=X_{ij}Y_{ij}. (17) For matrices \mathbf{X},\mathbf{Y}\in\mathbb{R}^{N\times N} , the Kronecker product is \mathbf{X}\otimes\mathbf{Y}=\begin{pmatrix}X_{11}\mathbf{Y}&\cdots&X_{1N}\mathbf{Y}\\ \vdots&\ddots&\vdots\\ X_{N1}\mathbf{Y}&\cdots&X_{NN}\mathbf{Y}\end{pmatrix}. (18) For \bm{x}\in\mathbb{R}^{N} , the outer product is \bm{x}\bm{x}^{\intercal}=\begin{pmatrix}x_{1}^{2}&x_{1}x_{2}&\cdots&x_{1}x_{N}\\ x_{2}x_{1}&x_{2}^{2}&\cdots&x_{2}x_{N}\\ \vdots&\vdots&\ddots&\vdots\\ x_{N}x_{1}&x_{N}x_{2}&\cdots&x_{N}^{2}\end{pmatrix}. (19) For notational brevity, when no confusion arises, we occasionally suppress full parameter dependence. For example, \Delta_{t}\equiv 1-e^{-2t} is sometimes written simply as \Delta . The range of indices in summation and product symbols is omitted when its extremes are clear from the context, i.e. they were specified in previous equations. Appendix B Further Related Works Dynamical transitions in diffusion models. The recent success of generative diffusion models has promoted a growing effort to interpret their behaviour through the lens of statistical mechanics, particularly in the high-dimensional limit where mean-field techniques become informative. Early works in this direction have analysed how diffusion models reconstruct the target data distribution through a sequence of dynamical transitions that coincide with ergodicity-breaking events in an effective diffusion potential [ 7 , 4 , 1 ] . [ 6 ] —namely speciation and collapse–while [ 2 ] highlighted speciation timescale separations for centred groups whose difference stems from higher-order moments. Still within the study of sampling dynamics in diffusion models, [ 55 , 3 , 38 , 52 , 45 ] investigated the evolution of the score function’s geometry in space and time. In particular, [ 55 , 3 ] demonstrated that: directions of higher variance in the data distribution are sampled earlier, as the score function progressively reconstructs the latent data structure; at later stages, data points that are strongly aligned with these high-variance directions are preferentially memorised, reflecting a temporal progression that parallels the earlier emergence of generalisation. Memorisation and generalisation in score learning. Another line of research has applied similar tools to study how diffusion models generalise the target distribution and memorise data points when parametrised by simple neural network architectures. In particular, [ 8 , 16 ] study how a random feature model [ 42 ] fits the score function of a diffusion model when the data distribution is a unimodal multivariate Gaussian. The transition from memorisation to generalisation as dataset size increases has been widely documented [ 27 ] , with early stopping acting as a crucial implicit regularisation mechanism driven by time-scale separation [ 8 , 15 ] . Notably, the universal time-scale separation between feature learning and overfitting demonstrated in two-layer regression networks [ 37 ] closely parallels these memorisation dynamics and transitions. Memorisation has also been explicitly detected by analysing the Hessian of the score in models with outliers [ 25 ] , conceptually echoing earlier findings on spurious correlations [ 46 ] . Unlike these studies, which primarily focus on unimodal distributions or isolated microscopic outliers, our work provides a solvable analytical framework for macroscopic data mixtures, explicitly deriving how the combination of class imbalance and cluster variance dictates distinct, class-specific critical times for both learning and memorisation. Furthermore, multiple studies address score learning when the model is parametrised by a linear or shallow denoiser. [ 35 ] showed that while PCA fails to recover signals in a spiked cumulant model, shallow non-linear autoencoders succeed. Other works [ 57 , 36 ] focus on the dynamical manner in which linear denoisers learn the data covariance. [ 57 ] shows that directions of large variance are learned first during training, consistent with the fact that such directions are sampled earlier in the diffusion dynamics [ 55 ] . Previous studies characterized linear auto-encoders as correlation machines utilizing power iteration for generative modeling [ 59 ] . Within more complex architectures, U-Net diffusion models yield multiplicative compositional representations [ 32 ] , whereas exact ODEs defined the online SGD dynamics of diffusion models utilizing two-layer autoencoders [ 10 , 11 ] . Although these frameworks identify variance as a driver to learning speed, they omit the role of heterogeneous datasets and their contribution to learning. We extend this understanding by demonstrating that while variance is the dominant force, other contributing factors, such as centroid norm and class imbalance, play a crucial role, becoming the decisive factor that dictates the learning sequence when class variances are comparable. Data imbalance and algorithmic bias. Despite recent theoretical advances [ 46 , 24 , 47 , 40 ] , analytical literature on the effect of heterogeneous datasets and data imbalance remains extremely sparse. Empirically, it has been shown that generative models can exacerbate biases relating to demographic traits such as race, gender, and age, even when trained on balanced datasets [ 39 ] . While the evolution of bias across modern diffusion models is highly dataset-dependent [ 56 ] , mechanistic interpretability approaches suggested that these biases often stem from neurons encoding for a multitude of semantic concepts—named polysemantic—within the architectures [ 48 , 31 ] . However, a rigorous theoretical understanding of why and when these models prioritize majority over minority classes during training is lacking. Our work bridges this critical gap, providing exact analytical predictions demonstrating that data structure and severe class imbalance force the features of undersampled modes to emerge at distinct, earlier speciation times, ultimately explaining the fundamental mechanisms that allow models to memorise one population while completely failing to memorise another. Appendices for theory Appendix C The solution of the dynamics We consider the gradient flow (GF) limit of the gradient descent of the readouts weights: \mathbf{A}_{k+1}=\mathbf{A}_{k}-\eta\frac{\partial\mathcal{E}_{train}}{\partial\mathbf{A}}|_{\mathbf{A}=\mathbf{A}_{k}}. (20) where the training loss is defined in ( 3 ). We consider the limit of very small learning rate: we set \eta\approx\widetilde{\eta}\,d\tau , so that \mathbf{A}_{k+1}-\mathbf{A}_{k}\approx d\mathbf{A} and d\mathbf{A}=-\widetilde{\eta}\frac{\partial\mathcal{E}_{train}}{\partial\mathbf{A}}\Biggl|_{\mathbf{A}=\mathbf{A}_{\tau}}\,d\tau. The GF equation then reads \dot{\mathbf{A}}=-\widetilde{\eta}\frac{\partial\mathcal{E}_{train}}{\partial\mathbf{A}}\Biggl|_{\mathbf{A}=\mathbf{A}(\tau)}\equiv-2\widetilde{\eta}\frac{\Delta_{t}}{N}\left[\mathbf{A}\mathbf{U}+\frac{1}{\sqrt{\Delta_{t}}}\mathbf{V}^{\intercal}\right]. (21) with \mathbf{U} and \mathbf{V} defined in ( 7 ), ( 8 ). The GF equation is an ODE for the matrix \mathbf{A} , and thus admits an explicit solution. Let us consider the Singular Value Decomposition (SVD) of \mathbf{A}=\mathbf{M}_{L}^{\intercal}\mathbf{S}_{A}\mathbf{M}_{R} , with \mathbf{M}_{L}\in\mathbb{R}^{N\times N} and \mathbf{M}_{R}\in\mathbb{R}^{P\times P} two orthogonal matrices: then the GF equation becomes \dot{\mathbf{S}}_{A}=-2\widetilde{\eta}\frac{\Delta_{t}}{N}\left[\mathbf{S}_{A}\widehat{\mathbf{U}}+\frac{1}{\sqrt{\Delta_{t}}}\widehat{\mathbf{V}}^{\intercal}\right], (22) with \widehat{\mathbf{U}}=\mathbf{M}_{R}\mathbf{U}\mathbf{M}_{R}^{\intercal} and \widehat{\mathbf{V}}=\mathbf{M}_{R}\mathbf{V}\mathbf{M}_{L}^{\intercal} . Since the matrix \mathbf{S}_{A} is non-zero only on the sub-diagonal 2 2 2 We always consider N

0 and c_{1}\in\mathbb{R} \phi(c_{0}x+c_{1})=\sum_{n=0}^{\infty}\frac{h_{n}}{n!}\operatorname{He}_{n}(x),\qquad h_{n}=\mathbb{E}_{z}\left[\operatorname{He}_{n}(z)\,\phi(c_{0}z+c_{1})\right]. (44) With all this, we get \begin{gathered}\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\phi_{1}^{(t)}\left(\frac{1}{\sqrt{N}}\sum_{i=1}^{N}\,W_{pi}x_{i}^{(\nu)}\right)\phi_{1}^{(t)}\left(\frac{1}{\sqrt{N}}\sum_{i=1}^{N}\,W_{pi}x_{i}^{(\nu)}\right)^{\intercal}\\ \,\\ \simeq\mathbb{E}_{u\sim\mathcal{N}(\mu_{c}^{(p)},\sigma_{c}^{2}),\,y}\left[y\,\phi\left(e^{-t}u_{p}+\sqrt{\Delta_{t}}y\right)\right]\mathbb{E}_{u\sim\mathcal{N}(\mu_{c}^{(q)},\sigma_{c}^{2}),\,y}\left[y\,\phi\left(e^{-t}u_{q}+\sqrt{\Delta_{t}}y\right)\right]\,\\ \,\\ \text{then}\,\\ \,\\ \mathbb{E}_{u\sim\mathcal{N}(\mu_{c}^{(p)},\sigma_{c}^{2}),\,y}\left[y\,\phi\left(e^{-t}u_{p}+\sqrt{\Delta(t)}y\right)\right]=\sum_{n=0}^{\infty}\frac{h_{n}^{(p)}}{n!}\mathbb{E}_{y,\,\widetilde{u}}\left[y\operatorname{He}_{n}\left(\frac{e^{-t}\sigma_{c}\widetilde{u}+\sqrt{\Delta_{t}}y}{\Gamma_{t}^{c}}\right)\right]\\ \,\\ =\frac{\sqrt{\Delta(t)}}{\Gamma_{c}(t)}\widetilde{\gamma}_{c}^{(p)}(t),\\ \,\\ \widetilde{\bm{\gamma}}_{c}(t)=\mathbb{E}_{z}\left[z\,\phi\left(z\,\Gamma_{c}(t)\bm{1}_{P}+e^{-t}\bm{\mu}_{c}\right)\right],\end{gathered} (45) and thus ( 43 ) becomes \begin{gathered}U_{c}^{(pq)}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\phi_{0}^{(t)}\left(\frac{1}{\sqrt{N}}\sum_{i=1}^{N}\,W_{pi}x_{i}^{(\nu)}\right)\phi_{0}^{(t)}\left(\frac{1}{\sqrt{N}}\sum_{i=1}^{N}\,W_{qi}x_{i}^{(\nu)}\right)+\frac{\Delta_{t}}{\Gamma_{c}^{2}(t)}\widetilde{\gamma}_{c}^{(p)}\widetilde{\gamma}_{c}^{(q)}\Sigma_{u}^{(pq)}.\end{gathered} To evaluate the first term in ( 43 ), we use the GEP of eq. ( 37 ): \begin{gathered}\phi_{0}\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}^{(\nu)}\right)\overset{\text{GEP}}{\rightarrow}\bm{G}_{c}^{(\nu)}\\ \,\\ \bm{G}_{c}^{(\nu)}\equiv\bm{\alpha}_{c}+\frac{1}{\sigma_{c}\sqrt{N}}\mathbf{W}(\bm{x}^{(\nu)}-\bm{m}_{c})\odot\bm{\gamma}_{c}+(\bm{\beta}_{c}-\bm{\alpha}_{c}^{\odot 2}-\bm{\gamma}_{c}^{\odot 2})^{\odot\frac{1}{2}}\odot\bm{\eta}_{\nu}^{c},\end{gathered} (46) where the vectors of Hermite coefficients can be computed using their definition in Appendix D and the definition of \phi_{0} in ( 43 ): \bm{\alpha}_{c}(t)=\mathbb{E}_{z}\left[\phi_{0}(z\,\sigma_{c}\bm{1}_{P}+\bm{m}_{c})\right]=\mathbb{E}_{z}\left[\phi(z\,\Gamma_{c}(t)\,\mathbf{1}+e^{-t}\bm{\mu}_{c})\right] (47) \begin{gathered}\,\\ \bm{\beta}_{c}(t)=\mathbb{E}_{z}\left[\phi_{0}^{\odot 2}(z\,\sigma_{c}\,\mathbf{1}+\bm{m}_{c})\right]\\ \,\\ =\mathbb{E}_{u,v\sim\mathcal{N}(0,\bm{\Sigma}_{c}(t))}\left[\phi(\Gamma_{c}(t)u\,\mathbf{1}+e^{-t}\bm{\mu}_{c})\odot\phi(\Gamma_{c}(t)v\,\mathbf{1}+e^{-t}\bm{\mu}_{c})\right]\\ \,\\ \text{with}\\ \,\\ \bm{\Sigma}_{c}(t)=\begin{pmatrix}1&\frac{e^{-2at}\sigma_{c}^{2}}{(\Gamma_{c}(t))^{2}}\\ &\\ \frac{e^{-2at}\sigma_{c}^{2}}{(\Gamma_{c}(t))^{2}}&1\end{pmatrix}\\ \,\end{gathered} (48) \bm{\gamma}_{c}(t)=\mathbb{E}_{z}\left[z\,\phi_{0}(z\,\sigma_{c}\bm{1}_{P}+\bm{m}_{c})\right]=\frac{\sigma_{c}e^{-t}}{\Gamma_{c}(t)}\widetilde{\bm{\gamma}}_{c}(t) (49) Figure 7: Comparison of the GEP derived in eq. ( 50 ) with the spectrum of U obtained through a Monte Carlo estimation of ( 7 ). Putting everything together, the GEP form of the matrix \mathbf{U} is equal to \boxed{\begin{gathered}\mathbf{U}\sim\sum_{c=1}^{C}b_{c}\mathbf{U}_{c}^{(gep)},\,\\ \,\mathbf{U}_{c}^{(gep)}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\bm{G}_{c}^{\nu}(t)\bm{G}_{c}^{\nu}(t)^{\intercal}+\frac{\Delta(t)}{N\sigma_{c}^{2}e^{-2t}}\bm{\gamma}_{c}(t)\bm{\gamma}_{c}(t)^{\intercal}\odot\mathbf{W}\mathbf{W}^{\intercal}\,\\ +\operatorname{diag}\left(\widetilde{\bm{\beta}}_{c}(t)-\bm{\beta}_{c}(t)-\frac{\Delta_{t}}{\sigma_{c}^{2}e^{-2t}}\bm{\gamma}_{c}(t)^{\odot 2}\right),\\ \,\\ \,\bm{G}_{c}^{(\nu)}=\bm{\alpha}_{c}+\frac{1}{\sigma_{c}\sqrt{N}}\mathbf{W}(\bm{x}^{(\nu)}-\bm{m}_{c})\odot\bm{\gamma}_{c}+(\bm{\beta}_{c}-\bm{\alpha}_{c}^{\odot 2}-\bm{\gamma}_{c}^{\odot 2})^{\odot\frac{1}{2}}\odot\bm{\eta}_{\nu}^{c}\,\\ \,\\ \end{gathered}} (50) In ( 9 ) we set \widehat{\mathbf{W}}_{c}\equiv\bm{\gamma}_{c}\bm{1}_{N}^{\intercal}\odot\mathbf{W},\qquad\bm{d}_{c}=\widetilde{\bm{\beta}}_{c}(t)-\bm{\beta}_{c}(t)-\frac{\Delta_{t}}{\sigma_{c}^{2}e^{-2at}}\bm{\gamma}_{c}(t)^{\odot 2}. (51) Note that the GEP matrix can be decomposed in term of a finite-norm matrix \widehat{\mathbf{U}}_{c}^{(gep)} plus a low rank extensive perturbation \mathbf{U}_{c}^{(gep)}=\widehat{\mathbf{U}}_{c}^{(gep)}+\bm{\alpha}_{c}\bm{\alpha}_{c}^{\intercal}+\left[\frac{\bm{\alpha}_{c}}{M_{c}}\sum_{\nu\in I_{c}}(\mathbf{G}_{*\nu}-\bm{\alpha}_{c})^{\intercal}+\frac{1}{M_{c}}\sum_{\nu\in I_{c}}(\mathbf{G}_{*\nu}-\bm{\alpha}_{c})\bm{\alpha}_{c}^{\intercal}\right] (52) The perturbation is extensive because its first term is a rank-one matrix of norm \mathcal{O}_{P}(P) , while the other is \mathcal{O}_{P}(1) . The first term in particular is related to the projection of the centroids in the space of features: this can be seen explicitly in the large t limit: \bm{\alpha}_{c}\approx\gamma\,e^{-t}\bm{\mu}_{c}. (53) We tested the goodness of the GEP in ( 50 ): in figure 7 , we show that the GEP of eq. ( 50 ) works very well. E.2 The GEP of \widetilde{\mathbf{U}} To compute the GEP of the corresponding population matrix, we simply use the GEP on the vector field \bm{\varphi}=\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}(t)\right) with \bm{x}(t) sampled from \mathcal{N}(\cdot,\bm{m}_{c}e^{-t},\Gamma_{c}^{2}(t)\mathbf{I}_{N}) . We get \bm{\varphi}_{gep}^{(c)}=\bm{\alpha}_{c}+\frac{1}{\sigma_{c}\sqrt{N}}\mathbf{W}(\bm{x}^{(\nu)}-\bm{m}_{c})\odot\bm{\gamma}_{c}+(\widetilde{\bm{\beta}}_{c}-\bm{\alpha}_{c}^{\odot 2}-\widetilde{\bm{\gamma}}_{c}^{\odot 2})^{\odot\frac{1}{2}}\odot\bm{\eta}_{\nu}^{c}\qquad\bm{\eta}_{\nu}^{c}\sim\mathcal{N}(\cdot,\mathbf{0},\mathbf{I}_{N}) (54) and thus the GEP of \widetilde{\mathbf{U}} is obtained averaging the \bm{\varphi}_{gep}^{(c)}{\bm{\varphi}_{gep}^{(c)}}\,^{\intercal} over the \bm{x}\sim\mathcal{N}_{c} and the \bm{\eta} , obtaining \boxed{\begin{gathered}\widetilde{\mathbf{U}}\sim\sum_{c=1}^{C}b_{c}\widetilde{\mathbf{U}}_{c}^{(gep)},\,\\ \,\\ \widetilde{\mathbf{U}}_{c}^{(gep)}=\bm{\alpha}_{c}\bm{\alpha}_{c}^{\intercal}+\frac{1}{N}\mathbf{W}\mathbf{W}^{\intercal}\odot\widetilde{\bm{\gamma}}_{c}\widetilde{\bm{\gamma}}_{c}^{\intercal}+\operatorname{diag}(\widetilde{\bm{\beta}}_{c}-\bm{\alpha}_{c}^{\odot 2}-\widetilde{\bm{\gamma}}_{c}^{\odot 2}).\end{gathered}} (55) One can easily verify that by averaging \mathbf{U}_{c}^{(gep)} over the dataset and the GEP noise, one obtains directly ( 55 ). It is insightful to relate \mathbf{U} with its population version \widetilde{\mathbf{U}} : with a few straightforward manipulations, one can show that \begin{gathered}\mathbf{U}_{c}^{gep}=\widetilde{\mathbf{U}}_{c}^{gep}+\mathbf{\delta U}_{c}^{(gep)}\\ \,\\ \mathbf{\delta U}_{c}^{(gep)}=\frac{1}{M_{c}}\sum_{\nu\in I_{c}}\bm{G}_{c}^{\nu}(t)\bm{G}_{c}^{\nu}(t)^{\intercal}-\frac{1}{N}\mathbf{W}\mathbf{W}^{\intercal}\odot\bm{\gamma}_{c}\bm{\gamma}_{c}^{\intercal}-\operatorname{diag}(\bm{\beta}_{c}-\bm{\alpha}_{c}^{\odot 2}-\bm{\gamma}_{c}^{\odot 2})\end{gathered} (56) The generalization during training is due to the rank N population matrix \widetilde{\mathbf{U}}\sim\sum_{c}b_{c}\widetilde{\mathbf{U}}_{c}^{gep} , while memorization origins from the rank P-N matrix \delta\mathbf{U}\sim\sum_{c}b_{c}\delta\mathbf{U}_{c}^{gep} . Proceeding similarly to [ 8 ] , one can verify that \lVert\widetilde{\mathbf{U}}-\sum_{c}b_{c}\bm{\alpha}_{c}\bm{\alpha}_{c}^{\intercal}\lVert_{F}=\mathcal{O}(\chi_{p}) and \lVert\delta\mathbf{U}\lVert_{F}=\mathcal{O}(\chi_{p}/\sqrt{\chi_{m}}) , where \lVert\cdot\lVert_{F} is the Frobenius norm. E.3 The GEP of \mathbf{V} We take formula ( 8 ) and rewrite the latent vector \bm{u}_{\nu}(t)=\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}_{\nu}(t) , where \nu\in I_{c} , as \bm{u}_{\nu}(t)=\bm{u}_{\nu}+e^{-t}\bm{\mu}_{c} (57) The vector \bm{u}_{\nu} is a gaussian vector with zero mean and covariance \mathbf{\Sigma}_{uu}=\frac{\Gamma_{c}^{2}(t)}{N}\mathbf{W}\mathbf{W}^{\intercal} . The cross covariance with the noise reads \mathbf{\Sigma}_{u\xi}=\frac{\sqrt{\Delta}_{t}}{\sqrt{N}}\mathbf{W} . Then the Kernel-Mehler expansion applied to ( 8 ) yields \begin{gathered}V_{c}^{pj}=\frac{1}{M_{c}}\sum_{\nu=1}^{M_{c}}\sum_{n=0}^{\infty}\frac{(\Sigma_{u\xi}^{pj})^{n}}{n!}\mathbb{E}_{z}\left[\phi\left(z\Gamma_{c}(t)+e^{-t}\mu_{c}^{(p)}\right)\operatorname{He}_{n}(z)\right]\mathbb{E}_{z}\left[z\operatorname{He}_{n}(z)\right]\\ \,\\ =\sqrt{\frac{\Delta_{t}}{N}}\frac{\widetilde{\gamma}_{c}^{(p)}}{\Gamma_{c}(t)}W_{pj}+\mathcal{O}_{N}(N^{-1})\end{gathered} (58) Then the GEP for \mathbf{V} reads \boxed{\begin{gathered}\mathbf{V}\sim\sum_{c=1}^{C}b_{c}\mathbf{V}_{c}^{(gep)}\\ \,\\ \mathbf{V}_{c}^{(gep)}=\sqrt{\frac{\Delta_{t}}{N}}\frac{\widetilde{\bm{\gamma}}_{c}\bm{1}_{N}^{\intercal}}{\Gamma_{c}(t)}\odot\mathbf{W}.\end{gathered}} (59) E.4 The GEP of \widetilde{\mathbf{V}} It is easy to see from ( 58 ) that the GEP of \widetilde{\mathbf{V}} is the same as that of \mathbf{V} , up to finite-size corrections: so, we write \boxed{\begin{gathered}\widetilde{\mathbf{V}}\sim\sum_{c=1}^{C}b_{c}\widetilde{\mathbf{V}}_{c}^{(gep)}\\ \,\\ \widetilde{\mathbf{V}}_{c}^{(gep)}=\mathbf{V}_{c}^{(gep)}.\end{gathered}} (60) Appendix F Spectral equations of \mathbf{U} The spectrum of the matrix \mathbf{U} is fully characterized by the resolvent matrix \mathbf{\mathcal{G}}_{U}(z)=(\mathbf{U}-z\mathbf{I}_{P})^{-1}\equiv\sum_{q=1}^{P}\frac{\bm{\psi}_{q}\bm{\psi}_{q}^{\intercal}}{\lambda_{q}-z},\qquad z\in\mathbb{C}/\{\operatorname{Spec}(\mathbf{U})\} (61) Since the matrix \mathbf{U} is random through the dataset \mathbf{X} and the random features matrix \mathbf{W} , the resolvent is a random matrix itself. However, its first matrix moment concentrates in the high-dimensional limit: \begin{gathered}\lim_{P\rightarrow\infty}\left|\frac{1}{P}\operatorname{Tr}\mathbf{\mathcal{G}}_{U}(z)-\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\frac{1}{P}\operatorname{Tr}\mathbf{\mathcal{G}}_{U}(z)\right]\right|=0\,\\ \\ g_{U}(z)=\frac{1}{P}\operatorname{Tr}\mathbf{\mathcal{G}}_{U}(z)\overset{P\rightarrow\infty}{\Longrightarrow}g(z)=\int\frac{d\lambda\,\rho(\lambda)}{\lambda-z}\end{gathered} (62) We shall call the asymptotic limit of the resolvent first moment resolvent function : it is the Steltjes transform [ 41 ] of the density of eigenvalues \rho(\lambda) . From the statistics of the resolvent matrix we can evaluate the statistical properties of the eigenvalues and the eigenvectors of \mathbf{U} : in particular, from the resolvent function in ( 62 ) we can compute the density of eigenvalues through Sokhotski-Plemelj formula, also known as inverse Stieltjes transform: \rho(\lambda)=\frac{1}{\pi}\lim_{\epsilon\rightarrow 0_{+}}\operatorname{Im}g(\lambda+i\epsilon) (63) To evaluate the resolvent function, we use computational techniques of statistical physics. We consider Edwards-Jones formula [ 14 ] : \begin{gathered}g(z)=\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\operatorname{Tr}(\mathbf{U}-z\mathbf{I}_{P})^{-1}\right]=-\frac{\partial}{\partial z}\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\operatorname{Tr}\log(\mathbf{U}-z\mathbf{I}_P)\right]\\ \,\\ =-\frac{\partial}{\partial z}\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\log\det(\mathbf{U}-z\mathbf{I}_P)\right]=2\frac{\partial}{\partial z}\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\log\mathcal{Z}_{U}\right],\\ \,\\ \,\\ \mathcal{Z}_{U}=\int d\bm{\psi}\,e^{-\frac{1}{2}\bm{\psi}^{\intercal}(\mathbf{U}-z\mathbf{I}_{P})\bm{\psi}}.\end{gathered} (64) F.1 Replica computation of the resolvent function The goal of a statistical physics computation is to represent high-dimensional systems in terms of few, low-dimensional parameters: in the case of random matrix calculations, these are resolvent functions of random matrices. Depending on the calculation, the final result can be characterized by several different resolvents. In particular, the main one and objective of this calculation is the resolvent function ( 62 ), which it easy to see from ( 64 ) that is given by g(z)=\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\int d\bm{\psi}\,\bm{\psi}^{\intercal}\bm{\psi}\,e^{-\frac{1}{2}\bm{\psi}^{\intercal}(\mathbf{U}-z\mathbf{I}_{P})\bm{\psi}}\right]. (65) To evaluate the average over the log in ( 64 ), we use the Replica trick [ 9 ] : \begin{gathered}\log\mathcal{Z}_{U}=\lim_{n\rightarrow 0}\frac{\mathcal{Z}_{U}^{n}-1}{n}\Longrightarrow\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\log\mathcal{Z}_{U}\right]=\lim_{n\rightarrow 0}\frac{\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\mathcal{Z}_{U}^{n}\right]-1}{n}\\ \,\\ \text{with}\\ \,\\ \mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\mathcal{Z}_{U}^{n}\right]=\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\left(\int d\bm{\psi}\,e^{-\frac{1}{2}\bm{\psi}^{\intercal}(\mathbf{U}-z\mathbf{I}_{P})\bm{\psi}}\right)^{n}\right]\\ \equiv\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\prod_{a=1}^{n}\int d\bm{\psi}_{a}\,e^{-\frac{1}{2}\bm{\psi}_{a}^{\intercal}(\mathbf{U}-z\mathbf{I}_{P})\bm{\psi}_{a}}\right].\end{gathered} (66) Then, we replace \mathbf{U} with its GEP in ( 50 ): \begin{gathered}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\prod_{a=1}^{n}\int d\bm{\psi}_{a}\,e^{-\frac{1}{2}\bm{\psi}_{a}^{\intercal}(\mathbf{U}-z\mathbf{I}_{P})\bm{\psi}_{a}}\right]=\mathbb{E}_{\{\mathbf{X}_{c},\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}\left[\prod_{a=1}^{n}\int d\bm{\psi}_{a}\,e^{-\frac{1}{2}\bm{\psi}_{a}^{\intercal}(\sum_{c=1}^{C}b_{c}\mathbf{U}_{c}^{(gep)}-z\mathbf{I}_{P})\bm{\psi}_{a}}\right]\end{gathered} where we indicate with \mathbf{H}_{c}\in\mathbb{R}^{P\times M_{c}} the matrix having as columns the noise vectors of the GEP of the different classes. Finally, we consider eq. ( 52 ): since we are mostly interested in the absolute continuous part of the spectrum of \mathbf{U}^{(gep)} , we perform the computation for the matrix \widehat{\mathbf{U}}^{(gep)}=\sum_{c=1}^{C}b_{c}\widehat{\mathbf{U}}^{(gep)}_{c} , since this matrix does not have a low-rank perturbation. Indeed, the matrices \mathbf{U}_{gep} and \widehat{U}_{gep} have the same absolute continuous spectrum, differing only by the presence of outliers in \mathbf{U}_{gep} . Thus, in what follows, we proceed with the computation of the following expectation: \overline{\mathcal{Z}^{n}}=\mathbb{E}_{\{\mathbf{X}_{c},\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}\left[\prod_{a=1}^{n}\int d\bm{\psi}_{a}\,e^{-\frac{1}{2}\bm{\psi}_{a}^{\intercal}(\sum_{c=1}^{C}b_{c}\widehat{\mathbf{U}}_{c}^{(gep)}-z\mathbf{I}_{P})\bm{\psi}_{a}}\right]. (67) We set \widetilde{\bm{G}}_{c}^{(\nu)}=\bm{G}_{c}^{(\nu)}-\bm{\alpha}_{c} (compare with eq. ( 50 )) and expand: \begin{gathered}\,\\ \overline{\mathcal{Z}^{n}}=\mathbb{E}_{{\{\mathbf{X}_{c},\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}}\Biggl[\int d\bm{\Psi}\,\prod_{a=1}^{n}e^{-\frac{1}{2}\sum_{c=1}^{C}b_{c}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}\bm{\varsigma}_{c}-z\mathbf{I}_{P})\bm{\psi}_{a}-\frac{1}{2\,M}\bm{\psi}_{a}^{\intercal}\sum_{c=1}^{C}\widetilde{\mathbf{G}}_{c}\widetilde{\mathbf{G}}_{c}^{\intercal}\bm{\psi}_{a}}\\ \,\\ \times e^{-\frac{\Delta}{2N}\bm{\psi}_{a}^{\intercal}\left(\sum_{c=1}^{C}\frac{b_{c}}{\Gamma_{c}^{2}}\widetilde{\bm{\gamma}}_{c}\widetilde{\bm{\gamma}}_{c}^{\intercal}\right)\odot\,\mathbf{W}\mathbf{W}^{\intercal}\bm{\psi}_{a}}\Biggr]\end{gathered} where we set d\bm{\psi}_{1}\cdots d\bm{\psi}_{n}=d\bm{\Psi} and defined the vectors \bm{\varsigma}_{c}=\widetilde{\bm{\beta}}_{c}-\bm{\beta}_{c}-\frac{\Delta_{t}}{\sigma_{c}^{2}e^{-2at}}\bm{\gamma}_{c}^{\odot 2}. (68) We do the disorder averages over the data, the GEP noise, and the random features step by step: to this end , it is convenient to compact the terms in the GEP features: \widetilde{G}_{c}^{p\nu}=\frac{\gamma_{c}^{(p)}}{\sigma_{c}\sqrt{N}}\sum_{j=1}^{N}\,W_{pj}(x_{j}^{(c,\nu)}-m_{j}^{(c)})+\widetilde{\eta}_{p\nu}^{(c)}\,\text{,}\qquad\widetilde{\bm{\eta}}_{\nu}^{(c)}\sim\mathcal{N}(\cdot\,;\,\bm{0},\operatorname{diag}(\bm{h}_{c}^{\odot 2})) (69) where we set \bm{h}_{c}^{\odot 2}=\bm{\beta}_{c}-\bm{\alpha}_{c}^{\odot 2}-\bm{\gamma}_{c}^{\odot 2} . We then group terms in the GEP covariances in terms of their disorder dependence: \displaystyle\frac{1}{M}\big(\widetilde{\bm{G}}_{c}\widetilde{\bm{G}}_{c}^{\intercal}\big)_{pq}=\Biggl\{\frac{\gamma_{c}^{(p)}\,\gamma_{c}^{(q)}}{M\,\sigma_{c}^{2}\,N}\sum_{i=1}^{N}\sum_{j=1}^{N}\sum_{\nu=1}^{M_{c}}W_{pi}\,W_{qj}\;\,\big(x_{i}^{(c,\nu)}-m_{i}^{(c)}\big)\,\big(x_{j}^{(c,\nu)}-m_{j}^{(c)}\big) \displaystyle+\left[\frac{\gamma_{c}^{(p)}}{M\sqrt{N}\,\sigma_{c}}\sum_{i=1}^{N}W_{qi}\,\sum_{\nu=1}^{M_{c}}\big(x_{i}^{(c,\nu)}-m_{i}^{(c)}\big)\widetilde{\eta}_{q\nu}^{(c)}+\frac{\gamma_{c}^{(q)}}{M\sqrt{N}\,\sigma_{c}}\sum_{i=1}^{N}W_{pi}\,\sum_{\nu=1}^{M_{c}}\big(x_{i}^{(c,\nu)}-m_{i}^{(c)}\big)\widetilde{\eta}_{p\nu}^{(c)}\right]\Biggr\} \displaystyle+\Biggl\{\frac{1}{M}\sum_{v=1}^{M_{c}}\widetilde{\eta}^{(c)}_{p\nu}\,\widetilde{\eta}^{(c)}_{q\nu}\Biggr\}\equiv A_{pq}^{(X_{c},H_{c},W)}+A_{pq}^{(H_{c},W)}. Note that each of the vector GEP coefficients \bm{\alpha}_{c},\bm{\beta}_{c},\bm{\gamma}_{c},\bm{\widetilde{\beta}}_{c} depends on the random features \mathbf{W} through the projected centroids \bm{\mu}_{c}\equiv(1/\sqrt{N})\mathbf{W}\mathbf{m}_{c} , see their definitions in Appendix E . We now proceed with the computations of the disorder averages. • Average over the data \{\bm{X}_{c}\}_{c=1}^{C} : the average over the data can be factorized in the different classes data. The generic c integral is a standard multi-variate integral \begin{gathered}\mathbb{E}_{\mathbf{X}_{c}}\left[e^{-\frac{1}{2}\sum_{a}\bm{\psi}_{a}^{\intercal}\mathbf{A}^{(X_{c},H_{c},W)}\bm{\psi}_{a}}\right]\,\,=\\ \,\\ \prod_{\nu=1}^{M_{c}}\int\frac{d\bm{x}^{(c)}_{\nu}}{(2\pi\sigma_{c}^{2})^{N/2}}\;e^{-\,\frac{1}{2\sigma_{c}^{2}}\,\big(\bm{x}^{(c)}_{\nu}-\mathbf{m}_{c}\big)^{\intercal}\Big(\mathbf{I}_{N}+\frac{1}{NM}\,\mathbf{W}^{\intercal}\sum_{a}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}\mathbf{W}\Big)\big(\bm{x}^{(c)}_{\nu}-m_{\nu}\big)}\\ \,\\ \times e^{\frac{1}{\sqrt{N}\sigma_{c}M}\sum_{a}\bm{\psi}_{a}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)}[(\bm{\psi}_{a}\odot\bm{\gamma}_{c})^{\intercal}\mathbf{W}](\bm{x}_{\nu}^{(c)}-\mathbf{m}_{c})}\\ \,\\ =e^{\frac{1}{2NM^{2}}\sum_{\nu=1}^{M_{c}}\sum_{ab}(\bm{\psi}_{a}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)})(\bm{\psi}_{b}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)})(\mathbf{W}^{\intercal}\bm{\psi}_{a}\odot\bm{\gamma}_{c})^{\intercal}(\mathbf{I}_{N}+\frac{1}{NM}\bm{J}_{c})^{-1}(\mathbf{W}^{\intercal}\bm{\psi}_{b}\odot\bm{\gamma}_{c})-\frac{M_{c}}{2}\log\det(\mathbf{I}_N+\frac{1}{N M}\boldsymbol{J}_{c})},\\ \,\\ \mathbf{J}_{c}\equiv\mathbf{W}^{\intercal}\sum_{a}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}\mathbf{W}.\end{gathered} (70) where we remind that \chi_{p}\equiv P/N . To make the \mathbf{J}_{c} independent from the fields \{\bm{\psi}_{a}\} , we introduce the auxiliary fields \bm{\omega}_{a,c}=\frac{1}{\sqrt{P}}\mathbf{W}^{\intercal}(\bm{\psi}_{a}\odot\bm{\gamma}_{c})) through delta functions \begin{gathered}1=\int\prod_{c=1}^{C}d\bm{\Omega}_{c}\delta(\sqrt{P}\bm{\omega}_{a,c}-\mathbf{W}^{\intercal}(\bm{\psi}_{a}\odot\bm{\gamma}_{c})))\\ \\ =\int\prod_{c=1}^{C}d\bm{\Omega}_{c}\frac{d\widehat{\bm{\Omega}}_{c}}{(2\pi)^{nN}}e^{i\sqrt{P}\bm{\omega}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{a,c}-i\widehat{\bm{\omega}}_{a,c}^{\intercal}\mathbf{W}^{\intercal}(\bm{\psi}_{a}\odot\bm{\gamma}_{c}))}\end{gathered} (71) where we set d\bm{\Omega}_{c}=d\bm{\omega}_{1,c}\cdots d\bm{\omega}_{n,c} and d\widehat{\bm{\Omega}}_{c}=d\widehat{\bm{\omega}}_{1,c}\cdots d\widehat{\bm{\omega}}_{n,c} . After averaging over the data, eq. ( 67 ) becomes \begin{gathered}\,\\ \mathbb{E}_{{\{\mathbf{X}_{c},\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}}\Biggl[\int d\bm{\Psi}\,\prod_{a=1}^{n}e^{-\frac{1}{2}\sum_{c=1}^{C}b_{c}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}\bm{\varsigma}_{c}-z\mathbf{I}_{P})\bm{\psi}_{a}-\frac{1}{2\,M}\bm{\psi}_{a}^{\intercal}\sum_{c=1}^{C}\widetilde{\mathbf{G}}_{c}\widetilde{\mathbf{G}}_{c}^{\intercal}\bm{\psi}_{a}}\\ \,\\ \times e^{-\frac{\Delta}{2N}\bm{\psi}_{a}^{\intercal}\left(\sum_{c=1}^{C}\frac{b_{c}}{\Gamma_{c}^{2}}\widetilde{\bm{\gamma}}_{c}\widetilde{\bm{\gamma}}_{c}^{\intercal}\right)\odot\,\mathbf{W}\mathbf{W}^{\intercal}\bm{\psi}_{a}}\Biggr]\\ \,\\ =\mathbb{E}_{\{\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}\Biggl[\int d\bm{\Psi}\int\prod_{c}d\bm{\Omega}_{c}\frac{d\widehat{\bm{\Omega}}_{c}}{(2\pi)^{Nn}}e^{i\sqrt{P}\sum_{c}\sum_{a}\bm{\omega}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{a,c}-\frac{1}{2}\sum_{c}b_{c}\sum_{a}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}\bm{\varsigma}_{c}-z\mathbf{I}_{P})\bm{\psi}_{a}}\\ \,\\ \times e^{-\frac{P\Delta}{2Ne^{-2t}}\sum_{c}\sum_{a}\frac{b_{c}}{\sigma_{c}^{2}}\bm{\omega}_{a,c}^{\intercal}\bm{\omega}_{a,c}+\frac{\chi_{p}}{2M^{2}}\sum_{c}\sum_{\nu=1}^{M_{c}}\sum_{ab}(\bm{\psi}_{a}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)})(\bm{\psi}_{b}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)})\bm{\omega}_{a,c}^{\intercal}(\mathbf{I}_{N}+\frac{\chi_{p}}{M}\bm{J}_{c})^{-1}\bm{\omega}_{a,c}}\\ \,\\ \times e^{-\frac{M}{2}\sum_{c}b_{c}\log\det(\mathbf{I}_N+\frac{\chi_p}{M}\boldsymbol{J}_{c})-i\sum_{c}\sum_{a}\widehat{\bm{\omega}}_{a,c}^{\intercal}\mathbf{W}^{\intercal}(\bm{\psi}_{a}\odot\bm{\gamma}_{c}))-\frac{1}{2M}\sum_{c}\sum_{a}\bm{\psi}_{a}^{\intercal}\widetilde{\bm{\eta}}_{\nu}^{(c)}(\widetilde{\bm{\eta}}_{\nu}^{(c)})^{\intercal}\bm{\psi}_{a}}\Biggr].\end{gathered} • Average over the GEP noise \{\mathbf{\widetilde{H}}_{c}\}_{c=1}^{C} : again, the average over the GEP noise can be factorized in the different classes \begin{gathered}\mathbb{E}_{\mathbf{\widetilde{H}}_{c}}\Biggl[e^{-\tfrac{1}{2}\sum_{a}\bm{\psi}_{a}^{\intercal}\mathbf{A}^{(H_{c},W)}\bm{\psi}_{a}+\frac{\chi_{p}}{2M^{2}}\sum_{\nu=1}^{S_{c}}\sum_{ab}\big(\widetilde{\bm{\eta}}_{\nu}^{(c)}\big)^{\intercal}\bm{\psi}_{a}\,\bm{\psi}_{b}^{\intercal}\bm{\eta}_{\nu}^{(c)}\,\bm{\omega}_{a,c}^{\intercal}[\mathbf{I}_{N}+\frac{\chi_{p}}{M}\bm{J}_{c}]^{-1}\bm{\omega}_{b,c}}\Biggr]=\\ \,\\ \prod_{\nu=1}^{M_{c}}\int\frac{d\widetilde{\bm{\eta}}_{\nu}^{(c)}\,e^{-\frac{1}{2}(\widetilde{\bm{\eta}}_{\nu}^{c})^{\intercal}\operatorname{diag}(\bm{h}_{c}^{\odot 2})^{-1}\widetilde{\bm{\eta}}_{\nu}^{c}}}{(2\pi)^{P/2}\sqrt{\det(\operatorname{diag}(\boldsymbol{h}_c^{\odot 2}))}}e^{-\frac{1}{2}\big(\widetilde{\bm{\eta}}_{\nu}^{(c)}\big)^{\intercal}\sum_{ab}\left[\frac{\delta_{ab}}{M}\bm{\psi}_{a}\bm{\psi}_{a}^{\intercal}-\frac{\chi_{p}}{2M^{2}}\,\bm{\psi}_{a}\,\bm{\omega}_{a,c}^{\intercal}[\mathbf{I}_{N}+\frac{\chi_{p}}{S}\bm{J}_{c}]^{-1}\bm{\omega}_{b,c}\bm{\psi}_{b}^{\intercal}\right]\widetilde{\bm{\eta}}_{\nu}^{(c)}\,}=\\ \,\\ e^{-\frac{M_{c}}{2}\log\det\left(\mathbf{I}_{P}+\frac{1}{M}\operatorname{diag}(\bm{h}_{c})\bm{\mathcal{J}}_{c}\operatorname{diag}(\bm{h}_{c})\right)}\\ \,\\ \text{where}\\ \,\\ \bm{\mathcal{J}}_{c}(\bm{\psi},\bm{\omega}_{c})=\sum_{ab}\bm{\psi}_{a}\bm{\psi}_{b}^{\intercal}\left(\delta_{ab}-\frac{\chi_{p}}{M}\bm{\omega}_{a,c}^{\intercal}\left(\bm{I}_{N}+\frac{\chi_{p}}{M}\bm{J}_{c}(\bm{\omega}_{c})\right)^{-1}\bm{\omega}_{b,c}\right).\end{gathered} (72) We introduce the projected class centroids \bm{\mu}_{c}=\frac{1}{\sqrt{N}}\mathbf{W}\bm{m}_{c} with a Dirac delta: 1=\int\prod_{c=1}^{C}d\bm{\mu}_{c}\delta\left(\bm{\mu}_{c}-\frac{1}{\sqrt{N}}\mathbf{W}\bm{m}_{c}\right)=\int\prod_{c=1}^{C}d\bm{\mu}_{c}\frac{d\bm{\mu}_{c}}{(2\pi)^{P}}e^{i\widehat{\bm{\mu}}_{c}^{\intercal}\bm{\mu}_{c}-\frac{i}{\sqrt{N}}\widehat{\bm{\mu}}_{c}^{\intercal}\mathbf{W}\bm{m}_{c}} (73) After averaging over the data and the GEP noise, eq. ( 67 ) becomes \begin{gathered}\,\\ \mathbb{E}_{{\{\mathbf{X}_{c},\mathbf{H}_{c}\}_{c=1}^{C},\mathbf{W}}}\Biggl[\int d\bm{\Psi}\,\prod_{a=1}^{n}e^{-\frac{1}{2}\sum_{c=1}^{C}b_{c}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}\bm{\varsigma}_{c}-z\mathbf{I}_{P})\bm{\psi}_{a}-\frac{1}{2\,M}\bm{\psi}_{a}^{\intercal}\sum_{c=1}^{C}\widetilde{\mathbf{G}}_{c}\widetilde{\mathbf{G}}_{c}^{\intercal}\bm{\psi}_{a}}\\ \,\\ \times e^{-\frac{\Delta}{2N}\bm{\psi}_{a}^{\intercal}\left(\sum_{c=1}^{C}\frac{b_{c}}{\Gamma_{c}^{2}}\widetilde{\bm{\gamma}}_{c}\widetilde{\bm{\gamma}}_{c}^{\intercal}\right)\odot\,\mathbf{W}\mathbf{W}^{\intercal}\bm{\psi}_{a}}\Biggr]\\ \,\\ =\mathbb{E}_{\mathbf{W}}\Biggl[\int d\bm{\Psi}\int\prod_{c}d\bm{\Omega}_{c}\frac{d\widehat{\bm{\Omega}}_{c}}{(2\pi)^{nN}}d\bm{\mu}_{c}\frac{d\bm{\mu}_{c}}{(2\pi)^{P}}e^{i\sqrt{P}\sum_{c}\sum_{a}\bm{\omega}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{a,c}+i\sum_{c}\widehat{\bm{\mu}}_{c}^{\intercal}\bm{\mu}_{c}}\\ \,\\ \times e^{-\frac{1}{2}\sum_{c}b_{c}\sum_{a}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}\bm{\varsigma}_{c}-z\mathbf{I}_{P})\bm{\psi}_{a}-\frac{P\Delta}{2Ne^{-2t}}\sum_{c}\sum_{a}\frac{b_{c}}{\sigma_{c}^{2}}\bm{\omega}_{a,c}^{\intercal}\bm{\omega}_{a,c}-\frac{M}{2}\sum_{c}b_{c}\log\det\left(\mathbf{I}_{P}+\frac{1}{M}\operatorname{diag}(\bm{h}_{c})\bm{\mathcal{J}}_{c}\operatorname{diag}(\bm{h}_{c})\right)}\\ \,\\ \times e^{-\frac{M}{2}\sum_{c}b_{c}\log\det(\mathbf{I}_N+\frac{\chi_p}{M}\boldsymbol{J}_{c})-i\sum_{c}\sum_{a}\widehat{\bm{\omega}}_{a,c}^{\intercal}\mathbf{W}^{\intercal}(\bm{\psi}_{a}\odot\bm{\gamma}_{c})-\frac{i}{\sqrt{N}}\sum_{c}\widehat{\bm{\mu}}_{c}^{\intercal}\mathbf{W}\bm{m}_{c}}\Biggr].\end{gathered} • Average over the random features: \begin{gathered}\mathbb{E}_{W}\left[e^{-i\sum_{c}\left[\frac{1}{\sqrt{N}}\widehat{\bm{\mu}}_{c}^{\intercal}\bm{W}\bm{m}_{c}+\sum_{a}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}\bm{W}\widehat{\bm{\omega}}_{a,c}\right]}\right]=\\ \,\\ \int\prod_{pj}\frac{dW_{pj}}{\sqrt{2\pi}}e^{-\frac{1}{2}\sum_{pj}W_{pj}^{2}-i\sum_{c}\left[\frac{1}{\sqrt{N}}\widehat{\bm{\mu}}_{c}^{\intercal}\bm{W}\bm{m}_{c}+\sum_{a}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}\bm{W}\widehat{\bm{\omega}}_{a,c}\right]}=\\ \,\\ e^{-\frac{1}{2N}\sum_{c,c^{\prime}}\bm{m}_{c}^{\intercal}\bm{m}_{c^{\prime}}\,\widehat{\bm{\mu}}_{c}^{\intercal}\widehat{\bm{\mu}}_{c^{\prime}}-\frac{1}{2}\sum_{c,c^{\prime}}\sum_{ab}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}(\bm{\gamma}_{c^{\prime}}\odot\bm{\psi}_{b})\,\widehat{\bm{\omega}}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{b,c^{\prime}}+o_{P}(P)}\end{gathered} (74) The term that is o_{P}(P) is -\frac{1}{\sqrt{N}}\sum_{c,c^{\prime}}\sum_{a}(\widehat{\bm{\omega}}_{a,c}^{\intercal}\bm{m}_{c})\,(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}\widehat{\bm{\mu}}_{c^{\prime}} : the first dot yields an O_{P}(\sqrt{P}) contribution, the second an \mathcal{O}_{P}(1) one, given that \lVert\widehat{\bm{\omega}}_{a,c}\lVert=\mathcal{O}_{P}(1) ; then, the overall scaling of the last term is \mathcal{O}_{P}(1) , and thus can be neglected, since the first two terms in the last side of ( 74 ) are \mathcal{O}_{P}(P) . The average of the replicated partition function, after the three disorder averages over data, GEP noise and random features, reads \begin{gathered}\overline{\mathcal{Z}^{n}}=\int\prod_{c}\left(d\bm{\mu}_{c}\,\frac{d\widehat{\bm{\mu}}_{c}}{(2\pi)^{P}}\right)\,e^{-\frac{1}{2N}\sum_{c,c^{\prime}}\bm{m}_{c}^{\intercal}\bm{m}_{c^{\prime}}\,\widehat{\bm{\mu}}_{c}^{\intercal}\widehat{\bm{\mu}}_{c^{\prime}}+i\sum_{c}\widehat{\bm{\mu}}_{c}^{\intercal}\bm{\mu}_{c}}\\ \,\\ \times\int\prod_{c}\left(d\bm{\Omega}_{c}\,\frac{d\widehat{\bm{\Omega}}_{c}}{(2\pi)^{nN}}\right)e^{-\frac{P\Delta}{2Ne^{-2t}}\sum_{c}\sum_{a}\frac{b_{c}}{\sigma_{c}^{2}}\bm{\omega}_{a,c}^{\intercal}\bm{\omega}_{a,c}+i\sqrt{P}\sum_{c}\sum_{a}\widehat{\bm{\omega}}_{a,c}^{\intercal}\bm{\omega}_{a,c}}\\ \,\\ \times\int d\bm{\Psi}e^{-\frac{1}{2}\sum_{c}b_{c}\sum_{a}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}(\bm{\varsigma}_{c})-z\bm{I}_{P})\bm{\psi}_{a}}e^{-\frac{M}{2}\sum_{c}b_{c}\log\det(\boldsymbol{I}_N +\frac{\chi_p}{M}\boldsymbol{J}_c)}\\ \,\\ \times e^{-\frac{M}{2}\sum_{c}b_{c}\log\det\left(I_{P}+\frac{1}{M}\operatorname{diag}(\bm{h}_{c})\bm{\mathcal{J}}_{c}\operatorname{diag}(\bm{h}_{c})\right)-\frac{1}{2}\sum_{c,c^{\prime}}\sum_{ab}(\bm{\gamma}_{c}\odot\bm{\psi}_{a})^{\intercal}(\bm{\gamma}_{c^{\prime}}\odot\bm{\psi}_{b})\,\widehat{\bm{\omega}}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{b,c^{\prime}}}\end{gathered} (75) We can perform the gaussian integrations with respect to the \widehat{\bm{\omega}}_{a,c} and the \widehat{\bm{\mu}}_{c} : we start with the integral over the \widehat{\bm{\omega}}_{a,c} : \begin{gathered}\int\frac{d\widehat{\mathbf{\Omega}}_{c}}{(2\pi)^{CnN}}\,e^{-\frac{1}{2}\sum_{cc^{\prime}}\sum_{ab}K_{ab}^{cc^{\prime}}\widehat{\bm{\omega}}_{a;c}^{\intercal}\widehat{\bm{\omega}}_{b;c^{\prime}}-\sum_{a}\sum_{c}i\bm{\omega}_{a,c}^{\intercal}\widehat{\bm{\omega}}_{a,c}}=\\ \,\\ =\frac{1}{(2\pi)^{CnN/2}}e^{-\frac{1}{2}\sum_{cc^{\prime}}\sum_{ab}(\mathbf{K}^{-1})_{ab}^{cc^{\prime}}\bm{\omega}_{a;c}^{\intercal}\bm{\omega}_{b;c^{\prime}}-\frac{N}{2}\log\det\mathbf{K}},\\ \,\\ \,\\ K_{ab}^{cc^{\prime}}=\frac{1}{P}\operatorname{Tr}\left(\bm{\gamma}_{c}\bm{\gamma}_{c^{\prime}}^{\intercal}\odot\bm{\psi}_{a}\bm{\psi}_{b}^{\intercal}\right).\end{gathered} (76) Then, the integration over the \widehat{\bm{\mu}}_{c} : it yields the pdf of the \bm{\mu}_{c} \begin{gathered}\int\frac{d\widehat{\bm{\mu}_{c}}}{(2\pi)^{P/2}}e^{-\frac{1}{2}\sum_{cc^{\prime}}r_{cc^{\prime}}\widehat{\bm{\mu}}_{c}^{\intercal}\widehat{\bm{\mu}}_{c^{\prime}}+i\sum_{c}\widehat{\bm{\mu}}_{c}^{\intercal}\bm{\mu}_{c}}=\frac{e^{-\frac{1}{2}\sum_{cc^{\prime}}(\mathbf{r}^{-1})_{cc^{\prime}}\bm{\mu}_{c}^{\intercal}\bm{\mu}_{c^{\prime}}}}{(2\pi\det\mathbf{r})^{P/2}},\\ \,\\ \,\\ r_{cc^{\prime}}=\frac{1}{N}\mathbf{m}_{c}^{\intercal}\mathbf{m}_{c^{\prime}}.\end{gathered} (77) Thus, after these integrations the partition function reads \begin{gathered}\overline{\mathcal{Z}^{n}}=\int\prod_{c}\frac{d\bm{\mu}_{c}}{(2\pi)^{P/2}}\,e^{-\frac{1}{2}\sum_{c,c^{\prime}}(\mathbf{r}^{-1})_{cc^{\prime}}\,\bm{\mu}_{c}^{\intercal}\bm{\mu}_{c^{\prime}}-\frac{1}{2}\log\det\mathbf{r}}\\ \times\int\prod_{c}d\bm{\Omega}_{c}e^{-\frac{\chi_{p}\Delta}{2e^{-2t}}\sum_{c}\sum_{a}\frac{b_{c}}{\sigma_{c}^{2}}\bm{\omega}_{a,c}^{\intercal}\bm{\omega}_{a,c}}\\ \,\\ \times\int d\bm{\Psi}e^{-\frac{1}{2}\sum_{c}b_{c}\sum_{a}\bm{\psi}_{a}^{\intercal}(\operatorname{diag}(\bm{\varsigma}_{c})-z\bm{I}_{P})\bm{\psi}_{a}-\frac{1}{2}\sum_{ab}\sum_{cc^{\prime}}(\mathbf{K}(\bm{\Psi})^{-1})_{ab}^{cc^{\prime}}\bm{\omega}_{a;c}^{\intercal}\bm{\omega}_{b;c^{\prime}}}\\ \,\\ \times e^{-\frac{N}{2}\log\det\mathbf{K}(\bm{\Psi})-\frac{M}{2}\sum_{c}b_{c}\log\det(\mathbf{I}_N+\frac{\chi_p}{M}\boldsymbol{J}_c)-\frac{M}{2}\sum_{c}b_{c}\log\det\left(\mathbf{I}_{P}+\frac{1}{M}\operatorname{diag}(\bm{h}_{c})\bm{\mathcal{J}}_{c}\operatorname{diag}(\bm{h}_{c})\right).}\end{gathered} (78) Note that all the dependence on the projected centroids \bm{\mu}_{c} is in the GEP Hermite coefficients, that features in the quantities \bm{\varsigma}_{c},\bm{h}_{c},\mathbf{J}_{c},\mathbf{\mathcal{J}}_{c} . We now introduce the order parameters of the problem: they are the following resolvent functions \begin{gathered}g_{ab}^{(\Psi)}=\frac{1}{P}\operatorname{Tr}\bm{\psi}_{a}\bm{\psi}_{b}^{\intercal}\qquad g_{a;c}^{(\Psi,\varsigma)}=\frac{1}{P}\operatorname{Tr}\operatorname{diag}(\bm{\varsigma}_{c})\bm{\psi}_{a}\bm{\psi}_{a}^{\intercal}\qquad g_{ab;cc^{\prime}}^{(\Psi,\gamma)}=\frac{1}{P}\operatorname{Tr}\bm{\gamma}_{c}\bm{\gamma}_{c^{\prime}}^{\intercal}\odot\bm{\psi}_{a}\bm{\psi}_{b}^{\intercal}\\ \,\\ g_{a;c}^{(\Psi,h)}=\frac{1}{P}\operatorname{Tr}\bm{h}_{c}\bm{h}_{c}^{\intercal}\odot\bm{\psi}_{a}\bm{\psi}_{a}^{\intercal}\qquad\qquad g_{ab;cc^{\prime}}^{(\Omega)}=\frac{1}{N}\operatorname{Tr}\bm{\omega}_{a,c}\bm{\omega}_{b,c^{\prime}}^{\intercal}.\end{gathered} (79) We enforce them in ( 78 ) through delta functions: 1=\int d\{g_{ab}^{(\Psi)}\}\frac{d\{\widehat{g}_{ab}^{(\Psi)}\}}{(2\pi)^{n^{2}}}e^{iP\sum_{ab}\widehat{g}_{ab}^{(\Psi)}g_{ab}^{(\Psi)}-i\sum_{ab}\widehat{g}_{ab}^{(\Psi)}\bm{\psi}_{a}^{\intercal}\bm{\psi}_{b}} 1=\int d\{g_{a,c}^{(\Psi,\varsigma)}\}\frac{d\{\widehat{g}_{a,c}^{(\Psi,\varsigma)}\}}{(2\pi)^{nC}}e^{iP\sum_{a}\sum_{c}\widehat{g}_{a;c}^{(\Psi,\varsigma)}g_{a;c}^{(\Psi,\varsigma)}-i\sum_{a}\sum_{c}\widehat{g}_{a;c}^{(\Psi,\varsigma)}\bm{\psi}_{a}^{\intercal}\operatorname{diag}(\bm{\varsigma}_{c})\bm{\psi}_{a}} 1=\int d\{g_{ab,cc^{\prime}}^{(\Psi,\gamma)}\}\frac{d\{\widehat{g}_{ab,cc^{\prime}}^{(\Psi,\gamma)}\}}{(2\pi)^{n^{2}C^{2}}}e^{iP\sum_{ab}\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Psi,\gamma)}g_{ab;cc^{\prime}}^{(\Psi,\gamma)}-i\sum_{ab}\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Psi,\gamma)}\bm{\psi}_{a}^{\intercal}\bm{\gamma}_{c}\bm{\gamma}_{c^{\prime}}^{\intercal}\bm{\psi}_{b}} 1=\int d\{g_{a,c}^{(\Psi,h)}\}\frac{d\{\widehat{g}_{a,c}^{(\Psi,h)}\}}{(2\pi)^{nC}}e^{iP\sum_{a}\sum_{c}\widehat{g}_{a;c}^{(\Psi,h)}g_{a;c}^{(\Psi,h)}-i\sum_{a}\sum_{c}\widehat{g}_{a;c}^{(\Psi,h)}\bm{\psi}_{a}^{\intercal}\bm{h}_{c}\bm{h}_{c}^{\intercal}\bm{\psi}_{a}} 1=\int d\{g_{ab,cc^{\prime}}^{(\Psi,\Omega)}\}\frac{d\{\widehat{g}_{ab,cc^{\prime}}^{(\Psi,\Omega)}\}}{(2\pi)^{n^{2}C^{2}}}e^{iN\sum_{ab}\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Psi,\Omega)}g_{ab;cc^{\prime}}^{(\Psi,\Omega)}-i\sum_{ab}\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Psi,\Omega)}\bm{\omega}_{a,c}^{\intercal}\bm{\omega}_{b,c^{\prime}}} Then, we can integrate over the \bm{\Psi} and the \mathbf{\Omega}_{c} 3 3 3 We ignore factors that are not exponential in system size : \begin{gathered}\int d\bm{\Psi}e^{-i\sum_{ab}\bm{\psi}_{a}^{\intercal}\left[\widehat{g}_{ab}^{(\Psi)}\mathbf{I}_{P}+\delta_{ab}\sum_{c}\widehat{g}_{a;c}^{(\Psi,\varsigma)}\operatorname{diag}(\bm{\varsigma}_{c})+\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Psi,\gamma)}\operatorname{diag}(\bm{\gamma}_{c}\odot\bm{\gamma}_{c^{\prime}})+\delta_{ab}\sum_{c}\widehat{g}_{a;c}^{(\Psi,h)}\operatorname{diag}(\bm{h}_{c}^{\odot 2})\right]\bm{\psi}_{b}}\\ \\ \propto e^{-\frac{1}{2}\log\det\left(i\widehat{\mathbf{G}}^{(\Psi)}\otimes\mathbf{I}_{P}+\sum_{c}i\widehat{\bm{G}}_{c}^{(\Psi,\varsigma)}\otimes\,\operatorname{diag}(\bm{\varsigma}_{c})+\sum_{cc^{\prime}}i\widehat{\bm{G}}_{cc^{\prime}}^{(\Psi,\gamma)}\otimes\,\operatorname{diag}(\bm{\gamma}_{c}\odot\bm{\gamma}_{c^{\prime}})+\sum_{c}i\widehat{\bm{G}}_{c}^{(\Psi,h)}\otimes\,\operatorname{diag}(\bm{h}_{c}^{\odot 2})\right)}\end{gathered} \int d\{\bm{\Omega}_{c}\}\,e^{-i\sum_{ab}\sum_{cc^{\prime}}\widehat{g}_{ab;cc^{\prime}}^{(\Omega)}\bm{\omega}_{a;b}^{\intercal}\bm{\omega}_{b;c^{\prime}}}\propto e^{-\frac{N}{2}\log\det\left(i\widehat{\bm{G}}^{(\Omega)}\right)} We impose a Replica-Symmetric (RS) ansatz 4 4 4 Random matrix theories are notoriously RS stable . The RS diagonal ansatz for the replica is usually used ab initio, but it can be easily verified starting from a more generic RS ansatz. g_{ab}^{(\Psi)}=\begin{cases}g^{(\Psi)}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases}\qquad\widehat{g}_{ab}^{(\Psi)}=\begin{cases}\widehat{g}^{(\Psi)}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases} (80) g_{a;c}^{(\Psi,\varsigma)}=g_{c}^{(\Psi,\varsigma)}\qquad\widehat{g}_{a;c}^{(\varsigma)}=\widehat{g}_{c}^{(\varsigma)} (81) g_{ab;cc^{\prime}}^{(\Psi,\varsigma)}=\begin{cases}g_{cc^{\prime}}^{(\Psi,\varsigma)}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases}\qquad\widehat{g}_{ab;cc^{\prime}}^{(\varsigma)}=\begin{cases}\widehat{g}_{cc^{\prime}}^{(\varsigma)}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases} (82) g_{a;c}^{(\Psi,h)}=g_{c}^{(\Psi,h)}\qquad\widehat{g}_{a;c}^{(h)}=\widehat{g}_{c}^{(h)} (83) g_{ab;cc^{\prime}}^{(\Omega)}=\begin{cases}g^{(\Omega)}_{cc^{\prime}}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases}\qquad\widehat{g}_{ab;cc^{\prime}}^{(\Omega)}=\begin{cases}\widehat{g}^{(\Omega)}_{cc^{\prime}}\qquad a=b\\ \,\\ 0\qquad a\neq b\end{cases} (84) The order parameters ( 79 ) represent the statistics sufficient to characterize the spectral properties of the matrix \widehat{\mathbf{U}} : the g^{(\Psi)} represent the resolvent function of \widehat{\mathbf{U}} itself (see eq. ( 91 ) later in the text), while the other order parameters capture the influence of different elements of the RF model to the spectrum of \widehat{U} . The g_{cc^{\prime}}^{(\Omega)} are resolvent functions of the projection of \widehat{\mathbf{U}} in data space: one can verify that g_{cc^{\prime}}^{(\Omega)}=\frac{1}{NP}\operatorname{Tr}\left[\mathbf{W}^{\intercal}\operatorname{diag}(\bm{\gamma}_{c})(\widehat{\mathbf{U}}-z)^{-1}\operatorname{diag}(\bm{\gamma}_{c^{\prime}})\mathbf{W}\right]. (85) They capture the autocorrelation ( c=c^{\prime} ) and cross-correlations ( c\neq c^{\prime} ) of classes observed by the model, projected back in the data space. The resolvents g_{c}^{(\Psi,h)},g_{c}^{(\Psi,\varsigma)} respectively capture the effect of GEP noise variances ( \bm{h}_{c}^{\odot 2} ) and feature variances ( \bm{\varsigma}_{c} ): one can check that g_{c}^{(\Psi,h)}=\frac{1}{P}\operatorname{Tr}\left[\operatorname{diag}(\bm{h}_{c})(\widehat{\mathbf{U}}-z)^{-1}\operatorname{diag}(\bm{h}_{c})\right] (86) g_{c}^{(\Psi,\varsigma)}=\frac{1}{P}\operatorname{Tr}\left[\operatorname{diag}(\bm{\varsigma}_{c}^{\odot 1/2})(\widehat{\mathbf{U}}-z)^{-1}\operatorname{diag}(\bm{\varsigma}_{c}^{\odot 1/2})\right]. (87) Finally, g_{cc^{\prime}}^{(\Psi,\gamma)} express class correlations observed by the model in features space: g_{cc^{\prime}}^{(\Psi,\gamma)}=\frac{1}{P}\operatorname{Tr}\left[\operatorname{diag}(\bm{\gamma}_{c})(\widehat{\mathbf{U}}-z)^{-1}\operatorname{diag}(\bm{\gamma}_{c^{\prime}})\right]. (88) When centroids are extensive, these effects are heterogeneous in feature space: the model displays a different expressivity among the different hidden neurons. Essentially, centroids make neurons activations statistically correlated. In contrast, in the limit of subextensive centroids studied later in section F.3 , the model acts homogeneously on the different hidden neurons: in this limit, one has \bm{\gamma}_{c}\rightarrow\gamma_{c}\bm{1}_{P} and similarly for the other GEP vectors. After clarifying the meaning of the order parameters, we proceed by simplifying all the terms in eq. ( 78 ), taking into account the previous integrations over the \mathbf{\Psi},\mathbf{\Omega} : \begin{gathered}\log\det\Biggl(i\widehat{\mathbf{G}}^{(\Psi)}\otimes\mathbf{I}_{P}+\sum_{c}i\widehat{\bm{G}}_{c}^{(\Psi,\varsigma)}\otimes\,\operatorname{diag}(\bm{\varsigma}_{c})\\ +\sum_{cc^{\prime}}i\widehat{\bm{G}}_{cc^{\prime}}^{(\Psi,\gamma)}\otimes\,\operatorname{diag}(\bm{\gamma}_{c}\odot\bm{\gamma}_{c^{\prime}})+\sum_{c}i\widehat{\bm{G}}_{c}^{(\Psi,h)}\otimes\,\operatorname{diag}(\bm{h}_{c}^{\odot 2})\Biggr)\simeq\\ \,\\ n\log\det\left(i\widehat{g}_{\Psi}\mathbf{I}_{P}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\operatorname{diag}(\bm{\varsigma}_{c})+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\operatorname{diag}(\bm{\gamma}_{c}\odot\bm{\gamma}_{c^{\prime}})+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}\operatorname{diag}(\bm{h}_{c}^{\odot 2})\right)=\\ \,\\ n\sum_{p=1}^{P}\log\left(i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}\right)\end{gathered} \log\det\left(i\widehat{\bm{G}}^{(\Omega)}\right)\simeq n\log\det i\{\widehat{g}_{cc^{\prime}}^{(\Omega)}\}_{cc^{\prime}} \log\det\left(\bm{I}_{N}+\frac{\chi_{p}}{\chi_{m}}\bm{J}_{c}\right)\simeq n\log\left(1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}\right) \log\det\left(\mathbf{I}_{P}+\frac{1}{\chi_{m}}\operatorname{diag}(\bm{h}_{c}^{\odot 2})\bm{\mathcal{J}}_{c}\right)\simeq n\log\left[1+\frac{\chi_{p}}{\chi_{m}}\left(1-\frac{\chi_{p}}{\chi_{m}}\frac{g_{cc}^{(\Omega)}}{1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}}\right)g_{a;c}^{(\Psi,h)}\right] \mathrm{K}_{ab}^{cc^{\prime}}=\delta_{ab}g_{cc^{\prime}}^{(\Psi,\gamma)}\Longrightarrow(\bm{\mathrm{K}}^{-1})_{ab}^{cc^{\prime}}=\delta_{ab}\,(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc^{\prime}} \frac{1}{2\chi_{p}}\sum_{ab}\sum_{cc^{\prime}}(\mathbf{K}(\bm{g}^{(\Psi,\gamma)})^{-1})_{ab}^{cc^{\prime}}g_{ab;cc^{\prime}}^{(\Omega)}\simeq\frac{n}{2\chi_{p}}\sum_{cc^{\prime}}(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc^{\prime}}g_{cc^{\prime}}^{(\Omega)} \frac{1}{2\chi_{p}}\log\det\bm{\mathrm{K}}\simeq\frac{n}{2\chi_{p}}\log\det\bm{g}^{(\Psi,\gamma)} Here and in the following lines, the symbols \bm{g}^{(\Psi,\gamma)} and \bm{g}^{(\Omega)} indicate the matrices g_{cc^{\prime}}^{(\Psi,\gamma)} , g_{cc^{\prime}}^{(\Omega)} for c,c^{\prime}=1,\dots,C . Collecting everything, we can finally write \overline{\mathcal{Z}^{n}}\propto\mathbb{E}_{\{\mu_{c}\}}\left[\int d\{\bm{g}^{(all)}\}d\{\widehat{\bm{g}}^{(all)}\}e^{nP\mathcal{F}\left(\{\bm{g}^{(all))},\widehat{\bm{g}}^{(all)}\}\right)}\right]\propto\mathbb{E}_{\{\mu_{c}\}}\left[e^{nP\mathcal{F}\left(\{\bm{g}_{*}^{(all))}\text{,}\,\widehat{\bm{g}}_{*}^{(all)}\}\right)}\right] (89) The compact notation \{\bm{g}^{(all)}\},\{\widehat{\bm{g}}^{(all)}\} identifies all the order parameters and their conjugated parameters. The, in its final form, reads \begin{gathered}\mathcal{F}\left(\{\bm{g}^{(all))}\text{,}\,\widehat{\bm{g}}^{(all)}\}\right)=i\widehat{g}_{\Psi}g_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}g_{c}^{(\Psi,\varsigma)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}g_{cc^{\prime}}^{(\Psi,\gamma)}\\ \,\\ +\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}g_{c}^{(\Psi,h)}+\frac{1}{\chi_{p}}\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Omega)}g_{cc^{\prime}}^{(\Omega)}-\frac{1}{2\chi_{p}}\log\det i\widehat{\bm{g}}_{\Omega}\,\\ \\ -\frac{1}{2P}\sum_{p=1}^{P}\log\left(i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}\right)\\ \;\\ -\frac{\Delta}{2e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}g_{cc}^{(\Omega)}-\frac{1}{2\chi_{p}}\sum_{cc^{\prime}}(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc^{\prime}}g_{cc^{\prime}}^{(\Omega)}\\ \,\\ -\frac{1}{2\chi_{p}}\log\det\bm{g}^{(\Psi,\gamma)}-\frac{1}{2}\sum_{c}b_{c}\left(g_{c}^{(\Psi,\varsigma)}-z\;g^{(\Psi)}\right)\\ \,\\ -\frac{\chi_{m}}{2\chi_{p}}\sum_{c}b_{c}\log\left(1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{c}^{(\Psi,h)}\right)\end{gathered} (90) We finally use ( 64 ) to get \begin{gathered}g(z)=2\frac{\partial}{\partial z}\lim_{P\rightarrow\infty}\frac{1}{P}\mathbb{E}_{\mathbf{X},\mathbf{W}}\left[\log\mathcal{Z}_{U}\right]=\\ 2\frac{\partial}{\partial z}\lim_{n\rightarrow 0}\lim_{P\rightarrow\infty}\frac{1}{P}\frac{\mathbb{E}_{\{\bm{\mu_{c}}\}}\left[e^{nP\mathcal{F}}\right]-1}{n}=2\frac{\partial}{\partial z}\mathbb{E}_{\{\mu_{c}\}}\left[\mathcal{F}\right]=g_{\Psi}^{*}(z).\end{gathered} (91) The order parameter g_{\Psi}^{*} maximising the action ( 90 ) is the resolvent function that we wish to determine. This quantity depends on all the other resolvents appearing in ( 90 ): to understand how, we need to write the saddle point equations for ( 90 ), whose solutions are the resolvents yielding the maximum of ( 90 ). For brevity of notation, in the symbol we omit the symbol * on the resolvents, used to indicate solutions of saddle point equations. We start with those for the conjugated order parameters: \frac{\partial\mathcal{F}}{\partial g_{\Psi}}=0\Longrightarrow i\widehat{g}_{\Psi}=-\frac{z}{2} (92) \frac{\partial\mathcal{F}}{\partial g_{c}^{(\Psi,\varsigma)}}=0\Longrightarrow i\widehat{g}_{c}^{(\Psi,\varsigma)}=\frac{b_{c}}{2} (93) \frac{\partial\mathcal{F}}{\partial g_{c}^{(\Psi,h)}}=0\Longrightarrow i\widehat{g}_{c}^{(\Psi,h)}=\frac{b_{c}}{2}\frac{1}{1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{c}^{(\Psi,h)}} (94) \begin{gathered}\frac{\partial\mathcal{F}}{\partial\bm{g}_{(\Psi,\gamma)}}=0\Longrightarrow i\widehat{\bm{g}}_{(\Psi,\gamma)}=\frac{1}{2\chi_{p}}\frac{\partial}{\partial\bm{g}_{(\Psi,\gamma)}}\operatorname{Tr}\left(\bm{g}_{(\Psi,\gamma)}^{-1}\bm{g}_{(\Omega)}^{\intercal}\right)+\frac{1}{2\chi_{p}}\frac{1}{\det\bm{g}^{(\Psi,\gamma)}}\frac{\partial\det\bm{g}^{(\Psi,\gamma)}}{\partial\bm{g}_{(\Psi,\gamma)}}\\ \,\\ \qquad\qquad\qquad=-\frac{1}{2\chi_{p}}\bm{g}_{(\Psi,\gamma)}^{-1}\bm{g}_{\Omega}\bm{g}_{(\Psi,\gamma)}^{-1}+\frac{1}{2\chi_{p}}\bm{g}_{(\Psi,\gamma)}^{-1}\end{gathered} (95) \frac{\partial\mathcal{F}}{\partial g_{cc}^{(\Omega)}}=0\Longrightarrow i\widehat{g}_{cc}^{(\Omega)}=\frac{1}{2}(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc}+\frac{b_{c}}{2}\frac{\chi_{p}}{1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{c}^{(\Psi,h)}}+\frac{\Delta\chi_{p}}{2e^{-2t}}\frac{b_{c}}{\sigma_{c}^{2}} (96) \frac{\partial\mathcal{F}}{\partial g_{cc^{\prime}}^{(\Omega)}}=0\Longrightarrow i\widehat{g}_{cc^{\prime}}^{(\Omega)}=\frac{1}{2}(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc^{\prime}}. (97) Second, we write the saddle point equations for the order parameters: \begin{gathered}\frac{\partial\mathcal{F}}{\partial(i\widehat{g}_{\Psi})}=0\\ \,\\ \Longrightarrow g_{\Psi}=\frac{1}{2P}\sum_{p=1}^{P}\frac{1}{i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}}\end{gathered} (98) \begin{gathered}\frac{\partial\mathcal{F}}{\partial(i\widehat{g}_{c}^{(\Psi,\varsigma)})}=0\\ \,\\ \Longrightarrow g_{c}^{(\Psi,\varsigma)}=\frac{1}{2P}\sum_{p=1}^{P}\frac{\varsigma_{c}^{(p)}}{i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}}\end{gathered} (99) \begin{gathered}\frac{\partial\mathcal{F}}{\partial(i\widehat{g}_{c}^{(\Psi,h)})}=0\\ \,\\ \Longrightarrow g_{c}^{(\Psi,h)}=\frac{1}{2P}\sum_{p=1}^{P}\frac{(h_{c}^{(p)})^{2}}{i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}}\end{gathered} (100) \begin{gathered}\frac{\partial\mathcal{F}}{\partial(i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)})}=0\\ \,\\ \Longrightarrow g_{cc^{\prime}}^{(\Psi,\gamma)}=\frac{1}{2P}\sum_{p=1}^{P}\frac{\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}}{i\widehat{g}_{\Psi}+\sum_{c}i\widehat{g}_{c}^{(\Psi,\varsigma)}\varsigma_{c}^{(p)}+\sum_{cc^{\prime}}i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)}\gamma_{c}^{(p)}\gamma_{c^{\prime}}^{(p)}+\sum_{c}i\widehat{g}_{c}^{(\Psi,h)}(h_{c}^{(p)})^{2}}\end{gathered} (101) \frac{\partial\mathcal{F}}{\partial(i\widehat{g}_{cc^{\prime}}^{(\Omega)})}=0\\ \,\\ \Longrightarrow g_{cc^{\prime}}^{(\Omega)}=\frac{1}{2}((i\widehat{\bm{g}}_{\Omega})^{-1})_{cc^{\prime}}. (102) F.2 Spectral equations for extensive centroids We can finally write the equations necessary to solve for the spectrum of \widehat{\mathbf{U}} , by combining eqs. ( 92 ), ( 94 ), ( 95 ), ( 96 ), ( 97 ) with eqs. ( 98 ), ( 100 ), ( 101 ), ( 102 ). Note that eqs ( 93 ) and ( 99 ) are not necessary to determine the resolvent function g(z)\equiv g_{\Psi}(z) , since i\widehat{g}_{c}^{(\Psi,\varsigma)} is a constant (eq. ( 93 )), independent of all other resolvents. For the sake of compactness, we define the functions \mathcal{D}(\{\mu_{c}\}_{c=1}^{C})=\sum_{c}b_{c}\varsigma_{c}(\mu_{c}) (103) \mathcal{R}_{z}(\{\mu_{c}\}_{c=1}^{C})=-\frac{2}{\chi_{p}}\sum_{cc^{\prime}}\mathrm{y}_{cc^{\prime}}(\bm{g}^{(\Psi,\gamma)},\bm{g}^{(\Omega)})\;\gamma_{c}(\mu_{c})\gamma_{c^{\prime}}(\mu_{c^{\prime}})-\sum_{c}\frac{b_{c}h_{c}^{2}(\mu_{c})}{1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{c}^{(\Psi,h)}} (104) for \mu_{c}\in\mathbb{R},c=1,\dots,C . In eq. ( 104 ), we renamed \mathrm{y}_{cc^{\prime}}=i\widehat{g}_{cc^{\prime}}^{(\Psi,\gamma)},\qquad c,c^{\prime}=1,\dots,C . Moreover, in ( 103 ) and ( 104 ) we introduced the GEP functions \begin{gathered}\varsigma_{c}(\mu)=\widetilde{\beta}_{c}(\mu)-\beta_{c}(\mu)-\frac{\Delta}{\sigma_{c}^{2}e^{-2t}}\gamma_{c}^{2}(\mu)\\ \,\\ h_{c}^{2}(\mu)=\beta_{c}(\mu)-\alpha_{c}^{2}(\mu)-\gamma_{c}^{2}(\mu)\\ \\ \text{with}\\ \,\\ \alpha_{c}(\mu)=\mathbb{E}_{x\sim\mathcal{N}(0,1)}\left[\phi\left(\Gamma_{c}x+e^{-t}\mu\right)\right]\\ \\ \widetilde{\beta}_{c}(\mu)=\mathbb{E}_{x\sim\mathcal{N}(0,1)}\left[\phi^{2}\left(\Gamma_{c}x+e^{-t}\mu\right)\right]\\ \\ \beta_{c}(\mu)=\mathbb{E}_{x_{1},x_{2}\sim\mathcal{N}(0,\bm{\Sigma}_{c}(t))}\left[\phi\left(\Gamma_{c}x_{1}+e^{-t}\mu\right)\phi\left(\Gamma_{c}x_{2}+e^{-t}\mu\right)\right]\\ \\ \gamma_{c}(\mu)=\frac{\sigma_{c}e^{-t}}{\Gamma_{c}(t)}\mathbb{E}_{x\sim\mathcal{N}(0,1)}\left[x\;\phi(\Gamma_{c}(t)x+e^{-t}\mu)\right].\end{gathered} (105) Finally, let us use the notation \mathbb{E}_{\{\mu_{c}\}}\left[\cdot\right]\equiv\int\frac{d\mu_{1},\dots,d\mu_{C}}{(2\pi)^{C/2}\sqrt{\det\bm{r}}}e^{-\frac{1}{2}\sum_{cc^{\prime}}\mu_{c}(\bm{r}^{-1})_{cc^{\prime}}\mu_{c^{\prime}}}(\cdot), (106) with r_{cc^{\prime}}=\frac{1}{N}\bm{m}_{c}\cdot\bm{m}_{c^{\prime}} . Then, in the limit P\rightarrow\infty the resolvent g(z) can be determined by solving the following system of equations for k,k^{\prime}=1,\dots,C : \boxed{\begin{gathered}\\ \qquad g_{k}^{(h)}(z)=\mathbb{E}_{\{\mu_{c}\}}\left[\frac{h_{k}^{2}(\mu_{k})}{\mathcal{D}(\{\mu_{c}\})-z-\mathcal{R}(\{g_{c}^{(h)}(z),g_{cc^{\prime}}^{(\gamma)}(z),g_{cc^{\prime}}^{(\Omega)}(z)\},\{\mu_{c}\})}\right]\qquad\\ \,\\ \,g_{kk^{\prime}}^{(\gamma)}(z)=\mathbb{E}_{\{\mu_{c}\}}\left[\frac{\gamma_{k}(\mu_{k})\gamma_{k^{\prime}}(\mu_{k^{\prime}})}{\mathcal{D}(\{\mu_{c}\})-z-\mathcal{R}(\{g_{c}^{(h)}(z),g_{cc^{\prime}}^{(\gamma)}(z),g_{cc^{\prime}}^{(\Omega)}(z)\},\{\mu_{c}\})}\right]\,\\ \,\\ i\widehat{g}_{kk}^{(\Omega)}=\frac{1}{2}(\bm{g}_{(\gamma)}^{-1})_{kk}+\frac{b_{k}}{2}\frac{\chi_{p}}{1+\frac{\chi_{p}}{\chi_{m}}g_{kk}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{k}^{(h)}}+\frac{\Delta\chi_{p}}{2e^{-2t}}\frac{b_{k}}{\sigma_{k}^{2}}\\ \,\\ i\widehat{g}_{kk^{\prime}}^{(\Omega)}=\frac{1}{2}(\bm{g}_{(\gamma)}^{-1})_{kk^{\prime}}\qquad k\neq k^{\prime}\\ \,\\ \bm{g}_{(\Omega)}=\frac{1}{2}(i\widehat{\bm{g}}_{\Omega})^{-1}.\\ \\ \end{gathered}} (107) For compactness, we simplified the notation of the auxiliary resolvents in eqs ( 107 ). The resolvent g(z) can be computed from the solution of ( 107 ) through the formula \boxed{\begin{gathered}\\ \qquad g(z)=\mathbb{E}_{\{\mu_{c}\}}\left[\frac{1}{\mathcal{D}(\{\mu_{c}\})-z-\mathcal{R}(\{g_{c}^{(h)}(z),g_{cc^{\prime}}^{(\gamma)}(z),g_{cc^{\prime}}^{(\Omega)}(z)\},\{\mu_{c}\})}\right].\qquad\\ \,\\ \end{gathered}} (108) Eqs. like ( 107 ), usually in a much simpler form, appear whenever a random matrix ensemble is non-rotational invariant: by inspection of ( 98 ) and ( 108 ), ( 104 ), ( 103 ), one can deduce that the diagonal entries of the resolvent matrix \mathbf{G}(z) yielded by the replica computation in the limit P\rightarrow\infty are G_{pp}(z)=\frac{1}{\mathcal{D}(\mu_{1}^{(p)},\dots,\mu_{C}^{(p)})-z-\mathcal{R}_{z}(\mu_{1}^{(p)},\dots,\mu_{C}^{(p)}).} (109) The diagonal entries of the resolvent are fluctuating quantities also in the high-dimensional limit, correlated to the statistics of the projected class centroids. Conversely, in rotationally invariant ensembles, like the Wishart Ensemble, the diagonal entries of the resolvent concentrate around their mean in the high-dimensional limit. ( 107 ) is a system of C(C+2) of complex equations 5 5 5 The total number of equations is actually 2C(C+2) , since the system is solved the real and imaginary part of each of the resolvents in ( 107 ). , for given z\in\mathbb{C} 6 6 6 In the high-dimensional limit, in regions of the spectrum with absolute continuous measure, the resolvent develops a branch cut singularity for \operatorname{Im}z=0 , rather than having first order poles on the eigenvalues, as it happens for discrete spectra. In this situation, the equations that define the spectrum are well defined in the whole complex plane. . In the multiclass case C>2 , it is a rather difficult system to solve. In the special binary case, C=2 , it is possible to simplify some terms in ( 107 ): first, the explicit expression of the matrix inverse \bm{g}_{(\Psi,\gamma)}^{-1}=\frac{1}{\det\bm{g}_{(\Psi,\gamma)}}\begin{pmatrix}g_{11}^{(\Psi,\gamma)}\qquad-g_{01}^{(\Psi,\gamma)}\\ -g_{01}^{(\Psi,\gamma)}\qquad g_{00}^{(\Psi,\gamma)}\end{pmatrix}\qquad\det\bm{g}_{(\Psi,\gamma)}=g_{00}^{(\Psi,\gamma)}g_{11}^{(\Psi,\gamma)}-(g_{01}^{(\Psi,\gamma)})^{2} (110) we can write for \mathbf{y} : \begin{gathered}\mathbf{y}=\frac{1}{2\chi_{p}}\frac{1}{g_{00}^{(\Psi,\gamma)}g_{11}^{(\Psi,\gamma)}-g_{01}^{(\Psi,\gamma)}}\begin{pmatrix}g_{11}^{(\Psi,\gamma)}\qquad-g_{01}^{(\Psi,\gamma)}\\ -g_{01}^{(\Psi,\gamma)}\qquad g_{00}^{(\Psi,\gamma)}\end{pmatrix}\\ \,\\ \times\left[\mathbf{I}_{2}-\frac{1}{g_{00}^{(\Psi,\gamma)}g_{11}^{(\Psi,\gamma)}-g_{01}^{(\Psi,\gamma)}}\begin{pmatrix}g_{11}^{(\Psi,\gamma)}\qquad-g_{01}^{(\Psi,\gamma)}\\ -g_{01}^{(\Psi,\gamma)}\qquad g_{00}^{(\Psi,\gamma)}\end{pmatrix}\begin{pmatrix}g_{00}^{(\Omega)}\qquad g_{01}^{(\Omega)}\\ g_{01}^{(\Omega)}\qquad g_{11}^{(\Omega)}\end{pmatrix}\right]\end{gathered} (111) and unveil the equations for the entries of \mathbf{g}_{\Omega} , by explicitly writing the matrix inverse in ( 102 ) and using ( 96 ), ( 97 ) \begin{gathered}g_{00}^{(\Omega)}=\frac{l_{11}}{l_{00}l_{11}-[(\bm{g}_{(\Psi,\gamma)}^{-1})_{01}]^{2}}\\ \,\\ g_{11}^{(\Omega)}=\frac{l_{00}}{l_{00}l_{11}-[(\bm{g}_{(\Psi,\gamma)}^{-1})_{01}]^{2}}\\ \,\\ g_{01}^{(\Omega)}=-\frac{(\bm{g}_{(\Psi,\gamma)}^{-1})_{01}}{l_{00}l_{11}-[(\bm{g}_{(\Psi,\gamma)}^{-1})_{01}]^{2}}\\ \,\\ \text{with}\\ \,\\ l_{cc}=\chi_{p}\left[\frac{\Delta b_{c}}{e^{-2t}\sigma_{c}^{2}}+\frac{1}{\chi_{p}}(\bm{g}_{(\Psi,\gamma)}^{-1})_{cc}+\frac{b_{c}}{1+\frac{\chi_{p}}{\chi_{m}}g_{cc}^{(\Omega)}+\frac{\chi_{p}}{\chi_{m}}g_{c}^{(\Psi,h)}}\right].\end{gathered} (112) In the binary case, the system ( 107 ) counts 16 self-consistent real equations. We reserve the study of eqs. ( 107 ) to future work. F.3 Spectral equations for subextensive centroids We consider the case of subextensive, i.e. for any class c one has \lVert\bm{\mu}_{c}\lVert=o_{P}(P) : this setting represents datasets with centered classes. In this case, P(\mu_{1},\dots,\mu_{C})\simeq\delta(\mu_{1})\cdots\delta(\mu_{C}) and the problem simplifies a lot: defining for c=1,\dots,C the scalars \begin{gathered}\widetilde{\beta}_{c}=\mathbb{E}_{z}\left[\phi^{2}(\Gamma_{c}z)\right]\qquad\qquad\gamma_{c}=\mathbb{E}_{z}\left[z\,\phi(\Gamma_{c}z)\right]\\ \,\\ \beta_{c}=\mathbb{E}_{(z_{1},z_{2})\sim\mathcal{N}(0,\bm{\Sigma}_{c}(t))}\left[\phi(\Gamma_{c}z_{1})\phi(\Gamma_{c}z_{2})\right]\\ \,\\ \varsigma_{c}=\widetilde{\beta}_{c}-\beta_{c}-\frac{\Delta\gamma_{c}^{2}}{\sigma_{c}^{2}e^{-2t}}\qquad h_{c}^{2}=\beta_{c}-\gamma_{c}^{2}\end{gathered} (113) the resolvent function g(z)\equiv g_{\Psi}(z) is determined from the solution of the following system of saddle-point equations: \boxed{\begin{gathered}\\ \,\left(1-\frac{1}{\chi_{p}}\right)\frac{1}{g_{\Psi}}=-\frac{1}{\chi_{p}}\frac{g_{\Omega}}{g_{\Psi}^{2}}+\sum_{c}b_{c}\,(\varsigma_{c}-z)+\sum_{c}\frac{b_{c}h_{c}^{2}}{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}+h_{c}^{2}g_{\Psi}]}\,\\ \,\\ \frac{1}{\chi_{p}}\frac{1}{g_{\Omega}}=\frac{\Delta}{e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\frac{1}{\chi_{p}}\frac{1}{g_{\Psi}}+\sum_{c}\frac{b_{c}\gamma_{c}^{2}}{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}+h_{c}^{2}g_{\Psi}]}\\ \\ \end{gathered}} (114) Eqs. ( 114 ) can be obtained as follows: first, write the action ( 90 ) in the limit of subextensive centroids, thus replacing the vector Hermite coefficients with their homogeneous counterparts in eqs. ( 113 ), \widetilde{\bm{\beta}}_{c}\rightarrow\widetilde{\beta}_{c}\bm{1}_{P},\,\bm{\beta}_{c}\rightarrow\beta_{c}\bm{1}_{P},\,\bm{\gamma}_{c}\rightarrow\gamma_{c}\bm{1}_{P} (note that, for an odd activation, the coefficient \bm{\alpha}_{c} vanishes in this limit). Second, note that g_{c}^{(\Psi,h)}\rightarrow h_{c}^{2}\,g_{\Psi} , g_{c}^{(\Psi,\varsigma)}\rightarrow\varsigma_{c}\,g_{\Psi} , g_{cc^{\prime}}^{(\Psi,\gamma)}\rightarrow\gamma_{c}\gamma_{c^{\prime}}\,g_{\Psi} , g_{cc^{\prime}}^{(\Omega)}\rightarrow\gamma_{c}\gamma_{c^{\prime}}g_{\Omega} ; to handle singular terms such as determinants and inverses of these last two resolvents appearing in ( 90 ), set g_{cc}^{(\Psi,\gamma)}=\gamma_{c}^{2}\,g_{\Psi}+\epsilon , g_{cc}^{(\Omega)}=\gamma_{c}^{2}\,g_{\Omega}+\epsilon , expand and simplify. Then, derive the saddle point equations of the resulting action and obtain ( 114 ). We remark that, while for extensive centroids \widehat{\mathbf{U}}_{gep} in ( 9 ) is non rotationally invariant, in the limit of finite centroids \widehat{\mathbf{U}}_{gep} consists of the sum of different Wishart matrices and therefore, the resulting matrix ensemble is rotationally invariant: usually, in this case the spectral equations are algebraic, and this is the case also for ( 114 ). Finally, note that in contrast with equations ( 107 ), in the case of finite centroids the total number of real equations to solve is always 4 , for any number of classes C . The homogeneous case \sigma_{1}=\dots=\sigma_{C}=\sigma corresponds to the problem studied in ref. [ 8 ] : eqs. ( 114 ) extend their result to centered gaussian mixtures. In figure 8 we compare the solution of ( 114 ) in the C=2 case with empirical histograms of the eigenvalues of \widehat{\mathbf{U}} , testing the case of zero centroid norm (left) and \lVert\bm{m}_{1}\lVert=\lVert\bm{m}_{2}\lVert=1 (right): we find a perfect agreement between theory and simulations. We compute the theoretical spectral density from the solution of ( 114 ) using ( 63 ). Figure 8: Test of eqs. ( 114 ) for t=0.01 . F.3.1 Equation for the edges The equations for the spectral edges \lambda_{*} can be obtained from the spectral equations ( 114 ) by performing the following joint limits \lim_{\lambda\rightarrow\lambda_{*}}\operatorname{Im}g_{\Psi}(\lambda)=\lim_{\lambda\rightarrow\lambda_{*}}\operatorname{Im}g_{\Omega}(\lambda)=0,\qquad\lim_{\lambda\rightarrow\lambda_{*}}\frac{\operatorname{Im}g_{\Omega}(\lambda)}{\operatorname{Im}g_{\Psi}(\lambda)}\equiv\omega_{*}\in\mathbb{R}/\{0\}. (115) For any bulk of the spectrum, the lower and upper edges are respectively defined as the largest and the smallest eigenvalues for which the spectral equations admit a real solution: conditions ( 115 ) ensure that we find such points, since they give guarantee that we are approaching the edges from within the spectrum of \widehat{\mathbf{U}} (otherwise the quantity \omega_{*} ) would be undefined. By applying it to the real and imaginary parts of eqs. ( 114 ), and setting \operatorname{Re}g_{\Psi}(\lambda_{*})=g_{\Psi}^{*} and \operatorname{Re}g_{\Omega}(\lambda_{*})=g_{\Omega}^{*} , we obtain the following system of three algebraic equations \begin{gathered}-\left(1-\frac{1}{\chi_{p}}\right)\frac{1}{(g_{\Psi}^{*})^{2}}=-\frac{\omega_{*}}{\chi_{p}(g_{\Psi}^{*})^{2}}+\frac{2g_{\Omega}^{*}}{\chi_{p}(g_{\Psi}^{*})^{3}}-\frac{\chi_{p}}{\chi_{m}}\sum_{c}\frac{b_{c}h_{c}^{2}(h_{c}^{2}+\omega_{*}\gamma_{c}^{2})}{\{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}^{*}+h_{c}^{2}g_{\Psi}^{*}]\}^{2}}\\ \,\\ \frac{\omega_{*}}{\chi_{p}(g_{\Omega}^{*})^{2}}=\frac{1}{\chi_{p}}\frac{1}{(g_{\Psi}^{*})^{2}}+\frac{\chi_{p}}{\chi_{m}}\sum_{c}\frac{b_{c}\gamma_{c}^{2}(h_{c}^{2}+\omega_{*}\gamma_{c}^{2})}{\{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}^{*}+h_{c}^{2}g_{\Psi}^{*}]\}^{2}}\\ \,\\ \frac{1}{\chi_{p}g_{\Omega}^{*}}=\frac{\Delta}{e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\frac{1}{\chi_{p}}\frac{1}{g_{\Psi}^{*}}+\sum_{c}\frac{b_{c}\gamma_{c}^{2}}{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}^{*}+h_{c}^{2}g_{\Psi}^{*}]}.\\ \end{gathered} (116) The spectral edges are computed from the solutions of ( 116 ): \boxed{\lambda_{*}=\sum_{c}b_{c}\varsigma_{c}+\sum_{c}\frac{b_{c}h_{c}^{2}}{1+\frac{\chi_{p}}{\chi_{m}}[\gamma_{c}^{2}g_{\Omega}^{*}+h_{c}^{2}g_{\Psi}^{*}]}-\left(1-\frac{1}{\chi_{p}}\right)\frac{1}{g_{\Psi}^{*}}-\frac{1}{\chi_{p}}\frac{g_{\Omega}^{*}}{(g_{\Psi}^{*})^{2}}.} (117) Eqs. ( 116 ) and ( 117 ) are used to compute the curves in fig. 2b in the limit t\rightarrow 0 , for the case of C=2 classes. One can show that eqs. ( 116 ) admit at most 2C+4 solutions. In the following, we connect the solutions of ( 116 ) to the spectral edges \lambda_{gen},\lambda_{mem}^{(1)},\lambda_{mem}^{(2)} defined in section 3.2 . Similarly to [ 8 ] , we take \chi_{p}>\chi_{m}\gg 1 and consider different scaling regimes for the resolvent function. We set \chi_{pm}=\chi_{p}/\chi_{m} . • Scaling g_{\Psi}=\mathcal{O}_{\chi_{p}}(1) and g_{\Omega}=\mathcal{O}_{\chi_{p}}\left(\frac{1}{\chi_{p}}\right) : let us set \widetilde{g}_{\Omega}^{*}=\chi_{p}g_{\Omega}^{*} . At leading order in 1/\chi_{p} , the equations for the edges become \begin{gathered}\frac{1}{(g_{\Psi}^{*})^{2}}\approx\chi_{pm}\sum_{c}\frac{b_{c}h_{c}^{4}}{\left(1+\chi_{pm}h_{c}^{2}g_{\Psi}^{*}\right)^{2}}\\ \,\\ \omega_{*}\approx\frac{1}{\chi_{m}}\sum_{c}\frac{b_{c}\gamma_{c}^{2}h_{c}^{2}\widetilde{g}_{\Omega}^{*}}{\left(1+\chi_{pm}h_{c}^{2}g_{\Psi}^{*}\right)^{2}}=\mathcal{O}_{\chi_{m}}\left(\frac{1}{\chi_{m}}\right)\\ \,\\ \frac{1}{\widetilde{g}_{\Omega}^{*}}\approx\frac{\Delta}{e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\sum_{c}\frac{b_{c}\gamma_{c}^{2}}{1+\chi_{pm}h_{c}^{2}g_{\Psi}^{*}}\\ \,\\ \lambda_{*}\approx\sum_{c}b_{c}\varsigma_{c}+\sum_{c}\frac{b_{c}h_{c}^{2}}{1+\chi_{pm}h_{c}^{2}g_{\Psi}^{*}}-\frac{1}{g_{\Psi}^{*}}-\frac{\widetilde{g}_{\Omega}^{*}}{(g_{\Psi}^{*})^{2}}\end{gathered} (118) In this limit, the equation for g_{\Psi}^{*} is decoupled from that for g_{\Omega}^{*} . We observe that the equation for g_{\Psi}^{*} can be rearranged as an algebraic equation of order 2C , thus yielding at most 2C values of spectral edges for C bulks. This regime identifies the t -independent memorization phase: the eigenvalue \lambda_{mem}^{(1)} of 3.2 is obtained from the solution g_{\Psi}^{*} that returns the largest spectral edge. This bulk has M eigenvalues, since it is origins from the memorization term \mathbf{\delta U}_{gep} in eq. ( 56 ). Thus, it carries a weight \chi_{m}/\chi_{p} . Note that from the first of ( 118 ) the scaling g_{\Psi}^{*}\propto 1/\chi_{pm} emerges. Then, for t\ll 1 one finds that all the edges in this scaling regime satisfy \lambda_{*}\propto\chi_{pm} and \tau_{mem}^{(1)}=\frac{1}{2\lambda_{mem}^{(1)}}\propto\frac{\chi_{s}}{\chi_{p}} (119) as proven in [ 8 ] for the unimodal case. • Scaling g_{\Psi}=\mathcal{O}_{\chi_{p}}(\frac{1}{\chi_{p}}) and g_{\Omega}=\mathcal{O}_{\chi_{p}}\left(\frac{1}{\chi_{p}}\right) : we set \widetilde{g}_{\Psi}^{*}=\chi_{p}g_{\Psi} . We can find the spectral edges more easily from the spectral equations ( 114 ), that for this scaling read \begin{gathered}\frac{\chi_{p}}{\widetilde{g}_{\Psi}^{*}}=-\frac{\widetilde{g}_{\Omega}^{*}}{(\widetilde{g}_{\Psi}^{*})^{2}}+(\varsigma-z)+\sum_{c}b_{c}h_{c}^{2}\\ \,\\ \frac{1}{\widetilde{g}_{\Omega}^{*}}=\frac{\Delta}{e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\frac{1}{\widetilde{g}_{\Psi}^{*}}+\sum_{c}b_{c}\gamma_{c}^{2}\end{gathered} (120) Combining these two equations, one finds the spectral equation of a Wishart matrix, and therefore the edges are those of a Marchenko-Pastur distribution [ 41 ] : \lambda_{\pm}^{(g)}\approx\varsigma+\sum_{c}b_{c}h_{c}^{2}+\left(\frac{\Delta}{e^{-2t}}\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\sum_{c}b_{c}\gamma_{c}^{2}\right)(1\pm\sqrt{\chi_{p}})^{2} (121) These are the edges of the rightmost bulk shown in fig. 2a , which counts D eigenvalues and carries a weight 1/\chi_{p} , since it is related to the population correlation \widetilde{\mathbf{U}}_{gep} (eq. ( 55 ) and see also eq. ( 56 )). It represents the generalization phase of the training: thus, we identify \lambda_{gen}=\lambda_{-}^{(g)} . We then have for t\ll 1 \tau_{gen}=\frac{1}{2\lambda_{gen}}\propto\frac{1}{\chi_{p}} (122) Combining ( 119 ), ( 122 ), we find the result of [ 15 ] , [ 8 ] , [ 37 ] for the generalization window w_{g}\equiv\frac{\tau_{mem}^{(1)}}{\tau_{gen}}\propto\chi_{s}, (123) that the generalization window grows linearly with the size of the dataset. Having verified the sample size scaling, in 3.2 we study the dependence of the prefactor of this scaling law on the variances of the classes in a binary setting, to show how class diversity affects the generalization window. • Scaling g_{\Psi}=\mathcal{O}_{\chi_{p}}(\frac{\chi_{m}^{2}}{t\chi_{p}}) and g_{\Omega}=\mathcal{O}_{\chi_{p}}\left(\frac{\chi_{m}^{2}}{t\chi_{p}}\right) : the choice of the scalings is motivated by fig. 9 . Figure 9: Check of the scaling of \lambda_{mem}^{(2)} . We show that the eigenvalue \lambda_{mem}^{(2)} scales linearly with t and converges to a constant value for large number of hidden neurons and number of samples. We also show the width \Delta\lambda of the leftmost bulk in fig. 2a as functions of the same quantities: we find that it scales linearly with diffusion time and that it decays as the inverse square of the number of samples. We also find empirically that the weight of the leftmost bulk is 1/\chi_{p} : then, considering our findings in fig. 9 , we choose to scale the resolvent functions as above. We now proceed to expand the spectral equations ( 114 ) for t\ll 1 and \chi_{m}\gg 1 : we get the following \begin{gathered}\frac{t\chi_{pm}}{\chi_{m}\widetilde{g}_{\Psi}^{*}}=-\frac{t\widetilde{g}_{\Omega}^{*}}{\chi_{m}^{2}(\widetilde{g}_{\Psi}^{*})^{2}}+\varsigma-z+\frac{t}{\chi_{m}}\sum_{c}\frac{b_{c}h_{c}^{2}}{\gamma_{c}^{2}\widetilde{g}_{\Omega}^{*}+h_{c}^{2}\widetilde{g}_{\Psi}^{*}}\\ \,\\ \frac{t}{\chi_{m}^{2}\widetilde{g}_{\Omega}^{*}}=2t\sum_{c}\frac{b_{c}}{\sigma_{c}^{2}}\gamma_{c}^{2}+\frac{t}{\chi_{m}^{2}\widetilde{g}_{\Psi}^{*}}+\frac{t}{\chi_{m}}\sum_{c}\frac{b_{c}\gamma_{c}^{2}}{\gamma_{c}^{2}\widetilde{g}_{\Omega}^{*}+h_{c}^{2}\widetilde{g}_{\Psi}^{*}}\end{gathered} (124) By summing these two equations together, we find for t\ll 1 and \chi_{m}\gg 1 \widetilde{g}_{\Omega}^{*}\approx\frac{z\widetilde{g}_{\Psi}^{*}}{2\sum_{c}b_{c}\frac{\gamma_{c}^{2}}{\sigma_{c}^{2}}\,t} (125) After some algebra, one finds that the edges are ( \widetilde{\varsigma}=t\,\varsigma ) \lambda_{\pm}^{(m)}=\widetilde{\varsigma}\,t+\frac{\chi_{pm}\,t}{4\chi_{m}^{3}\sum_{c}b_{c}\frac{\gamma_{c}^{2}}{\sigma_{c}^{2}}}\pm t\,\sqrt{\frac{\widetilde{\varsigma}\chi_{pm}}{2\chi_{m}^{3}\,\sum_{c}b_{c}\frac{\gamma_{c}^{2}}{\sigma_{c}^{2}}}-\frac{2\sum_{c}b_{c}\frac{\gamma_{c}^{2}}{\sigma_{c}^{2}}}{\chi_{m}^{3}}\sum_{c}b_{c}\frac{h_{c}^{2}}{\gamma_{c}^{2}}} (126) In this last equation, we identify \lambda_{mem}^{(2)}=\lambda_{-}^{(m)} : we observe that it scales linearly in t . The bulk width \lambda_{+}^{(m)}-\lambda_{-}^{(m)} scales linearly with t and decays as \chi_{pm}^{1/2}/\chi_{m}^{3/2}\propto\frac{1}{\chi_{m}^{2}} . We finally find that the scaling of the final memorization time is \tau_{mem}^{(2)}=\frac{1}{2\lambda_{mem}^{(2)}}\propto\frac{1}{t} (127) and that the memorization window scales as w_{m}=\frac{\tau_{mem}^{(2)}}{\tau_{mem}^{(1)}}\propto\frac{\chi_{p}}{\chi_{m}\,t}. (128) In 3.2 we study the dependence of the prefactor of w_{m} on the variances of the classes and their sampling weights. The remaining weight is 1-\chi_{m}/\chi_{p}-2/\chi_{p} and is carried by a delta peak: it represents eigenvectors that are orthogonal to all rows of the random features and GEP noise matrices. These modes do not affect training. The delta is located at \lambda=\varsigma\equiv\sum_{c}b_{c}(\beta_{c}-\widehat{\beta}_{c}-\frac{\Delta}{\sigma_{c}^{2}e^{-2t}}\gamma_{c}^{2})\propto t . Appendix G Theoretical curves of train and test losses For reader convenience, we copy the expression of the train and test errors in eqs. ( 3 ), ( 14 ): \begin{gathered}\mathcal{E}_{train}=\frac{1}{NM}\sum_{\nu=1}^{M}\mathbb{E}_{\bm{\xi}}\left[\left\lVert\sqrt{\Delta_{t}}\mathbf{s}\left(\bm{x}_{\nu}e^{-\mathrm{a}t}+\sqrt{\Delta_{t}}\bm{\xi}\Bigl|\mathbf{A},\mathbf{W}\right)+\bm{\xi}\right\lVert^{2}\right]\\ \,\\ \end{gathered} (129) \begin{gathered}\mathcal{E}_{test}=\sum_{c}b_{c}\,\mathcal{E}_{test}^{(c)}\\ \,\\ \mathcal{E}_{test}^{(c)}=\frac{1}{N}\mathbb{E}_{\bm{x}\sim\mathcal{N}(\mathbf{m}_{c},\sigma_{c}^{2}\mathbf{I}_{N}),\,\bm{\xi}}\left[\lVert\sqrt{\Delta_{t}}\mathbf{s}\left(\bm{x}e^{-t}+\sqrt{\Delta_{t}}\bm{\xi}|\mathbf{A},\mathbf{W}\right)+\bm{\xi}\lVert^{2}\right]\end{gathered} (130) Training and test errors can be rewritten in the following form: \mathcal{E}_{train}=1+\frac{\Delta_{t}}{N}\operatorname{Tr}(\mathbf{A}\mathbf{U}\mathbf{A}^{\intercal})+\frac{2\sqrt{\Delta_{t}}}{N}\operatorname{Tr}(\mathbf{V}\mathbf{A}), (131) \begin{gathered}\mathcal{E}_{test}^{(c)}=1+\frac{\Delta_{t}}{N}\operatorname{Tr}(\mathbf{A}\widetilde{\mathbf{U}}_{c}\mathbf{A}^{\intercal})+\frac{2\sqrt{\Delta_{t}}}{N}\operatorname{Tr}(\mathbf{V}_{c}\mathbf{A})\\ \\ \simeq\mathcal{E}_{train}+\frac{\Delta_{t}}{N}\operatorname{Tr}(\mathbf{A}(\widetilde{\mathbf{U}}_{c}-\mathbf{U})\mathbf{A}^{\intercal})+\frac{2\sqrt{\Delta_{t}}}{N}\operatorname{Tr}((\mathbf{V}_{c}-\mathbf{V})\mathbf{A}),\\ \,\\ \mathcal{E}_{test}=\mathcal{E}_{train}+\frac{\Delta_{t}}{N}\operatorname{Tr}(\mathbf{A}(\widetilde{\mathbf{U}}-\mathbf{U})\mathbf{A}^{\intercal}).\end{gathered} (132) By substituting into eqs. ( 131 ), ( 132 ) the solution of the dynamics ( 6 ) and by expanding everything in the basis of eigenvectors of \mathbf{U} , we derived equations for the train and test errors: \boxed{\begin{gathered}\mathcal{E}_{train}(\tau)=1-\frac{\Delta}{N}\sum_{q=1}^{P}\frac{1-e^{-4\lambda_{q}\,\tau}}{\lambda_{q}}\left\lVert\sum_{c=1}^{C}\frac{b_{c}}{\Gamma_{c}}\bm{\omega}_{c}^{(q)}\right\lVert^{2},\\ \,\\ \mathcal{E}_{test}(\tau)=\mathcal{E}_{train}(\tau)+\frac{\Delta}{N}\sum_{q,p}\frac{\left(1-e^{-2\lambda_{q}\,\tau}\right)\left(1-e^{-2\lambda_{p}\,\tau}\right)}{\lambda_{q}\lambda_{p}}\\ \,\\ \times\left(\sum_{c}b_{c}\frac{\bm{\omega}_{c}^{(q)}}{\Gamma_{c}}\right)^{\intercal}\left(\sum_{c}b_{c}\frac{\bm{\omega}_{c}^{(p)}}{\Gamma_{c}}\right)\left(\bm{\psi}_{q}^{\intercal}\widetilde{\mathbf{U}}\bm{\psi}_{p}-\lambda_{p}\delta_{qp}\right),\\ \,\\ \,\\ \mathcal{E}_{test}^{c}(\tau)=\mathcal{E}_{train}(\tau)+\frac{\Delta}{N}\sum_{q,p}\frac{\left(1-e^{-2\lambda_{q}\,\tau}\right)\left(1-e^{-2\lambda_{p}\,\tau}\right)}{\lambda_{q}\lambda_{p}}\\ \,\\ \times\left(\sum_{c}b_{c}\frac{\bm{\omega}_{c}^{(q)}}{\Gamma_{c}}\right)^{\intercal}\left(\sum_{c}b_{c}\frac{\bm{\omega}_{c}^{(p)}}{\Gamma_{c}}\right)\left(\bm{\psi}_{q}^{\intercal}\widetilde{\mathbf{U}}_{c}\bm{\psi}_{p}-\lambda_{p}\delta_{qp}\right)\,\\ \,\\ -\frac{2\Delta}{N}\sum_{q}\frac{1-e^{-2\,\lambda_{q}\,\tau}}{\lambda_{q}}\left(\sum_{c^{\prime}}b_{c^{\prime}}\frac{\bm{\omega}_{c^{\prime}}^{(q)}}{\Gamma_{c^{\prime}}}\right)^{\intercal}\left(\frac{\bm{\omega}_{c}^{(q)}}{\Gamma_{c}}-\left(\sum_{c^{\prime}}b_{c^{\prime}}\frac{\bm{\omega}_{c^{\prime}}^{(q)}}{\Gamma_{c^{\prime}}}\right)\right),\end{gathered}} (133) where \{\lambda_{q},\bm{\psi}_{q}\} are eigenvalues and eigenvectors of \mathbf{U} , and we introduced \bm{\omega}_{c}^{(q)}=\frac{1}{\sqrt{N}}\mathbf{W}^{\intercal}(\bm{\psi}_{q}\odot\widetilde{\bm{\gamma}}_{c}) . The formula in eqs ( 133 ), with the feature correlation matrices replaced by their GEP expression, are our semi-analytical curves for the train and test errors. We name them like that because we need to numerically diagonalise the matrix \mathbf{U}_{gep} to use them. The curves for the test errors were used in sections 3.2 and 3.2.1 to represent our theoretical predictions. For test errors, in general we cannot write asymptotic expressions in terms of the solution of the saddle point equations ( 107 ); we can only do that for the train error. We derived the following asymptotic formula for the train error, in the joint limits N,P,M\rightarrow\infty with fixed ratios \chi_{p}=P/N and \chi_{m}=M/N : \boxed{\,\mathcal{E}_{train}(\tau)=1-\frac{\Delta\chi_{p}}{e^{-2t}}\sum_{cc^{\prime}}\frac{b_{c}b_{c^{\prime}}}{\sigma_{c}\sigma_{c^{\prime}}}\int\frac{d\lambda}{\lambda}\left(1-e^{-4\lambda\tau}\right)\rho_{\Omega}^{(cc^{\prime})}(\lambda)} (134) where the spectral densities \rho_{\Omega}^{cc^{\prime}} are computed from the resolvent functions g_{\Omega}^{(cc^{\prime})} in eq. ( 107 ): \rho_{\Omega}^{(cc^{\prime})}(\lambda)=\frac{1}{\pi}\lim_{\epsilon\rightarrow 0_{+}}\operatorname{Im}g_{\Omega}^{(cc^{\prime})}(\lambda+i\epsilon) We refer to eq. ( 134 ) as our fully analytical formula for the train error. We derived ( 134 ) from the first equation in ( 133 ), noting that the dot products \omega_{c}(\lambda)\cdot\omega_{c^{\prime}}(\lambda) featuring in ( 133 ) can be computed from the imaginary part of g_{\Omega}^{cc^{\prime}} . Indeed, since by definition one has \begin{gathered}g_{\Omega}^{cc^{\prime}}(z)=\frac{1}{N^{2}}\sum_{q=1}^{P}\frac{\bm{\psi}(\lambda_{q})^{\intercal}(\mathbf{W}^{\intercal}\odot\bm{1}_{N}\bm{\gamma}_{c^{\prime}})(\bm{\gamma}_{c}\bm{1}_{N}^{\intercal}\odot\mathbf{W})\bm{\psi}(\lambda_{q})}{\lambda_{q}-z}\\ \equiv\frac{\sigma_{c}\sigma_{c^{\prime}}e^{-2t}}{\Gamma_{c}\Gamma_{c^{\prime}}}\int d\lambda\frac{\rho(\lambda)\,\bm{\omega}_{c}(\lambda)\cdot\bm{\omega}_{c^{\prime}}(\lambda)}{\lambda-z}\end{gathered} then it follows that \bm{\omega}_{c}(\lambda)\cdot\bm{\omega}_{c^{\prime}}(\lambda)=\frac{\Gamma_{c}\Gamma_{c^{\prime}}}{\sigma_{c}\sigma_{c^{\prime}}e^{-2t}}\frac{\rho_{\Omega}^{cc^{\prime}}(\lambda)}{\rho(\lambda)} (135) In the limit of finite centroids, \lVert\bm{m}_{c}\lVert=\mathcal{O}_{N}(1) , the vector Hermite coefficients become homogeneous and thus ( 135 ) turns into \bm{\omega}_{c}(\lambda)\cdot\bm{\omega}_{c^{\prime}}(\lambda)=\frac{\Gamma_{c}\Gamma_{c^{\prime}}\gamma_{c}\gamma_{c^{\prime}}}{\sigma_{c}\sigma_{c^{\prime}}e^{-2t}}\frac{\rho_{\Omega}(\lambda)}{\rho(\lambda)} (136) and the analytical train error formula simplifies \mathcal{E}_{train}(\tau)=1-\frac{\Delta\chi_{p}}{e^{-2t}}\left(\sum_{c=1}^{C}b_{c}\frac{\widetilde{\gamma}_{c}}{\sigma_{c}}\right)^{2}\int\frac{d\lambda}{\lambda}\left(1-e^{-4\lambda\tau}\right)\rho_{\Omega}(\lambda). (137) Appendix H Score MSE We write the formula for the MSE of the score: \mathcal{E}_{score}=\sum_{c}b_{c}\mathcal{E}_{score}^{(c)},\qquad\mathcal{E}_{score}^{(c)}=\frac{1}{N}\mathbb{E}_{\bm{x}\sim\mathcal{N}_{c}(t)}\left[\norm{ \mathbf{A}\,\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}\right) -\bm{s}_{true}(\bm{x}, t) }^{2}\right] (138) The MSE on the score is a proxy for the quality of the generative model: indeed, the Kublack-Liebler (KL) Divergence between the prior distribution \mathcal{P}^{*} and the sampling distribution learned by the diffusion model \widetilde{\mathcal{P}} is upper-bounded by the integral over diffusion time of the score error [ 49 ] : D_{KL}(\widetilde{\mathcal{P}}|\mathcal{P}^{*})\equiv\int d\bm{x}\mathcal{P}^{*}(\bm{x})\log(\widetilde{\mathcal{P}}(\bm{x})/\mathcal{P}^*(\bm{x}))\leq\frac{N}{2}\int dt\mathcal{E}_{score}(t) (139) Given the hypothesis of well separated classes, the condition in ( 139 ) holds also for the single components of the mixture: D_{KL}(\widetilde{\mathcal{P}}_{c}|\mathcal{P}_{c}^{*})\equiv\int d\bm{x}\mathcal{P}_{c}^{*}(\bm{x})\log(\widetilde{\mathcal{P}}_c(\bm{x})/\mathcal{P}_c^*(\bm{x}))\leq\frac{N}{2}\int dt\mathcal{E}_{score}^{(c)}(t). (140) We can compute semi-analytical formulas analogous to those in ( 133 ) for the score MSEs. The score of a gaussian mixture such as that in ( 5 ) has the following expression: \begin{gathered}\bm{s}_{true}(\bm{x},t)=\sum_{c=1}^{C}b_{c}\bm{s}_{true}^{(c)}(\bm{x},t)\qquad\bm{s}_{true}^{(c)}(\bm{x},t)=-\frac{\bm{x}-e^{-t}\bm{m}_{c}}{\Gamma_{c}^{2}(t)}\,\zeta_{c}(\bm{x},t)\\ \,\\ \zeta_{c}(\bm{x},t)=\frac{\mathcal{P}_{c}(\bm{x},t)}{\sum_{c^{\prime}=1}^{C}b_{c^{\prime}}\mathcal{P}_{c^{\prime}}(\bm{x},t)},\qquad\mathcal{P}_{c}(\bm{x},t)=\frac{e^{-\frac{\norm{\bm{x}-e^{-t}\bm{m}_c}^{2}}{2\Gamma_{c}^{2}(t)}}}{(2\pi\Gamma_{c}^{2}(t))^{N/2}}\end{gathered} (141) For generic mixtures, the components of the true score interfere with each other through the functions \zeta_{c} . In the case of well-separated mixtures, one gets \zeta_{c}=1/b_{c} for any datapoint sampled from that class: then, the scores are the scores that the components of the mixture would have in isolation, b_{c}\mathbf{s}_{true}^{(c)}(\bm{x},t)\approx-\frac{\bm{x}-\mathbf{m}_{c}e^{-t}}{\Gamma_{c}^{2}(t)}\equiv\bm{s}_{c}(\bm{x},t)\qquad\bm{x}\text{ belonging to class }c. (142) We can define the effective domain for classes by looking at eqs ( 141 ): all exponential terms should be vanishing for classes c^{\prime}\neq c compared to class c , and this is achieved for values of \bm{x} such that \frac{1}{\Gamma_{c^{\prime}}^{2}(t)N}\lVert\bm{x}-\mathbf{m}_{c^{\prime}}e^{-t}\lVert^{2}-\frac{1}{\Gamma_{c}^{2}(t)N}\lVert\bm{x}-\mathbf{m}_{c}e^{-t}\lVert^{2}+\log(\Gamma_{c'}/\Gamma_c)>0,\qquad\forall c^{\prime}\neq c,N\rightarrow\infty (143) The boundaries of the effective domains are regions such that \left|\frac{1}{\Gamma_{c^{\prime}}^{2}(t)}\lVert\bm{x}-\mathbf{m}_{c^{\prime}}e^{-t}\lVert^{2}-\frac{1}{\Gamma_{c}^{2}(t)}\lVert\bm{x}-\mathbf{m}_{c}e^{-t}\lVert^{2}+N\log(\Gamma_{c'}/\Gamma_c)\right|=\mathcal{O}_{N}(1)\qquad N\rightarrow\infty (144) In the high-dimensional limit N\gg 1 , samples \bm{x} belong with high probability to the bulks of the effective domains, the boundaries are atypical. We consider the case of well-separated mixtures, where the inequalities ( 12 ) hold for all classes: then the score MSE in ( 138 ) begets \mathcal{E}_{score}=\sum_{c}b_{c}\mathcal{E}_{score}^{(c)},\qquad\mathcal{E}_{score}^{(c)}\simeq\frac{1}{N}\mathbb{E}_{\bm{x}\sim\mathcal{N}_{c}(t)}\left[\norm{ \mathbf{A}\,\phi\left(\frac{1}{\sqrt{N}}\mathbf{W}\bm{x}\right) +\frac{\bm{x}-e^{-t}\bm{m}_c}{\Gamma_c^2(t)} }^{2}\right] (145) Figure 10: Comparison between the test losses and the score MSEs. Parameters as in figure 3 . Finally, by following the steps of Appendix G , we obtain \boxed{\begin{gathered}\,\\ \mathcal{E}_{score}^{(c)}(\tau)=\frac{1}{\Gamma_{c}^{2}(t)}-\frac{2}{\Gamma_{c}N}\sum_{q}\frac{1-e^{-2\lambda_{q}\tau}}{\lambda_{q}}\left(\sum_{c^{\prime\prime}}\frac{b_{c^{\prime\prime}}}{\Gamma_{c^{\prime\prime}}}\bm{\omega}_{c^{\prime\prime}}^{q}\right)^{\intercal}\bm{\omega}_{c}^{q}\\ \,\\ \,+\frac{1}{N}\sum_{pq}\frac{(1-e^{-2\lambda_{p}\tau})(1-e^{-2\lambda_{q}\tau})}{\lambda_{p}\lambda_{q}}\left(\sum_{c^{\prime\prime}}\frac{b_{c^{\prime\prime}}}{\Gamma_{c^{\prime\prime}}}\bm{\omega}_{c^{\prime\prime}}^{p}\cdot\sum_{c^{\prime\prime\prime}}\frac{b_{c^{\prime\prime\prime}}}{\Gamma_{c^{\prime\prime\prime}}}\bm{\omega}_{c^{\prime\prime\prime}}^{q}\right)\bm{\psi}_{p}^{\intercal}\mathbf{\widetilde{U}}_{c}\bm{\psi}_{q}\,\\ \,\\ \equiv\frac{1}{\Gamma_{c}^{2}(t)}+\frac{1}{\Delta_{t}}(\mathcal{E}_{test}^{(c)}(\tau)-1)\\ \,\end{gathered}} (146) We found that in the limit of well-separated classes, the score MSE of any class c is just the test loss of that class plus a diffusion time and class dependent constant shift and a diffusion time dependent rescaling multiplicative factor, implying that the class-specific generalization times and memorization times defined in ( 15 ) for the test losses are the same for the score MSEs. In figure 10 we compare the test loss shown in figure 3 with the score MSE. Appendices for experiments Appendix I Numerical experiments on Random Features I.1 Training of RF model Training of the Random Features model was conducted using Gradient Descent: for k=1,\dots,N_{epoch} , we used \mathbf{A}_{k+1}=\mathbf{A}_{k}-\eta\frac{\partial\mathcal{E}_{train}}{\partial\mathbf{A}}\Biggl|_{\mathbf{A}=\mathbf{A}_{k}} with \mathcal{E}_{train} given by eq. ( 3 ). In all experiments, we set \eta=5\times 10^{-5}\frac{N}{\Delta_{t}} , where N is data dimension, and \Delta_{t}=1-e^{-2t} (compare with eq. ( 25 ) to understand the origin of this scaling choice of the learning rate). We set N_{epoch}=2\times 10^{6} and 600 log-spaced sampling times. We fix P=6000 , N=100 and M=3000 for the parameters in sections 3.2 , 3.2.1 . For each choice of data distribution parameters, we conducted several runs with different instantiations of the RF model and the dataset, namely different draws of the matrix \mathbf{W} and the dataset \mathbf{X} , and then obtained curves for train, test and score errors versus training time by averaging over different runs. We employed a gaussian smoothing to each error curve of each run, to polish fluctuations at small scales due to GD discrete steps. Generalization and memorization times were computed using ( 15 ) on the curves averaged over different runs. As the dynamics converges to a unique readout matrix, asymptotically independent of the initial condition (see eq. ( 25 )), we did not average over different initial conditions. An experiment with 5 runs, with the parameters specified above, requires approximately 4 hours and a half on a A40 GPU. I.2 Numerical diagonalization of \mathbf{U},\widetilde{\mathbf{U}} To evaluate the semi-analytical curves in eqs. ( 133 ),( 146 ), for each choice of gaussian mixture, we obtained the eigenvalues and eigenvectors of N_{diag}=10 instances of the GEP matrices \mathbf{U}_{gep} and \widetilde{\mathbf{U}}_{gep} . In sections 3.2 , 3.2.1 , we set P=6000 for the number of hidden neurons, N=100 for data dimension and M=3000 for the number of samples. In section 4 , we set P=10000 , N=100 , M=500 . The numerical diagonalization of instances of \mathbf{U}_{gep},\widetilde{\mathbf{U}}_{gep} requires roughly 10 minutes on a state-of-the-art CPU. I.3 Solution of the spectral equations Algorithm 1 Solver of eqs. ( 114 ) 1: Hermite coefficients \{(\beta_{k},\tilde{\beta}_{k},\gamma_{k})\}_{k=1}^{C} , diagonal terms d_{k}=\tilde{\beta}_{k}-\beta_{k}-\frac{\Delta}{2e^{-2t}}\gamma_{k} , grid \{\lambda_{j}\}_{j=1}^{N} , continuation schedule \mathcal{E}=\operatorname{Concat}((\operatorname{Log-Spaced}([100,10^{-9}],N_{eps}),\{0\}] . 2: real parts \{\operatorname{Re}g_{\Psi}(\lambda_{j}),\,\operatorname{Re}g_{\Omega}(\lambda_{j})\} and spectral densities \{\rho(\lambda_{j}),\,\rho_{\Omega}(\lambda_{j})\} 3: for j=1 to N do \triangleright sweep over spectral grid 4: \lambda\leftarrow\lambda_{j} 5: z\leftarrow\lambda+i\,\varepsilon_{0} \triangleright initialise at largest imaginary shift 6: g_{\Psi}^{(0)}\leftarrow-1/z , g_{\Omega}^{(0)}\leftarrow-1/z \triangleright free-theory initial guess 7: for \varepsilon\in\mathcal{E} do \triangleright decrease imaginary part to 0 8: z\leftarrow\lambda+i\,\varepsilon 9: (g_{\Psi},g_{\Omega})\leftarrow\textsc{Solve}\!\left(F_{\Psi}(\cdot,\cdot;\,z)=0,\;F_{\Omega}(\cdot,\cdot;\,z)=0,\;\text{init}=(g_{\Psi}^{(0)},g_{\Omega}^{(0)})\right) \triangleright Levenberg–Marquardt 10: g_{\Psi}^{(0)}\leftarrow g_{\Psi} , g_{\Omega}^{(0)}\leftarrow g_{\Omega} \triangleright warm start for next \varepsilon 11: end for 12: \operatorname{Re}g_{\Psi}(\lambda_{j})\leftarrow\operatorname{Re}(g_{\Psi}) 13: \rho(\lambda_{j})\leftarrow\tfrac{1}{\pi}\,\operatorname{Im}(g_{\Psi}) 14: \operatorname{Re}g_{\Omega}(\lambda_{j})\leftarrow\operatorname{Re}(g_{\Omega}) 15: \rho_{\Omega}(\lambda_{j})\leftarrow\tfrac{1}{\pi}\,\operatorname{Im}(g_{\Omega}) 16: end for To solve eqs. ( 117 ), we used the following algorithm: for each of 10^{4} log-spaced values of \lambda\in[10^{-8},10^{2}] , we took z=\lambda+i\epsilon and iteratively solved ( 117 ) for decreasing values of \epsilon until \epsilon=0 , starting from \epsilon_{start}=100 with initial conditions g_{start}(z)=-1/z and g_{\Omega}^{(start)}=-1/z . The spectral densities \rho(\lambda),\rho_{\Omega}(\lambda) are evaluated with formula ( 63 ). Spectral density values below 10^{-6} are truncated to zero. The choice of \epsilon_{start}\gg 1 ensures the selection of the correct branch of g(z) (in random matrix theory, the resolvent function is a polidrome function featuring different branches, see [ 41 ] ), uniquely identified by g(z)\approx-1/z for |z|\gg 1 . To solve eqs. ( 116 ) to compute the edges through ( 117 ), we computed the initial conditions from the solution of ( 117 ), by selecting values of \lambda in the grid where \rho(\lambda) acquires a nonzero value. In algorithm 1 we report a pseudocode for the solver algorithm. The solver takes around 3 minutes on a state-of-the-art CPU to solve the equations on a grid of N_{values}=10^{4} values of \lambda . Appendix J Numerical experiments on Fashion MNIST J.1 Additional Simulations Framework Details Model. A standard DDPM [ 22 ] was employed on the FashionMNIST dataset [ 60 ] , with a UNet [ 44 ] serving as the backbone. The network follows a U-shaped encoder–decoder structure connected by skip connections across four resolution levels (64, 128, 256, 256 channels, respectively). Each level contains ResNet blocks [ 21 ] with a dropout rate of 0.1 [ 51 ] , conditioned on the diffusion time step through sinusoidal time embeddings [ 54 , 22 ] injected additively into each block. The encoder is comprised of two such blocks per level, and the decoder of three. Four-head self-attention with GroupNorm pre-normalization is applied within the ResNet blocks at the two intermediate resolutions. At the deepest level, a two-block bottleneck bridges the encoder and the decoder, with self-attention enabled in the first block and disabled in the second. Training. Each model is trained on a binary subset of FashionMNIST, pairing with the Sneaker class that exhibits the lowest pixel-wise variance and yielding nine class pairs in total. Each pair is trained at three Sneaker proportions (25%, 50%, 75%) on 8,000 images on a single core of an NVIDIA A100 GPU for approximately one week, reaching approximately 4\times 10^{6} gradient steps. In this study, a linear noise schedule is adopted, with the parameters set at \beta_{1}=10^{-4} to \beta_{T}=2\times 10^{-2} , and T=1{,}000 discrete steps. The Adam optimizer (lr =10^{-4} ) is utilized to minimize the mean squared error (MSE) between the predicted and the true noise [ 28 ] . 32 model checkpoints are saved at log-spaced intervals ( 5 per scale) per run to capture both early and late training dynamics. Generation. The DDPM ancestral sampler [ 22 ] generated 500 samples for a pair and includes all checkpoints in one to two hours with a single NVIDIA A100 or A40 GPU. Starting from \bm{x}_{T}\sim\mathcal{N}(\bm{0},\mathbf{I}_{N}) , the model iteratively denoised through all T reverse steps. At each step t\in\{T,\ldots,1\} , the update is \bm{x}_{t-1}=\frac{1}{\sqrt{\alpha_{t}}}\!\left(\bm{x}_{t}-\frac{\beta_{t}}{\sqrt{1-\bar{\alpha}_{t}}}\,\bm{\varepsilon}_{\theta}(\bm{x}_{t},t)\right)+\sqrt{\beta_{t}}\,\bm{z}_{t}, where \bm{z}_{t}\sim\mathcal{N}(\bm{0},\mathbf{I}_{N}) for t>1 and z_{t}=0 for t=1 , \bar{\alpha}_{t}=\prod_{s=1}^{t}\alpha_{s}=\prod_{s=1}^{t}(1-\beta_{s}) is the cumulative product, and \bm{\varepsilon}_{\theta}(\bm{x}_{t},t) is the UNet’s predicted noise. Examples of generated samples can be found in the J.2 . Evaluation. In accordance with the nearest-neighbor criterion outlined in [ 61 , 20 , 8 ] , a generated sample \bm{x}_{c} from class c is deemed memorized if r(\bm{x}_{c})=\frac{\|\bm{x}_{c}-\mathrm{nn}_{1}(\bm{x}_{c})\|_{2}}{\|\bm{x}_{c}-\mathrm{nn}_{2}(\bm{x}_{c})\|_{2}}<\frac{1}{3}, where \mathrm{nn}_{i}(\bm{x}_{c}) denotes the i -th nearest neighbor of \bm{x}_{c} in the training set under the \ell_{2} norm. The per-class memorization fraction is defined as the expected memorized rate under the estimated data distribution at time t , f_{\mathrm{mem}}^{c}(t)=\mathbb{E}_{\bm{x}_{c}\sim p_{\theta}^{c}(t)}\!\left[\mathbb{I}\!\left(r(\bm{x}_{c})<\tfrac{1}{3}\right)\right], and is empirically estimated by its mean over n_{c} generated samples. We define the threshold-crossing time t_{\mathrm{mem}}^{c}=\inf\{t:f_{\mathrm{mem}}^{c}(t)\geq 1/3\}, so the Sneaker-partner memorization gap \Delta t_{\mathrm{mem}}(c_{p})=t_{\mathrm{mem}}^{\mathrm{snk}}-t_{\mathrm{mem}}^{c_{p}}. (147) is tracked across all log-spaced checkpoints and class ratios. To assign each generated sample to its class, a dedicated binary ResNet-18 classifier [ 21 ] is trained for each of the nine Sneaker–partner pairs. The first convolutional layer is replaced with a single-channel counterpart to accommodate Fashion-MNIST’s grayscale input, and the network is trained with the same input preprocessing as the diffusion model (class-pair mean subtracted, unit standard deviation). Training uses AdamW [ 34 ] with cosine annealing [ 33 ] over 15 epochs, differential learning rates (backbone: 10^{-5} , head: 10^{-4} ) [ 23 , 13 ] , weight decay 0.01 [ 30 ] , and label smoothing 0.1 [ 53 ] . The classifiers used for class assignment are trained on a 90/10 train–validation split; using an 80/20 split led to no material difference. Across all class proportions, all nine classifiers achieved above 96.0\% macro F1 and 97.3\% balanced accuracy. The reported lowest values were observed for the visually similar Sneaker–Ankle Boot pair, confirming reliable class attribution of generated samples under the primary imbalance conditions examined. J.2 Supplementary Figures Generated samples and memorization dynamics. We first visualize a representative Sneaker–Bag pair in Figure 11 to illustrate the transition from generalization to memorization. The figure shows generated samples at selected checkpoints alongside their first and second nearest training examples, providing an intuitive view of the sample-level memorization criterion defined in the Section 4 . Under this criterion, the memorized sample is highlighted in red. The bottom panel traces the corresponding nearest-neighbor dynamics: solid and dashed curves denote the mean distances to the first and second nearest neighbors, respectively, while vertical dotted lines mark the class-specific memorization times. Figures 13a to 19a report the same analysis for the remaining eight Fashion MNIST class pairs. Figure 11: Overview example for the Bag class. a T-shirt/top Figure 12: Overview examples for Fashion-MNIST classes (Part 1). a Trouser Figure 13: Overview examples for Fashion-MNIST classes (Part 2). a Pullover Figure 14: Overview examples for Fashion-MNIST classes (Part 3). a Dress Figure 15: Overview examples for Fashion-MNIST classes (Part 4). a Coat Figure 16: Overview examples for Fashion-MNIST classes (Part 5). a Sandal Figure 17: Overview examples for Fashion-MNIST classes (Part 6). a Shirt Figure 18: Overview examples for Fashion-MNIST classes (Part 7). a Ankle boot Figure 19: Overview examples for Fashion-MNIST classes (Part 8). Memorization fraction curves. We next extend the illustration in Figure 5 (a) by showing the memorization fraction curves for all Sneaker-paired Fashion MNIST classes in Figure 5 . Including early checkpoints shows that the memorization fraction remains zero for all classes before the onset of memorization. Afterward, all paired classes except Trouser reach the memorization threshold before Sneaker. Figure 20: Memorization fraction curves for all Sneaker-paired Fashion MNIST classes. Further validation on CIFAR. We further present the same phenomenon on CIFAR [ 29 ] using the same DDPM architecture and training settings, with 3,000 training samples. The left panel of Figure 21 shows that CIFAR classes have smaller normalized in-class variances than Fashion-MNIST classes. Nevertheless, when zooming in on the lowest- and highest-variance CIFAR classes, Automobile is memorized before Deer, matching the variance-based prediction. Absolute memorization times differ from Fashion-MNIST, which is expected because the CIFAR experiment uses a different total sample size; this is consistent with the theoretical prediction that sample number also affects memorization time [ 27 , 8 ] . The corresponding generated samples and the dynamics of the nearest-neighbor are shown in Figure 22 . Figure 21: Left: normalized variance for each class on two datasets; the annotated numbers report the total class variance. Right: memorization fraction curves for the class pair with the largest variance gap in each dataset. The inset shows the same curves on a linear training-step scale, and the legend reports the corresponding memorization-time gaps. Figure 22: CIFAR generated samples and nearest-neighbor dynamics. For CIFAR, we restrict the second nearest neighbor to the same class. This avoids fluctuations in the average 2-NN distance caused by Automobile samples whose unconstrained second nearest neighbor may lie in Deer, while preventing such fluctuations from shifting the Automobile memorization time earlier. Robustness to memorization thresholds. Because memorization has no unique operational definition, choosing comparable thresholds across models is inherently difficult. We use f_{\mathrm{mem}}=1/3 for DDPM in the main text to capture a realistic regime where a substantial, but not exhaustive, fraction of samples is memorized. The same trends hold under stricter choices f_{\mathrm{mem}}=1/6 and 1/12 . For RF, whose criterion is tied to the initial loss, tightening the threshold from 20\% worse than the initial loss to 10\% worse, or equal to the initial loss, also preserves the qualitative picture (see Figure 23 and Figure 24 , respectively). Moreover, using RF threshold 1.3 gives a correlation with the DDPM result comparable to that obtained with the main threshold 1.2 . Figure 23: Same plot as Figure 6 , but using alternative thresholds to compute the DDPM memorization gap \Delta t_{\mathrm{mem}} . The three rows correspond to f_{\mathrm{mem}}=1/12 , 1/6 , and 1/3 , with the definition of \Delta t_{\mathrm{mem}} given in Section 4 . The overall patterns are similar across these threshold choices. Figure 24: Same plot as Figure 6 , but using alternative RF memorization thresholds. The RF threshold is defined by how much the test loss is allowed to degrade relative to the initial loss, as described in Section 3.2.1 ; for example, a threshold of 1.1 means 10\% worse than the initial loss. Similar patterns also persist across thresholds.