Multi-layer Cross-Attention is Provably Optimal for Multi-modal In-context Learning Nicholas Barnfield, Subhabrata Sen, Pragya Sur Abstract Recent progress has rapidly advanced our understanding of the mechanisms underlying in-context learning in modern attention-based neural networks. However, existing results focus exclusively on unimodal data; in contrast, the theoretical underpinnings of in-context learning for multi-modal data remain poorly understood. We introduce a mathematically tractable framework for studying multi-modal learning and explore when transformer-like architectures can recover Bayes-optimal performance in-context. To model multi-modal problems, we assume the observed data arises from a latent factor model. Our first result comprises a negative take on expressibility: we prove that single-layer, linear self-attention fails to recover the Bayes-optimal predictor uniformly over the task distribution. To address this limitation, we introduce a novel, linearized cross-attention mechanism, which we study in the regime where both the number of cross-attention layers and the context length are large. We show that this cross-attention mechanism is provably Bayes optimal when optimized using gradient flow. Our results underscore the benefits of depth for in-context learning and establish the provable utility of cross-attention for multi-modal distributions. 1 Introduction Large language models exhibit striking “in-context learning” (ICL) behavior ( 7 ) : given a sequence of input-output pairs for a new task, the model can infer the rule (the function from input to output) without any update to the model weights. This phenomenon has motivated a growing body of theoretical work that tries to understand when and how ICL succeeds in linearized attention-based models ( 49 ; 28 ; 51 ) . Prior work on ICL focuses on unimodal data; in contrast, modern foundation models routinely process multi-modal data, such as text, images, video ( 24 ) , multi-omic data ( 12 ) , etc. This prompts the natural question: Can attention-based neural networks learn prediction rules in-context when deployed on multi-modal datasets? In this work, we formulate and study an ICL problem on multi-modal data. Our main contributions are as follows: • We introduce a statistical model for ICL on multi-modal data. The proposed data distribution is a latent factor model where the factors are dependent across the data modalities. • We show that a single-layer, linear self-attention (LSA) model fails to achieve Bayes-optimal performance in-context over this class of data distributions. • We propose a multi-layer model with cross-attention (CA) plus self-attention (SA) and skip connections to solve the ICL problem in this context. Linearizing the attention mechanism, we show that, upon a suitable restriction of the model parameters, gradient flow on the population loss of converges to the Bayes-optimal ICL predictor. To highlight the technical challenge in our setting, note that prior work on ICL in a regression setting assumes that the covariates are sampled from a fixed distribution (usually Gaussian) independent of the learning task ( 49 ; 51 ; 28 ) . Indeed, ( 49 ; 51 ) explicitly notes that the invariance of the covariate distribution across prompts is crucial in establishing the success of single-layer LSA. In sharp contrast, our multi-modal model exhibits covariate-shifts across prompts. In addition, the prediction rule in a prompt is naturally coupled with the covariate distribution in our setting. In Theorem 4.1 , we formally establish that the natural covariate shift in our setup invalidates single-layer LSA (i.e., models based on single-layer LSA fail to be Bayes optimal). To overcome this challenge, we introduce a multi-layer model based on both linear cross-attention (LCA) and LSA, and show that it succeeds on the ICL task. At an intuitive level, the success of attention-based neural networks is derived from their ability to learn “long-range” relations among the features. In multi-modal learning, it is critical to learn the dependence among features across the observed modalities. The CA mechanism has been suggested as a natural extension of the attention mechanism to this end ( 42 ; 27 ) ; in our work, we demonstrate the efficacy of deep neural networks which use both LCA and LSA layers for multi-modal learning. Paper organization. The rest of the paper is organized as follows. In Section 2 , we review prior work on ICL and multimodal learning. In Section 3 , we introduce the latent-factor data distribution. In Section 4 , we define the ICL objective and show a single-layer LSA baseline fails at the ICL task. In sections 5 – 6 , we propose the multi-layer CA architecture and show that gradient flow converges to the Bayes-optimal in-context prediction. In Section 7 , we present supporting numerical experiments, and then conclude in Section 8 with discussion and future directions. Full proofs are left for Appendices A – E . Appendices F – G include additional numerics. 2 Prior Work ICL capabilities of large language models were first noted in ( 7 ) . These observations motivated significant recent research on the foundations and intricacies of ICL. Early investigations focused on the expressivity of transformers ( 5 ; 2 ; 16 ) and demonstrated that their ICL capabilities enable them to implement common statistical algorithms and learn certain function classes. Connections of ICL with meta-learning and variants of gradient descent were noted in ( 43 ; 1 ; 50 ) . Generalization and stability properties of ICL were studied in ( 25 ) , while a Bayesian interpretation was offered in ( 46 ) . Training dynamics of attention-based models and ICL performance of the trained models have also been investigated thoroughly. Perhaps the closest to our work is ( 49 ) , which studies ICL in the context of regression, demonstrating that a single-layer LSA model trained by gradient flow on the population loss learns the Bayes-optimal predictor. Subsequently, gradient flow or descent dynamics for multi-head self-attention were studied in ( 9 ; 51 ) . The recent work ( 20 ) goes beyond linearized attention models, and studies gradient descent on stylized one-layer transformers with non-linear softmax attention. More recently, ICL has been studied for a wider variety of models ranging from Gaussian mixture classification and clustering to non-parametric regression ( 39 ; 30 ; 29 ; 10 ) . Attention-based models have also been studied through a Gaussian sequence multi-index modeling lens in ( 13 ; 4 ; 41 ) and on sparse-token classification tasks ( 34 ; 6 ) , although ICL was not necessarily a key focus in these lines of work. In a different direction, ICL performance for infinite token dimension was studied in ( 28 ) ; they uncovered interesting trade-offs for ICL with regards to the number of pretraining examples, task diversity and other problem parameters; see also ( 45 ) for the impact of the number of independent pre-training tasks. The recent work ( 23 ) investigated the impacts of pre-training and testing task covariance mismatch. Despite this extensive literature, these prior works are restricted to data arising from a single mode, whereas we focus on ICL for multi-modal data. In diverse artificial intelligence problems, multi-modal learning—combining information from varied modes, e.g., text, image, video—is known to improve prediction, reasoning and learning capabilities. Although examined extensively in empirical studies ( 35 ; 3 ; 21 ; 44 ) , this setting is far from understood from a rigorous standpoint. Bridging this theoretical gap is a primary aim of our manuscript. Specifically, multimodal learning is useful when the modes share common information. To capture this, we use latent variable models that have been widely used in statistical estimation for studying multimodal data. Relevant works in this regard include ( 33 ; 15 ; 31 ; 22 ; 14 ; 48 ; 38 ) . However, these papers do not study ICL or attention-based models in this context. On the theoretical end, ( 26 ; 19 ; 8 ) study multi-modal contrastive learning, but do not focus on ICL, which is the main focus of our present work. 3 Problem Setup Notation. Bold lower and upper case letters are used for vectors and matrices respectively. We use \bm{0}_{d\times d} and \bm{0}_{d} for the matrix and vector of all zero entries. We use \bm{I}_{d} to denote the identity matrix in {\mathbb{R}}^{d} , omitting the subscript at times when the ambient dimension is evident. The standard basis vectors are written as \bm{e}_{j} for j\geq 1 to denote the vector of zeros except for a one in the j -th entry with the context implying the dimension. The multivariate Gaussian distribution in {\mathbb{R}}^{d} is written \mathcal{N}_{d}(\bm{\mu},\bm{\Sigma}) where \bm{\mu}\in{\mathbb{R}}^{d} denotes the mean and \bm{\Sigma}\in{\mathbb{R}}^{d\times d} denotes the covariance. Lastly, for k\in{\mathbb{N}} , we write [k]=\{1,2,\dots,k\} . We study a multi-modal framework where each prompt (task) provides a context of input–output examples; the inputs contain features from two distinct modalities. To model a natural multi-modal setting, we assume the data is drawn from a latent variable model. Unlike prior work on ICL, we allow the distribution of covariates to differ across tasks. Formally, we observe N prompts (tasks) with (training) context length L . For each prompt j\in[N] , we observe a sequence (\bar{\bm{z}}_{i}^{(j)},\tilde{\bm{z}}_{i}^{(j)},y_{i}^{(j)})_{i=1}^{L} where y^{(j)}_{i}\in{\mathbb{R}} is a response and \bar{\bm{z}}_{i}^{(j)}\in{\mathbb{R}}^{d_{1}},\tilde{\bm{z}}_{i}^{(j)}\in{\mathbb{R}}^{d_{2}} are two modalities of covariates. For example, \bar{\bm{z}} could represent an image, \tilde{\bm{z}} some associated text annotation, and y represents a real-valued output. In each prompt, we additionally observe a tuple (\bar{z}_{q}^{(j)},\tilde{z}_{q}^{(j)},y_{q}^{(j)}) . We input the prompt and the covariate pair (\bar{\bm{z}}_{q}^{(j)},\tilde{\bm{z}}_{q}^{(j)}) into the model, and it outputs a prediction \hat{y}_{q}^{(j)} for y_{q}^{(j)} . While training, the model weights are tuned to minimize the error in predicting the y_{q} ’s on the training prompts. To assess the ICL performance of the fitted model, we consider a fresh prompt, and study the prediction error of the fitted model on the y_{q} associated with the test prompt. We now turn to a statistical model for the data. The covariates and response are generated via \displaystyle\bar{\bm{z}}_{i}^{(j)} \displaystyle=u_{i}^{(j)}\bm{v}^{(j)}+\bm{\xi}_{i}^{(j)} \displaystyle\tilde{\bm{z}}_{i}^{(j)} \displaystyle=u_{i}^{(j)}\bm{r}^{(j)}+\bm{\eta}_{i}^{(j)} \displaystyle y_{i}^{(j)} \displaystyle=\zeta^{(j)}u_{i}^{(j)}. (3.1) The latent variable u_{i}^{(j)}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}\mathcal{N}(0,1) is shared across both modalities and the response. The the prompt-specific regression coefficient, which relates u_{i}^{(j)} to y_{i}^{(j)} , is given by \zeta^{(j)}\in{\mathbb{R}} . We will assume that across prompts, \zeta^{(j)} are sampled i.i.d. from a distribution with mean 0 and variance 1 . On the other hand, \bm{v}^{(j)}\in\mathbb{R}^{d_{1}} and \bm{r}^{(j)}\in\mathbb{R}^{d_{2}} are modality-specific vectors sampled i.i.d. across prompts. We defer precise assumptions about their distributions to later sections. Finally, \bm{\xi}_{i}^{(j)}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}\mathcal{N}_{d_{1}}(0,\bm{I}) and \bm{\eta}_{i}^{(j)}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}\mathcal{N}_{d_{2}}(0,\bm{I}) are i.i.d. noise variables. The setup in ( 3 ) formalizes mathematically a fundamental idea underlying multi-modal machine learning: each modality provides a different (noisy) view of a common latent feature u which drives the response y . Focusing on a single task, omitting the prompt superscript, stacking the covariates and their modality vectors, we denote \bm{x}_{i}:=\begin{bmatrix}\bar{\bm{z}}_{i}\\ \tilde{\bm{z}}_{i}\end{bmatrix},\qquad\qquad\bm{m}:=\begin{bmatrix}\bm{v}\\ \bm{r}\end{bmatrix} (3.2) and let d=d_{1}+d_{2} . Then, in each prompt (i.e. conditional on \bm{m} and \zeta ), the covariates and response are jointly Gaussian \begin{bmatrix}\bm{x}_{i}\\ y_{i}\end{bmatrix}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}{\cal N}_{d+1}\left(0,\bm{\Sigma}\right)\,\,\,\,\text{with}\,\,\,\,\bm{\Sigma}=\begin{bmatrix}\bm{I}+\bm{m}\bm{m}^{\top}&\zeta\bm{m}\\ \zeta\bm{m}^{\top}&\zeta^{2}\end{bmatrix}. The joint Gaussianity of the covariates and response allows us to write y_{i}=\langle\bm{w},\bm{x}_{i}\rangle+\varepsilon_{i}\quad{\rm where}\quad\bm{w}=\frac{\zeta}{1+\|\bm{m}\|^{2}}\bm{m} (3.3) \quad{\rm and}\quad\varepsilon_{i}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}{\cal N}\left(0,\;\zeta^{2}/(1+\|\bm{m}\|^{2})\right). Our goal is to learn the task-specific Bayes-optimal predictor \langle w,x\rangle . The setup ( 3.3 ) is reminiscent of the regression setting considered in prior work ( 49 ; 28 ; 51 ) , yet presents several differences that make the learning problem significantly more difficult. Upon setting \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} (3.4) as the covariance of the covariates \{\bm{x}_{i}\}_{i=1}^{L}\cup\{\bm{x}_{q}\} , we note that the distribution of covariates varies across prompts, since \bm{m} is sampled anew for each task. Furthermore, the task vector w and covariate distribution are coupled through \bm{m} . Similarly, the variance of the additive noise and the task vector are coupled through the task-specific parameter \zeta . These dependencies invalidate prior ICL theory in our setup. As we will see below, this leads to the failure of single-layer linearized attention models previously shown to be successful for ICL when the covariate distribution does not change across prompts ( 49 ; 51 ) . 4 ICL and Failure of LSA In this section, we introduce ICL formally and show that a single-layer LSA model fails at the ICL task. To this end, we represent a single prompt by its covariate matrix and target vector \displaystyle\bm{X} \displaystyle:=[\bm{x}_{1},\dots,x_{L},\bm{x}_{q}]\in\mathbb{R}^{d\times(L+1)}, \displaystyle\bm{y} \displaystyle:=[y_{1},\dots,y_{L},0]^{\top}\in\mathbb{R}^{L+1}, where we append a dummy zero label at the query position. We define the (non-learned) joint embedding matrix \bm{E}_{\bm{X}}:=\begin{bmatrix}\bm{X}\\ \bm{y}^{\top}\end{bmatrix}=\begin{bmatrix}\bm{x}_{1}&\bm{x}_{2}&\cdots&\bm{x}_{L}&\bm{x}_{q}\\ y_{1}&y_{2}&\cdots&y_{L}&0\end{bmatrix}\in\mathbb{R}^{(d+1)\times(L+1)} which has been employed in recent works on ( 1 ; 49 ; 9 ; 20 ) . A model f maps \bm{E}_{\bm{X}} to a scalar prediction \hat{y}_{q}=f(\bm{E}_{\bm{X}}) with the goal of approximating \hat{y}_{q}\approx y_{q} . So far, the context length L is a free variable. In the subsequent discussion, it will be helpful to assume that the context length L=L_{\rm tr} for prompts in the training data. We set L=L_{\rm te} to denote the context length at test time. Our model architecture is independent of the context length, and thus this distinction is mostly for mathematical convenience. The parameter L_{\rm te} governs the generalization performance of the fitted model. 4.1 ICL Definition Formal ICL Criterion. Let \hat{y}_{q}^{(L_{\mathrm{te}})} denote the model prediction on a new prompt when the test context length L=L_{\mathrm{te}} . We say a model in-context learns if \hat{y}_{q}^{(L_{\mathrm{te}})}\longrightarrow y_{q}^{\rm Bayes}:={\mathbb{E}}[y_{q}|\bm{m},\zeta,\bm{x}_{q}]=\langle\bm{w},\bm{x}_{q}\rangle (4.1) almost surely as L_{\mathrm{te}}\to\infty , where the almost sure statement is with respect to the randomness of the new prompt. In words, ICL in our framework is synonymous with the model recovering the Bayes-optimal predictor y_{q}^{\rm Bayes} almost surely in the asymptotic L_{\mathrm{te}}\to\infty limit. The criterion ( 4.1 ) matches the mathematical interpretation of ICL in prior work ( 49 ) , although unlike in the linear regression setup ( 16 ; 49 ; 28 ) , the task vector w , the covariate distribution and the variance of the errors are all coupled via the latent variables \bm{m} , \zeta . 4.2 Baseline Model As a starting point, we study a simple baseline model and show its inability to in-context learn in our setting. Single-layer LSA. We consider a single, LSA layer acting on \bm{E}_{\bm{X}} as seen in a line of prior works ( 43 ; 1 ; 49 ; 28 ) . We write \mathsf{LSA}(\bm{E}_{\bm{X}};\theta)\in\mathbb{R}^{(d+1)\times(L+1)} , \mathsf{LSA}(\bm{E}_{\bm{X}};\theta)=\bm{E}_{\bm{X}}+\bm{W}^{PV}\bm{E}_{\bm{X}}\cdot\frac{\bm{E}_{\bm{X}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{X}}}{L} (4.2) where \theta=\{\bm{W}^{PV},\bm{W}^{KQ}\} are learnable weight matrices and the model’s prediction is taken to be \hat{y}_{q}=(\mathsf{LSA}(\bm{E};\theta))_{d+1,L+1} . This model is a linearized analogue of a transformer block \displaystyle\mathsf{SA}(\bm{E}_{\bm{X}};\theta) \displaystyle=\bm{E}+\bm{W}^{P}\bm{W}^{V}\bm{E}\cdot\mathsf{softmax}\left(\frac{(\bm{W}^{K}\bm{E})^{\top}\bm{W}^{Q}\bm{E}}{L}\right), \displaystyle\theta \displaystyle=\{\bm{W}^{P},\bm{W}^{V},\bm{W}^{K},\bm{W}^{Q}\}, (4.3) without nonlinearities and normalization, and with tied parameters \bm{W}^{KQ}=(\bm{W}^{K})^{\top}\bm{W}^{Q} and \bm{W}^{PV}=\bm{W}^{P}\bm{W}^{V} . Collapsing the key and query, and the projection and value weight matrices into single matrices for the LSA model differs from a practical transformer implementation, but is mathematically identical in regards to expressibility. In demonstrating the success of the LSA model in unimodal ICL tasks, prior works ( 50 ) rely on proving that the parameters \theta can emulate a global, inverse, covariance \bm{\Lambda}^{-1} . However, in the multimodal setting, as the covariance \bm{\Lambda} is random, no fixed parameters \theta can perform this role and hence the LSA model fails at the ICL task as shown in Theorem 4.1 . Theorem 4.1 (Single-layer LSA fails at ICL) . In the setting of Section 3 and assuming \|\bm{m}\| is atomless 1 1 1 For instance, any distribution on \bm{m} that is absolutely continuous with respect to the Lebesgue measure in {\mathbb{R}}^{d} . , no single-layer LSA predictor \hat{y}_{q}=\left(\mathsf{LSA}(\bm{E}_{\bm{X}};\theta)\right)_{d+1,L_{\rm te}+1} can in-context learn in the sense of ( 4.1 ). In particular, for any fixed \theta=\{\bm{W}^{PV},\bm{W}^{KQ}\} , \mathbb{P}\left(\lim_{L_{\rm te}\to\infty}\hat{y}_{q}=\langle\bm{w},\bm{x}_{q}\rangle\right)=0. The above negative result, whose proof is found in Appendix B , lays the motivation behind examining more complex and deeper architectures for the data distribution provided herein. ( 49 ) demonstrate, for a particular shifting-covariate distribution, that the LSA model with weights obtained via gradient flow fails to in-context learn. In contrast, Theorem 4.1 establishes a negative result in full generality, showing that no parameter configuration will yield success at the ICL task under the multimodal setting. 5 A Multi-layer CA Model Motivated by Theorem 4.1 , we propose a model where the embedding matrix is now learned and obtained from a deep network of layers akin to CA. Consider the model \displaystyle f(\bm{X},\bm{y};\theta,\gamma) \displaystyle=\mathsf{SA}(\bm{E}_{\bm{F}};\theta)_{d+1,L+1}\quad{\rm where}\quad\bm{E}_{\bm{F}}=\begin{bmatrix}\bm{F}\\ \bm{y}^{\top}\end{bmatrix}\quad \displaystyle{\rm and}\quad\bm{F}=\mathsf{CA}(\bm{X};\gamma). The above model f is a composition of a self-attention layer applied to an embedding \bm{E}_{\bm{F}} that is in turn obtained by applying multiple layers of CA between the covariates \bm{X} and an evolving distribution \{\bm{F}_{t}\}_{t\geq 0} defined below. The final SA layer is defined analogously to ( 4.2 ) with parameters \theta and where \bm{E}_{\bm{F}} now replaces \bm{E}_{\bm{X}} . Now, to define the CA model \mathsf{CA}(\bm{X};\gamma) , consider the recurrence \bm{F}_{t}=\bm{F}_{t-1}+\bm{S}_{t-1}+\bm{A}_{t-1} (5.1) for t=1,\dots,T where \bm{A}_{t-1} is the output of an attention head, \displaystyle\mathsf{A}_{t-1} \displaystyle=\mathsf{A}(\bm{Q}_{t-1},\bm{K}_{t-1},\bm{V}_{t-1}) \displaystyle=\bm{V}_{t-1}\cdot\mathsf{softmax}\left(\frac{\bm{K}_{t-1}^{\top}\bm{Q}_{t-1}}{L}\right), (5.2) with \bm{V}_{t-1}=\bm{W}^{V}_{t-1}\bm{X},\quad\bm{K}_{t-1}=\bm{W}^{K}_{t-1}\bm{X},\quad\bm{Q}_{t-1}=\bm{W}^{Q}_{t-1}\bm{F}_{t-1} where \bm{W}^{V}_{t-1},\bm{W}^{K}_{t-1},\bm{W}^{Q}_{t-1} are learnable weight matrices, and \bm{S}_{t-1}=\bm{W}^{S}_{t-1}\bm{X} with learnable weight matrix \bm{W}^{S}_{t-1} . We take \bm{F}_{0}=0_{d\times L} to begin the recurrence and set \bm{F}=\bm{F}_{T} with T denoting the depth of the CA embedding. The weights of the embedding are \gamma=\{\bm{W}_{t}^{V},\bm{W}_{t}^{K},\bm{W}^{Q}_{t},\bm{W}^{S}_{t}\}_{t=0}^{T-1} . Notice that since the query matrix \bm{Q}_{t-1} depends on \bm{F}_{t-1} , \bm{A}_{t-1} is an application of CA between the original data matrix \bm{X} and an evolving data distribution \bm{F}_{t-1} . For this reason, we view f(\bm{X},\bm{y};\theta,\gamma) as a T -layer CA model followed by a single layer of SA to obtain the final model output. The model includes the skip-connection of the previous layer input \bm{F}_{t-1} in each layer ( 5.1 ) resembling standard transformers. Diverging from conventional architectures ( 42 ) , we also include a learnable skip-connection \bm{S}_{t-1} that injects the unaltered raw data \bm{X} into each layer as displayed in Figure 1 . Taking inspiration from unrolled neural networks ( 18 ; 32 ) , the inclusion of \bm{S}_{t-1} was preceded by theoretical considerations—specifically, to yield embeddings \bm{E}_{\bm{F}} with desirable properties—and later supported by ablation experiments (see Appendix F ). As earlier, we use the bottom-right corner of the final output as our prediction \hat{y}_{q} . Figure 1 : Visual representation of the re-injection of covariates \bm{X} throughout the \mathsf{CA} ( \mathsf{LCA} ) embedding in addition to the skip-connection \bm{F}_{t} standard to transformers ( 42 ) . The propagation of the raw data \bm{X} occurs both through \bm{S}_{t} as well as through the CA block \bm{A}_{t} . To ensure the analysis remains tractable, we replace the \mathsf{softmax} with an identity map along the lines of Section 4.2 and prior theoretical literature on ICL ( 43 ; 1 ; 49 ; 28 ) . This yields the linearization \displaystyle f(\bm{X},\bm{y};\theta,\gamma) \displaystyle=\mathsf{LSA}(\bm{E}_{\bm{F}};\theta)_{d+1,L+1}\quad{\rm where}\quad\bm{E}_{\bm{F}}=\begin{bmatrix}\bm{F}\\ \bm{y}^{\top}\end{bmatrix}\quad \displaystyle{\rm and}\quad\bm{F}=\mathsf{LCA}(\bm{X};\gamma) (5.3) where the \mathsf{LCA}(\bm{X};\gamma) simply denotes \mathsf{CA}(\bm{X};\gamma) whereby ( 5 ) is modified to \mathsf{A}(\bm{Q}_{t-1},\bm{K}_{t-1},\bm{V}_{t-1})=\bm{V}_{t-1}\cdot\frac{\bm{K}_{t-1}^{\top}\bm{Q}_{t-1}}{L}. For mathematical simplification, we do not include two key components of conventional transformers—layer normalization ( 47 ) and non-linear activations (MLP layers). That said, the model ( 5 ) is highly-nonlinear in \bm{X} and the final LSA readout is itself a non-linear (cubic) transformation of the learned embedding \bm{E}_{\bm{F}} . Additionally, we notice qualitative similarities between the minima both with and without layer normalization (see Figure 6 , Appendix G ). 5.1 Weight Simplifications Thus far, the learnable weights have remained unconstrained. We now restrict their parameter space to ensure analytical tractability. To this end, we consider two simplifications. For both, we freeze \displaystyle\bm{W}_{t-1}^{K} \displaystyle=\bm{W}_{t-1}^{Q}=\bm{I}_{d},\quad\bm{W}^{PV}=\begin{bmatrix}\bm{0}_{d\times d}&\bm{0}_{d}\\ \bm{0}_{d}^{\top}&1\end{bmatrix},\quad \displaystyle{\rm and}\quad\bm{W}^{KQ}=\begin{bmatrix}\bm{I}_{d}&\bm{0}_{d}\\ \bm{0}_{d}^{\top}&0\end{bmatrix}. We note that the prescription of zero blocks in \bm{W}^{PV} and \bm{W}^{KQ} mimics the initialization given in ( 49 ) . One-parameter Model. In the first case, we tie weights across layers and set \bm{W}_{t-1}^{S}=-\bm{W}_{t-1}^{V}=\alpha\bm{I}_{d} (5.4) for all 1\leq t\leq T-1 where \alpha\in{\mathbb{R}} is a learnable scalar parameter. This gives a one-parameter model \hat{y}_{q}=f(\bm{X},\bm{y};\alpha). (5.5) Two-parameter Model. For the second model, we instead set \bm{W}_{t-1}^{S}=\alpha\bm{I}_{d}\quad{\rm and}\quad\bm{W}_{t-1}^{V}=\beta\bm{I}_{d}\quad (5.6) for all 1\leq t\leq T-1 where (\alpha,\beta)\in{\mathbb{R}}^{2} are learnable parameters, yielding a two-parameter model \hat{y}_{q}=f(\bm{X},\bm{y};\alpha,\beta). (5.7) The first model is recovered from the second by setting \beta=-\alpha . In both cases, we have kept the original architecture while restricting the parameter space. Assuming a well-chosen training procedure, one can thus view the performance of the one- and two-parameter models as an upper-bound for the full model where all parameters are free. We show in the following that the two simplified models successfully achieve Bayes-optimal prediction in the ICL setting when trained by gradient flow. 6 Training Setup and Main Results 6.1 Training Setup Herein, we consider the one- and two-parameter models \hat{y}_{q}=f(\bm{X},y;\theta) of Section 5.1 where \theta either denotes the parameters \alpha or (\alpha,\beta) . Starting with a set of N training prompts \{(\bm{x}_{i}^{(j)},y_{i}^{(j)})_{i=1}^{L_{\rm tr}}\cup(\bm{x}_{q}^{(j)},y_{q}^{(j)})\}_{j=1}^{N} , given real-valued, continuous targets, it is natural to consider the empirical squared loss on the target query \ell_{N,L_{\mathrm{tr}}}(\theta):=\frac{1}{N}\sum_{j=1}^{N}\left(y^{(j)}_{q}-f(\bm{X}^{(j)},\bm{y}^{(j)};\theta)\right)^{2}. As in prior work ( 49 ; 1 ) , taking the number of training prompts N\to\infty , we operate on the population loss \ell_{L_{\mathrm{tr}}}(\theta):=\lim_{N\to\infty}\ell_{N,L_{\mathrm{tr}}}(\theta)={\mathbb{E}}\left[\left(y_{q}-f(\bm{X},\bm{y};\theta)\right)^{2}\right], where the expectation is taken with respect to the joint distribution detailed in Section 3 . As a final reduction, we consider the asymptotic, training context-length regime and define the loss \ell(\theta):=\lim_{L_{\rm tr}\to\infty}\ell_{L_{\mathrm{tr}}}(\theta). (6.1) This regime is qualitatively similar to prior work ( 49 ) whereby one establishes the ICL capacity of the model at large context length, however our presentation diverges by taking the L_{\mathrm{tr}}\to\infty limit before training on the loss function. Having established the loss of interest, the training procedure for both variants of the CA model will simply be to run gradient flow on the limiting objective \ell . That is, the model parameters evolve according to the ordinary differential equation \frac{\mathop{\mathrm{\mathstrut d}}\nolimits\!}{\mathop{\mathrm{\mathstrut d}}\nolimits\!t}\theta_{t}=-\nabla\ell(\theta_{t}), where (\theta_{t})_{t\geq 0} is the trajectory of the parameters over the training horizon. Gradient flow can be seen as the limit of gradient descent in vanishing step size. Analyzing optimization in the gradient flow limit has enabled precise characterization of deep neural network training dynamics ( 37 ; 11 ) ; this approach has been leveraged in previous studies on ICL for transformers ( 49 ; 51 ) . 6.2 Main Results Recall the stacked modality-dependent vector \bm{m} from ( 3.2 ). We make the following assumption on the distribution of \bm{m} across prompts. Assumption 6.1 (Support of \|\bm{m}\| ) . Assume \bm{m} has a continuous distribution and \underline{m}:={\rm ess}\inf\|\bm{m}\|^{2}<{\rm ess}\sup\|\bm{m}\|^{2}=:\overline{m}<\infty so that \|\bm{m}\| is almost-surely bounded and non-degenerate. The boundedness assumption on \bm{m} is mild. For example, it holds as soon as the covariates are normalized, for instance \bm{x}_{i}\in[0,1]^{d} . The density assumption is included for technical reasons; it simplifies the proofs of our main results. We do not believe this assumption is intrinsically necessary for the results described below. We now present our main results. We show that a deep model of CA layers learns the Bayes-optimal prediction rule in-context for this multi-modal problem. Theorem 6.2 (One-parameter model optimality) . Run gradient flow on the loss \ell(\alpha) for the one-parameter model. Under the data generating process in Section 3 and Assumption 6.1 , we have: 1. Gradient flow converges. Formally, letting (\alpha_{t,T})_{t\geq 0} denote the gradient descent trajectory for a CA stack of depth T , the limit \alpha^{\ast}_{T}:=\lim_{t\to\infty}\alpha_{t,T} exists. 2. As T\to\infty , \alpha^{\ast}_{T}\to\frac{2}{2+\underline{m}+\overline{m}}=:\alpha^{\ast}. 3. The resulting predictor is Bayes optimal as the depth diverges. Formally, \lim_{T\to\infty}\lim_{L_{\rm te}\to\infty}\hat{y}_{q}=\langle\bm{w},\bm{x}_{q}\rangle almost surely. We prove this result in Appendix D . We sketch the proof ideas below. Proof sketch. The one-parameter loss assumes the compact form \ell(\alpha)={\mathbb{E}}[\|\bm{m}\|^{2}(1-\alpha(\|\bm{m}\|^{2}+1))^{2T}]. The strict convexity and coercivity of this loss imply convergence of gradient flow using well-established theory ( 17 ) . Subsequently, taking the (\cdot)^{1/2T} -th root of the loss, one shows epigraphical convergence ( 36 ) as T\to\infty to the limit \phi(\alpha)=\max\{|1-\alpha(\underline{m}+1)|,|1-\alpha(\overline{m}+1)|\}. This yields convergence of the sequence of minimizers (\alpha^{\ast}_{T})_{T\geq 1} to the unique minimizer of \phi which is merely \alpha^{\ast} . Bayes optimality follows by solving the recurrence 5.1 to find that \lim_{L_{\rm te}\to\infty}\hat{y}_{q}=\langle\bm{w},\bm{x}_{q}\rangle+e(\alpha) (6.2) with error e(\alpha)=O(\|\bm{I}-\alpha\bm{\Lambda}\|^{T}) where \|\bm{I}-\alpha\bm{\Lambda}\|<1 at \alpha=\alpha^{\ast} and hence e(\alpha^{\ast})\to 0 as T\to\infty . ∎ We now turn to the two-parameter setting in the following result which requires additional technical assumptions. Theorem 6.3 (Two-parameter model optimality) . Under the data generating process in Section 3 and Assumption 6.1 , run gradient flow on the loss \ell(\alpha,\beta) for the two-parameter model with initialization \beta_{0}\in(-2/(\overline{m}+1),0)\quad{\rm and}\quad\alpha_{0}=\alpha^{\ast}(\beta_{0}) (6.3) where \beta\mapsto\alpha^{\ast}(\beta) is defined in E.1 (Appendix E ). Then, we have the following: 1. Gradient flow converges. Formally, letting (\alpha_{t,T},\beta_{t,T})_{t\geq 0} denote the gradient descent trajectory for a CA stack of depth T , the limit (\alpha^{\ast}_{T},\beta^{\ast}_{T}):=\lim_{t\to\infty}(\alpha_{t,T},\beta_{t,T}) exists. 2. Suppose \lim_{T\to\infty}\beta^{\ast}_{T}\notin\{-2/(\overline{m}+1),0\} . Then, with \alpha^{\ast} as defined in Theorem 6.2 , as T\to\infty , \ \alpha^{\ast}_{T}\to\alpha^{\ast} and \beta^{\ast}_{T}\to-\alpha^{\ast}. 3. As in Theorem 6.2 , the resulting predictor is Bayes optimal as the depth grows. Formally, \lim_{T\to\infty}\lim_{L_{\rm te}\to\infty}\hat{y}_{q}=\langle\bm{w},\bm{x}_{q}\rangle almost surely. As before, we include a brief sketch of the proof of Theorem 6.3 . This will also motivate the choice of the initialization in the theorem above. Proof sketch. The two-parameter loss has the explicit expression \ell(\alpha,\beta)={\mathbb{E}}\left[\|\bm{m}\|^{2}\left(\frac{\alpha}{\beta}[(1+\beta(\|\bm{m}\|^{2}+1))^{T}-1]-1\right)^{2}\right]. (6.4) This loss is non-convex and non-coercive; however, it is quadratic in \alpha for fixed \beta with profiled minimizer \alpha^{\ast}(\beta)=\argmin_{\alpha\in{\mathbb{R}}}\ell(\alpha,\beta) . By using this structure, we first show that (\alpha_{t})_{t\geq 0} (at fixed depth T ) is bounded. Then, establishing that \ell(\alpha_{0},\beta_{0})<\inf_{\alpha\in{\mathbb{R}}}\min\{\ell(\alpha,-2/(\overline{m}+1)),\ell(\alpha,0)\} and given gradient flow is characteristically non-increasing on the loss \ell(\alpha,\beta) , it follows that (\beta_{t})_{t\geq 0}\subset(-2/(\overline{m}+1),0) —namely the entire gradient flow trajectory (\alpha_{t},\beta_{t})_{t\geq 0} remains bounded. Starting with this a priori boundedness, we establish convergence of gradient flow at fixed T . To determine the limiting behavior as T\to\infty , one takes a log-transformation of \beta\mapsto\ell(\alpha^{\ast}(\beta),\beta) and finds that its derivative remains nonzero for sufficiently large T if \lim_{T\to\infty}\beta^{\ast}_{T}\neq-\alpha^{\ast} . This contradicts (\alpha^{\ast}_{T},\beta^{\ast}_{T})_{T\geq 1} being a sequence of stationary points. Convergence of \alpha^{\ast}_{T}\to\alpha^{\ast} as T\to\infty follows by examining \lim_{T\to\infty}\alpha^{\ast}(\beta_{T}) as necessarily \alpha^{\ast}_{T}=\alpha^{\ast}(\beta_{T}) . Finally, Bayes optimality is delivered via the same argument as in Theorem 6.2 . ∎ The proof of the above result is considerably more intricate than that of Theorem 6.2 and can be found in Appendix E . Theorem 6.3 shows that the limiting behavior of the two-parameter model mimics that of the one-parameter setting, whereby in both cases one achieves the Bayes-optimal predictor. A careful reader may have noticed how the proof sketches above help inform the choice of initialization ( 6.3 ). Firstly, a short calculation shows that \alpha\in(0,2/(\overline{m}+1))\implies\|\bm{I}-\alpha\bm{\Lambda}\|<1 (6.5) almost surely. Therefore, from ( 6.2 ), choosing any \alpha in this window for the one-parameter setup ( 6.5 ) will produce a Bayes-optimal prediction. Given the correspondence between the two models (see ( 5.4 ) and ( 5.6 )), this lends to \beta_{0}\in(-2/(\overline{m}+1),0) as a suitable initialization in the two-parameter setup. Moreover, as \ell(\alpha,\beta) is quadratic in \alpha with explicit minimizer \alpha^{\ast}(\beta) , starting at \alpha_{0}=\alpha^{\ast}(\beta_{0}) becomes an obvious choice. This intuition is supported in a visualization of the loss landscape provided in Figure 6 , Appendix G . 6.3 The limiting parameter \alpha^{\ast} Thus far, we have only mentioned that the limiting parameter \alpha^{\ast}=2/(2+\underline{m}+\overline{m}) suffices for Bayes optimality—which follows from ( 6.2 ) and ( 6.5 )—but have not commented on its particular form. As remarked above, for the one-parameter model, one learns the ICL task at asymptotic depth if \|\bm{I}-\alpha\bm{\Lambda}\|<1 with vanishing error e(\alpha) . Recalling \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} , along the spike direction, the absolute value of the largest attainable eigenvalue is \phi(\alpha):=\max\{|1-\alpha(1+\underline{m})|,|1-\alpha(1+\overline{m})|\} and we note \alpha^{\ast}=\argmin_{\alpha\in{\mathbb{R}}}\phi(\alpha) . Interestingly, the limiting parameter \alpha^{\ast} coincides with the parametrization minimizing the worst-case error rate given by the spike contribution to e(\alpha) . Hence, Theorems 6.2 and 6.3 show that the CA models are in a sense minimax optimal in the large T and L_{\rm te} limits. 6.4 The role of depth Consider the embedding \bm{F}=\mathsf{LCA}(\bm{X};\theta) produced by the T -layer CA stack, and let \{\bm{f}_{i}\}_{i=1}^{L_{\rm te}} denote its (non-query) columns corresponding to the context tokens. Under mild conditions (and ignoring lower-order terms that vanish as L_{\mathrm{te}}\to\infty ), the final prediction produced by the LSA readout has the schematic form \hat{y}_{q}\approx\bm{w}^{\top}\left(\frac{1}{L_{\rm te}}\sum_{i=1}^{L_{\rm te}}\bm{x}_{i}\bm{f}_{i}^{\top}\right)\bm{x}_{q}. as shown in Appendix C (Lemma C.1 ). Thus, if the CA stack can enforce \frac{1}{L_{\rm te}}\sum_{i=1}^{L_{\rm te}}\bm{x}_{i}\bm{f}_{i}^{\top}\longrightarrow\bm{I}_{d}\quad\text{as }T\to\infty, (6.6) then \hat{y}_{q}\to\langle\bm{w},\bm{x}_{q}\rangle as both T\to\infty and L_{\mathrm{te}}\to\infty , yielding Bayes-optimal ICL. An instance where ( 6.6 ) can occur is if \bm{F}\approx\bm{X}^{\top}\bm{\Lambda}^{-1} (6.7) —that is, the embedding \bm{F} whitens the covariates. Crucially, since the embedding \bm{F} is prompt-dependent, ( 6.7 ) is achievable even though \bm{\Lambda} is random: the model is not constrained to learning a single global inverse covariance, instead it can compute \bm{\Lambda}^{-1} implicitly from the prompt itself. Here lies the significance of the CA embedding as a whitening (denoising) mechanism for the covariates. We note that in sharp contrast to the mechanism above, a single LSA layer can only learn an average covariance, and thus fails to attain Bayes-optimal performance in our setup. 7 Numerical Experiments To convey the insights of Theorems 4.1 , 6.2 , and 6.3 in a more accessible form, we provide the results of some numerical experiments, now opting for gradient descent in place of its continuous analog and operate on the non-asymptotic objective \ell_{N,L_{\rm tr}} . In Figure 2 , we observe the failure of the single-layer LSA model proved in Theorem 4.1 . In contrast, LCA-based models achieve error-rates which are several orders of magnitude smaller as {L_{\rm te}} grows. Figure 2 : In-context performance at various L_{\rm te} of one- and two-parameter LCA-based models ( T=10 ) and LSA model from ( 4.2 ). Models are optimized on \ell_{N,L_{\mathrm{tr}}} ( L_{\rm tr}=100,N=2000 ) using gradient descent. Error bars represent standard deviation over 1000 test-prompts. Figure 3 shows the effect of depth in the \mathsf{LCA} embedding in aiding model performance on the multi-modal ICL task. Notably, despite the asymptotic presentation of Theorems 6.2 and 6.3 , we observe exceptional performance at moderate depth as anticipated by the geometric-rate error decay ( 6.2 ). Figure 3 : In-context performance for L_{\rm te}=64 at various T of one- and two-parameter LCA models. Models are optimized on \ell_{N,L_{\mathrm{tr}}} ( L_{\rm tr}=100,N=2000 ) using gradient descent. Error bars represent standard deviation over 1000 test-prompts. 8 Discussion We studied a multi-modal task in which each prompt is generated by a latent factor model, inducing prompt-dependent covariate statistics which places the setting outside of standard unimodal ICL analyses. To elucidate this added complexity, we first demonstrated the failure of single-layer LSA models standard in the literature. Motivated by this limitation, we introduced a novel transformer-like architecture, incorporating both depth and CA, proving not only its expressibility for the ICL task, but also demonstrating its capacity to learn the Bayes-optimal predictor via gradient flow. To our knowledge, our work is the first to tackle a multi-modal ICL task in a mathematically tractable setting and provably overcome covariate distribution shifts among prompts. Continuing on the theoretical side, a natural future direction will include exploring models where the covariance structure contains more than one spike—that is, generalizations of ( 3.4 ). Additionally, it will be of interest to study if the learnable weights can be varied over larger parameter classes, and whether a similar collapse as seen for the two-parameter to one-parameter case is observed for more complex settings. Toward applications, the CA architecture proposed in ( 5.1 ) is novel and should be tested on real-world, multi-modal data without the linearization and with all the conventional sophistications of modern large-language models. Lastly, while we analyzed the population loss for our CA architecture, it would be significant to extend this to sample-level results, as done earlier for unimodal problems ( 28 ) . In addition, extending to infinite token dimensions, in the spirit of ( 28 ; 23 ) , would also constitute a crucial direction for future research. These directions pose intriguing mathematical challenges, in particular, requiring potential new developments in random matrix theory, which we view as an exciting follow-up to the present paper. Appendix A Notation, Basic Identities, and the Bayes-predictor A.1 Notation and Conventions We work with a single prompt (task) unless otherwise stated. Symbol Meaning d=d_{1}+d_{2} total covariate dimension L context length (we use L_{\mathrm{tr}} or L_{\mathrm{te}} when needed) \bm{x}_{i}\in\mathbb{R}^{d} stacked covariate for context token i\in[L] \bm{x}_{q}\in\mathbb{R}^{d} query covariate y_{i}\in\mathbb{R} context response for token i\in[L] y_{q}\in\mathbb{R} query response \bm{m}\in\mathbb{R}^{d} stacked modality vector (prompt-specific), m=[v;r] \zeta\in\mathbb{R} prompt-specific scalar controlling the response u_{i}\sim\mathcal{N}(0,1) latent scalar shared across modalities and response \bm{\mu}_{i}\sim\mathcal{N}(0,\bm{I}_{d}) stacked noise in covariates \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} covariate covariance conditional on \bm{m} \bm{\Sigma} joint covariance of (x,y) conditioned on (m,\zeta) Z:=1+\|\bm{m}\|^{2} top eigenvalue of \bm{\Lambda} (rank-one spike) \bm{w}\in\mathbb{R}^{d} Bayes-optimal regression coefficient: \bm{w}=\frac{\zeta}{1+\|\bm{m}\|^{2}}\bm{m} \underline{m},\overline{m} \underline{m}=\mathrm{ess\,inf}\,\|\bm{m}\|^{2} , \overline{m}=\mathrm{ess\,sup}\,\|\bm{m}\|^{2} \underline{Z},\overline{Z} \underline{Z}=1+\underline{m}=\mathrm{ess\,inf}\,Z , \overline{Z}=1+\overline{m}=\mathrm{ess\,sup}\,Z For two sequences (a_{n})_{n\geq 1} and (b_{n})_{n\geq 1} , we write a_{n}=O(b_{n}) to mean a_{n}\leq C\cdot b_{n} for some constant C>0 for n sufficiently large. We also use o(1) to denote a sequence of terms which vanish as the ambient index grows. For example, writing a_{n}=o(1) implies a_{n}\to 0 as n\to\infty . A.2 Joint Gaussian Form and Bayes-predictor Recall the data generating process (Section 3 ): for i\in[L]\cup\{q\} , \bm{x}_{i}=u_{i}\bm{m}+\bm{\mu}_{i},\qquad y_{i}=\zeta u_{i}, with u_{i}\sim\mathcal{N}(0,1) and \bm{\mu}_{i}=[\bm{\xi}_{i},\bm{\eta}_{i}]\sim\mathcal{N}(0,I_{d}) independent across tokens i and independent of (\bm{m},\zeta) . Lemma A.1 (Joint covariance and Bayes coefficient) . Conditional on (\bm{m},\zeta) , the pair (\bm{x}_{i},y_{i})\in\mathbb{R}^{d+1} is jointly Gaussian with mean 0 and covariance \bm{\Sigma}=\begin{bmatrix}\bm{\Lambda}&\zeta\bm{m}\\ \zeta\bm{m}^{\top}&\zeta^{2}\end{bmatrix},\qquad\bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top}. Moreover, {\mathbb{E}}[y_{i}\mid\bm{m},\zeta,\bm{x}_{i}]=\bm{w}^{\top}\bm{x}_{i},\qquad\bm{w}=\frac{\zeta}{1+\|\bm{m}\|^{2}}\bm{m}, and we may write y_{i}=\langle\bm{w},\bm{x}_{i}\rangle+\varepsilon_{i},\quad\varepsilon_{i}\,\perp\!\!\!\perp\bm{x}_{i}\mid(\bm{m},\zeta),\quad\varepsilon_{i}\sim{\cal N}\left(0,\frac{\zeta^{2}}{1+\|\bm{m}\|^{2}}\right). Proof. We compute conditional covariances given (m,\zeta) : \bm{\Sigma}_{x,x}:={\mathbb{E}}[\bm{x}_{i}\bm{x}_{i}^{\top}\mid\bm{m},\zeta]={\mathbb{E}}[(u_{i}\bm{m}+\bm{\mu}_{i})(u_{i}\bm{m}+\bm{\mu}_{i})^{\top}]=\bm{m}\bm{m}^{\top}+\bm{I}=\bm{\Lambda}, \bm{\Sigma}_{x,y}:={\mathbb{E}}[\bm{x}_{i}y_{i}\mid\bm{m},\zeta]={\mathbb{E}}[(u_{i}\bm{m}+\bm{\mu}_{i})\cdot\zeta u_{i}]=\zeta\,{\mathbb{E}}[u_{i}^{2}]\,\bm{m}=\zeta\bm{m}, \bm{\Sigma}_{y,y}:={\mathbb{E}}[y_{i}^{2}\mid\bm{m},\zeta]=\zeta^{2}{\mathbb{E}}[u_{i}^{2}]=\zeta^{2}, yielding the stated \bm{\Sigma} . For a jointly Gaussian vector, the conditional mean is {\mathbb{E}}[y_{i}\mid\bm{x}_{i},\bm{m},\zeta]=\bm{\Sigma}_{x,y}^{\top}\bm{\Sigma}_{x,x}^{-1}\bm{x}_{i}=(\zeta\bm{m})^{\top}\bm{\Lambda}^{-1}\bm{x}_{i} and so \bm{w}=\bm{\Lambda}^{-1}(\zeta\bm{m}) . Using the Sherman–Morrison formula, \bm{\Lambda}^{-1}=(\bm{I}+\bm{m}\bm{m}^{\top})^{-1}=\bm{I}-\frac{\bm{m}\bm{m}^{\top}}{1+\|\bm{m}\|^{2}}. and hence, w=\left(\bm{I}-\frac{\bm{m}\bm{m}^{\top}}{1+\|\bm{m}\|^{2}}\right)\zeta\bm{m}=\zeta\bm{m}-\zeta\frac{\|\bm{m}\|^{2}}{1+\|\bm{m}\|^{2}}m=\frac{\zeta}{1+\|\bm{m}\|^{2}}\bm{m}. Finally, the conditional variance of y_{i} given \bm{x}_{i} is \displaystyle\mathrm{Var}(y_{i}\mid\bm{x}_{i},\bm{m},\zeta) \displaystyle=\bm{\Sigma}_{y,y}-\bm{\Sigma}_{x,y}^{\top}\bm{\Sigma}^{-1}_{x,x}\bm{\Sigma}_{x,y} \displaystyle=\zeta^{2}-(\zeta\bm{m})^{\top}\bm{\Lambda}^{-1}(\zeta\bm{m}) \displaystyle=\zeta^{2}\left(1-\|\bm{m}\|^{2}/(1+\|\bm{m}\|^{2})\right) \displaystyle=\zeta^{2}/(1+\|\bm{m}\|^{2}). The residual \varepsilon_{i}:=y_{i}-\langle\bm{w},\bm{x}_{i}\rangle is independent of \bm{x}_{i} conditional on (\bm{m},\zeta) by Gaussianity. ∎ A.3 Law of Large Numbers for Prompt Statistics Let \bm{X}=[\bm{x}_{1},\dots,\bm{x}_{L},\bm{x}_{q}]\in\mathbb{R}^{d\times(L+1)} and \bm{y}=[y_{1},\dots,y_{L},0]^{\top}\in\mathbb{R}^{L+1} denote the covariate matrix and target vector, and define the sample covariance \widehat{\bm{\Lambda}}:=\frac{1}{L}\bm{X}\bm{X}^{\top}. Lemma A.2 (Matrix LLN at fixed dimension) . Fix (\bm{m},\zeta) and thus \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} . Then, almost surely as L\to\infty , \widehat{\bm{\Lambda}}\to\bm{\Lambda} entry-wise, and hence also in operator norm. Moreover, \frac{1}{L}\bm{X}\bm{y}\to{\mathbb{E}}[\bm{x}_{i}y_{i}\mid\bm{m},\beta]=\zeta\bm{m},\qquad\frac{1}{L}\sum_{i=1}^{L}y_{i}^{2}\to{\mathbb{E}}[y_{i}^{2}\mid\bm{m},\zeta]=\zeta^{2}. Finally, writing y_{i}=\langle\bm{w},\bm{x}_{i}\rangle+\varepsilon_{i} as in Lemma A.1 and letting \bm{\varepsilon}=(\varepsilon_{1},\dots,\varepsilon_{L},0)^{\top} , \frac{1}{L}\bm{X}\bm{\varepsilon}\to\bm{0}\quad\text{almost surely.} Proof. Standard application of the Law of Large Numbers. ∎ Appendix B Proof of Theorem 4.1 Recall the single-layer LSA predictor \hat{y}_{q}=\mathsf{LSA}(\bm{E}_{\bm{X}};\theta)_{d+1,L+1},\quad\mathsf{LSA}(\bm{E}_{\bm{X}};\theta)=\bm{E}_{\bm{X}}+\bm{W}_{PV}\bm{E}_{\bm{X}}\cdot\frac{\bm{E}_{\bm{X}}^{\top}\bm{W}_{KQ}\bm{E}_{\bm{X}}}{L}, (B.1) where \bm{E}_{\bm{X}}=\begin{bmatrix}\bm{X}\\ y^{\top}\end{bmatrix}\in\mathbb{R}^{(d+1)\times(L+1)} and the query label is the dummy token y_{L+1}=0 . We provide the full proof of Theorem 4.1 below. Proof of Theorem 3.1. Let us write the weight matrix \bm{W}^{KQ} in block form \bm{W}^{KQ}=\begin{bmatrix}\bm{A}&\bm{b}^{\prime}\\ \bm{b}^{\top}&c\end{bmatrix},\qquad\bm{A}\in{\mathbb{R}}^{d\times d},\;\bm{b},\bm{b}^{\prime}\in{\mathbb{R}}^{d},c\in{\mathbb{R}}, and denote the last row of \bm{W}^{PV} by \begin{bmatrix}\bm{u}^{\top}&v\end{bmatrix}:=\bm{e}_{d+1}^{\top}\bm{W}^{PV},\qquad\bm{u}\in{\mathbb{R}}^{d},\;v\in{\mathbb{R}}. Since (\bm{E}_{\bm{X}})_{d+1,{L_{\rm te}}+1}=y_{{L_{\rm te}}+1}=0 , the residual term (skip-connection) in \mathsf{LSA}(\bm{E}_{\bm{X}};\theta) does not contribute to the predictor \hat{y}_{q} and so \hat{y}_{q}=\bm{e}_{d+1}^{\top}\bm{W}^{PV}\bm{E}_{\bm{X}}\cdot\frac{\bm{E}_{\bm{X}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{X}}}{{L_{\rm te}}}\bm{e}_{{L_{\rm te}}+1}. (B.2) For i\in[{L_{\rm te}}] , the i -th entry of the vector \bm{E}_{\bm{X}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{X}}\bm{e}_{{L_{\rm te}}+1} is given by [\bm{E}_{\bm{X}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{X}}\bm{e}_{{L_{\rm te}}+1}]_{i}=\begin{bmatrix}\bm{x}_{i}\\ y_{i}\end{bmatrix}^{\top}\begin{bmatrix}\bm{A}&\bm{b}^{\prime}\\ \bm{b}\top&c\end{bmatrix}\begin{bmatrix}\bm{x}_{q}\\ 0\end{bmatrix}=\left(\bm{x}_{i}^{\top}\bm{A}\bm{x}_{q}+y_{i}\bm{b}^{\top}\bm{x}_{q}\right). Moreover, the ({L_{\rm te}}+1) -th entry of \tfrac{1}{{L_{\rm te}}}\bm{E}_{\bm{X}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{X}}\bm{e}_{{L_{\rm te}}+1} is of order O(\tfrac{1}{{L_{\rm te}}}) and thus negligible as {L_{\rm te}}\to\infty . Hence, we obtain \hat{y}_{q}=\frac{1}{{L_{\rm te}}}\sum_{i=1}^{L_{\rm te}}\left(\bm{u}^{\top}\bm{x}_{i}+vy_{i}\right)\left(\bm{x}_{i}^{\top}\bm{A}+y_{i}\bm{b}^{\top}\right)\bm{x}_{q}+o(1). (B.3) Conditioned on (\bm{m},\zeta) , the context tokens \{(\bm{x}_{i},y_{i})\}_{i=1}^{L_{\rm te}} are i.i.d., and \bm{x}_{q} is independent of \{(\bm{x}_{i},y_{i})\}_{i=1}^{L_{\rm te}} with the same conditional law as \bm{x}_{i} . Applying Lemma A.2 to each empirical moment that appears when expanding ( B.3 ) yields, almost surely (for fixed (\bm{m},\zeta,\bm{x}_{q}) ), \hat{y}_{q}\longrightarrow\langle\hat{\bm{w}},\bm{x}_{q}\rangle, as {L_{\rm te}}\to\infty where the limiting regression vector \hat{\bm{w}}=\hat{\bm{w}}(\bm{m},\zeta)\in\mathbb{R}^{d} is \hat{\bm{w}}(\bm{m},\zeta)^{\top}=\bm{u}^{\top}\bm{\Lambda}\bm{A}+(\bm{m}\bm{u}\bm{b}^{\top}+v\bm{m}^{\top}\bm{A})\zeta+v\bm{b}^{\top}\zeta^{2}. (B.4) We now show that {\mathbb{P}}(\hat{\bm{w}}(\bm{m},\zeta)=\bm{w}(\bm{m},\zeta))=0 . We begin by assuming, for contradiction, that indeed \langle\hat{\bm{w}},\bm{x}_{q}\rangle=\langle\bm{w},\bm{x}_{q}\rangle and then examine the measure of this event. Since \bm{x}_{q}\mid(\bm{m},\zeta)\sim\mathcal{N}(0,\bm{\Lambda}) , we must have \hat{\bm{w}}(\bm{m},\zeta)=\bm{w}(\bm{m},\zeta) . Note that the Bayes vector \bm{w} is linear in \zeta , while, in contrast, \hat{\bm{w}}(\bm{m},\zeta) in ( B.4 ) is a polynomial in \zeta of degree of degree two and so the \zeta^{2} -coefficient must vanish: v\bm{b}=\bm{0}_{d} . Similarly, since \bm{w} has no constant ( \zeta^{0} ) term, we must have \bm{A}^{\top}\bm{\Lambda}\bm{u}=\bm{0}_{d} . It then follows that \hat{\bm{w}}(\bm{m},\zeta)=\bm{B}\bm{m}\zeta (B.5) for the fixed matrix \bm{B}=\bm{u}\bm{b}^{\top}+v\bm{A} . Recalling that \bm{w}=\frac{\zeta}{1+\|\bm{m}\|^{2}}\bm{m}, by ( B.5 ), it follows that (1+\|\bm{m}\|^{2})^{-1} is an eigenvalue of B . Since \|\bm{m}\| is atomless while the spectrum of B is finite, this cannot occur—explicitly, \sup_{B\in{\mathbb{R}}^{d\times d}}{\mathbb{P}}\left(\frac{1}{1+\|m\|^{2}}\in\sigma(B)\right)=0 where \sigma(B) denotes the spectrum of B . Hence, \mathbb{P}\left(\hat{\bm{w}}(\bm{m},\zeta)=\bm{w}(\bm{m},\zeta)\right)=0 (B.6) which establishes the desired result. ∎ Appendix C CA Algebra and Preliminaries This appendix collects algebraic identities for the CLA stack and the final LSA readout. These identities are used in the proofs of Theorems 6.2 and 6.3 . C.1 LSA Readout with Frozen Parameters Recall the (fixed) readout parameters from Section 5.1 : \bm{W}^{PV}=\begin{bmatrix}\bm{0}_{d\times d}&\bm{0}_{d}\\ \bm{0}_{d}^{\top}&1\end{bmatrix},\qquad\bm{W}^{KQ}=\begin{bmatrix}\bm{I}_{d}&\bm{0}_{d}\\ \bm{0}_{d}^{\top}&0\end{bmatrix}. Lemma C.1 (Closed-form readout) . With the above \bm{W}^{PV},\bm{W}^{KQ} , the single-layer LSA readout satisfies \widehat{y}_{q}=\mathrm{LSA}(\bm{E}_{\bm{F}})_{d+1,L+1}=\bm{w}^{\top}\left[\frac{1}{L}\sum_{i=1}^{L}\bm{x}_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}+\left[\frac{1}{L}\sum_{i=1}^{L}\varepsilon_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}. and \left[\frac{1}{L}\sum_{i=1}^{L}\varepsilon_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}\to 0 almost surely as L\to\infty if \sup_{i\geq 1}\|\bm{f}_{i}\|<\infty . Proof. By definition, \mathsf{LSA}(\bm{E}_{\bm{F}})=\bm{E}_{\bm{F}}+\bm{W}^{PV}\bm{E}_{\bm{F}}\cdot\frac{\bm{E}_{\bm{F}}^{\top}\bm{W}^{KQ}\bm{E}_{\bm{F}}}{L}. Since (\bm{E}_{\bm{F}})_{d+1,L+1}=0 , given the definitions of \bm{W}^{PV} and \bm{W}^{KQ} , we have \displaystyle\hat{y}_{q} \displaystyle=\bm{e}_{d+1}^{\top}\left(\bm{E}_{\bm{F}}+\bm{E}_{\bm{F}}\cdot\frac{\bm{E}_{\bm{F}}^{\top}\bm{E}_{\bm{F}}}{L}\right)\bm{e}_{L+1} \displaystyle=\bm{e}_{d+1}^{\top}\frac{\bm{E}_{\bm{F}}\bm{E}_{\bm{F}}^{\top}}{L}\begin{bmatrix}\bm{x}_{q}\\ 0\end{bmatrix} \displaystyle=\bm{e}_{d+1}^{\top}\frac{1}{L}\begin{bmatrix}\bm{F}\bm{F}^{\top}&\bm{F}\bm{y}\\ \bm{y}^{\top}\bm{F}^{\top}&\bm{y}^{\top}\bm{y}\end{bmatrix}\begin{bmatrix}\bm{x}_{q}\\ 0\end{bmatrix} \displaystyle=\frac{\bm{y}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} \displaystyle=\bm{w}^{\top}\left[\frac{1}{L}\sum_{i=1}^{L}\bm{x}_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}+\left[\frac{1}{L}\sum_{i=1}^{L}\varepsilon_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}. Moreover, since {\mathbb{E}}[\varepsilon_{i}]=0 and \varepsilon_{i}\perp\!\!\!\perp\bm{f}_{i} as \bm{F} depends only on \bm{X} , by the Strong Law of Large Numbers, we have \left[\frac{1}{L}\sum_{i=1}^{L}\varepsilon_{i}\bm{f}_{i}^{\top}\right]\bm{x}_{q}\to 0 almost surely as L\to\infty . ∎ Recall now that \bm{F} and hence \{\bm{f}_{i}\}_{i\geq 1} depend on the model depth T . From Lemma C.1 , we see that if \frac{1}{L}\bm{X}\bm{F}^{\top}\to\bm{I}_{d} as T\to\infty , the asymptotic model predictor will be \lim_{T\to\infty}\lim_{L\to\infty}\hat{y}_{q}=\langle\bm{w},\bm{x}_{q}\rangle, hence yielding the Bayes-optimal prediction. This will be the key step is establishing Theorems 6.2 (3) and 6.3 (3). C.2 Solving the CA Recurrence In the one- and two-scalar simplification (Section 5.1 ), we take (for all layers) \bm{W}^{K}=\bm{W}^{Q}=\bm{I}_{d},\qquad\bm{W}^{S}=\alpha\bm{I}_{d},\qquad\bm{W}^{V}=\beta\bm{I}_{d}, where \alpha,\beta\in{\mathbb{R}} are scalar parameters (with the one-parameter model corresponding to \beta=-\alpha ). Layer-wise, the model then becomes, for t=1,\dots,T , \bm{F}_{t}=\bm{F}_{t-1}+\alpha\bm{X}+\frac{\beta}{L}\bm{X}\bm{X}^{\top}\bm{F}_{t-1}, with \bm{F}_{0}=\bm{0}_{d\times(L+1)} and \bm{F}=\bm{F}_{T} . Define the sample covariance \widehat{\bm{\Lambda}}:=\frac{1}{L}\bm{X}\bm{X}^{\top} . The following result yields a closed-form expression for the final output of the CA stack and establishes the parameter window for which one obtains the Bayes-predictor. Lemma C.2 . The output of the final layer of the CA network is \bm{F}=\bm{F}_{T}=\alpha\sum_{k=0}^{T-1}\bm{M}^{k}\bm{X}\quad{\rm where}\quad\bm{M}=\bm{I}+\beta\hat{\bm{\Lambda}}. (C.1) and \frac{1}{L}\bm{X}\bm{F}^{\top}=\frac{\alpha}{\beta}\left[(\bm{I}+\beta\hat{\bm{\Lambda}})^{T}-\bm{I}\right] (C.2) If \alpha=-\beta\in(0,2/(1+\overline{m})) , then as context length L\to\infty followed by the number of layers T\to\infty , we have \frac{1}{L}\bm{X}\bm{F}^{\top}\to\bm{I}. almost surely. Proof. We prove the first statement by induction. For the base case T=1 , we have trivially \bm{F}_{1}=\alpha\bm{X} since \bm{F}_{0}=\bm{0}_{d\times(L+1)} . Now, suppose \bm{F}_{T-1}=\alpha\sum_{k=0}^{T-2}\bm{M}^{k}\bm{X} . Then, \displaystyle\bm{F}_{T} \displaystyle=\bm{F}_{T-1}+\alpha\bm{X}+\beta\hat{\bm{\Lambda}}\bm{F}_{T-1} \displaystyle=\alpha\bm{X}+(\bm{I}+\beta\hat{\bm{\Lambda}})\bm{F}_{T-1} \displaystyle=\alpha\bm{X}+\alpha\bm{M}\sum_{k=0}^{T-2}\bm{M}^{k}\bm{X} \displaystyle=\alpha\bm{X}+\alpha\sum_{k=1}^{T-1}\bm{M}^{k}\bm{X}=\alpha\sum_{k=0}^{T-1}\bm{M}^{k}\bm{X} which completes the induction. As \bm{M} is symmetric and \hat{\bm{\Lambda}}=\beta^{-1}(\bm{M}-\bm{I}) , a simple computation then yields \displaystyle\frac{1}{L}\bm{X}\bm{F}^{\top} \displaystyle=\alpha\hat{\bm{\Lambda}}\sum_{k=0}^{T-1}\bm{M}^{k}=\frac{\alpha}{\beta}\sum_{k=0}^{T-1}(\bm{M}^{k+1}-\bm{M}^{k}) \displaystyle=\frac{\alpha}{\beta}(\bm{M}^{T}-\bm{I})=\frac{\alpha}{\beta}\left[(\bm{I}+\beta\hat{\bm{\Lambda}})^{T}-\bm{I}\right]. Now, if \alpha=-\beta , we have \frac{1}{L}\bm{X}\bm{F}^{\top}=\bm{I}-(\bm{I}-\alpha\hat{\bm{\Lambda}})^{T}\to\bm{I}-(\bm{I}-\alpha\bm{\Lambda})^{T} as L\to\infty by the Law of Large Numbers. As \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} , the eigenvalues of \bm{I}-\alpha\bm{\Lambda} are 1-\alpha and 1-\alpha(1+\|\bm{m}\|^{2}) . Hence, for the choice of \alpha\in(0,2/(1+\overline{m}) , it follows that the operator norm \|\bm{I}-\alpha\bm{\Lambda}\|<1 almost surely and so (\bm{I}-\alpha\bm{\Lambda})^{T}\to\bm{0}_{d\times d} as T\to\infty almost surely. ∎ Remark C.3 . From the proof of Lemma C.2 , we see that at asymptotic context length the error away from the Bayes-optimal prediction decays geometrically in depth T so long as the model parameters satisfy \alpha=-\beta\in(0,2/(1+\overline{m})) . Hence, although the result concerns the behavior at infinite depth, in practice small to moderate depth networks should suffice for accurate in-context predictions. This intuition is supported by numerical experiments in Section 7 . Appendix D Proof of Theorem 6.2 This appendix proves Theorem 6.2 for the one-parameter model, i.e. the simplified CA stack with \beta=-\alpha trained by gradient flow on the limiting population loss. Throughout, we assume Assumption 6.1 : \|\bm{m}\|^{2} is almost surely bounded and has non-degenerate continuous support. Define Z:=1+\|\bm{m}\|^{2},\qquad\underline{Z}:=\mathrm{ess}\inf\,Z,\qquad\overline{Z}:=\mathrm{ess}\sup\,Z, so 1\leq\underline{Z}<\overline{Z}<\infty . We begin by determining a simplified form for the loss \ell(\alpha) and collecting some of its properties. Lemma D.1 (One-parameter loss) . The loss \ell(\alpha) has the form \ell(\alpha)={\mathbb{E}}[(Z-1)(1-\alpha Z)^{2T}] where Z=1+\|\bm{m}\|^{2} . Moreover, the loss has the following properties: 1. \ell(\alpha) is strictly-convex and coercive in the sense that \lim_{|\alpha|\to\infty}\ell(\alpha)=\infty; 2. \ell(\alpha) has a unique minimizer which lies between (0,1) . Proof. By Proposition C.2 , the model output can be written as \hat{y}_{q}=\bm{w}^{\top}(\bm{I}-\bm{M}^{T})\bm{x}_{q}+\frac{1}{L}\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}=\bm{w}^{\top}\bm{x}_{q}-\bm{w}^{\top}\bm{M}^{T}\bm{x}_{q}+\frac{1}{L}\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}. where \bm{M}=\bm{I}-\alpha\hat{\bm{\Lambda}} and \hat{\bm{\Lambda}} is the sample covariance matrix with the true covariance being \bm{\Lambda}=\bm{I}+\bm{m}\bm{m}^{\top} . We begin by conditioning on \bm{\Lambda} so that \bm{x}_{i}\stackrel{{\scriptstyle\text{i.i.d.}}}{{\sim}}{\cal N}(0,\bm{\Lambda}) and \bm{w}\perp\!\!\!\perp\bm{X},\bm{x}_{q} . Then, set \sigma^{2}:={\mathbb{E}}[\varepsilon_{i}^{2}] and \bm{\Sigma}_{w}:={\rm Cov}(\bm{w}) . Notice that y_{q}-\hat{y}_{q}=\bm{w}^{\top}\bm{M}^{T}\bm{x}_{q}+\varepsilon_{q}-\frac{1}{L}\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}. Let \ell(\alpha|\bm{\Lambda}) denote the loss \ell(\alpha) where one conditions on \bm{\Lambda} . We have, suppressing terms that do not depend on \alpha , \displaystyle\ell(\alpha|\bm{\Lambda}) \displaystyle={\mathbb{E}}[(\bm{w}^{\top}\bm{M}^{T}\bm{x}_{q})^{2}|\bm{\Lambda}]+\frac{1}{L^{2}}{\mathbb{E}}[(\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q})^{2}|\bm{\Lambda}]+{\mathbb{E}}[\varepsilon_{q}^{2}|\bm{\Lambda}] \displaystyle\propto{\mathbb{E}}[\tr(\bm{\Sigma}_{w}\bm{M}^{T}\bm{\Lambda}\bm{M}^{T})|\bm{\Lambda}]+\frac{1}{L^{2}}{\mathbb{E}}[\sigma^{2}\tr(\bm{\Lambda}\bm{F}\bm{F}^{\top})|\bm{\Lambda}] \displaystyle={\mathbb{E}}[\tr(\bm{\Sigma}_{w}\bm{\Lambda}\bm{M}^{2T})|\bm{\Lambda}]+\frac{\alpha^{2}}{L}{\mathbb{E}}[\sigma^{2}\tr(\bm{\Lambda}(\sum_{k=0}^{T-1}\bm{M}^{k}(\bm{I}-\bm{M}^{T})))|\bm{\Lambda}] where we neglect {\mathbb{E}}[\varepsilon_{q}^{2}|\bm{\Lambda}] as it does not depend on \alpha . In the first line above, the cross-terms do not appear by the independence of \bm{\varepsilon},\varepsilon_{q}\perp\!\!\!\perp\bm{w},\bm{X},\bm{x}_{q} and given {\mathbb{E}}[\varepsilon_{i}]=0 . As the training context length grows, we have \ell(\alpha|\bm{\Lambda}):=\lim_{L\to\infty}\ell(\alpha|\bm{\Lambda})={\mathbb{E}}[\tr(\bm{\Sigma}_{w}\bm{\Lambda}(\bm{I}-\alpha\bm{\Lambda})^{2T})|\bm{\Lambda}] as \frac{\alpha^{2}}{L}{\mathbb{E}}[\sigma^{2}\tr(\bm{\Lambda}(\sum_{k=0}^{T-1}\bm{M}^{k}(\bm{I}-\bm{M}^{T})))|\bm{\Lambda}]\to 0\quad{\rm as}\quad L\to\infty since \bm{M}\in{\mathbb{R}}^{d\times d} and we are holding the embedding dimension d fixed. Let us write the eigen-decomposition \bm{\Lambda}=\bm{U}\bm{\Gamma}\bm{U}^{\top} where \bm{U} is an orthogonal matrix and \bm{\Gamma}=\diag(\gamma_{1},\dots,\gamma_{d}) with \gamma_{i}\geq 0 the eigenvalues of \bm{\Lambda} . Writing \bm{V}=\bm{U}^{\top}\bm{\Sigma}_{w}\bm{U} which is positive semi-definite, we have \displaystyle\ell(\alpha|\bm{\Lambda}) \displaystyle=\sum_{i=1}^{d}v_{ii}\gamma_{i}(1-\alpha\gamma_{i})^{2T} where v_{ii}\geq 0 for all i\in[d] . Without loss of generality, we assume that v_{ii} and \gamma_{i} are non-increasing in i\in[d] . Letting \gamma_{\max}=\gamma_{1} denote the largest eigenvalue of \bm{\Lambda} , we have that \gamma_{\max}=1+\|\bm{m}\|^{2}=Z and \gamma_{i}=1 for i\geq 2 . Since {\mathbb{E}}[\zeta^{2}]=1 , we have \bm{\Sigma}_{w}=\frac{\bm{m}\bm{m}^{\top}}{1+\|\bm{m}\|^{2}}=\bm{I}-\bm{\Lambda}^{-1} and so v_{ii}=1-1/\gamma_{i} . Thus v_{11}=\|\bm{m}\|^{2}/(\|\bm{m}\|^{2}+1) and v_{ii}=0 for i\geq 2 . The conditional loss then simplifies to \ell(\alpha|\bm{\Lambda})=\|\bm{m}\|^{2}(1-\alpha(1+\|\bm{m}\|^{2}))^{2T}=(Z-1)(1-\alpha Z)^{2T}. and so the unconditional loss is given by \ell(\alpha)={\mathbb{E}}[(Z-1)(1-\alpha Z)^{2T}] as claimed. 1. Since (Z-1)(1-\alpha Z)^{2T} is strongly convex in \alpha for Z>0 and {\mathbb{P}}(Z>0)>0 by assumption 6.1 , it follows that \ell(\alpha) is strongly convex. Similarly, coercivity of (Z-1)(1-\alpha Z)^{2T} carries over to \ell(\alpha) by simply taking the expectation. 2. By (1), \ell(\alpha) has a unique minimizer. The first derivative of the loss is given by \ell^{\prime}_{\infty}(\alpha)=-2T{\mathbb{E}}[\gamma_{\max}(Z-1)(1-\alpha Z)^{2T-1}]. Hence, {\rm sign}(\ell^{\prime}_{\infty}(\alpha))=\begin{cases}-1,&{\rm if}\;\alpha\leq 0\\ 1,&{\rm if}\;\alpha\geq 1\\ \end{cases} (D.1) since (1-\alpha/Z)^{2T-1}\leq 0 when \alpha\geq 1 because Z\geq 1 . Thus, the unique root of \ell^{\prime}_{\infty}(\alpha) is contained in (0,1) . ∎ D.1 Convergence of Gradient Flow Given the above established properties of \ell(\alpha) , by standard dynamical systems theory results, we can derive the global convergence of gradient flow on the one-parameter loss. We include a detailed proof to initiate the unfamiliar reader. Lemma D.2 (One-parameter gradient flow convergence) . Suppose Assumption 6.1 holds. Then, gradient flow on \ell(\alpha) converges globally to the unique minimum of \ell whose existence is guaranteed by Lemma D.1 . Proof. Let (\alpha_{t})_{t\geq 0} be the gradient flow trajectory initialized at \alpha_{0}\in{\mathbb{R}} and let \alpha^{\ast} denote the unique minimizer of \ell(\alpha) . By chain rule and the definition of gradient flow, we have \frac{\mathop{\mathrm{\mathstrut d}}\nolimits\!}{\mathop{\mathrm{\mathstrut d}}\nolimits\!t}\ell(\alpha_{t})=\nabla_{\alpha}\ell(\alpha_{t})\dot{\alpha}_{t}=-\|\nabla_{\alpha}\ell(\alpha_{t})\|^{2}\leq 0. Hence, the trajectory of the loss function \ell(\alpha_{t}) is decreasing and since \ell(\alpha)\geq 0 , it follows that \ell(\alpha_{t}) converges as t\to\infty . Moreover, by coercivity of \ell , \alpha_{t}\in\{\alpha:L(\alpha)\leq\ell(\alpha_{0})\} for all t which is compact. Thus, as \ell\in C^{\infty} , \ell^{\prime}(\alpha_{t}) is uniformly continuous for all t\geq 0 . Then, by Barbalat’s Lemma [ 40 ] , \ell^{\prime}(\alpha_{t})\to 0 as t\to\infty . As \alpha_{t}\in\{\alpha:L(\alpha)\leq L(\alpha_{0})\} which is compact, moving to a convergent subsequence, \alpha_{t_{k}}\to\bar{\alpha} as k\to\infty . By continuity of \ell^{\prime} , \ell^{\prime}(\alpha_{t_{k}})\to\ell^{\prime}(\bar{\alpha})=0 . Hence, \bar{\alpha}=\alpha^{\ast} which is the unique minimizer of \ell . Hence, as every subsequence of (\alpha_{t})_{t\geq 1} converges to \alpha^{\ast} , it follows that \alpha_{t}\to\alpha^{\ast} as t\to\infty . ∎ D.2 Asymptotic Depth Behavior Having thus far established the convergence of gradient flow at finite depth T , we now complete the proof of Theorem 6.2 with the following result result which shows that as T\to\infty , we recover the optimal prediction of the model. Formally, let \alpha^{\ast}_{T} denote the limit of the gradient flow on the T -layer model which, from Lemma D.2 , exists and coincides with the global minimum of \ell(\alpha) . Theorem D.3 . Suppose Assumption 6.1 holds. Let \alpha^{\ast}_{T} denote the global minimum of \ell(\alpha) for the T -layer CA model which exists uniquely by Lemma D.1 . Then, \lim_{T\to\infty}\alpha^{\ast}_{T}=:\alpha^{\ast}_{\infty}=\frac{2}{2+\underline{m}+\overline{m}}=\frac{2}{\underline{z}+\overline{z}}. Hence, the model is Bayes optimal by Lemmas C.1 and C.2 . Proof. Consider for \alpha\in[0,1] , the function \phi(\alpha):=\max_{z\in[\underline{z},\overline{z}]}|1-\alpha z|=\max\{|1-\alpha\underline{z}|,|1-\alpha\overline{z}|\}. As the composition of a convex function with an affine function, z\mapsto|1-\alpha z| is convex. On any interval, the maximum of a convex function occurs at the interval’s endpoints and so \phi(\alpha)=\max\{|1-\alpha\underline{z}|,|1-\alpha\overline{z}|\}. Note that \phi(\alpha) is convex as the maximum of convex functions. The minimum of \phi(\alpha) occurs when |1-\alpha\underline{z}|=|1-\alpha\overline{z}| . Since m<\overline{Z} , the balancing occurs at opposite signs 1-\alpha\underline{z}=-(1-\alpha\overline{z}) which yields a unique minimizer \alpha^{\ast}_{\infty}=\frac{2}{\underline{z}+\overline{z}}. Now, let f_{T}(\alpha):={\mathbb{E}}[(Z-1)(1-\alpha Z)^{2T}]^{1/{2T}}. We use a shorthand W=Z-1 and X_{\alpha}=(1-\alpha Z) so that f_{T}(\alpha)={\mathbb{E}}[WX_{\alpha}^{2T}]^{1/{2T}}. Since X_{\alpha}\leq\phi(\alpha) and {\mathbb{P}}(W>0)>0 by the assumption that \overline{z}>\underline{z}\geq 1 (so {\mathbb{E}}[W]>0 ), we have \limsup_{T\to\infty}f_{T}(\alpha)\leq\limsup_{T\to\infty}{\mathbb{E}}[W]^{1/2T}\phi(\alpha)=\phi(\alpha). (D.2) Now, let (\alpha_{T})_{T\geq 1} be a converging sequence with \alpha:=\lim_{T\to\infty}\alpha_{T} . Notice that \displaystyle\|X_{\alpha_{T}}-X_{\alpha}\|_{\infty} \displaystyle=\||1-\alpha_{T}Z|-|1-\alpha Z|\|_{\infty} \displaystyle\leq\|(\alpha_{T}-\alpha)Z\|_{\infty} \displaystyle\leq(\alpha_{T}-\alpha)\overline{Z}\xrightarrow[T\to\infty]{}0. Fixing \varepsilon\in(0,1) , the above implies \|X_{\alpha_{T}}-X_{\alpha}\|\leq 1-\varepsilon for T sufficiently large. The set S_{\varepsilon}:=\{|X_{\alpha}|>\varepsilon\|X_{\alpha}\|_{\infty}\} satisfies {\mathbb{P}}(S_{\varepsilon})>0 by definition of \|\cdot\|_{\infty} . Moreover, since W>0 a.s., there exists n\in{\mathbb{N}} such that for A_{n}:=\{W>1/n\} , we have {\mathbb{P}}(A_{n}\cap S_{\varepsilon})>0 . Putting things together, we have \displaystyle f_{T}(\alpha_{T}) \displaystyle\geq{\mathbb{E}}[WX^{2T}_{\alpha_{T}}\mathbf{1}_{S_{\varepsilon}\cap A_{n}}]^{1/2T} \displaystyle\geq\left(\frac{1}{n}\right)^{1/2T}{\mathbb{E}}[(|X_{\alpha}|-\|X_{\alpha_{T}}-X_{\alpha}\|_{\infty})^{2T}\mathbf{1}_{S_{\varepsilon}\cap A_{n}}]^{1/2T} \displaystyle\geq\left(\frac{1}{n}\right)^{1/2T}{\mathbb{E}}[(\varepsilon\|X_{\alpha}\|_{\infty}-\varepsilon+1)^{2T}\mathbf{1}_{S_{\varepsilon}\cap A_{n}}]^{1/2T} \displaystyle=\left(\frac{{\mathbb{P}}(S_{\varepsilon}\cap A_{n})}{n}\right)^{1/2T}(\varepsilon\|X_{\alpha}\|_{\infty}-\varepsilon+1) \displaystyle\xrightarrow[T\to\infty]{}\varepsilon\|X_{\alpha}\|_{\infty}-\varepsilon+1 Noticing that \phi(\alpha)=\|X_{\alpha}\|_{\infty} , taking \varepsilon\uparrow 1 , we obtain \liminf_{T\to\infty}f_{T}(\alpha_{T})\geq\phi(\alpha). (D.3) Now, note that (\alpha^{\ast}_{T})_{T\geq 1}\subset[0,1] by Lemma D.1 (2). Therefore, we can extract a convergent subsequence (\alpha_{T_{k}}^{\ast})_{k\geq 1} whose limit we denote by \bar{\alpha} . Since, \alpha^{\ast}_{T_{k}} minimizes \ell (at depth T_{k} ) and hence f_{T_{k}} , from ( D.2 ), we have f_{T_{k}}(\alpha_{T_{k}}^{\ast})\leq f_{T_{k}}(\alpha^{\ast}_{\infty})\implies\limsup_{k\to\infty}f_{T_{k}}(\alpha_{T_{k}}^{\ast})\leq\phi(\alpha^{\ast}_{\infty}) Applying ( D.3 ), we then have \phi(\bar{\alpha})\leq\liminf_{k\to\infty}f_{T_{k}}(\alpha_{T_{k}}^{\ast})\leq\limsup_{k\to\infty}f_{T_{k}}(\alpha_{T_{k}}^{\ast})\leq\phi(\alpha^{\ast}_{\infty}). Since \alpha^{\ast}_{\infty} is the unique minimizer of \phi , it follows that \bar{\alpha}=\alpha^{\ast}_{\infty} . This completes the proof since if every convergent subsequence has the same limit, it follows that the sequence itself converges and shares this limit. ∎ Appendix E Proof of Theorem 6.3 We now turn our attention to the model with the pair of learnable parameters (\alpha,\beta) . As before, we begin by determining a simplified form for the loss \ell(\alpha,\beta) and collect some properties. Recall, Z=1+\|\bm{m}\|^{2} . Let S:=S(Z,\beta)=\frac{(1+\beta Z)^{T}-1}{\beta}\quad{\rm where}\quad S(Z,0)=\lim_{\beta\to 0}S(\beta,Z)=TZ, W=Z-1 , and A(\beta)={\mathbb{E}}[WS^{2}],\quad B(\beta)={\mathbb{E}}[WS]. Lemma E.1 (Two-parameter loss) . The loss \ell(\alpha,\beta) has the form \ell(\alpha,\beta)={\mathbb{E}}\left[(Z-1)\left(\frac{\alpha}{\beta}[(1+\beta Z)^{T}-1]-1\right)^{2}\right]. Moreover, for fixed \beta\in{\mathbb{R}} , the loss is strongly convex in \alpha , with unique minimizer: \alpha^{\ast}(\beta):=\frac{B(\beta)}{A(\beta)}. (E.1) Proof. We have \displaystyle\frac{\bm{y}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} \displaystyle=\frac{\bm{w}^{\top}\bm{X}\bm{F}^{\top}\bm{x}_{q}}{L}+\frac{\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} \displaystyle=\frac{\alpha}{\beta}\bm{w}^{\top}(\bm{M}^{T}-\bm{I})\bm{x}_{q}+\frac{\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} \displaystyle=-\frac{\alpha}{\beta}\bm{w}^{\top}\bm{x}_{q}+\frac{\alpha}{\beta}\bm{w}^{\top}(\bm{I}+\beta\hat{\bm{\Lambda}})^{T}\bm{x}_{q}+\frac{\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} and so y_{q}-\hat{y}_{q}=(1+\frac{\alpha}{\beta})\bm{w}^{\top}\bm{x}_{q}-\frac{\alpha}{\beta}\bm{w}^{\top}(\bm{I}+\beta\hat{\bm{\Lambda}})^{T}\bm{x}_{q}-\frac{\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L}+\varepsilon_{q}. Taking L\to\infty so that \frac{\bm{\varepsilon}^{\top}\bm{F}^{\top}\bm{x}_{q}}{L} is negligible, and omitting {\mathbb{E}}[\varepsilon_{q}^{2}|\bm{\Lambda}] which does not depend on (\alpha,\beta) , we have \displaystyle\ell(\alpha,\beta|\bm{\Lambda}) \displaystyle\propto(1+\frac{\alpha}{\beta})^{2}{\mathbb{E}}[(\bm{w}^{\top}\bm{x}_{q})^{2}|\bm{\Lambda}]+(\frac{\alpha}{\beta})^{2}{\mathbb{E}}[(\bm{w}^{\top}(\bm{I}+\beta\bm{\Lambda})^{T}\bm{x}_{q})^{2}|\bm{\Lambda}]-\frac{2\alpha}{\beta}(1+\frac{\alpha}{\beta}){\mathbb{E}}[\bm{w}^{\top}\bm{x}_{q}\bm{w}^{\top}(\bm{I}+\beta\bm{\Lambda})^{T}\bm{x}_{q}|\bm{\Lambda}] \displaystyle=(1+\frac{\alpha}{\beta})^{2}\tr(\bm{\Sigma}_{w}\bm{\Lambda})+(\frac{\alpha}{\beta})^{2}\tr(\bm{\Sigma}_{w}\bm{\Lambda}(\bm{I}+\beta\bm{\Lambda})^{2T})-\frac{2\alpha}{\beta}(1+\frac{\alpha}{\beta})\tr(\bm{\Sigma}_{w}\bm{\Lambda}(\bm{I}+\beta\bm{\Lambda})^{T}). In the first line we used that {\mathbb{E}}[\varepsilon_{i}]=0 to get rid of cross terms and in the second, we use that \bm{\Sigma}_{w} commutes with \bm{\Lambda} . Recall, \bm{\Sigma}_{w}=\bm{I}-\bm{\Lambda}^{-1} and so the loss simplifies to \displaystyle\ell(\alpha,\beta|\bm{\Lambda}) \displaystyle=(1+\frac{\alpha}{\beta})^{2}\sum_{i=1}^{d}(\gamma_{i}-1)+(\frac{\alpha}{\beta})^{2}\sum_{i=1}^{d}(\gamma_{i}-1)(1+\beta\gamma_{i})^{2T}-2\frac{\alpha}{\beta}(1+\frac{\alpha}{\beta})\sum_{i=1}^{d}(\gamma_{i}-1)(1+\beta\gamma_{i})^{T} \displaystyle=(1+\frac{\alpha}{\beta})^{2}(Z-1)+(\frac{\alpha}{\beta})^{2}(Z-1)(1+\beta Z)^{2T}-2\frac{\alpha}{\beta}(1+\frac{\alpha}{\beta})(Z-1)(1+\beta Z)^{T} \displaystyle=(Z-1)\left(\frac{\alpha}{\beta}[(1+\beta Z)^{T}-1]-1\right)^{2}. For the unconditional loss, one simply takes expectation: \ell(\alpha,\beta)={\mathbb{E}}\left[(Z-1)\left(\frac{\alpha}{\beta}[(1+\beta Z)^{T}-1]-1\right)^{2}\right]. Expanding the above square, we see \ell(\alpha,\beta)=\alpha^{2}{\mathbb{E}}[WS^{2}]-2\alpha{\mathbb{E}}[WS]+{\mathbb{E}}[W]=\alpha^{2}A(\beta)-2\alpha B(\beta)+{\mathbb{E}}[W] is quadratic in \alpha —hence strongly convex – and thus has a unique minimizer at B(\beta)/A(\beta) . ∎ In light of Lemma E.1 , profiling out \alpha , we can write a reduced loss F(\beta):=\min_{\alpha\in\mathbb{R}}\ell(\alpha,\beta)=\ell\bigl(\alpha^{\ast}(\beta),\beta\bigr)={\mathbb{E}}[W]-\frac{B(\beta)^{2}}{A(\beta)}. At this point, we notice that neither the loss \ell(\alpha,\beta) or the reduced loss F(\beta) are convex. Hence, the subsequent analysis establishing the convergence of gradient flow will require a different and more involved route than in the one-parameter setup. E.1 Convergence of Gradient Flow In this section, we establish that at finite depth T , gradient flow on the two-parameter loss converges under suitable initialization. We first show that, regardless of initialization, the iterates (\alpha_{t})_{t\geq 0} remain bounded. Then, we show that the iterates (\beta_{t})_{t\geq 0} remain bounded if one initializes \beta_{0}\in(-2/\overline{Z},0) and \alpha_{0}=\alpha^{\ast}(\beta_{0}) . Under this setup where the iterates (\alpha_{t},\beta_{t})_{t\geq 0} remain bounded, we conclude by showing they must converge as t\to\infty , hence establishing convergence of the gradient flow procedure at finite layer-depth. We first establish some preliminary properties of the function A(\beta) . Lemma E.2 . Suppose Assumption 6.1 holds. Then, 1. A(\beta) is continuous and \lim_{|\beta|\to\infty}A(\beta)=+\infty . 2. A^{\ast}:=\inf_{\beta\in{\mathbb{R}}}A(\beta)>0 . Proof. 1. Continuity follows readily by the dominated convergence theorem which may be applied as Z\in[\underline{Z},\overline{Z}] almost surely. Let z_{0}\in(1,\overline{Z}] be such that {\mathbb{P}}(Z\geq z_{0})>0 . Then, as |\beta|\to\infty , we have S(\beta,z)^{2}=\left(z\sum_{k=0}^{T-1}(1+\beta z)^{k}\right)^{2}\asymp z(1+\beta z)^{2T-2} and so S(\beta,z)^{2}\geq z_{0}^{2}(1+\beta z_{0})^{2T-2} for z\geq z_{0} . Thus, A(\beta)={\mathbb{E}}[WS^{2}]\geq{\mathbb{E}}[W\mathbf{1}_{Z\geq z_{0}}]z_{0}^{2}(1+\beta z_{0})^{2T-2}\xrightarrow[|\beta|\to\infty]{}\infty. 2. Let C>0 , then on the compact set [-C,C] , by continuity of A(\beta) , its minimum A_{\min}:=\min_{|\beta|\leq C}A(\beta) is attained. Assume for contradiction that A_{\min}=0 . Then, S(\beta_{\ast},Z)=0 almost surely for some \beta^{\ast} . Since Z has a continuous distribution with support [\underline{Z},\overline{Z}] , it follows that for all z\in[\underline{Z},\overline{Z}] , \sum_{k=0}^{T-1}(1+\beta^{\ast}z)^{k}=0 deterministically. Which implies that the non-zero polynomial S(\beta,z) has unaccountably many roots which is not possible and so A_{\min}>0 . As \lim_{|\beta|\to\infty}A(\beta)=+\infty , it follows that A^{\ast}:=\inf_{\beta\in{\mathbb{R}}}A(\beta)>0 . ∎ We can show that the iterates (\alpha_{t})_{t\geq 0} remain bounded regardless of initialization. Lemma E.3 . Suppose Assumption 6.1 holds. Then, \sup_{\beta\in{\mathbb{R}}}|\alpha^{\ast}(\beta)|\leq\sqrt{\frac{{\mathbb{E}}[W]}{A^{\ast}}}=:M^{\ast}<\infty. Moreover, letting (\alpha_{t},\beta_{t})_{t\geq 0} be any gradient flow trajectory on \ell , we have \sup_{t\geq 0}|\alpha_{t}|\leq M^{\ast}+\sqrt{\frac{\ell(\alpha_{0},\beta_{0})}{A^{\ast}}}=:M_{\alpha_{0},\beta_{0}}<\infty. Proof. By the Cauchy-Schwarz inequality, B(\beta)^{2}={\mathbb{E}}[W^{1/2}\cdot W^{1/2}S(\beta)]^{2}\leq{\mathbb{E}}[W]{\mathbb{E}}[WS(\beta)^{2}]={\mathbb{E}}[W]A(\beta). By Lemma E.2 , \sup_{\beta\in{\mathbb{R}}}|\alpha^{\ast}(\beta)|=\sup_{\beta\in{\mathbb{R}}}\frac{|B(\beta)|}{A(\beta)}\leq\sqrt{\frac{{\mathbb{E}}[W]}{A(\beta)}}=M^{\ast}<\infty. Now, setting \Delta_{t}=\alpha_{t}-\alpha^{\ast}(\beta_{t}) , notice that we may write \ell(\alpha,\beta)=A(\beta)\Delta^{2}+\underbrace{{\mathbb{E}}[W]-\frac{B(\beta)^{2}}{A(\beta)}}_{:=C(\beta)\geq 0} where the non-negativity of C(\beta) follows from the inequality B(\beta)^{2}\leq{\mathbb{E}}[W]A(\beta) . Recall that the loss \ell is non-increasing along gradient flow for all t\geq 0 which follows from \frac{\mathop{\mathrm{\mathstrut d}}\nolimits\!}{\mathop{\mathrm{\mathstrut d}}\nolimits\!t}\ell(\alpha_{t},\beta_{t})=-\|\nabla\ell(\alpha_{t},\beta_{t})\|^{2}\leq 0 . Hence, \ell(\alpha_{t},\beta_{t})\leq\ell(\alpha_{0},\beta_{0}) for all t\geq 0 and so A(\beta_{t})\Delta_{t}^{2}=\ell(\alpha_{t},\beta_{t})-C(\beta_{t})\leq\ell(\alpha_{0},\beta_{0}). Since A(\beta_{t})\geq A^{\ast} by Lemma E.2 , we obtain \sup_{t\geq 0}|\Delta_{t}|\leq\sqrt{\ell(\alpha_{0},\beta_{0})/A^{\ast}} and so \sup_{t\geq 0}|\alpha_{t}|\leq\sup_{t\geq 0}|\alpha^{\ast}(\beta_{t})|+\sup_{t\geq 0}|\Delta_{t}|\leq M^{\ast}+\sqrt{\frac{L(\alpha_{0},\beta_{0})}{A^{\ast}}}<\infty as desired. ∎ Now, focusing on the iterates (\beta_{t})_{t\geq 0} , the following result shows that these iterates remain bounded. It is convenient to introduce the probability measure \mu=\frac{W\mathop{\mathrm{\mathstrut d}}\nolimits\!{\mathbb{P}}}{{\mathbb{E}}[W]} so that \mu is obtained be reweighing \mathop{\mathrm{\mathstrut d}}\nolimits\!{\mathbb{P}} by W and {\mathbb{E}}_{\mu}[Y]={\mathbb{E}}[WY]/{\mathbb{E}}[W] for a random variable Y . The following remark contains a technical device which is generic under Assumption 6.1 . Remark E.4 (Density of Z under \mu ) . Suppose that under \mu , Z has density g with respect to the Lebesgue measure on [\underline{Z},\overline{Z}] such that (i) g is continuous; (ii) g(\overline{Z})>0 . Writing u_{T}(\beta,Z):=(1+\beta Z)^{T}, a short calculation shows F_{T}(\beta)={\mathbb{E}}[W]\frac{{\textrm{Var}}_{\mu}(u_{T}(\beta,Z))}{{\mathbb{E}}_{\mu}\bigl[(1-u_{T}(\beta,Z))^{2}\bigr]} (E.2) for any \beta\neq 0 which will provide for a convenient representation of the loss in subsequent proofs. Lemma E.5 . Suppose Assumption 6.1 and E.4 hold and that one initializes gradient flow at \alpha_{0}=\alpha^{\ast}(\beta_{0}) with \beta_{0}\in(-2/\overline{Z},0) . Then, there exists T^{\prime}=T^{\prime}(\beta_{0})\in{\mathbb{N}} such that for all T\geq T^{\prime} , we have \ell(\alpha_{0},\beta_{0})<\min\{\ell(\alpha,-2/\overline{Z}),\ell(\alpha,0)\}. for all \alpha\in{\mathbb{R}} . Consequently, since gradient flow is non-increasing on the loss \ell , one has (\beta_{t})_{t\geq 1}\subset(-2/\overline{Z},0) . Proof. For \beta=0 , a quick derivation reveals \ell(\alpha,0)\geq\ell(\alpha^{\ast}(0),0)={\mathbb{E}}[W]-\frac{({\mathbb{E}}[WZ])^{2}}{{\mathbb{E}}[WZ^{2}]}=:c>0 for all \alpha\in{\mathbb{R}} by Cauchy-Schwarz where c does not depend on T . At \beta=-2/\overline{Z} , write v_{T}(Z):=u_{T}(-2/\overline{Z},Z)=(1-2Z/\overline{Z})^{T}. Since |v_{T}(Z)|\leq 1 , we have {\mathbb{E}}[(1-u_{T}(Z))^{2}]\leq 4 , and hence from ( E.2 ), \ell(\alpha,-2/\overline{Z})\geq F_{T}(-2/\overline{Z})\geq\frac{{\mathbb{E}}[W]}{4}{\textrm{Var}}_{\mu}(v_{T}(Z)) for all \alpha\in{\mathbb{R}} . We now show that {\textrm{Var}}_{\mu}(v_{T}(Z))=\Omega(1/T) . From E.4 , let g denote the continuous density of \mu on [\underline{Z},\overline{Z}] , so that {\mathbb{E}}_{\mu}[h(Z)]=\int_{\underline{Z}}^{\overline{Z}}h(z)g(z)\,{\rm d}z and in particular, there exist \delta>0 and c_{1}>0 such that g(z)\geq c_{1}\qquad\text{for all }z\in[\overline{Z}-\delta,\overline{Z}]. (E.3) By a change of variables z=\overline{Z}-y for y\in[0,\overline{Z}-\underline{Z}] and taking T sufficiently large so that 1/T\leq\delta , we have \displaystyle{\mathbb{E}}_{\mu}[v_{T}(Z)^{2}] \displaystyle=\int_{\underline{Z}}^{\overline{Z}}(1-2z/\overline{Z})^{2T}g(z)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!z=\int_{0}^{\overline{Z}-\underline{Z}}(1-2y/\overline{Z})^{2T}g(\overline{Z}-y)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!y \displaystyle\geq\int_{0}^{1/T}(1-2y/\overline{Z})^{2T}g(\overline{Z}-y)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!y\geq c_{1}\int_{0}^{1/T}(1-2y/\overline{Z})^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!y. where we used ( E.3 ) for the last inequality. For T sufficiently large and y\in[0,1/T] , we have 2y/\overline{Z}\leq 1/2 and so applying the standard inequality 1-x\geq e^{-2x} for x\in[0,1/2] yields {\mathbb{E}}_{\mu}[v_{T}(Z)^{2}]\geq c_{1}\int_{0}^{1/T}\exp\left(-\frac{8Ty}{\overline{Z}}\right)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!y\geq c_{1}\int_{0}^{1/T}\exp\left(-\frac{8}{\overline{Z}}\right)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!y=\Omega(1/T). We now turn our attention to {\mathbb{E}}[v_{T}(Z)]^{2} . Since g is continuous on [\underline{Z},\overline{Z}] , let c_{3} be an upper bound on g and assume without loss of generality that \overline{Z}/2\leq\overline{Z}-\underline{Z} 2 2 2 If this is not the case, the analysis below is simplified. Using the inequality 1-x\leq e^{-x} for x\in[0,1] and |1-2y/\overline{Z}|=:\bar{\rho}<1 for all z\in[\overline{Z}/2,\overline{Z}-\underline{Z}] , we have \displaystyle{\mathbb{E}}_{\mu}[|v_{T}(Z)|] \displaystyle=\int_{\underline{Z}}^{\overline{Z}}|1-2z/\overline{Z}|^{T}g(z)\;\mathop{\mathrm{\mathstrut d}}\nolimits\!z=\int_{0}^{\overline{Z}-\underline{Z}}|1-2y/\overline{Z}|^{T}g(\overline{Z}-y)\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y \displaystyle\leq c_{3}\int_{0}^{\overline{Z}/2}|1-2y/\overline{Z}|^{T}\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y+c_{3}\int_{\overline{Z}/2}^{\overline{Z}-\underline{Z}}|1-2y/\overline{Z}|^{T}\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y \displaystyle\leq c_{3}\int_{0}^{\overline{Z}/2}\exp\left(-2Ty/\overline{Z}\right)\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y+c_{3}\int_{\overline{Z}/2}^{\overline{Z}-\underline{Z}}\bar{\rho}^{T}\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y \displaystyle\leq c_{3}\left(\int_{0}^{\infty}\exp\left(-2Ty/\overline{Z}\right)\;\mathop{\mathrm{\mathstrut d}}\nolimits\!y+(\overline{Z}-\underline{Z})\bar{\rho}^{T}\right) \displaystyle\leq c_{3}\left(\frac{\overline{Z}}{2T}+(\overline{Z}-\underline{Z})\bar{\rho}^{T}\right)=O(1/T). By Jensen’s inequality, we have {\mathbb{E}}_{\mu}[v_{T}(Z)]^{2}=O(1/T^{2}) and so {\textrm{Var}}_{\mu}(v_{T}(Z))=\Omega(1/T) . Hence, for all \alpha\in{\mathbb{R}} , \ell(\alpha,-2/\overline{Z})=\Omega(1/T) (E.4) for all T large. Finally, note that for \beta\in(-2/\overline{Z},0) , we have u_{T}(\beta,Z)\leq\rho_{\beta}^{T}\quad{\rm where}\quad\rho_{\beta}\in(0,1) almost surely (in fact surely). Hence, there exists \bar{T} such that {\mathbb{E}}_{\mu}[(1-u_{T}(\beta,Z))^{2}]\geq C>0 (e.g. C=1/2 ) and so for T\geq\bar{T} , F_{T}(\beta)\leq\frac{{\textrm{Var}}_{\mu}(u_{T}(\beta,Z))}{C}\asymp O(\rho_{\beta}^{2T}) when \beta\in(-2/\overline{Z},0) . ∎ Theorem E.6 . Suppose Assumption 6.1 holds and that one initializes gradient flow at \alpha_{0}=\alpha^{\ast}(\beta_{0}) with \beta_{0}\in(-2/\overline{Z},0) . Then, gradient flow on \ell(\alpha,\beta) converges with \beta^{\ast}_{T}:=\lim_{t\to\infty}\beta_{t,T}\in(-2/\overline{Z},0) and \alpha^{\ast}_{T}:=\lim_{t\to\infty}\alpha_{t,T}=\alpha^{\ast}(\beta_{T}^{\ast}). Proof. By Lemma E.5 , since gradient flow is non-increasing on L(\alpha,\beta) , it follows that \beta_{t}\in(-2/\overline{Z},0) for all t\geq 0 . Moreover, from Lemma E.3 , we know that \alpha_{t} remains bounded and so the gradient flow trajectory (\alpha_{t},\beta_{t})_{t\geq 0} is bounded. Consequently, as the loss is twice-continuously differentiable, bounded below, and real-analytic, gradient flow converges. Clearly, \alpha^{\ast}_{T}=\alpha^{\ast}(\beta^{\ast}_{t}) and since \beta_{t}\in(-2/\overline{Z},0) for all t\geq 0 , it follows that \beta^{\ast}_{T}\in[-2/\overline{Z},0] . Moreover, by continuity of the loss \ell in (\alpha,\beta) and Lemma E.5 which shows \ell(\alpha_{0},\beta_{0})<\min\{\ell(\alpha,-2/\overline{Z}),\ell(\alpha,0)\} , \beta^{\ast}_{T}\notin\{-2/\overline{Z},0\} as if this were the case then necessarily, for t sufficiently large one would have \ell(\alpha_{t},\beta_{t})>\ell(\alpha_{0},\beta_{0}) —a contradiction. Hence, \beta^{\ast}_{T} lies in the open interval (-2/\overline{Z},0) . ∎ E.2 Asymptotic Depth Behavior Having established in the previous subsection that gradient flow converges to a stationary point at any fixed depth T , we now study how these stationary points behave as the depth T\to\infty . Our goal is to understand the asymptotic depth behavior of the limits of gradient flow and to show that, as in the one-parameter case, the limiting predictor is Bayes optimal. To make explicit the dependence on depth, let \ell^{(T)} denote the loss \ell where the CA model is at depth T . In the two-parameter setting, the loss is not jointly convex, so we cannot identify the gradient-flow limit (\alpha_{T}^{*},\beta_{T}^{*}) as a global minimizer of \ell . However, what is guaranteed is that (\alpha_{T}^{*},\beta_{T}^{*})\ \text{is a stationary point of }\ell^{(T)}\quad\text{and}\quad\alpha_{T}^{*}=\alpha_{T}^{*}(\beta_{T}^{*}), so in particular F_{T}^{\prime}(\beta_{T}^{*})=0. Thus, the large-depth behavior of the gradient-flow limits is governed by the stationary points of the one-dimensional function \beta\mapsto F_{T}(\beta) . It will be convenient to work with a logarithmically rescaled version of F_{T} : G_{T}(\beta):=\frac{1}{2T}\log\left(\frac{F_{T}(\beta)}{{\mathbb{E}}[W]}\right). (E.5) The function G_{T} is well-defined and smooth as F_{T}>0 . Moreover, G_{T} is a strictly monotone transform of F_{T} so F_{T}^{\prime}(\beta_{T}^{*})=0 if and only if G_{T}^{\prime}(\beta_{T}^{*})=0 . Our task is therefore to understand the asymptotic behavior of G_{T} and G_{T}^{\prime} as T\to\infty , and to show that stationary points of F_{T} (and G_{T} ) concentrate near a single value of \beta . Lemma E.7 . Suppose Assumption 6.1 holds and fix any compact interval K\subset I:=(-2/\overline{Z},0) . For each T\in{\mathbb{N}} and \beta\in K define the probability measure \mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z):=\frac{|1+\beta z|^{2T}}{\int|1+\beta s|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(s)}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z). Then the following hold uniformly for \beta\in K as T\to\infty : 1. The reduced loss F_{T}(\beta) satisfies F_{T}(\beta)^{1/(2T)}\longrightarrow\phi(\beta). where \phi(\alpha)=\max\{|1-\beta\underline{z}|,|1-\beta\overline{z}|\}. as defined in Theorem D.3 . 2. Let z^{\ast}(\beta)\in\{\underline{Z},\overline{Z}\} be an endpoint at which \phi(\beta)=|1+\beta z^{\ast}(\beta)| is attained. Then \nu_{T,\beta} converges weakly to the point mass at the active endpoint. Proof. We begin from the variance representation: F_{T}(\beta)={\mathbb{E}}[W]\frac{{\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right)}{{\mathbb{E}}_{\mu}\left[(1-u_{T}(\beta,Z))^{2}\right]}. We analyze numerator and denominator separately. For the denominator, for any \beta\in K and z\in[\underline{Z},\overline{Z}] we have |1+\beta z|\leq\phi(\beta)\leq\phi_{K}:=\sup_{\beta\in K}\phi(\beta)<1, where \phi_{K}<1 by continuity of \phi and compactness of K . Thus, |u_{T}(\beta,Z)|=|1+\beta Z|^{T}\leq\phi_{K}^{T} almost surely and therefore {\mathbb{E}}_{\mu}\left[(1-u_{T}(\beta,Z))^{2}\right]=1-2{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)]+{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}], with |{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)]|\leq\phi_{K}^{T},\qquad{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]\leq\phi_{K}^{2T}. Hence {\mathbb{E}}_{\mu}\left[(1-u_{T}(\beta,Z))^{2}\right]\in[1-2\phi_{K}^{T},1+\phi_{K}^{2T}]\xrightarrow[T\to\infty]{}1 uniformly in \beta\in K . In particular, for all sufficiently large T , we have \frac{1}{2}\leq{\mathbb{E}}_{\mu}\left[(1-u_{T}(\beta,Z))^{2}\right]\leq 2,\qquad\forall\,\beta\in K. (E.6) Now, for an upper bound on the numerator, we have {\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right)\leq{\mathbb{E}}_{\mu}\left[u_{T}(\beta,Z)^{2}\right]=\int|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)\leq\phi(\beta)^{2T}. (E.7) Now, for a lower bound on the numerator, note that for any random variable X and measurable event A , the law of total variance shows: {\textrm{Var}}_{\mu}(X)\geq\mu(A)\mu(A^{c})\left({\mathbb{E}}[X\mid A]-{\mathbb{E}}[X\mid A^{c}]\right)^{2}. (E.8) Now, for fixed \beta\in K , we define X_{T}(\beta):=u_{T}(\beta,Z)=(1+\beta Z)^{T}. Since \mu is strictly positive near the endpoints of its support by continuity and since K is compact, there exist constants \varepsilon>0 and c>0 such that, for every \beta\in K , • if z^{\ast}(\beta)=\overline{Z} , then A_{\beta}:=[\overline{Z}-\varepsilon,\overline{Z}] satisfies \mu(A_{\beta})\geq c ; • if z^{\ast}(\beta)=\underline{Z} , then A_{\beta}:=[\underline{Z},\underline{Z}+\varepsilon] satisfies \mu(A_{\beta})\geq c . Without loss of generality, by continuity of the map (\beta,z)\mapsto|1+\beta z| on the compact set K\times[\underline{Z},\overline{Z}] , we may also choose \varepsilon small enough so that there exists \delta\in(0,1-\phi_{K}) and \eta>0 with \displaystyle|1+\beta z| \displaystyle\geq\phi(\beta)-\delta\quad\text{for all }z\in A_{\beta},\beta\in K, (E.9) \displaystyle|1+\beta z| \displaystyle\leq\phi(\beta)-\eta\quad\text{for all }z\in A_{\beta}^{c},\beta\in K. (E.10) From ( E.9 )–( E.10 ), we have |X_{T}(\beta)|\geq(\phi(\beta)-\delta)^{T} on A_{\beta} while |X_{T}(\beta)|\leq(\phi(\beta)-\eta)^{T} on A_{\beta}^{c} . Hence, \left|{\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}]\right|\geq(\phi(\beta)-\delta)^{T}\quad{\rm and}\quad\left|{\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}^{c}]\right|\leq(\phi(\beta)-\eta)^{T}. Further, for all sufficiently large T we have (\phi(\beta)-\eta)^{T}\leq\tfrac{1}{2}(\phi(\beta)-\delta)^{T} , and so \left|{\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}]-{\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}^{c}]\right|\geq(\phi(\beta)-\delta)^{T}-(\phi(\beta)-\eta)^{T}\geq\tfrac{1}{2}(\phi(\beta)-\delta)^{T}. Applying the inequality E.8 with X=X_{T}(\beta) and A=A_{\beta} , we obtain {\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right)\geq\mu(A_{\beta})\mu(A_{\beta}^{c})\left({\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}]-{\mathbb{E}}[X_{T}(\beta)\mid A_{\beta}^{c}]\right)^{2}\geq C_{1}(\phi(\beta)-\delta)^{2T}, for all \beta\in K and all sufficiently large T , where C_{1}:=\tfrac{1}{4}c(1-c)>0 is independent of \beta . Combining this with the upper bound ( E.7 ), we have, for all large T and all \beta\in K , C_{1}(\phi(\beta)-\delta)^{2T}\leq{\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right)\leq\phi(\beta)^{2T}. (E.11) Putting everything together, using ( E.6 ) and ( E.11 ), we obtain \frac{1}{2}{\mathbb{E}}[W]{\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right)\leq F_{T}(\beta)\leq 2{\mathbb{E}}[W]{\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right) for all large T and all \beta\in K . Hence, for such T , \left(\tfrac{1}{2}{\mathbb{E}}[W]C_{1}\right)^{1/(2T)}(\phi(\beta)-\delta)\;\leq\;F_{T}(\beta)^{1/(2T)}\;\leq\;\left(2{\mathbb{E}}[W]\right)^{1/(2T)}\phi(\beta). Letting T\to\infty , we have \phi(\beta)-\delta\leq\liminf_{T\to\infty}F_{T}(\beta)^{1/(2T)}\leq\limsup_{T\to\infty}F_{T}(\beta)^{1/(2T)}\leq\phi(\beta) and, since \delta>0 was arbitrary, we obtain desired uniform convergence over K . We now turn to proving the second statement of the lemma. Fix a bounded, continuous function f:[\underline{Z},\overline{Z}]\to{\mathbb{R}} . By definition of \nu_{T,\beta} , \int f(z)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z)=\frac{\displaystyle\int f(z)\,|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)}{\displaystyle\int|1+\beta s|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(s)}. (E.12) We will show that the right-hand side of ( E.12 ) converges to f(z^{\ast}(\beta)) uniformly in \beta\in K . Split both the numerator and denominator into contributions from A_{\beta} and A_{\beta}^{c} . From ( E.9 )–( E.10 ) we have \int_{A_{\beta}}|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)\geq\mu(A_{\beta})(\phi(\beta)-\delta)^{2T}\geq c(\phi(\beta)-\delta)^{2T} and \int_{A_{\beta}^{c}}|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)\leq(\phi(\beta)-\eta)^{2T}. Thus, \frac{\displaystyle\int_{A_{\beta}^{c}}|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)}{\displaystyle\int_{A_{\beta}}|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)}\leq\frac{(\phi(\beta)-\eta)^{2T}}{c(\phi(\beta)-\delta)^{2T}}\xrightarrow[T\to\infty]{}0, uniformly over \beta\in K . Therefore, the contribution of A_{\beta}^{c} to both the numerator and denominator in ( E.12 ) is negligible. More precisely, write the numerator N_{T}(\beta) and denominator D_{T}(\beta) as N_{T}(\beta)=\int f(z)|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)=N_{T}^{(A)}(\beta)+N_{T}^{(A^{c})}(\beta), D_{T}(\beta)=\int|1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)=D_{T}^{(A)}(\beta)+D_{T}^{(A^{c})}(\beta), where the superscripts denote integration over A_{\beta} and A_{\beta}^{c} respectively. By boundedness of f and the previous estimates, we have \frac{|N_{T}^{(A^{c})}(\beta)|}{D_{T}^{(A)}(\beta)}\leq\|f\|_{\infty}\frac{(\phi(\beta)-\eta)^{2T}}{c(\phi(\beta)-\delta)^{2T}}\xrightarrow[T\to\infty]{}0, and \frac{D_{T}^{(A^{c})}(\beta)}{D_{T}^{(A)}(\beta)}\xrightarrow[T\to\infty]{}0, uniformly over \beta\in K . Hence, \int f\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}=\frac{N_{T}^{(A)}(\beta)}{D_{T}^{(A)}(\beta)}+o(1), where o(1)\to 0 uniformly in \beta\in K . Now, we restrict attention to the conditional probability measure on A_{\beta} with density proportional to |1+\beta z|^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z) . On A_{\beta} , the function z\mapsto|1+\beta z| attains its unique maximum at z^{\ast}(\beta) , and the interval A_{\beta} can be made arbitrarily small by taking \varepsilon\downarrow 0 . Since f is uniformly continuous on the compact set [\underline{Z},\overline{Z}] , for any \varepsilon>0 we can shrink \varepsilon>0 (uniformly in \beta\in K ) so that |f(z)-f(z^{\ast}(\beta))|<\varepsilon\qquad\forall\,z\in A_{\beta},\ \beta\in K. Then, \left|\frac{N_{T}^{(A)}(\beta)}{D_{T}^{(A)}(\beta)}-f\left(z^{\ast}(\beta)\right)\right|\leq\sup_{z\in A_{\beta}}|f(z)-f(z^{\ast}(\beta))|<\varepsilon, because N_{T}^{(A)}(\beta)/D_{T}^{(A)}(\beta) is merely the expectation of f(Z) under the normalized weights |1+\beta Z|^{2T}\mathbf{1}_{A_{\beta}}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu where 1_{A_{\beta}} denotes the indicator of the set A_{\beta} . Combining this with the negligible contribution of A_{\beta}^{c} , we conclude that \int f(z)\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z)\longrightarrow f\left(z^{\ast}(\beta)\right) uniformly over \beta\in K . Since this holds for every bounded continuous f , we have \nu_{T,\beta}\to\delta_{z^{\ast}(\beta)} 3 3 3 By standard convention, \delta denotes a point-mass (Dirac measure). weakly, uniformly over \beta\in K . ∎ The above result will be utilized in proving the following lemma establishing the uniform convergence of the derivatives of G_{T} over a compact interval omitting the point -\alpha^{\ast} . This will then yield a contradiction as the limiting derivative is strictly positive away from -\alpha^{\ast} . As a quick reminder from Appendix D , we defined \alpha^{\ast}=\frac{2}{\underline{Z}+\overline{Z}}. Lemma E.8 (Asymptotics of the derivative) . Suppose Assumption 6.1 holds. Fix a compact interval K\subset I:=(-2/\overline{Z},0) such that -\alpha^{\ast}\notin K . Then: 1. The derivatives G_{T}^{\prime}(\beta) converge uniformly on K to the derivative of \log\phi(\beta) : G_{T}^{\prime}(\beta)\longrightarrow\frac{d}{d\beta}\log\phi(\beta) uniformly for \beta\in K as T\to\infty . 2. In particular, since -\alpha^{\ast}\notin K , there exist constants T_{K}<\infty and c_{K}>0 such that |G_{T}^{\prime}(\beta)|\geq c_{K}>0,\qquad\forall\,\beta\in K,T\geq T_{K}. Proof. We begin by writing F_{T}(\beta)={\mathbb{E}}[W]\frac{V_{T}(\beta)}{D_{T}(\beta)},\qquad V_{T}(\beta):={\textrm{Var}}_{\mu}\left(u_{T}(\beta,Z)\right),\quad D_{T}(\beta):={\mathbb{E}}_{\mu}\left[(1-u_{T}(\beta,Z))^{2}\right]. Thus, G_{T}(\beta)=\frac{1}{2T}\left(\log V_{T}(\beta)-\log D_{T}(\beta)\right) and so G_{T}^{\prime}(\beta)=\frac{1}{2T}\frac{V_{T}^{\prime}(\beta)}{V_{T}(\beta)}-\frac{1}{2T}\frac{D_{T}^{\prime}(\beta)}{D_{T}(\beta)}. (E.13) We analyze the two terms in ( E.13 ) separately starting with the denominator term. For \beta\in K and z\in[\underline{Z},\overline{Z}] , we have |1+\beta z|\leq\phi_{K}<1 , thus |u_{T}(\beta,z)|=|1+\beta z|^{T}\leq\phi_{K}^{T}. From the proof of Lemma E.7 we know that D_{T}(\beta)\to 1 as T\to\infty uniformly in \beta\in K . Differentiating under the integral sign, we have D_{T}^{\prime}(\beta)={\mathbb{E}}_{\mu}\left[2(1-u_{T})(-u_{T}^{\prime})\right], where u_{T}^{\prime}(\beta,z):=\frac{d}{d\beta}u_{T}(\beta,z)=Tz(1+\beta z)^{T-1}. Therefore, |D_{T}^{\prime}(\beta)|\leq 2{\mathbb{E}}_{\mu}\left(|1-u_{T}||u_{T}^{\prime}|\right)\leq 4T\overline{Z}\phi_{K}^{T-1} since |1-u_{T}|\leq 1+|u_{T}|\leq 2 for large T . Consequently, for some constant C>0 , \left|\frac{1}{2T}\frac{D_{T}^{\prime}(\beta)}{D_{T}(\beta)}\right|\leq C\phi_{K}^{T-1}\xrightarrow[T\to\infty]{}0, uniformly in \beta\in K which shows that the second term in ( E.13 ) is o(1) uniformly on K . The prior differentiation under the integral sign was justified by dominated convergence: |(1-u_{T})(-u_{T}^{\prime})|\leq 2T\overline{Z}\phi_{K}^{T-1} which is integrable w.r.t. \mu and independent of z , and for each fixed z the integrand is C^{1} in \beta . We now turn to the numerator term of ( E.13 ): \frac{1}{2T}\frac{V_{T}^{\prime}(\beta)}{V_{T}(\beta)} . Since V_{T}(\beta)={\mathbb{E}}_{\mu}[u_{T}^{2}]-{\mathbb{E}}_{\mu}[u_{T}]^{2} with u_{T}:=u_{T}(\beta,Z) , differentiating, we obtain V_{T}^{\prime}(\beta)=\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}^{2}]-2{\mathbb{E}}_{\mu}[u_{T}]\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}]. As above, \left|\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}]\right|\leq T\overline{Z}\phi_{K}^{T-1},\qquad\left|\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}^{2}]\right|\overline{Z}\phi_{K}^{2T-1}, uniformly over \beta\in K . From Lemma E.7 (1), we know that V_{T}(\beta)\asymp\phi(\beta)^{2T} uniformly on K ; in particular, there exist constants 00 . Thus, the main contribution to \frac{1}{2T}\frac{V_{T}^{\prime}(\beta)}{V_{T}(\beta)} comes from {\mathbb{E}}_{\mu}[u_{T}^{2}] : \frac{1}{2T}\frac{V_{T}^{\prime}(\beta)}{V_{T}(\beta)}=\frac{1}{2T}\frac{\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]}{{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]}+o(1), (E.14) uniformly over \beta\in K . Now {\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]=\int(1+\beta z)^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)\implies\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]=\int 2Tz(1+\beta z)^{2T-1}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z). and therefore \frac{1}{2T}\frac{\frac{d}{d\beta}{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]}{{\mathbb{E}}_{\mu}[u_{T}(\beta,Z)^{2}]}=\frac{\displaystyle\int z(1+\beta z)^{2T-1}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)}{\displaystyle\int(1+\beta z)^{2T}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\mu(z)}=\int\frac{z}{1+\beta z}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z) where \nu_{T,\beta} is precisely the probability measure from Lemma E.7 (2). Combining with ( E.14 ) and the negligibility of the denominator term, we obtain G_{T}^{\prime}(\beta)=\int\frac{z}{1+\beta z}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z)+o(1), (E.15) where o(1)\to 0 uniformly over \beta\in K . By Lemma E.7 (2), for each fixed \beta\in K the measures \nu_{T,\beta} converge weakly to \delta_{z^{\ast}(\beta)} , where z^{\ast}(\beta)\in\underline{Z},\overline{Z}\} is the endpoint at which \phi(\beta) is attained and this convergence is uniform in \beta\in K . Since the function (\beta,z)\longmapsto\frac{z}{1+\beta z} is continuous on K\times[\underline{Z},\overline{Z}] , by uniform weak convergence, \int\frac{z}{1+\beta z}\,\mathop{\mathrm{\mathstrut d}}\nolimits\!\nu_{T,\beta}(z)\longrightarrow\frac{z^{\ast}(\beta)}{1+\beta z^{\ast}(\beta)}, uniformly over \beta\in K . Together with ( E.15 ), this yields G_{T}^{\prime}(\beta)\longrightarrow\frac{z^{\ast}(\beta)}{1+\beta z^{\ast}(\beta)} uniformly over \beta\in K . Now, on any compact K\subset I that does not contain -\alpha^{\ast} , the active endpoint z^{\ast}(\beta) is constant (always \underline{Z} or always \overline{Z} ), and the sign of 1+\beta z^{\ast}(\beta) is fixed. Therefore, \frac{d}{d\beta}\log\phi(\beta)=\frac{d}{d\beta}\log|1+\beta z^{\ast}(\beta)|=\frac{z^{\ast}(\beta)}{1+\beta z^{\ast}(\beta)}. and so G_{T}^{\prime}(\beta)\longrightarrow\frac{d}{d\beta}\log\phi(\beta) as T\to\infty uniformly over \beta\in K which proves part (1). We can now wrap up the proof by establishing the second statement of the lemma. Note that the function \phi is smooth on I\setminus\{-\alpha^{\ast}\} and -\alpha^{\ast} is the unique minimizer of \phi . Hence \frac{d}{d\beta}\log\phi(\beta) is continuous and nonzero on K , and therefore there exists c_{K}>0 such that \left|\frac{d}{d\beta}\log\phi(\beta)\right|\geq 2c_{K} for all \beta\in K , By uniform convergence of G_{T}^{\prime} to \frac{d}{d\beta}\log\phi on K , we may choose T_{K} large enough so that |G_{T}^{\prime}(\beta)|\geq c_{K} for all \beta\in K when T\geq T_{K} . This proves part (2) and completes the proof. ∎ The full result of Theorem 6.3 will now follow by a simple proof by contradiction by extracting a subsequence (\beta_{T_{k}})_{k\geq 1} converging in the interior of the interval. The culmination of this section is now provided in the next result. Theorem E.9 . Suppose the assumptions of Theorem E.6 hold Let (\alpha^{\ast}_{T},\beta^{\ast}_{T}) denote the limit of gradient flow on the two-parameter, T -layer, CA model whose existence is guaranteed by Theorem E.6 . Moreover, assume that \lim_{T\to\infty}\beta^{\ast}_{T}\notin\{-2/(\overline{m}+1),0\} . Then, \lim_{T\to\infty}\alpha^{\ast}_{T}=\alpha^{\ast}=\frac{2}{\underline{z}+\overline{z}}. and \lim_{T\to\infty}\beta^{\ast}_{T}=-\alpha^{\ast}. Hence, the model is Bayes optimal by Lemmas C.1 and C.2 . Proof. We assume for contradiction that \lim_{T\to\infty}\beta^{\ast}_{T}\neq-\alpha^{\ast} . Then, as (\beta^{\ast}_{T})_{T\geq 1} is contained in the compact interval [-2/(\overline{m}+1),0] with \lim_{T\to\infty}\beta^{\ast}_{T}\notin\{-2/(\overline{m}+1),-\alpha^{\ast},0\} , we extract a convergent subsequence (\beta^{\ast}_{T_{k}})_{k\geq 1} with limit \bar{\beta}:=\lim_{k\to\infty}\beta^{\ast}_{T_{k}}\in(-2/(\overline{m}+1),0)\setminus\{-\alpha^{\ast}\}. By Lemma E.8 , it follows that G^{\prime}_{T_{k}}(\beta^{\ast}_{T_{k}})>0 for k\in{\mathbb{N}} sufficiently large. This immediately contradicts the nature of (\beta^{\ast}_{T_{k}})_{k\geq 1} as a sequence of stationary points for (G^{\prime}_{T_{k}})_{k\geq 1} . Therefore, one must have \bar{\beta}=-\alpha^{\ast} and as the subsequence (T_{k})_{k\geq 1}\subseteq{\mathbb{N}} was arbitrary, convergence for the entire sequence (\beta_{T}^{\ast})_{T\geq 1} to -\alpha^{\ast} holds: \lim_{T\to\infty}\beta^{\ast}_{T}=:-\alpha^{\ast}. (E.16) Convergence of \lim_{T\to\infty}\alpha^{\ast}_{T}=\alpha^{\ast} follows from ( E.16 ) and that necessarily \alpha^{\ast}_{T}=\alpha^{\ast}(\beta^{\ast}_{T}) for all T\geq 1 . ∎ The above result concludes the proof of Theorem 6.3 . Appendix F Ablation Experiments In this Appendix, we examine the significance of the S_{t} skip-connection and the CA between the layer outputs (F_{t})_{t\geq 0} and the original raw data X —displayed in Figure 1 . To this end, we compare, empirically, the trained performance of the one- and two-parameter LCA models defined in Section 5 against ablated models. We introduce three new architectures in the one- and two-parameter settings. First, consider the one-parameter LCA model without S_{t} (equivalently with \alpha\equiv 0) —that is, we modify ( 5.1 ) to be \bm{F}_{t}=\bm{F}_{t-1}+\bm{A}_{t-1} (F.1) and operate with one learnable parameter as in Section 5.1 . Second, building off the preceding model, we now set \bm{A}_{t}=\mathsf{A}(\bm{Q}_{t},\bm{K}_{t},\bm{V}_{t}) with \bm{V}_{t}=\alpha\bm{F}_{t},\quad\bm{K}_{t}=\bm{Q}_{t}=\bm{F}_{t}, (F.2) so that \bm{A}_{t} is no longer a LCA implementation, but rather is LSA applied to \bm{F}_{t} with a single learnable parameter. We refer to this architecture as a “one-parameter deep LSA without S_{t} ” to delineate it from the single-layer LSA model of Section 4 . Lastly, as a final trainable comparison, we consider the LSA modification given in ( F.2 ) and re-introduce S_{t} (again producing two learnable parameters) in the architecture, and refer to this ablation as a “two-parameter deep LSA.” As a naive baseline, we also consider the in-context sample mean: \bar{y}_{L_{\rm te}}=\frac{1}{L_{\rm te}}\sum_{i=1}^{L_{\rm te}}y_{i}. Figure 4 : In-context performance at various L_{\rm te} of one- and two-parameter LCA-based models, ablations without S_{t} ( T=10 ), and the sample mean \bar{y}_{L_{\rm te}} . Models are optimized on \ell_{N,L_{\mathrm{tr}}} ( L_{\rm tr}=100,N=2000 ) using gradient descent. Performance is averaged over 1000 test-prompts where error bars represent standard deviation over 10 separate training runs. Figure 5 : In-context performance at various L_{\rm te} of one- and two-parameter LCA-based models, two-parameter, deep LSA model ( T=10 ), the LSA model from ( 4.2 ), and the sample mean \bar{y}_{L_{\rm te}} . Models are optimized on \ell_{N,L_{\mathrm{tr}}} ( L_{\rm tr}=100,N=2000 ) using gradient descent. Performance is averaged over 1000 test-prompts where error bars represent standard deviation over 10 separate training runs. In Figure 4 , we see that the removal of the S_{t} skip-connection in the embedding architecture compromises model performance. Notably, in the simplified one-parameter setting, the ablated models fail to improve upon the naive in-context sample mean. Moreover, in Figure 5 , we see that, swapping the LCA mechanism for LSA on F_{t} while keeping the S_{t} skip-connection deteriorates model-performance, albeit improving upon the sample mean baseline and the single-layer LSA model. This further emphasizes the utility of the cross-attention and particularly of the our novel S_{t} component. Appendix G Visualization of the Loss Landscape The rationale behind the initializations given in Theorem 6.3 and discussed in Section 6 are supported in Figure 6 which illustrates a steep valley along the curve \{(\alpha^{\ast}(\beta),\beta):\beta\in(-2/(\overline{m}+1),0)\} as \alpha^{\ast}(\beta)\approx-\beta ( \alpha^{\ast}(\beta)\to-\beta as T\to\infty ) in this window. To contrast our setting with a more sophisticated model, we also plot the loss landscape of the two-parameter model where pre-Layer Normalization [ 47 ] is added between the LCA layers. Interestingly, this model reveals a similarly located and sized ravine in the loss landscape, hinting at the insights from our ablated setting to more complex models. Figure 6 : Log-scale heat map plots of the two-parameter loss \ell(\alpha,\beta) at depth T=10 ( top ) and T=5 ( bottom ) where \|\bm{m}\|\sim{\rm Unif}(0,2) . At depth T=5 , we compare the LCA-based model considered herein ( bottom left ) with the addition of pre-LayerNorm between the CA layers ( bottom right ).