Introduction
Transformer architectures are empirically strong predictors of the next token from a finite context, but how long must that context be? Practice has an answer by means of experiments, and asserts that longer context is often better.
In this paper, we answer this question in terms of an intrinsic property of the general possibly non-Markovian source by investigating how much such a non-Markovian source can be approximated by an N N N th order finite Markov model, in a suitable sense, together with optimal training loss due to approximation and sample complexity errors.
A specific application will involve partially observed Markov models (known also as hidden Markov models) for which stronger bounds will be presented in terms of filter stability.
The theory of partially observed Markov process (POMP) tells us that if the source is a latent Markov process, i.e. an unseen Markov process coupled with an observation process obtained via a noisy channel conditioned on the source, then the optimal predictor is a filter. Going one step further, we predict the next observation variable based on the history of previous observation variables, corresponding to the language modeling task of next-token prediction. Using the full history as context is often challenging in practice. Therefore, we truncate the input, that is, initialize it from a (possibly wrong) prior and take the finite window as the context. Then, the predictive performance on this truncated context is a question of filter stability [5 , 30 , 10 , 11 ] .
On the other hand, practice demonstrates that Transformer architectures are efficient for processing sequential data such as sentences for large language models. Yun et al. [51 ] reveal that Transformers are universal approximators of continuous, sequence-to-sequence functions on compact domains. Thus, a natural question arises: Can Transformers approximate finite-window filter processes arising from POMPs? In this paper, we show that the answer is affirmative and we find quantitative bounds for the approximation error while specifying the class of Transformers achieving such task by explicit width and depth constructions.
On an N N N th order Markovian model, that is, the law of the next state is determined by the previous N N N states, we define noisy observation channels in order to make it latent. Then we define the associated prediction process: full history, finite-window and finite-window with quantized observations. There are three major unknowns: (i) Are finitely many quantized observations sufficient statistics? (ii) Can Transformers realize finite-window predictive distribution with quantized observations? (iii) How can we learn the optimal weight trajectory for such Transformer? We answer (i) and (ii) in this paper, whereas (iii) is studied by Akman et al. [3 ] , where an optimal control theoretic formulation of Transformers is studied with rigorously justified finite model approximations and dynamic programming.
Transformer training amortizes the output cost: paying upfront at training to reduce inference costs compared to an empirical lookup table. This amortization is done by compressing the information from the empirical distribution lookup table to a representation that lives in the model weights, built on the structure of the Transformer architecture. While this compression requires an initial computational cost in the form of training, it saves the user compute and storage by replacing a large input table search with a deterministic equation that approximates the target distribution. This representation has other useful properties as well, such as continuity and generalization, and thus the ability to interpolate sequences absent from the training data set.
We begin by defining a generally non-Markovian process that we segment to create the training data set. In the context of LLMs, this can be thought of as a sequence of tokens on the internet. We then formulate the Transformer dynamics as a control theoretic problem: selecting the optimal model weights (controls), to approximate the empirical next-token distribution (target state) given the input sequence (current state). The sequence flows through the Transformer one layer at a time, each comprised of a feed-forward layer and self-attention block. We employ dynamic programming to train a quantized Transformer model to minimize the cross-entropy between the actual predicted and target empirical distributions. We show that the empirical prediction gets arbitrarily close to the truncated-window quantized prediction. Then, we prove the existence of a Transformer that approximates this truncated-window quantized prediction, which we approximate experimentally with quantized Transformer training.
Related Works
There is a developing literature focusing on the control–theoretic formulations and properties of Transformers. E (2017) suggests to see machine learning problems—in particular, residual neural networks (ResNets)—as optimal control of continuous time dynamical systems governed by ordinary differential equations where the time index corresponds to the layers of a neural network. Around the same time, Haber and Ruthotto [20 ] study a similar ODE based analysis of ResNets by proving stability and well-posedness results. They also study discretization of such systems for numerical analysis and implementability. Ruthotto and Haber [44 ] categorize convolutional neural networks (CNNs) into PDE inspired classes and authors discuss the regularity of CNNs via the theory of parabolic and hyperbolic PDEs. An alternative approach by seeing neural networks as solutions of suitable dynamical systems, called neural ordinary differential equations , is studied by Chen et al. [9 ] ; Lu et al. (2018), where the neural networks structure is replaced by the solution of the governing ODEs, obtained by the Runge-Kutta methods (Butcher, [7 ] ). Ruiz-Balet and Zuazua [42 ] study controllability of neural ordinary differential equations while Ruiz-Balet and Zuazua [43 ] study the controllability of neural transport equations , which are continuity equations governed by a neural network’s velocity field.
Geshkovski et al. [19 ] study Transformers in a mathematically rigorous way while focusing on clustering properties, building on their earlier work (Geshkovski et al., [17 ] ). The training scheme used in this paper is by Akman et al. [3 ] where Transformers are represented as measure-state Markov decision processes lifted from discrete-time McKean–Vlasov dynamics (McKean Jr, [35 ] ) exhibited at the token level, and then, the training is reformulated as a dynamic programming problem. For computational tractability, Akman et al. [3 ] derive a finite model approximation to the measure-state MDP using the algorithm of Reznik [41 ] and (Saldi et al., [45 ] ). The generalization properties of the quantized training method are studied by Akman et al. [2 ] from two angles: norm-based excess risk bounds and Wasserstein distributional robustness.
A different use of control theory appears in Chang and Mehta [8 ] , who construct a Transformer-like architecture for prediction in hidden Markov models through a duality between nonlinear filtering and optimal control. Kudre et al. [29 ] extend this to linear-Gaussian models and compare the optimal control weights with the attention weights of a trained Transformer. Our work differs by the usage of control classes; in Chang and Mehta [8 ] , control describes inference over the full history (and is thus closed-loop or context dependent), whereas we use control for training at the distributional level leading to open-loop (and thus context-independent) parameters consistent with standard Transformer architecture, and quantify the cost of a finite context window via filter stability.
Transformers are universal approximators of continuous sequence-to-sequence functions on compact domains with fixed width and arbitrary depth (Yun et al., [51 ] ) while Yun et al. [52 ] show that sparse Transformers can preserve such universal approximation capabilities. In contrast, our target, in this paper, is a measure-valued map on a finite quantized domain for which we give explicit depth and width with one head per layer. As another refinement direction, Kajitsuka and Sato [24 ] prove Transformers with one-headed single self-attention having low-rank weight matrices and double feed-forward layers can approximate continuous and permutation-equivariant maps on compact domains. There is a line of work treating the context as a probability measure over tokens; Furuya et al. [16 ] prove universal approximation for this setup, while Geshkovski et al. [18 ] focuses on Transformer’s interpolation ability from measures to measures. Agrachev and Letrouit [1 ] show controllability of general equivariant systems and treat self-attention mechanism as a special case. There are several studies providing explicit approximation rates: Jiang and Li [23 ] prove Jackson-type rates for sequence-to-sequence matching scenario, while Wang et al. [49 ] gives approximation rates for Transformers with long but sparse memory, and they characterize how various hyperparameters such as depth, width, and the number of heads contribute.
For k k k -th order fully observable Markov sources, Rajaraman et al. [40 ] show that three layers with one head suffice to represent the conditional k k k -gram with an attention-only Transformer. Their constructed network represents a statistic of the prompt, namely, the empirical distribution of successors to the current token with the sequence itself, which is unbiased for a fully observed source and is kernel-agnostic; whereas we represent the predictive distribution of a partially observed source in the weights.
A complementary line bounds what Transformers cannot do. Transformers with hard attention fail to recognize even relatively simple formal languages (Hahn, [21 ] ). Merrill and Sabharwal [36 ] show that a fixed-depth Transformer with limited numerical precision cannot carry out a computation that requires many sequential steps. Strobl et al. [46 ] survey the expressibility of Transformers.
Filter stability and memory in prediction
The filter stability problem refers to the correction of an incorrectly initialized nonlinear filter for a partially observed stochastic dynamical system (controlled or control-free) with increasing measurements [10 , 11 , 5 , 30 ] . McDonald and Yüksel [33 ] give an explicit geometric rate for filter stability through Dobrushin coefficient (Dobrushin, [14 ] ) of the transition kernel and the observation channel of the latent Markov source. Truncating a predictor to a finite window is exactly this situation since discarding the data amounts to replacing the true conditional law of the hidden state by a fixed prior. Kara and Yuksel [26 ] use a similar observation to establish near optimality of finite-memory feedback policies in partially observed MDPs, converting the belief-state error into an error of discrepancy in the values; Kara et al. [28 ] extend this to continuous spaces. In this paper, we use belief error and propagate it through the one-step prediction kernel instead. Alternative approaches to filter stability also establish exponential filter stability through a different route: Atar and Zeitouni [5 ] and Le Gland and Oudjane [30 ] prove exponential stability rates for the Hilbert projective metric via Birkhoff’s contraction coefficient. Alternatively, asymptotic filter stability can also be utilized if one only wishes to have asymptotic performance bounds without explicit rates of convergence Chigansky et al. [11 ] ; McDonald and Yüksel [34 ] . An infinite product space approach, where finite memory truncation is viewed as quantization, is presented in Yüksel [50 ] .
Contributions
Our main results can be summarized as follows. Given a general non-Markovian model { Y r : r ∈ Z + } \{Y_r : r \in\mathbb{Z}_+\} { Y r : r ∈ Z + } taking values from a compact metric space Y \mathsf{Y} Y , consider its finite approximation q s ( Y r ) q^{s}(Y_r) q s ( Y r ) , r ∈ Z + r \in\mathbb{Z}_+ r ∈ Z + where ∣ q ( Y ) ∣ = : R ( s ) < ∞ |q(\mathsf{Y})| =: R(s) < \infty ∣ q ( Y ) ∣ =: R ( s ) < ∞ and q q q is a quantizer. We show that Transformer performance is fundamentally related to finite model with finite memory approximability.
Such a finite model with finite memory approximability is a highly qualified expression and requires care with regard to its precise presentation. For a general stationary and ergodic model, this term is given by
sup r ≥ M E Y 0 : r [ ∥ Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) − Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r ) , q s ( Y r − 1 ) , … , q s ( Y r − M + 1 ) ) ∥ T V ] \sup_{r \ge M} \mathbb{E}_{Y_{0:r}}\left[\left\|\Pr(Y_{r+1} \in\cdot\mid Y_{0:r})-\Pr\left(Y_{r+1} \in\cdot\mid q^{s}(Y_r),q^{s}(Y_{r-1}),\ldots,q^{s}(Y_{r-M+1})\right)\right\|_{\mathrm{TV}}\right] r ≥ M sup E Y 0 : r [ ∥ Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) − Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r ) , q s ( Y r − 1 ) , … , q s ( Y r − M + 1 ) ) ∥ TV ]
: = F ( M , q s ) := F(M,q^{s}) := F ( M , q s )
for the case with stationary and ergodic data.
We show that as F ( M , q s ) → 0 F(M,q^{s}) \to0 F ( M , q s ) → 0 with M → ∞ M \to\infty M → ∞ , R ( s ) → ∞ R(s) \to\infty R ( s ) → ∞ , Transformers, trained optimally via stochastic control, perform asymptotically well, with explicit convergence bounds. Information theoretic or ergodic theoretic bounds on F ( M , q s ) F(M,q^{s}) F ( M , q s ) can be utilized in the quantitative expressions.
To make our results stronger and more explicit in a particular context but one with significant applied relevance, we will also consider the special case of hidden Markov models, where there is an underlying Markov process X r X_r X r , r ∈ Z + r \in\mathbb{Z}_+ r ∈ Z + which generates Y r Y_r Y r , the observable measurement process, through Y r = H ( X r , V r ) Y_r = H(X_r,V_r) Y r = H ( X r , V r ) for some measurable H H H and i.i.d. noise V r V_r V r (whose representation is without loss for such models). In this case, the above approximation bounds can be obtained more explicitly in terms of filter stability; stationarity can be relaxed away and more explicit conditions can be obtained. Without imposing ergodicity, define
sup r ≥ M E Y 0 : r [ ∥ Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) − Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r ) , q s ( Y r − 1 ) , … , q s ( Y r − M + 1 , π ^ ) ) ∥ T V ] \sup_{r \ge M} \mathbb{E}_{Y_{0:r}}\left[\left\|\Pr(Y_{r+1} \in\cdot\mid Y_{0:r})-\Pr\left(Y_{r+1} \in\cdot\mid q^{s}(Y_r),q^{s}(Y_{r-1}),\ldots,q^{s}(Y_{r-M+1},\hat{\pi})\right)\right\|_{\mathrm{TV}}\right] r ≥ M sup E Y 0 : r [ ∥ Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) − Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r ) , q s ( Y r − 1 ) , … , q s ( Y r − M + 1 , π ^ ) ) ∥ TV ]
: = F ~ ( M , q s ) , := \widetilde{F}(M,q^{s}), := F ( M , q s ) ,
where π ^ \hat{\pi} π ^ denotes a fixed probability measure serving as an artificial and incorrect prior at time 0 0 0 , to facilitate Bayesian updates.
We show that as F ~ ( M , q s ) → 0 \widetilde{F}(M,q^{s}) \to0 F ( M , q s ) → 0 with M → ∞ M \to\infty M → ∞ , R ( s ) → ∞ R(s) \to\infty R ( s ) → ∞ , Transformers, trained via optimal stochastic control [3 ] , can rigorously be shown to perform prediction and filtering with near lossless performance under filter stability and regularity conditions. We thus address a fundamental question on Transformer architectures and obtain quantified error bounds due to finite model with finite memory approximation for general non-Markovian models.
Figure 1 summarizes our technical results. Extensive simulations corroborate the mathematical results. We note that our ingredients in the analysis are: (i) approximation via finite memory models (in a suitable, expectation or uniform over priors, sense), (ii) approximation of finite memory models with finite Markov models, (iii) optimal Transformer learning for finite Markov models and their performance, and (iv) a sample complexity analysis.
Figure 1. Summary of the results of this paper.
Our analysis also highlights what Transformers can and cannot do: Since our analysis builds on rigorously justified near optimal training via control theory, a corollary of our analysis is that when sequence to sequence approximations is realizable with no error using some Transformer, an optimally trained scheme can construct a Transformer which attains an arbitrarily small error performance. That is, analogous to standard control theoretic paradigm (see e.g. Anderson and Moore (2007)), controllability/reachability certifies that under a suitably formulated cost, optimality arrives at arbitrarily small performance error whenever mild regularity conditions hold.
Sufficiency of Finite Memory in Prediction
Let S S S be a finite alphabet and ( Y , ρ ) (\mathbb{Y},\rho) ( Y , ρ ) be a compact metric space endowed with a reference probability measure μ \mu μ defined on the Borel σ \sigma σ -field generated by ρ \rho ρ . Let { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + be a stochastic process taking values in S S S and Q ∈ P ( Y ∣ S ) \mathcal{Q}\in\mathcal{P}(\mathbb{Y}\mid S) Q ∈ P ( Y ∣ S ) be a stochastic kernel admitting a Radon-Nikodym derivative
ψ ( y ∣ z ) : = d Q ( ⋅ ∣ z ) d μ ( y ) , y ∈ Y , z ∈ S . \psi(y\mid z) := \frac{\mathrm{d}\mathcal{Q}(\cdot\mid z)}{\mathrm{d}\mu}(y), \qquad y\in\mathbb{Y},\ z\in S. ψ ( y ∣ z ) := d μ d Q ( ⋅ ∣ z ) ( y ) , y ∈ Y , z ∈ S .
Since S S S is finite, such μ \mu μ always exists; we simply take μ ( ⋅ ) = ∑ z ∈ S 1 ∣ S ∣ Q ( ⋅ ∣ z ) \mu(\cdot)=\sum_{z\in S}\frac{1}{|S|}\mathcal{Q}(\cdot\mid z) μ ( ⋅ ) = ∑ z ∈ S ∣ S ∣ 1 Q ( ⋅ ∣ z ) . We take observation variables Y r ∼ Q ( ⋅ ∣ Z r ) Y_r\sim\mathcal{Q}(\cdot\mid Z_r) Y r ∼ Q ( ⋅ ∣ Z r ) from this channel for all r ∈ Z + r\in\mathbb{Z}_+ r ∈ Z + and we assume that Y r Y_r Y r is independent of Z t Z_t Z t and Y t Y_t Y t whenever r ≠ t r\ne t r = t , conditioned on Z r Z_r Z r .
Figure 2. Flows of the latent process and observations.
As Y \mathbb{Y} Y is a compact space, by total boundedness, for any s ∈ N s\in\mathbb{N} s ∈ N , there exists a 1 / s 1/s 1/ s -net Λ s : = { y s , i : i = 1 , … , R ( s ) } \Lambda_s:=\{y_{s,i}:i=1,\ldots,R(s)\} Λ s := { y s , i : i = 1 , … , R ( s )} , where R ( s ) ∈ N R(s)\in\mathbb{N} R ( s ) ∈ N , that is
min i = 1 , … , R ( s ) ρ ( y , y s , i ) ≤ 1 s (1) \min_{i=1,\ldots,R(s)}\rho(y,y_{s,i})\le\frac{1}{s} \tag*{(1)} i = 1 , … , R ( s ) min ρ ( y , y s , i ) ≤ s 1 (1)
for all y ∈ Y y\in\mathbb{Y} y ∈ Y .
Definition 1. The quantizer q s : Y → Λ s q^s:\mathbb{Y}\to\Lambda_s q s : Y → Λ s is defined as
q s ( ⋅ ) : = arg min i = 1 , … , R ( s ) ρ ( ⋅ , y s , i ) , q^s(\cdot):=\underset{i=1,\ldots,R(s)}{\arg\min}\ \rho(\cdot,y_{s,i}), q s ( ⋅ ) := i = 1 , … , R ( s ) arg min ρ ( ⋅ , y s , i ) , where the ties are broken in a measurable way.
We separate Y \mathbb{Y} Y into R ( s ) R(s) R ( s ) -cells represented by the elements of Λ s \Lambda_s Λ s . Say C ( s , i ) C(s,i) C ( s , i ) be the cell associated to y s , i y_{s,i} y s , i , that is, C ( s , i ) : = ( q s ) − 1 ( y s , i ) C(s,i):=(q^s)^{-1}(y_{s,i}) C ( s , i ) := ( q s ) − 1 ( y s , i ) . Then { C ( s , i ) } i = 1 R ( s ) \{C(s,i)\}_{i=1}^{R(s)} { C ( s , i ) } i = 1 R ( s ) form a disjoint partition of Y \mathbb{Y} Y , i.e. ⨆ i = 1 R ( s ) C ( s , i ) = Y \bigsqcup_{i=1}^{R(s)}C(s,i)=\mathbb{Y} ⨆ i = 1 R ( s ) C ( s , i ) = Y . Note that diam ( C ( s , i ) ) ≤ 2 / s \operatorname{diam}(C(s,i))\le2/s diam ( C ( s , i )) ≤ 2/ s for all s ∈ N s\in\mathbb{N} s ∈ N and i = 1 , … , R ( s ) i=1,\ldots,R(s) i = 1 , … , R ( s ) .
We define four objects: First, we have the true predictive distribution which makes a prediction on the next token based on the full history. This is an object with the highest informative value provided that the underlying structure is well-behaved. However, as we progress further into the time horizon, computing it may require vast computation power and memory requirements. To this end, we also introduce the M M M -window predictive distribution which uses only the M M M -many past observations prior to the next time step. After that we define the quantized version of the M M M -window predictive distribution, which uses the M M M -window data from the 1 s \frac{1}{s} s 1 -net approximation of Y \mathbb{Y} Y . Finally, since Transformers realize maps via finite set of logits, we quantize the target as well. Eventually, one part of our objective is to reveal that, depending on the window size M M M and quantization level s s s , M M M -window s s s -quantized data are near-sufficient statistics with explicit error rates.
Definition 2. For any r ∈ N r \in\mathbb{N} r ∈ N , we define
The true predictive distribution
P r ( ⋅ ) : = Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) . P_r(\cdot) := \Pr(Y_{r+1} \in\cdot\mid Y_{0:r}). P r ( ⋅ ) := Pr ( Y r + 1 ∈ ⋅ ∣ Y 0 : r ) . The M M M -window predictive distribution
P r M ( ⋅ ) : = Pr ( Y r + 1 ∈ ⋅ ∣ Y r − M + 1 , … , Y r ) , P_r^M(\cdot) := \Pr(Y_{r+1} \in\cdot\mid Y_{r-M+1}, \ldots, Y_r), P r M ( ⋅ ) := Pr ( Y r + 1 ∈ ⋅ ∣ Y r − M + 1 , … , Y r ) , The M M M -window quantized-data predictive distribution
P r M , s ( ⋅ ) : = Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r − M + 1 ) , … , q s ( Y r ) ) , P_r^{M,s}(\cdot) := \Pr(Y_{r+1} \in\cdot\mid q^s(Y_{r-M+1}), \ldots, q^s(Y_r)), P r M , s ( ⋅ ) := Pr ( Y r + 1 ∈ ⋅ ∣ q s ( Y r − M + 1 ) , … , q s ( Y r )) , The M M M -window fully quantized predictive distribution
P ^ r M , s ( ⋅ ) : = q # s P r M , s ( ⋅ ∣ q s ( Y r − M + 1 ) , … , q s ( Y r ) ) . \widehat{P}_r^{M,s}(\cdot) := q_{\#}^s P_r^{M,s}(\cdot\mid q^s(Y_{r-M+1}), \ldots, q^s(Y_r)). P r M , s ( ⋅ ) := q # s P r M , s ( ⋅ ∣ q s ( Y r − M + 1 ) , … , q s ( Y r )) . In 2-4, we take the initial distribution as Law ( Z r − M ) \operatorname{Law}(Z_{r-M}) Law ( Z r − M ) .
In the theory of partially observed Markov decision processes (POMDPs), one desires to compute the filter process π r ( ⋅ ) = Pr ( Z r ∈ ⋅ ∣ Y 0 : r ) \pi_r(\cdot) = \Pr(Z_r \in\cdot\mid Y_{0:r}) π r ( ⋅ ) = Pr ( Z r ∈ ⋅ ∣ Y 0 : r ) [27 ] . Hence, the problem we study in this paper is slightly different from the usual nonlinear filtering problem. A filter is an estimator of hidden states, based on the information given by the observation variables. In this paper, we are trying to estimate the next observation given the observations seen so far. For Markovian processes, these two problems are equivalent since one can arrive at P r P_r P r by composing the filter π r \pi_r π r with the transition and observation kernels of the system (which are non-expansive in the total variation distance), in that order. However, this is not true in general for an ergodic source.
The analysis of this problem requires several assumptions, which we regard as mild as they balance the level of difficulty imposed by the generality.
Assumption 3. The following hold throughout:
(A1) The density ψ \psi ψ satisfies the minorization condition ψ ( y ∣ z ) ≥ q min > 0 \psi(y \mid z) \ge q_{\min} > 0 ψ ( y ∣ z ) ≥ q m i n > 0 for all y ∈ Y y \in\mathbb{Y} y ∈ Y and all z ∈ S z \in S z ∈ S .
(A2) There exists L ψ ≥ 0 L_{\psi} \ge0 L ψ ≥ 0 such that for all z ∈ S z \in S z ∈ S and all y , y ′ ∈ Y y,y' \in\mathcal{Y} y , y ′ ∈ Y , ∣ ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ∣ ≤ L ψ ρ ( y , y ′ ) |\psi(y \mid z)-\psi(y' \mid z)| \le L_{\psi}\rho(y,y') ∣ ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ∣ ≤ L ψ ρ ( y , y ′ ) .
(A3) For all s ∈ N s \in\mathbb{N} s ∈ N , there is μ min s > 0 \mu_{\min}^{s} > 0 μ m i n s > 0 such that, for all i = 1 , … , R ( s ) i=1,\ldots,R(s) i = 1 , … , R ( s ) , μ ( C ( s , i ) ) ≥ μ min s \mu(C(s,i)) \ge\mu_{\min}^{s} μ ( C ( s , i )) ≥ μ m i n s holds.
Once we obtain the necessary results, we need to be able to come back from the quantized space to the original space. In particular, in §4, we build a Transformer to realize P ^ r M , s \widehat{P}_{r}^{M,s} P r M , s in Definition 2, using which we obtain the final error bounds in §5. Since the Transformer gives a probability distribution over Λ s \Lambda_s Λ s , we have to revert back to a distribution on Y \mathcal{Y} Y , namely P r M , s P_{r}^{M,s} P r M , s .
Definition 4. For any s ∈ N s \in\mathbb{N} s ∈ N , define Ξ s : P ( Λ s ) → P ( Y ) \Xi_s:\mathcal{P}(\Lambda_s) \to\mathcal{P}(\mathcal{Y}) Ξ s : P ( Λ s ) → P ( Y ) by
Ξ s ( ν ) ( A ) : = ∑ i = 1 R ( s ) ν ( y s , i ) μ ( A ∩ C ( s , i ) ) μ ( C ( s , i ) ) , ν ∈ P ( Λ s ) . \Xi_s(\nu)(A):=\sum_{i=1}^{R(s)}\nu(y_{s,i})\frac{\mu(A\cap C(s,i))}{\mu(C(s,i))},\qquad\nu\in\mathcal{P}(\Lambda_s). Ξ s ( ν ) ( A ) := i = 1 ∑ R ( s ) ν ( y s , i ) μ ( C ( s , i )) μ ( A ∩ C ( s , i )) , ν ∈ P ( Λ s ) .
The function Ξ s \Xi_s Ξ s is well-defined if Assumption 3-(A3) holds: Then the denominator μ ( C ( s , i ) ) \mu(C(s,i)) μ ( C ( s , i )) is positive for all s ∈ N s \in\mathbb{N} s ∈ N and i = 1 , … , R ( s ) i=1,\ldots,R(s) i = 1 , … , R ( s ) .
We study this problem under two scenarios: (i) We add the assumption that the latent source { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is stationary ergodic, in addition to Assumption 3. (ii) { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is N N N th order Markov, which we initially treat the first order case, then generalize to the N N N th order case by reducing to the first order case back. This setting allows us to derive explicit rates showing exponentially fast convergence using Dobrushin coefficient-based analyses, following [33 ] .
Proposition 5. Under Assumptions 3-(A1-2), for all r ≥ M r \ge M r ≥ M and all s ∈ N s \in\mathbb{N} s ∈ N ,
sup y ∈ Y M ∥ P r M ( ⋅ ∣ y ) − P r M , s ( ⋅ ∣ q M , s ( y ) ) ∥ T V ≤ 2 M L ψ q min s . \sup_{y\in\mathcal{Y}^{M}}\left\|P_r^M(\mathord{\cdot}\mid y)-P_r^{M,s}(\mathord{\cdot}\mid q^{M,s}(y))\right\|_{\mathrm{TV}}\le\frac{2ML_{\psi}}{q_{\min}^{s}}. y ∈ Y M sup P r M ( ⋅ ∣ y ) − P r M , s ( ⋅ ∣ q M , s ( y )) TV ≤ q m i n s 2 M L ψ . where q M , s q^{M,s} q M , s is the application of q s q^s q s to sequences of length M M M .
The case where { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is a general stationary and ergodic process
In this part, we cover the case where the latent source is stationary and ergodic. This setting allows us to derive vanishing error bounds using information–theoretic tools. However, the bounds are of qualitative nature. We commence with stating our base assumption for this subsection, and then we investigate how the regularity of the latent source affects the regularity of the observed variables. Finally, we show that the finite memory approximation yields a entropy gap based bound decreasing to 0.
Assumption 6. { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is ergodic with probability one, i.e.
lim T → + ∞ 1 T ∑ r = 0 T − 1 f ( Z r ) = a . s . ∑ z ∈ S π Z ( z ) f ( z ) \lim_{T\to+\infty}\frac{1}{T}\sum_{r=0}^{T-1}f(Z_r)\mathrel{\stackrel{\mathrm{a.s.}}{=}}\sum_{z\in S}\pi_Z(z)f(z) T → + ∞ lim T 1 r = 0 ∑ T − 1 f ( Z r ) = a.s. z ∈ S ∑ π Z ( z ) f ( z ) for any f : S → R f:S\to\mathbb{R} f : S → R . We further assume that { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is stationary.
Let A \mathcal{A} A and B \mathcal{B} B be measurable spaces, A A A and B B B be two continuous random variables with a joint probability density function f : A × B → [ 0 , 1 ] f:\mathcal{A}\times\mathcal{B}\to[0,1] f : A × B → [ 0 , 1 ] , where A A A is A \mathcal{A} A -valued and B B B is B \mathcal{B} B -valued. Then the conditional differential entropy is defined as
H ( A ∣ B ) : = − ∫ A × B f ( a , b ) log f ( a ∣ b ) d ( a , b ) (2) H(A\mid B):=-\int_{\mathcal{A}\times\mathcal{B}}f(a,b)\log f(a\mid b)\,\mathrm{d}(a,b) \tag*{(2)} H ( A ∣ B ) := − ∫ A × B f ( a , b ) log f ( a ∣ b ) d ( a , b ) (2)
whenever the integral above exists, where f ( a ∣ b ) f(a\mid b) f ( a ∣ b ) is the conditional probability of A A A given B B B . The memory gap is then defined as
Δ M , r : = H ( Y r + 1 ∣ Y r − M + 1 : r ) − H ( Y r + 1 ∣ Y 0 : r ) (3) \Delta_{M,r}:=H(Y_{r+1}\mid Y_{r-M+1:r})-H(Y_{r+1}\mid Y_{0:r}) \tag*{(3)} Δ M , r := H ( Y r + 1 ∣ Y r − M + 1 : r ) − H ( Y r + 1 ∣ Y 0 : r ) (3)
Note that for fixed r r r , Δ M , r → 0 \Delta_{M,r}\to0 Δ M , r → 0 monotonically as M M M increases to r r r since the conditioning σ \sigma σ -field grows monotonically to the full history σ \sigma σ -field generated by Y 0 : r Y_{0:r} Y 0 : r . In addition, for the proof of next lemma, we require the notation H j : = H ( Y j ∣ Y 0 : j − 1 ) H_j:=H(Y_j\mid Y_{0:j-1}) H j := H ( Y j ∣ Y 0 : j − 1 ) for all j ∈ N j\in\mathbb{N} j ∈ N and define H ∞ : = lim j → ∞ H j H_\infty:=\lim_{j\to\infty}H_j H ∞ := lim j → ∞ H j . Note that Assumptions 3-(A2) and (A3) ensure that the conditional entropies in (3) and H j H_j H j ’s exist since ψ ( ⋅ ∣ z ) \psi(\cdot\mid z) ψ ( ⋅ ∣ z ) is (Lipschitz) continuous on a compact space Y \mathcal{Y} Y , therefore, it is bounded. Hence, H j ∈ [ − log ∥ ψ ∥ ∞ , − log q min ] H_j\in[-\log\|\psi\|_\infty,-\log q_{\min}] H j ∈ [ − log ∥ ψ ∥ ∞ , − log q m i n ] . Note that { H j } j ∈ N \{H_j\}_{j\in\mathbb{N}} { H j } j ∈ N forms a non-increasing sequence:
H j + 1 : = H ( Y j + 1 ∣ Y 0 : j ) ≤ H ( Y j + 1 ∣ Y 1 : j ) = H ( Y j ∣ Y 0 : j − 1 ) = : H j , j ∈ N H_{j+1}:=H(Y_{j+1}\mid Y_{0:j})\le H(Y_{j+1}\mid Y_{1:j})=H(Y_j\mid Y_{0:j-1})=:H_j,\qquad j\in\mathbb{N} H j + 1 := H ( Y j + 1 ∣ Y 0 : j ) ≤ H ( Y j + 1 ∣ Y 1 : j ) = H ( Y j ∣ Y 0 : j − 1 ) =: H j , j ∈ N
The inequality H ( Y j + 1 ∣ Y 0 : j ) ≤ H ( Y j + 1 ∣ Y 1 : j ) H(Y_{j+1}\mid Y_{0:j})\le H(Y_{j+1}\mid Y_{1:j}) H ( Y j + 1 ∣ Y 0 : j ) ≤ H ( Y j + 1 ∣ Y 1 : j ) holds for all j ∈ N j\in\mathbb{N} j ∈ N since conditioning on a coarser σ \sigma σ -field results in higher entropy. The equality H ( Y j + 1 ∣ Y 1 : j ) = H ( Y j ∣ Y 0 : j − 1 ) H(Y_{j+1}\mid Y_{1:j})=H(Y_j\mid Y_{0:j-1}) H ( Y j + 1 ∣ Y 1 : j ) = H ( Y j ∣ Y 0 : j − 1 ) is due to the stationarity of { Y r } r ∈ Z + \{Y_r\}_{r\in\mathbb{Z}_+} { Y r } r ∈ Z + , established in Lemma 30. Therefore, by monotone convergence theorem for real-valued sequences, H ∞ H_\infty H ∞ exists.
We define the Kullback-Leibler divergence between two probability measures P 1 P_1 P 1 and P 2 P_2 P 2 on a measurable space ( Ω , F ) (\Omega,\mathcal{F}) ( Ω , F ) as follows:
D K L ( P 1 ∥ P 2 ) : = { ∫ Ω d P 1 log d P 1 d P 2 , P 1 ≪ P 2 ; + ∞ , otherwise. (4) D_{\mathrm{KL}}(P_1\mathbin\Vert P_2):=
\begin{cases}
\int_{\Omega}\mathrm{d}P_1\log\frac{\mathrm{d}P_1}{\mathrm{d}P_2}, & P_1\ll P_2;\\
+\infty, & \text{otherwise.}
\end{cases} \tag*{(4)} D KL ( P 1 ∥ P 2 ) := { ∫ Ω d P 1 log d P 2 d P 1 , + ∞ , P 1 ≪ P 2 ; otherwise. (4)
In addition, recall that the mutual information of two random variables A A A and B B B , defined on the same probability space, is defined as
I ( A ; B ) : = D K L ( Law ( A , B ) ∥ Law ( A ) ⊗ Law ( B ) ) . (5) I(A;B):=D_{\mathrm{KL}}(\operatorname{Law}(A,B)\mathbin\Vert\operatorname{Law}(A)\otimes\operatorname{Law}(B)). \tag*{(5)} I ( A ; B ) := D KL ( Law ( A , B ) ∥ Law ( A ) ⊗ Law ( B )) . (5)
An additional third random variable C C C allows us to define the conditional mutual information :
I ( A ; B ∣ C ) : = E C D K L ( Law ( A , B ∣ C ) ∥ Law ( A ∣ C ) ⊗ Law ( B ∣ C ) ) . (6) I(A;B\mid C):=\mathbb{E}_{C}D_{\mathrm{KL}}(\operatorname{Law}(A,B\mid C)\mathbin\Vert\operatorname{Law}(A\mid C)\otimes\operatorname{Law}(B\mid C)). \tag*{(6)} I ( A ; B ∣ C ) := E C D KL ( Law ( A , B ∣ C ) ∥ Law ( A ∣ C ) ⊗ Law ( B ∣ C )) . (6)
It can be shown that the conditional mutual information satisfies
I ( A ; B ∣ C ) = H ( A ∣ C ) − H ( A ∣ B , C ) . (7) I(A;B\mid C)=H(A\mid C)-H(A\mid B,C). \tag*{(7)} I ( A ; B ∣ C ) = H ( A ∣ C ) − H ( A ∣ B , C ) . (7)
Let ζ 1 \zeta_1 ζ 1 and ζ 2 \zeta_2 ζ 2 be probability measures on a measurable space ( Ω , F ) (\Omega,\mathcal{F}) ( Ω , F ) . The total variation distance is defined as ∥ ζ 1 − ζ 2 ∥ T V : = sup A ∈ F ∣ ζ 1 ( A ) − ζ 2 ( A ) ∣ \|\zeta_1-\zeta_2\|_{\mathrm{TV}}:=\sup_{A\in\mathcal{F}}|\zeta_1(A)-\zeta_2(A)| ∥ ζ 1 − ζ 2 ∥ TV := sup A ∈ F ∣ ζ 1 ( A ) − ζ 2 ( A ) ∣ .
Proposition 7. Under Assumption 6, Δ M : = sup r ≥ M Δ M , r = H M − H ∞ \Delta_M:=\sup_{r\ge M}\Delta_{M,r}=H_M-H_\infty Δ M := sup r ≥ M Δ M , r = H M − H ∞ , and Δ M ↓ 0 \Delta_M\downarrow0 Δ M ↓ 0 as M → ∞ M\to\infty M → ∞ . Consequently, sup r ≥ M E Y 0 : r ∥ P r − P r M ∥ T V ≤ Δ M / 2 ↓ 0 \sup_{r\ge M}\mathbb{E}_{Y_{0:r}}\|P_r-P_r^M\|_{\mathrm{TV}}\le\sqrt{\Delta_M/2}\downarrow0 sup r ≥ M E Y 0 : r ∥ P r − P r M ∥ TV ≤ Δ M /2 ↓ 0 .
The hidden Markov model setup: { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is Markov but not necessarily stationary
The case where { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is first order Markov
We assume that { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is a time-homogeneous Markov chain, such that
Pr ( Z r + 1 ∈ ⋅ ∣ Z 0 : r = z 0 : r ) = Pr ( Z r + 1 ∈ ⋅ ∣ Z r = z r ) = : κ ( ⋅ ∣ z r ) (8) \Pr(Z_{r+1} \in\cdot\mid Z_{0:r}=z_{0:r}) = \Pr(Z_{r+1} \in\cdot\mid Z_r=z_r) =: \kappa(\cdot\mid z_r) \tag*{(8)} Pr ( Z r + 1 ∈ ⋅ ∣ Z 0 : r = z 0 : r ) = Pr ( Z r + 1 ∈ ⋅ ∣ Z r = z r ) =: κ ( ⋅ ∣ z r ) (8)
for all r ∈ Z + r \in\mathbb{Z}_+ r ∈ Z + and z 0 : r ∈ S r + 1 z_{0:r} \in S^{r+1} z 0 : r ∈ S r + 1 . We have the observation channel Q Q Q and sequence { Y r } r ∈ Z + \{Y_r\}_{r\in\mathbb{Z}_+} { Y r } r ∈ Z + as before.
The filter stability bounds derived by McDonald and Yüksel [33 ] uses Dobrushin’s coefficient [14 ] , thereby, it is a centerpiece to our analysis as well. In the following, we define Dobrushin coefficient of a stochastic kernel between general measurable spaces in the minorization form .
Definition 8. Dobrushin coefficient of a stochastic kernel K K K on a measurable space B given another measurable space A is defined as
δ ( K ) : = inf ∑ i = 1 n min { K ( B i ∣ a ) , K ( B i ∣ a ′ ) } \delta(K) := \inf\sum_{i=1}^{n} \min\{K(B_i \mid a), K(B_i \mid a')\} δ ( K ) := inf i = 1 ∑ n min { K ( B i ∣ a ) , K ( B i ∣ a ′ )} where the infimum is taken over all a , a ′ ∈ A a,a' \in A a , a ′ ∈ A and all finite measurable partitions { B i } i = 1 n \{B_i\}_{i=1}^{n} { B i } i = 1 n of B.
Informally, the Dobrushin coefficient of a kernel K K K can be interpreted as the worst-case one-step probability of forgetting where you started. It takes values in [ 0 , 1 ] [0,1] [ 0 , 1 ] where 1 is often interpreted as total forgetting in one-step and 0 tells us that there is no forced forgetting. For any two probability measures ζ 1 , ζ 2 ∈ P ( B ) \zeta_1,\zeta_2 \in\mathcal{P}(\mathrm{B}) ζ 1 , ζ 2 ∈ P ( B ) , one has the Lipschitz property ∥ ζ 1 K − ζ 2 K ∥ T V ≤ ( 1 − δ ( K ) ) ∥ ζ 1 − ζ 2 ∥ T V \|\zeta_1 K-\zeta_2 K\|_{\mathrm{TV}} \le(1-\delta(K))\|\zeta_1-\zeta_2\|_{\mathrm{TV}} ∥ ζ 1 K − ζ 2 K ∥ TV ≤ ( 1 − δ ( K )) ∥ ζ 1 − ζ 2 ∥ TV .
In the following proposition, we prove the exponential filter stability bounds for the next token predictive conditional distributions with full and truncated data, using [33 Corollary 3.7] . We show that the difference is bounded by an exponential rate depending on the Dobrushin coefficients of the transition kernel κ \kappa κ and the observation channel Q Q Q .
Proposition 9. Suppose Assumption 3-(A1) holds. Then, whenever r ≥ M ≥ 1 r \ge M \ge1 r ≥ M ≥ 1 , we have
E Y 0 : r ∥ P r − P r M ∥ T V ≤ α M \mathbb{E}_{Y_{0:r}}\|P_r-P_r^M\|_{\mathrm{TV}} \le\alpha^M E Y 0 : r ∥ P r − P r M ∥ TV ≤ α M with α = ( 1 − δ ( κ ) ) ( 2 − δ ( Q ) ) \alpha=(1-\delta(\kappa))(2-\delta(Q)) α = ( 1 − δ ( κ )) ( 2 − δ ( Q )) .
Under suitable conditions, for which an example would be δ ( κ ) > 1 / 2 \delta(\kappa)>1/2 δ ( κ ) > 1/2 , it can be shown that the rate in Proposition 9 gives an exponential decay. In general, the faster convergence requires both δ ( κ ) \delta(\kappa) δ ( κ ) and δ ( Q ) \delta(Q) δ ( Q ) to be near 1. This is in parallel with the intuitive meaning of Dobrushin’s coefficient: Whenever it is close to 1, the system forgets where it started, hence, the truncated data filter converges to the full history filter.
The case where { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is N N N th order Markov
Now, we assume that { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is an N N N th order Markov chain, that is
Pr ( Z r + 1 ∈ ⋅ ∣ Z 0 : r = z 0 : r ) = Pr ( Z r + 1 ∈ ⋅ ∣ Z r − N + 1 : r = z r − N + 1 : r ) (9) \Pr(Z_{r+1}\in\cdot\mid Z_{0:r}=z_{0:r})=\Pr(Z_{r+1}\in\cdot\mid Z_{r-N+1:r}=z_{r-N+1:r}) \tag*{(9)} Pr ( Z r + 1 ∈ ⋅ ∣ Z 0 : r = z 0 : r ) = Pr ( Z r + 1 ∈ ⋅ ∣ Z r − N + 1 : r = z r − N + 1 : r ) (9)
for all r ∈ Z + r\in\mathbb{Z}_+ r ∈ Z + and all z 0 : r ∈ S r + 1 z_{0:r}\in S^{r+1} z 0 : r ∈ S r + 1 . Then we define the quantity on the right hand side in (9), κ ( ⋅ ∣ z r − N + 1 : r ) \kappa(\cdot\mid z_{r-N+1:r}) κ ( ⋅ ∣ z r − N + 1 : r ) which defines a conditional probability distribution on S S S given S N S^N S N . We call κ \kappa κ the transition kernel of { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + . As before, { Y r } r ∈ Z + \{Y_r\}_{r\in\mathbb{Z}_+} { Y r } r ∈ Z + is the induced observation variables emitted through the channel Q Q Q . The objects in Definition 2 transfer directly to here as well. In this setting, { ( Z r , Y r ) } r ∈ Z + \{(Z_r,Y_r)\}_{r\in\mathbb{Z}_+} {( Z r , Y r ) } r ∈ Z + defines a hidden (partially observed) N N N th order Markov model.
We use a block hidden Markov model that we derive from the original N N N th-order partially observed Markovian process as an apparatus for enabling us to use the machinery provided by McDonald and Yüksel [33 ] . To this end, we fix a time index r ∈ N r\in\mathbb{N} r ∈ N and a window length M M M that is larger than N N N throughout. Moreover, we define m : = ⌊ M / N ⌋ m:=\lfloor M/N\rfloor m := ⌊ M / N ⌋ and res : = r − m N \operatorname{res}:=r-mN res := r − m N , where the former serves as the time-index for the block process and the latter is the residual time-index due to block lifting.
For each i = 1 , … , m i=1,\ldots,m i = 1 , … , m , we define two processes:
X i : = ( Z res + ( i − 1 ) N + 1 , … , Z res + i N ) ∈ S N (10) X_i := (Z_{\operatorname{res}+(i-1)N+1},\ldots,Z_{\operatorname{res}+iN})\in S^N \tag*{(10)} X i := ( Z res + ( i − 1 ) N + 1 , … , Z res + i N ) ∈ S N (10)
and
Y i : = ( Y res + ( i − 1 ) N + 1 , … , Y res + i N ) ∈ Y N (11) Y_i := (Y_{\operatorname{res}+(i-1)N+1},\ldots,Y_{\operatorname{res}+iN})\in\mathbb{Y}^N \tag*{(11)} Y i := ( Y res + ( i − 1 ) N + 1 , … , Y res + i N ) ∈ Y N (11)
with X 0 : = ( Z 1 , … , Z res ) X_0:=(Z_1,\ldots,Z_{\operatorname{res}}) X 0 := ( Z 1 , … , Z res ) . The indices are chosen in a way that X m = ( Z r − N + 1 , … , Z r ) X_m=(Z_{r-N+1},\ldots,Z_r) X m = ( Z r − N + 1 , … , Z r ) and Y 1 : m Y_{1:m} Y 1 : m lies inside { Y r − M + 1 , … , Y r } \{Y_{r-M+1},\ldots,Y_r\} { Y r − M + 1 , … , Y r } . In addition, we have M − m N < N M-mN<N M − m N < N observations as leftover. For these processes, we define three kernels: For any z = ( z 1 , … , z N ) \boldsymbol{z}=(z_1,\ldots,z_N) z = ( z 1 , … , z N ) , z ′ = ( z 1 ′ , … , z N ′ ) ∈ S N \boldsymbol{z}'=(z'_1,\ldots,z'_N)\in S^N z ′ = ( z 1 ′ , … , z N ′ ) ∈ S N and y = ( y 1 , … , y N ) ∈ Y N \boldsymbol{y}=(y_1,\ldots,y_N)\in\mathbb{Y}^N y = ( y 1 , … , y N ) ∈ Y N
**(K1) The block transition kernel
T ( z ′ ∣ z ) : = ∏ j = 1 N κ ( z j ′ ∣ z j , … , z N , z 1 ′ , … , z j − 1 ′ ) ∈ P ( S N ∣ S N ) . \mathsf{T}(\boldsymbol{z}'\mid\boldsymbol{z}):=\prod_{j=1}^{N}\kappa(z'_j\mid z_j,\ldots,z_N,z'_1,\ldots,z'_{j-1})\in\mathcal{P}(S^N\mid S^N). T ( z ′ ∣ z ) := j = 1 ∏ N κ ( z j ′ ∣ z j , … , z N , z 1 ′ , … , z j − 1 ′ ) ∈ P ( S N ∣ S N ) .
**(K2) The block observation kernel
Q ( y ∣ z ) : = ∏ j = 1 N Q ( y j ∣ z j ) ∈ P ( Y N ∣ S N ) . Q(\boldsymbol{y}\mid\boldsymbol{z}):=\prod_{j=1}^{N}Q(y_j\mid z_j)\in\mathcal{P}(\mathbb{Y}^N\mid S^N). Q ( y ∣ z ) := j = 1 ∏ N Q ( y j ∣ z j ) ∈ P ( Y N ∣ S N ) .
**(K3) The one-step prediction kernel
Pred ( y ∣ z ) = ∑ z ∈ S N ψ ( y ∣ z ) κ ( z ∣ z ) ∈ P ( Y ∣ S N ) , y ∈ Y . \operatorname{Pred}(y\mid\boldsymbol{z})=\sum_{\boldsymbol{z}\in S^N}\psi(y\mid\boldsymbol{z})\kappa(\boldsymbol{z}\mid\boldsymbol{z})\in\mathcal{P}(\mathbb{Y}\mid S^N),\qquad y\in\mathbb{Y}. Pred ( y ∣ z ) = z ∈ S N ∑ ψ ( y ∣ z ) κ ( z ∣ z ) ∈ P ( Y ∣ S N ) , y ∈ Y .
Our proof strategy is to reduce the N N N th order Markov chain to a first order one with the block lifting, which is now a known territory to us.
Figure 3. Two ways of lifting an N t h N^{\mathrm{th}} N th order Markov chain to a first order one. Sliding lift makes the process share coordinates as it evolves, therefore, resulting in zero Dobrushin coefficient. The block lifting solves this issue.
The following proof is a reiteration of the proof of Proposition 9 for the block Markov reduction of the N t h N^{\mathrm{th}} N th order Markov model with additional worked out details.
Proposition 10. Suppose Assumptions 3-(A1, A2) hold. Then, whenever r ≥ M ≥ N ≥ 1 r \ge M \ge N \ge1 r ≥ M ≥ N ≥ 1 , we have
E Y 0 : r ∥ P r − P r M ∥ T V ≤ α ⌊ M / N ⌋ \mathbb{E}_{Y_{0:r}}\left\|P_r-P_r^M\right\|_{\mathrm{TV}} \le\alpha^{\lfloor M/N\rfloor} E Y 0 : r P r − P r M TV ≤ α ⌊ M / N ⌋ with α : = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) \alpha:= (1-\delta(\mathsf{T}))(2-\delta(\mathsf{Q})) α := ( 1 − δ ( T )) ( 2 − δ ( Q )) .
Remark 11. *It is also possible to block by taking the sliding lift X ~ r = ( Z r − N + 1 , … , Z r ) \widetilde{X}_r=(Z_{r-N+1},\ldots,Z_r) X r = ( Z r − N + 1 , … , Z r ) for each r ∈ Z + r\in\mathbb{Z}_+ r ∈ Z + . However, the transition kernel is slightly degenerate in this case: For all r ∈ Z + r\in\mathbb{Z}_+ r ∈ Z + , X ~ r \widetilde{X}_r X r contains all information in X ~ r + 1 \widetilde{X}_{r+1} X r + 1 except the last component. Therefore, the target supports are disjoint whenever we move on from two states differing in a non-terminal coordinate, resulting in 0 Dobrushin coefficient for the respective kernel. In this case, we lose the contraction property of the kernel. Non-overlapping blocks of length exactly N N N are the smallest block lift possible with positive Dobrushin coefficient. This is the reason why we have the exponent ⌊ M / N ⌋ \lfloor M/N\rfloor ⌊ M / N ⌋ instead of M M M as in the estimates of [33 , 26 , 28 ] . *
Filter stability and sufficiency of finite memory
We finally merge the findings of §2.2.1 and § 4.2.2 to fully characterize the effect of memory on next token prediction.
Theorem 12. Under Assumptions 3-(A1, A2), for all M ≥ N M \ge N M ≥ N and all s ∈ N s \in\mathbb{N} s ∈ N , we have
(i) with α = ( 1 − δ ( κ ) ) ( 2 − δ ( Q ) ) \alpha= (1-\delta(\kappa))(2-\delta(Q)) α = ( 1 − δ ( κ )) ( 2 − δ ( Q )) ,
sup r ≥ M E Y 0 : r ∥ P r − P r M , s ∥ T V ≤ α M + 2 M L ψ q min s . \sup_{r \ge M} \mathbb{E}_{Y_{0:r}}\lVert P_r-P_r^{M,s}\rVert_{\mathrm{TV}} \le\alpha^M+\frac{2ML_\psi}{q_{\min}s}. r ≥ M sup E Y 0 : r ∥ P r − P r M , s ∥ TV ≤ α M + q m i n s 2 M L ψ . (ii) with α = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) \alpha= (1-\delta(\mathsf{T}))(2-\delta(Q)) α = ( 1 − δ ( T )) ( 2 − δ ( Q )) ,
sup r ≥ M E Y 0 : r ∥ P r − P r M , s ∥ T V ≤ α ⌊ M / N ⌋ + 2 M L ψ q min s . \sup_{r \ge M} \mathbb{E}_{Y_{0:r}}\lVert P_r-P_r^{M,s}\rVert_{\mathrm{TV}} \le\alpha^{\lfloor M/N\rfloor}+\frac{2ML_\psi}{q_{\min}s}. r ≥ M sup E Y 0 : r ∥ P r − P r M , s ∥ TV ≤ α ⌊ M / N ⌋ + q m i n s 2 M L ψ .
Theorem 12’s findings raise two naturally arising questions: (i) How much memory is sufficient for next token estimation? (ii) How fine must the quantization be?
Corollary 13. Under Assumptions 3-(A1, A2), for any precision ε > 0 \varepsilon> 0 ε > 0 if s ≥ 4 M L ψ / ( q min ε ) s \ge4ML_\psi/(q_{\min}\varepsilon) s ≥ 4 M L ψ / ( q m i n ε ) and, in addition
(i) α < 1 \alpha< 1 α < 1 holds, and whenever
M ≥ log ( 2 / ε ) log ( 1 / α ) , M \ge\frac{\log(2/\varepsilon)}{\log(1/\alpha)}, M ≥ log ( 1/ α ) log ( 2/ ε ) , holds, where α \alpha α as in Proposition 9,
(ii) α < 1 \alpha< 1 α < 1 holds, and whenever
M ≥ N ⌈ log ( 2 / ε ) log ( 1 / α ) ⌉ , M \ge N\left\lceil\frac{\log(2/\varepsilon)}{\log(1/\alpha)}\right\rceil, M ≥ N ⌈ log ( 1/ α ) log ( 2/ ε ) ⌉ , holds, where α \alpha α as in Proposition 10,
we get
sup r ≥ M E Y 0 : r ∥ P r − P r M , s ∥ T V ≤ ε . \sup_{r \ge M} \mathbb{E}_{Y_{0:r}}\lVert P_r-P_r^{M,s}\rVert_{\mathrm{TV}} \le\varepsilon. r ≥ M sup E Y 0 : r ∥ P r − P r M , s ∥ TV ≤ ε .
Remark 14. All results in this section use predictive distributions in Definition 2 with the prior Law ( Z r − M ) \operatorname{Law}(Z_{r-M}) Law ( Z r − M ) . However, it is possible to take an arbitrary prior π ~ 0 ∈ P ( S ) \tilde{\pi}_0 \in\mathcal{P}(\mathcal{S}) π ~ 0 ∈ P ( S ) ; Assumption 3 ensures that the conditions of [33 Theorem 3.6] hold for π ~ 0 \tilde{\pi}_0 π ~ 0 , and the same analysis applies for the predictive distributions initialized from π ~ 0 \tilde{\pi}_0 π ~ 0 .
The Optimal Control Formulation of Transformers
We follow Akman et al. [3 ] ’s formulation; however, with a divergence: we do not consider positional encoding separately in the first lift, but rather encode it in the token embedding itself. This depicts how position is used in early Transformers (now it is done at the attention matrix level, see Barbero et al. [6 ] , which requires generating a token from a static ’vocabulary’ and then embedding it with positional information.
Transformers as Discrete-Time Dynamical Systems with Open-Loop Control
We recall the definitions and conventions of Akman et al. [3 ] for a self-contained discussion. Let X \mathsf{X} X be the token embedding space and U \mathsf{U} U be the space of network weights in one Transformer layer. We define the particle flow function f : X × P ( X ) × U → X f:\mathsf{X}\times\mathcal{P}(\mathsf{X})\times\mathsf{U}\to\mathsf{X} f : X × P ( X ) × U → X for all x ∈ X x\in\mathsf{X} x ∈ X , μ ∈ P ( X ) \mu\in\mathcal{P}(\mathsf{X}) μ ∈ P ( X ) , and U = ( W W , W A , W b , W Q , W K , W V , E E , E U ) ∈ U U=(W_W,W_A,W_b,W_Q,W_K,W_V,E_E,E_U)\in\mathsf{U} U = ( W W , W A , W b , W Q , W K , W V , E E , E U ) ∈ U by
f ( x , μ , U ) : = W W σ ( W A x + W b ) + ∫ X μ ( d z ) e β ⟨ W Q x , W K z ⟩ W V z ∫ X μ ( d z ) e β ⟨ W Q x , W K z ⟩ f(x,\mu,U):=W_W\sigma(W_Ax+W_b)+\frac{\int_{\mathsf{X}}\mu(\mathrm{d}z)e^{\beta\langle W_Qx,W_Kz\rangle}W_Vz}{\int_{\mathsf{X}}\mu(\mathrm{d}z)e^{\beta\langle W_Qx,W_Kz\rangle}} f ( x , μ , U ) := W W σ ( W A x + W b ) + ∫ X μ ( d z ) e β ⟨ W Q x , W K z ⟩ ∫ X μ ( d z ) e β ⟨ W Q x , W K z ⟩ W V z
for a sharpening parameter β ≥ 0 \beta\ge0 β ≥ 0 . The feed-forward block is the left term, and the attention block is the right term. The number of layers is denoted by T ∈ N T\in\mathbb{N} T ∈ N where T : = { 0 , … , T − 1 } \mathcal{T}:=\{0,\ldots,T-1\} T := { 0 , … , T − 1 } and T ‾ : = T ∪ { T } \overline{\mathcal{T}}:=\mathcal{T}\cup\{T\} T := T ∪ { T } .
We encode the position p ∈ P E L p\in\mathrm{PE}_L p ∈ PE L into s ∈ S s\in\mathcal{S} s ∈ S via E E : S × P E L → X E_E:\mathcal{S}\times\mathrm{PE}_L\to\mathsf{X} E E : S × PE L → X to produce x ∈ X x\in\mathsf{X} x ∈ X where L ∈ N L\in\mathbb{N} L ∈ N is the input sequence length. Henceforth, we assume that positional information is embedded and retrievable in x i x^i x i via E E E_E E E for i ∈ L : = { 1 , … , L } i\in\mathcal{L}:=\{1,\ldots,L\} i ∈ L := { 1 , … , L } including under transitions. That is, we assume the following:
Assumption 15. There exists an unembedding function E U : X → R ∣ Λ s ∣ × P E L E_U:\mathsf{X}\to\mathbb{R}^{|\Lambda_s|}\times\mathrm{PE}_L E U : X → R ∣ Λ s ∣ × PE L such that E U ∘ E E = i d S × P E L E_U\circ E_E=\mathrm{id}_{\mathcal{S}\times\mathrm{PE}_L} E U ∘ E E = id S × PE L and E U ( f ( x , μ , U ) ) = ( . , p ) ⟺ E U ( x ) = ( . , p ) E_U(f(x,\mu,U))=(.,p)\Longleftrightarrow E_U(x)=(.,p) E U ( f ( x , μ , U )) = ( . , p ) ⟺ E U ( x ) = ( . , p ) .
In practice, this may correspond to a positional encoder and decoder where the particle flow function sufficiently preserves proximity to the original positional encoding such that projecting it onto the image of the embedded vocabulary E E ( S × P E L ) E_E(\mathcal{S}\times\mathrm{PE}_L) E E ( S × PE L ) in X \mathsf{X} X retrieves the decoded position.
For our realization, for any t ∈ T ‾ t\in\overline{\mathcal{T}} t ∈ T , we take x t i ∈ X x_t^i\in\mathsf{X} x t i ∈ X , U t ∈ U U_t\in\mathsf{U} U t ∈ U , and define μ t : = 1 L ∑ i = 1 L δ x t i ∈ P ( X ) \mu_t:=\frac{1}{L}\sum_{i=1}^{L}\delta_{x_t^i}\in\mathcal{P}(\mathsf{X}) μ t := L 1 ∑ i = 1 L δ x t i ∈ P ( X ) for i ∈ L i\in\mathcal{L} i ∈ L and t ∈ T t\in\mathcal{T} t ∈ T . The weights of U t U_t U t are specified as W W , t ∈ R d × d 1 W_{W,t}\in\mathbb{R}^{d\times d_1} W W , t ∈ R d × d 1 , W A , t ∈ R d 1 × d W_{A,t}\in\mathbb{R}^{d_1\times d} W A , t ∈ R d 1 × d , W b , t ∈ R d 1 W_{b,t}\in\mathbb{R}^{d_1} W b , t ∈ R d 1 , W Q , t , W K , t ∈ R d 2 × d W_{Q,t},W_{K,t}\in\mathbb{R}^{d_2\times d} W Q , t , W K , t ∈ R d 2 × d , W V , t ∈ R d × d W_{V,t}\in\mathbb{R}^{d\times d} W V , t ∈ R d × d for d 1 , d 2 ∈ N d_1,d_2\in\mathbb{N} d 1 , d 2 ∈ N . The first layer U 0 U_0 U 0 additionally includes the embedding matrix E E ∈ R d × ∣ Λ s ∣ E_E\in\mathbb{R}^{d\times|\Lambda_s|} E E ∈ R d × ∣ Λ s ∣ and the last layer U T U_T U T includes the unembedding matrix E U ∈ R ∣ Λ s ∣ × d E_U\in\mathbb{R}^{|\Lambda_s|\times d} E U ∈ R ∣ Λ s ∣ × d . The particle flow function represents the evolution of a single token embedding, such that
f ( x t i , μ t , U t ) = W T σ ( W A , t x t i + W b , t ) + ∫ X μ t ( d z ) e β ⟨ W Q , t x t i , W K , t z ⟩ W V , t z ∫ X μ t ( d z ) e β ⟨ W Q , t x t i , W K , t z ⟩ = W T σ ( W A , t x t i + W b , t ) + ∑ j = 1 L e β ⟨ W Q , t x t i , W K , t x t j ⟩ W V , t x t j , k ∑ l = 1 L e β ⟨ W Q , t x t i , W K , t x t l ⟩ = x t + 1 i . \begin{aligned}
f(x_t^i,\mu_t,U_t)&=W_T\sigma(W_{A,t}x_t^i+W_{b,t})+\frac{\int_{\mathsf{X}}\mu_t(\mathrm{d}z)e^{\beta\langle W_{Q,t}x_t^i,W_{K,t}z\rangle}W_{V,t}z}{\int_{\mathsf{X}}\mu_t(\mathrm{d}z)e^{\beta\langle W_{Q,t}x_t^i,W_{K,t}z\rangle}}\\
&=W_T\sigma(W_{A,t}x_t^i+W_{b,t})+\frac{\sum_{j=1}^{L}e^{\beta\langle W_{Q,t}x_t^i,W_{K,t}x_t^j\rangle}W_{V,t}x_t^{j,k}}{\sum_{l=1}^{L}e^{\beta\langle W_{Q,t}x_t^i,W_{K,t}x_t^l\rangle}}=x_{t+1}^i.
\end{aligned} f ( x t i , μ t , U t ) = W T σ ( W A , t x t i + W b , t ) + ∫ X μ t ( d z ) e β ⟨ W Q , t x t i , W K , t z ⟩ ∫ X μ t ( d z ) e β ⟨ W Q , t x t i , W K , t z ⟩ W V , t z = W T σ ( W A , t x t i + W b , t ) + ∑ l = 1 L e β ⟨ W Q , t x t i , W K , t x t l ⟩ ∑ j = 1 L e β ⟨ W Q , t x t i , W K , t x t j ⟩ W V , t x t j , k = x t + 1 i .
We define the measure flow map Φ : P ( X ) × U → P ( X ) \Phi:\mathcal{P}(\mathsf{X})\times\mathsf{U}\to\mathcal{P}(\mathsf{X}) Φ : P ( X ) × U → P ( X ) such that
Φ ( μ , U ) : = μ ∘ T μ , U − 1 (12) \Phi(\mu,U):=\mu\circ T_{\mu,U}^{-1} \tag*{(12)} Φ ( μ , U ) := μ ∘ T μ , U − 1 (12)
where T μ , U : X → X T_{\mu,U}:\mathsf{X}\to\mathsf{X} T μ , U : X → X is given by T μ , U ( x ) = f ( x , μ , U ) T_{\mu,U}(x)=f(x,\mu,U) T μ , U ( x ) = f ( x , μ , U ) for all x ∈ X x\in\mathsf{X} x ∈ X . A change-of-measures argument yields that Φ ( μ t , U ) = μ t + 1 \Phi(\mu_t,U)=\mu_{t+1} Φ ( μ t , U ) = μ t + 1 for all t ∈ T t\in\mathcal{T} t ∈ T and k ∈ K k\in\mathcal{K} k ∈ K . This shows that Φ \Phi Φ is indeed the right tool to describe measure-level Transformer dynamics. Under compactness assumptions that can be realizable via practical tools, Φ \Phi Φ is jointly continuous on its domain. Moreover, { μ t } t ∈ T \{\mu_t\}_{t\in\mathcal{T}} { μ t } t ∈ T defines a weak Feller Markov decision process, that is, the process { ( μ t , U t ) : t ∈ T } ∪ { μ T } \{(\mu_t,U_t):t\in\mathcal{T}\}\cup\{\mu_T\} {( μ t , U t ) : t ∈ T } ∪ { μ T } is controlled Markov chain with state space P ( X ) \mathcal{P}(\mathcal{X}) P ( X ) , action space U \mathcal{U} U , and with transition kernel
η ( ⋅ ∣ μ , U ) : = δ Φ ( μ , U ) ( ⋅ ) \eta(\cdot\mid\mu,U):=\delta_{\Phi(\mu,U)}(\cdot) η ( ⋅ ∣ μ , U ) := δ Φ ( μ , U ) ( ⋅ )
which satisfies: For any continuous and bounded c : P ( X ) → R c:\mathcal{P}(\mathcal{X})\to\mathbb{R} c : P ( X ) → R , the function
P ( X ) × U ∋ ( μ , U ) ↦ ∫ P ( X ) η ( d μ ′ ∣ μ , U ) c ( μ ′ ) \mathcal{P}(\mathcal{X})\times\mathcal{U}\ni(\mu,U)\mapsto\int_{\mathcal{P}(\mathcal{X})}\eta(\mathrm{d}\mu'\mid\mu,U)c(\mu') P ( X ) × U ∋ ( μ , U ) ↦ ∫ P ( X ) η ( d μ ′ ∣ μ , U ) c ( μ ′ )
is jointly continuous on P ( X ) × U \mathcal{P}(\mathcal{X})\times\mathcal{U} P ( X ) × U , where P ( X ) \mathcal{P}(\mathcal{X}) P ( X ) is given the weak∗ ^* ∗ -topology, metrized by the 2-Wasserstein loss
W 2 ( P , Q ) = inf π ∈ Π ( P , Q ) ∫ S × S ∥ x − y ∥ 2 2 π ( d x , d y ) (13) W_2(P,Q)=\inf_{\pi\in\Pi(P,Q)}\int_{\mathcal{S}\times\mathcal{S}}\lVert x-y\rVert_2^2\pi(\mathrm{d}x,\mathrm{d}y) \tag*{(13)} W 2 ( P , Q ) = π ∈ Π ( P , Q ) inf ∫ S × S ∥ x − y ∥ 2 2 π ( d x , d y ) (13)
where Π ( P , Q ) : = { ζ ∈ P ( S × S ) : ζ ( S × ⋅ ) = P ( ⋅ ) and ζ ( ⋅ × S ) = Q ( ⋅ ) } \Pi(P,Q):=\{\zeta\in\mathcal{P}(\mathcal{S}\times\mathcal{S}):\zeta(\mathcal{S}\times\cdot)=P(\cdot)\text{ and }\zeta(\cdot\times\mathcal{S})=Q(\cdot)\} Π ( P , Q ) := { ζ ∈ P ( S × S ) : ζ ( S × ⋅ ) = P ( ⋅ ) and ζ ( ⋅ × S ) = Q ( ⋅ )} .
Note that the Transformer dynamics define a deterministic Markov chain. The noise in Transformer training, or in general, neural network training is due to mini-batching process.
Data Set Construction
We generate K ~ \widetilde{K} K sequences of length L + 1 L+1 L + 1 from the quantized process { q s ( Y r ) } r ∈ Z + \{q^s(Y_r)\}_{r\in\mathbb{Z}_+} { q s ( Y r ) } r ∈ Z + . We split each sequence into a training pair by taking x k = ( x 1 , k , … , x L , k ) x^k=(x^{1,k},\ldots,x^{L,k}) x k = ( x 1 , k , … , x L , k ) as the first L L L elements of the sequence and y ~ k \widetilde{y}^k y k as the last element, for k ∈ K ~ = { 1 , … , K ~ } k\in\widetilde{\mathcal{K}}=\{1,\ldots,\widetilde{K}\} k ∈ K = { 1 , … , K } . We aggregate these prompts to an initial single state-labeled data set, given by
D ~ = { ( x k , y ~ k ) : k ∈ K ~ } ∈ ( Λ s L × Λ s ) K ~ \widetilde{D}=\{(x^k,\widetilde{y}^k):k\in\widetilde{\mathcal{K}}\}\in(\Lambda_s^L\times\Lambda_s)^{\widetilde{K}} D = {( x k , y k ) : k ∈ K } ∈ ( Λ s L × Λ s ) K
where x k x^k x k is the feature vector and y ~ k ∈ Λ s \widetilde{y}^k\in\Lambda_s y k ∈ Λ s is the target token embedding. The initial data set D ~ \widetilde{D} D has training pairs indexed by K ~ \widetilde{\mathcal{K}} K , with possibly some duplicate feature vectors, i.e., x j = x l x^j=x^l x j = x l for j ≠ l j\ne l j = l , and j , l ∈ K ~ j,l\in\widetilde{\mathcal{K}} j , l ∈ K .
We construct a new data set D D D from D ~ \widetilde{D} D with unique feature vectors and labels as probability measures instead of individual token embeddings. We index the unique feature vectors with K = { 1 , … , K } \mathcal{K}=\{1,\ldots,K\} K = { 1 , … , K } , picking one representative index from K ~ \widetilde{\mathcal{K}} K for each unique feature vector. For k ∈ K k\in\mathcal{K} k ∈ K , we define the empirical measure y k ∈ P ( Λ s ) y^k\in\mathcal{P}(\Lambda_s) y k ∈ P ( Λ s ) conditioned on x k x^k x k as
y k = ∑ l = 1 K ~ δ y ~ l 1 { x l = x k } ∑ l = 1 K ~ 1 { x l = x k } y^k=\frac{\sum_{l=1}^{\widetilde{K}}\delta_{\widetilde{y}^l}\mathbf{1}_{\{x^l=x^k\}}}{\sum_{l=1}^{\widetilde{K}}\mathbf{1}_{\{x^l=x^k\}}} y k = ∑ l = 1 K 1 { x l = x k } ∑ l = 1 K δ y l 1 { x l = x k }
Then D = { ( x k , y k ) : k ∈ K } ∈ ( Λ s L × P ( Λ s ) ) K D=\{(x^k,y^k):k\in\mathcal{K}\}\in(\Lambda_s^L\times\mathcal{P}(\Lambda_s))^K D = {( x k , y k ) : k ∈ K } ∈ ( Λ s L × P ( Λ s ) ) K has unique training samples x k x^k x k , with labels y k y^k y k as empirical probability measures. Note that the denominator is non-zero since it is the count of samples in D ~ \widetilde{D} D with feature vector x k x^k x k .
A distinction between this data set construction and that of most large language models (LLMs) is that here we exclude elements of generated process appearing after the target label before training at the data set level, whereas most current pre-trained LLMs use the technique of masking of Devlin et al. [13 ] during training, see [53 ] .
We then construct μ 0 k : = 1 L ∑ i = 1 L δ x i , k \mu_0^k := \frac{1}{L}\sum_{i=1}^{L}\delta_{x_{i,k}} μ 0 k := L 1 ∑ i = 1 L δ x i , k and push it through the time horizon via lifted Transformer dynamics Φ \Phi Φ for all k ∈ K : = { 1 , … , K } k \in\mathcal{K} := \{1,\ldots,K\} k ∈ K := { 1 , … , K } . We write { μ t k } T \{\mu_t^k\}_{\mathcal{T}} { μ t k } T for the resulting process. If we concatenate all of these processes over the data set, then we obtain another MDP with state process { μ t } t ∈ T = { ( μ t 1 , … , μ t K ) } t ∈ T \{\mu_t\}_{t\in\mathcal{T}} = \{(\mu_t^1,\ldots,\mu_t^K)\}_{t\in\mathcal{T}} { μ t } t ∈ T = {( μ t 1 , … , μ t K ) } t ∈ T for which the state space is P ( X ) K \mathcal{P}(\mathbb{X})^K P ( X ) K , the action space is U \mathbb{U} U and the transition kernel is
η K ( ⋅ ∣ μ t , U ) : = δ Φ ( μ t , U ) ( ⋅ ) , t ∈ T . (14) \eta^K(\cdot\mid\mu_t,U) := \delta_{\Phi(\mu_t,U)}(\cdot), \quad t \in\mathcal{T}. \tag*{(14)} η K ( ⋅ ∣ μ t , U ) := δ Φ ( μ t , U ) ( ⋅ ) , t ∈ T . (14)
This can be regarded as an ensemble control problem [31 ] .
The Loss Structure
Having defined the particle dynamics and the data set D D D , we now specify how to train the policy γ \gamma γ . The Transformer outputs an unembedding score vector E U x T , γ k , L ∈ R ∣ Λ s ∣ E_Ux_{T,\gamma}^{k,L} \in\mathbb{R}^{|\Lambda_s|} E U x T , γ k , L ∈ R ∣ Λ s ∣ for each prompt x k x^k x k . We convert this into a probability measure and penalize its distance from the empirical label y k ∈ P ( Λ s ) y^k \in\mathcal{P}(\Lambda_s) y k ∈ P ( Λ s ) .
We employ the softmax function to obtain probability distributions from our predicted unembedding scores. For a vector z ∈ R ∣ Λ s ∣ z \in\mathbb{R}^{|\Lambda_s|} z ∈ R ∣ Λ s ∣ , softmax : R ∣ Λ s ∣ → P ( Λ s ) \operatorname{softmax} : \mathbb{R}^{|\Lambda_s|} \to\mathcal{P}(\Lambda_s) softmax : R ∣ Λ s ∣ → P ( Λ s ) maps z z z onto the probability simplex as
softmax ( z ) = ( e z 1 ∑ j = 1 ∣ Λ s ∣ e z j , … , e z ∣ Λ s ∣ ∑ j = 1 ∣ Λ s ∣ e z j ) . \operatorname{softmax}(z) = \left(\frac{e^{z_1}}{\sum_{j=1}^{|\Lambda_s|}e^{z_j}},\ldots,\frac{e^{z_{|\Lambda_s|}}}{\sum_{j=1}^{|\Lambda_s|}e^{z_j}}\right). softmax ( z ) = ( ∑ j = 1 ∣ Λ s ∣ e z j e z 1 , … , ∑ j = 1 ∣ Λ s ∣ e z j e z ∣ Λ s ∣ ) .
This grants us softmax ( z ) j ∈ ( 0 , 1 ) \operatorname{softmax}(z)_j \in(0,1) softmax ( z ) j ∈ ( 0 , 1 ) and ∑ j = 1 ∣ Λ s ∣ softmax ( z ) j = 1 \sum_{j=1}^{|\Lambda_s|}\operatorname{softmax}(z)_j = 1 ∑ j = 1 ∣ Λ s ∣ softmax ( z ) j = 1 , providing us a valid probability measure in P ( S ) \mathcal{P}(S) P ( S ) . A useful property of softmax is shifting invariance, where softmax ( z ) = softmax ( z + c 1 ) \operatorname{softmax}(z) = \operatorname{softmax}(z+c\mathbf{1}) softmax ( z ) = softmax ( z + c 1 ) , for c ∈ R c \in\mathbb{R} c ∈ R applied component-wise to z z z .
We define ν k : = softmax ( E U x T , γ k , L ) ∈ P ( S ) \nu^k := \operatorname{softmax}(E_Ux_{T,\gamma}^{k,L}) \in\mathcal{P}(S) ν k := softmax ( E U x T , γ k , L ) ∈ P ( S ) , where x T , γ k , L ∈ X x_{T,\gamma}^{k,L} \in\mathbb{X} x T , γ k , L ∈ X is initialized at x 0 , γ k , L ∈ X x_{0,\gamma}^{k,L} \in\mathbb{X} x 0 , γ k , L ∈ X with its empirical measure μ 0 , γ k \mu_{0,\gamma}^k μ 0 , γ k evolving according to the pushforward Φ \Phi Φ with actions determined by a policy γ : P ( X ) K → U \gamma: \mathcal{P}(\mathbb{X})^K \to\mathbb{U} γ : P ( X ) K → U . We aim to find a policy γ ∈ Γ \gamma\in\Gamma γ ∈ Γ that minimizes the following loss structure.
Cross-Entropy loss is commonly used for machine learning classification tasks and autoregressive generative models [12 ] . It is well-suited for next-token prediction, which can be seen as classification over the entire vocabulary. For a true probability measure P 1 P_1 P 1 and a predicted measure P 2 P_2 P 2 in P ( Λ s ) \mathcal{P}(\Lambda_s) P ( Λ s ) , with P 2 P_2 P 2 being absolutely continuous with respect to some reference measure λ o \lambda_o λ o , the cross entropy is given by
CE ( P 1 , P 2 ) = E P 1 [ − log p 2 ( x ) ] = − ∫ Λ s P 1 ( d v ) log p 2 ( v ) \operatorname{CE}(P_1,P_2) = \mathbb{E}_{P_1}[-\log p_2(x)] = -\int_{\Lambda_s} P_1(\mathrm{d}v)\log p_2(v) CE ( P 1 , P 2 ) = E P 1 [ − log p 2 ( x )] = − ∫ Λ s P 1 ( d v ) log p 2 ( v )
where the density of P 2 P_2 P 2 , p 2 = d P 2 d λ o p_2 = \frac{\mathrm{d}P_2}{\mathrm{d}\lambda_o} p 2 = d λ o d P 2 , is given by the Radon-Nikodym derivative. The continuous case has undesirable properties, such as potentially negative entropy, so we use the following discrete case, which is applicable for next-token prediction over a finite vocabulary. For discrete P 1 , P 2 ∈ P ( Λ s ) P_1,P_2 \in\mathcal{P}(\Lambda_s) P 1 , P 2 ∈ P ( Λ s ) , the cross entropy is given by
CE ( P 1 , P 2 ) = − ∑ v ∈ Λ s P 1 ( v ) log P 2 ( v ) . \operatorname{CE}(P_1,P_2) = -\sum_{v\in\Lambda_s}P_1(v)\log P_2(v). CE ( P 1 , P 2 ) = − v ∈ Λ s ∑ P 1 ( v ) log P 2 ( v ) .
For our formulation, we sum the prompt-wise losses over the entire data set to get our final cross entropy loss functional V C E : ( Λ s L × P ( Λ s ) ) K × Γ → R V_{\mathrm{CE}} : (\Lambda_s^L \times\mathcal{P}(\Lambda_s))^K \times\Gamma\to\mathbb{R} V CE : ( Λ s L × P ( Λ s ) ) K × Γ → R given by
V C E ( D , γ ) = ∑ k = 1 K n k K ~ CE ( y k , ν k ) = − ∑ k = 1 K n k K ~ ∑ v ∈ Λ s y k ( v ) log ν k ( v ) (15) V_{\mathrm{CE}}(D,\gamma)=\sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}\operatorname{CE}(y^k,\nu^k)=-\sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}\sum_{v\in\Lambda_s}y^k(v)\log\nu^k(v) \tag*{(15)} V CE ( D , γ ) = k = 1 ∑ K K n k CE ( y k , ν k ) = − k = 1 ∑ K K n k v ∈ Λ s ∑ y k ( v ) log ν k ( v ) (15)
where n k = ∑ l = 1 K ~ χ X k ( x l ) n_k=\sum_{l=1}^{\widetilde{K}}\chi_{X_k}(x^l) n k = ∑ l = 1 K χ X k ( x l ) for all k = 1 , … , K k=1,\ldots,K k = 1 , … , K .
(15) is equivalent to the empirical risk of the original sample:
1 K ~ ∑ l = 1 K ~ − log ν ( y ~ l ∣ x l ) = ∑ k = 1 K n k K ~ ( 1 n k ∑ l = 1 x l = x k K ~ − log ν ( y ~ l ∣ x l ) ) = ∑ k = 1 K n k K ~ CE ( y k , ν k ) . \frac{1}{\widetilde{K}}\sum_{l=1}^{\widetilde{K}}-\log\nu(\widetilde{y}^l\mid x^l)=\sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}\left(\frac{1}{n_k}\sum_{\substack{l=1\\x^l=x^k}}^{\widetilde{K}}-\log\nu(\widetilde{y}^l\mid x^l)\right)=\sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}\operatorname{CE}(y^k,\nu^k). K 1 l = 1 ∑ K − log ν ( y l ∣ x l ) = k = 1 ∑ K K n k n k 1 l = 1 x l = x k ∑ K − log ν ( y l ∣ x l ) = k = 1 ∑ K K n k CE ( y k , ν k ) .
The cross entropy loss has no notion of the underlying geometry of the state space. It depends only on where p p p assigns the same probability mass as q q q , not the proximity of non-overlapping masses for p , q ∈ P ( X ) p,q\in\mathcal{P}(\mathsf{X}) p , q ∈ P ( X ) . This property is useful for vocabularies where the token geometry doesn’t reflect semantic information; adjacent tokens can have unrelated meanings.
We only compare the probability measure of the last position (p L = L ∈ P E L p_L=L\in\mathrm{PE}_L p L = L ∈ PE L ) in the output vectors to our label. This is also a trick used in practice in Transformer fine-tuning, where features and labels are separated in this way, see [39 Equation 3] .
Finite Model Approximations to Transformers
We select parameters l , m , n ∈ Z + l,m,n\in\mathbb{Z}_+ l , m , n ∈ Z + to quantize the above MDP into MDP ( l , m , n ) \operatorname{MDP}^{(l,m,n)} MDP ( l , m , n ) as follows: we quantize the values of the probability measure on the state space with l l l , the state space itself with n n n , and the action space with m m m . We quantize the token embedding space X \mathsf{X} X as X n \mathsf{X}_n X n . By the compactness of X \mathsf{X} X , there exist some M X ∈ R + M_{\mathsf{X}}\in\mathbb{R}_+ M X ∈ R + that tightly bounds all coordinates of points x = ( x 1 , x 2 , … , x d ) x=(x_1,x_2,\ldots,x_d) x = ( x 1 , x 2 , … , x d ) in the embedding space X ⊂ R d \mathsf{X}\subset\mathbb{R}^d X ⊂ R d , i.e.
M X : = max x ∈ X , j ∈ { 0 , … , d } ∥ x j ∥ . M_{\mathsf{X}}:=\max_{x\in\mathsf{X},j\in\{0,\ldots,d\}}\lVert x_j\rVert. M X := x ∈ X , j ∈ { 0 , … , d } max ∥ x j ∥ .
So X ⊂ [ − M X , M X ] d \mathsf{X}\subset[-M_{\mathsf{X}},M_{\mathsf{X}}]^d X ⊂ [ − M X , M X ] d . We place a grid X n \mathsf{X}_n X n of n d n^d n d many points uniformly over [ − M X , M X ] d [-M_{\mathsf{X}},M_{\mathsf{X}}]^d [ − M X , M X ] d with spacing 2 M X n − 1 \frac{2M_{\mathsf{X}}}{n-1} n − 1 2 M X , which is finite for n > 1 n>1 n > 1 . Then, given x ∈ X x\in\mathsf{X} x ∈ X , we can find some x ^ ∈ X n \hat{x}\in\mathsf{X}_n x ^ ∈ X n that satisfies
∥ x − x ^ ∥ ≤ 1 2 2 M X n − 1 d = M X d n − 1 . \lVert x-\hat{x}\rVert\leq\frac{1}{2}\frac{2M_{\mathsf{X}}}{n-1}\sqrt{d}=\frac{M_{\mathsf{X}}\sqrt{d}}{n-1}. ∥ x − x ^ ∥ ≤ 2 1 n − 1 2 M X d = n − 1 M X d .
where d \sqrt{d} d comes from taking the L2 norm in d d d dimensions. We can arrive at such a grid arrangement by taking
X n = { ( − M X + 2 M X k ^ 1 n − 1 , … , − M X + 2 M X k ^ d n − 1 ) : k ^ j ∈ { 0 , … , n − 1 } } . \mathsf{X}_n=\left\{\left(-M_{\mathsf{X}}+\frac{2M_{\mathsf{X}}\hat{k}_1}{n-1},\ldots,-M_{\mathsf{X}}+\frac{2M_{\mathsf{X}}\hat{k}_d}{n-1}\right):\hat{k}_j\in\{0,\ldots,n-1\}\right\}. X n = { ( − M X + n − 1 2 M X k ^ 1 , … , − M X + n − 1 2 M X k ^ d ) : k ^ j ∈ { 0 , … , n − 1 } } .
Quantizing X \mathsf{X} X in this way ensures that the number of points is always n d n^d n d which lends itself nicely for implementation.
We quantize the action space, imposing a grid on the entries of the parameter matrices. Due to the compactness of U \mathbb{U} U , there exists some M U < ∞ M_{\mathbb{U}} < \infty M U < ∞ that is the tightest bound for all elements of the weights ( W , A , b , Q , K , V , E E , E U ) (W,A,b,Q,K,V,E_E,E_U) ( W , A , b , Q , K , V , E E , E U ) of U ∈ U U \in\mathbb{U} U ∈ U , i.e.
M U : = max U ∈ U , θ ∈ U ; i , j ∣ θ i , j ∣ M_{\mathbb{U}} := \max_{U \in\mathbb{U},\theta\in U;i,j} |\theta_{i,j}| M U := U ∈ U , θ ∈ U ; i , j max ∣ θ i , j ∣
where θ i , j \theta_{i,j} θ i , j are matrix entries of θ \theta θ . Thus, − M U ≤ θ i , j ≤ M U -M_{\mathbb{U}} \le\theta_{i,j} \le M_{\mathbb{U}} − M U ≤ θ i , j ≤ M U , and we place m m m points uniformly over each parameter’s matrix entries with spacing 2 M U m − 1 \frac{2M_{\mathbb{U}}}{m-1} m − 1 2 M U , which is finite for m > 1 m > 1 m > 1 .
Then, given U = ( W W , W A , W b , W Q , W K , W V , E E , E U ) ∈ U U = (W_W,W_A,W_b,W_Q,W_K,W_V,E_E,E_U) \in\mathbb{U} U = ( W W , W A , W b , W Q , W K , W V , E E , E U ) ∈ U , we can find some U ^ = ( W ^ W , W ^ A , W ^ b , W ^ Q , W ^ K , W ^ V , E ^ E , E ^ U ) \widehat{U} = (\widehat{W}_W,\widehat{W}_A,\widehat{W}_b,\widehat{W}_Q,\widehat{W}_K,\widehat{W}_V,\widehat{E}_E,\widehat{E}_U) U = ( W W , W A , W b , W Q , W K , W V , E E , E U ) such that
∥ U − U ^ ∥ F ≤ 1 2 2 M U m − 1 ( d ⋅ d 1 + d 1 ⋅ d + d 1 + d 2 ⋅ d + d 2 ⋅ d + d ⋅ d + ∣ Λ s ∣ ⋅ d + d ⋅ ∣ Λ s ∣ ) = M U m − 1 ( 2 d ⋅ d 1 + d 1 + 2 d 2 ⋅ d + d + 2 ∣ Λ s ∣ ⋅ d ) . \begin{aligned}
\lVert U-\widehat{U}\rVert_F
&\le\frac{1}{2}\frac{2M_{\mathbb{U}}}{m-1}\left(\sqrt{d\cdot d_1}+\sqrt{d_1\cdot d}+\sqrt{d_1}+\sqrt{d_2\cdot d}+\sqrt{d_2\cdot d}\right.\\
&\qquad\left.+\sqrt{d\cdot d}+\sqrt{|\Lambda_s|\cdot d}+\sqrt{d\cdot|\Lambda_s|}\right)\\
&= \frac{M_{\mathbb{U}}}{m-1}\left(2\sqrt{d\cdot d_1}+\sqrt{d_1}+2\sqrt{d_2\cdot d}+d+2\sqrt{|\Lambda_s|\cdot d}\right).
\end{aligned} ∥ U − U ∥ F ≤ 2 1 m − 1 2 M U ( d ⋅ d 1 + d 1 ⋅ d + d 1 + d 2 ⋅ d + d 2 ⋅ d + d ⋅ d + ∣ Λ s ∣ ⋅ d + d ⋅ ∣ Λ s ∣ ) = m − 1 M U ( 2 d ⋅ d 1 + d 1 + 2 d 2 ⋅ d + d + 2 ∣ Λ s ∣ ⋅ d ) .
where the coefficient is determined from the dimensions of the parameter matrices and ∥ ⋅ ∥ F \lVert\cdot\rVert_F ∥ ⋅ ∥ F is the product-wise Frobenius norm (as squared):
∥ U ∥ F 2 = Tr ( W W T ) + Tr ( A A T ) + Tr ( b b T ) + Tr ( Q Q T ) + Tr ( K K T ) + Tr ( V V T ) + Tr ( E E E E T ) + Tr ( E U E U T ) . \begin{aligned}
\lVert U\rVert_F^2
&= \operatorname{Tr}(WW^T)+\operatorname{Tr}(AA^T)+\operatorname{Tr}(bb^T)\\
&\quad+\operatorname{Tr}(QQ^T)+\operatorname{Tr}(KK^T)+\operatorname{Tr}(VV^T)+\operatorname{Tr}(E_EE_E^T)+\operatorname{Tr}(E_UE_U^T).
\end{aligned} ∥ U ∥ F 2 = Tr ( W W T ) + Tr ( A A T ) + Tr ( b b T ) + Tr ( Q Q T ) + Tr ( K K T ) + Tr ( V V T ) + Tr ( E E E E T ) + Tr ( E U E U T ) .
Note that Transformers with T > 1 T > 1 T > 1 layers do not have actions containing both E E E_E E E and E U E_U E U ; however, we keep them here to provide an upper bound. A quantization that adheres to the above conditions can be obtained by taking
U m = { ( W ^ W , W ^ A , W ^ b , W ^ Q , W ^ K , W ^ V , E ^ E , E ^ U ) : θ i , j = − M U + 2 M U k ^ m m − 1 , θ ∈ { W ^ W , W ^ A , W ^ b , W ^ Q , W ^ K , W ^ V , E ^ E , E ^ U } , k ^ m ∈ { 0 , … , m − 1 } } . \mathbb{U}_m=\left\{(\widehat{W}_W,\widehat{W}_A,\widehat{W}_b,\widehat{W}_Q,\widehat{W}_K,\widehat{W}_V,\widehat{E}_E,\widehat{E}_U):\theta_{i,j}=-M_{\mathbb{U}}+\frac{2M_{\mathbb{U}}\widehat{k}_m}{m-1},\ \theta\in\{\widehat{W}_W,\widehat{W}_A,\widehat{W}_b,\widehat{W}_Q,\widehat{W}_K,\widehat{W}_V,\widehat{E}_E,\widehat{E}_U\},\ \widehat{k}_m\in\{0,\ldots,m-1\}\right\}. U m = { ( W W , W A , W b , W Q , W K , W V , E E , E U ) : θ i , j = − M U + m − 1 2 M U k m , θ ∈ { W W , W A , W b , W Q , W K , W V , E E , E U } , k m ∈ { 0 , … , m − 1 } } .
Finally, we quantize P ( X n ) \mathcal{P}(\mathbb{X}_n) P ( X n ) by taking the set of quantized probability measures on X n \mathbb{X}_n X n as
P l ( X n ) : = { ( p α ) α = 1 ∣ X n ∣ : p α ∈ 1 l − 1 { 0 , … , l − 1 } , ∑ α = 1 ∣ X n ∣ p α = 1 } . \mathcal{P}_l(\mathbb{X}_n):=\left\{(p_\alpha)_{\alpha=1}^{|\mathbb{X}_n|}:p_\alpha\in\frac{1}{l-1}\{0,\ldots,l-1\},\ \sum_{\alpha=1}^{|\mathbb{X}_n|}p_\alpha=1\right\}. P l ( X n ) := ⎩ ⎨ ⎧ ( p α ) α = 1 ∣ X n ∣ : p α ∈ l − 1 1 { 0 , … , l − 1 } , α = 1 ∑ ∣ X n ∣ p α = 1 ⎭ ⎬ ⎫ .
We define the quantizers Q n : X → X n Q_n:\mathbb{X}\to\mathbb{X}_n Q n : X → X n mapping x ∈ X x\in\mathbb{X} x ∈ X to the closest point in X n \mathbb{X}_n X n , and R l : P ( X n ) → P l ( X n ) R_l:\mathcal{P}(\mathbb{X}_n)\to\mathcal{P}_l(\mathbb{X}_n) R l : P ( X n ) → P l ( X n ) mapping μ ^ ∈ P ( X n ) \widehat{\mu}\in\mathcal{P}(\mathbb{X}_n) μ ∈ P ( X n ) to the closest element in P l ( X n ) \mathcal{P}_l(\mathbb{X}_n) P l ( X n ) using Reznik [41 ] ’s algorithm. Quantizing the spaces in this fashion ensures a deterministic grid that is straightforward for implementation while guaranteeing the same O ( 1 / n ) O(1/n) O ( 1/ n ) asymptotic error rate.
Figure 4. Two-stage State Quantization
Dynamic Programming Based Training
To guarantee that the quantized Transformer is trained optimally, we solve the finite state and action space MDP ( l , n , m ) \operatorname{MDP}^{(l,n,m)} MDP ( l , n , m ) exactly using backward dynamic programming rather than using gradient-based or other training schemes that lack such a guarantee. We define Φ ( n ) : P ( X n ) × U → P ( X n ) \Phi^{(n)} : \mathcal{P}(\mathbb{X}_n) \times\mathbb{U} \to\mathcal{P}(\mathbb{X}_n) Φ ( n ) : P ( X n ) × U → P ( X n ) as the pushforward on the quantized embedding space: Φ ( n ) ( μ ^ , U ) : = μ ^ ∘ T μ ^ , U − 1 \Phi^{(n)}(\hat{\mu},U) := \hat{\mu} \circ T^{-1}_{\hat{\mu},U} Φ ( n ) ( μ ^ , U ) := μ ^ ∘ T μ ^ , U − 1 , where T T T is the same as in the definition for Φ \Phi Φ , μ ^ ∈ P ( X n ) \hat{\mu} \in\mathcal{P}(\mathbb{X}_n) μ ^ ∈ P ( X n ) and U ∈ U U \in\mathbb{U} U ∈ U . The quantized deterministic ensemble pushforward Φ ( l , n , m ) \Phi^{(l,n,m)} Φ ( l , n , m ) maps P ( X n ) K × U m → P ( X n ) K \mathcal{P}(\mathbb{X}_n)^K \times\mathbb{U}_m \to\mathcal{P}(\mathbb{X}_n)^K P ( X n ) K × U m → P ( X n ) K by quantizing and applying the single-measure pushforward Φ ( n ) : P ( X n ) × U → P ( X n ) \Phi^{(n)} : \mathcal{P}(\mathbb{X}_n) \times\mathbb{U} \to\mathcal{P}(\mathbb{X}_n) Φ ( n ) : P ( X n ) × U → P ( X n ) point-wise and quantizing with R l R_l R l , that is, Φ ( l , n , m ) ( μ ^ , U ) : = ( R l ( Φ ( n ) ( μ ^ 1 , U ) ) , … , R l ( Φ ( n ) ( μ ^ K , U ) ) \Phi^{(l,n,m)}(\hat{\mu},U) := (R_l(\Phi^{(n)}(\hat{\mu}^1,U)), \ldots, R_l(\Phi^{(n)}(\hat{\mu}^K,U)) Φ ( l , n , m ) ( μ ^ , U ) := ( R l ( Φ ( n ) ( μ ^ 1 , U )) , … , R l ( Φ ( n ) ( μ ^ K , U )) . It induces the transition kernel η ( l , n , m ) : P ( X n ) × U m → P ( P ( X n ) ) \eta^{(l,n,m)} : \mathcal{P}(\mathbb{X}_n) \times\mathbb{U}_m \to\mathcal{P}(\mathcal{P}(\mathbb{X}_n)) η ( l , n , m ) : P ( X n ) × U m → P ( P ( X n )) . This characterizes MDP ( l , n , m ) \operatorname{MDP}^{(l,n,m)} MDP ( l , n , m ) with a state space P ( X n ) K \mathcal{P}(\mathbb{X}_n)^K P ( X n ) K , action space U m \mathbb{U}_m U m , transition kernel η ( l , n , m ) \eta^{(l,n,m)} η ( l , n , m ) and the discrete cross-entropy loss V C E V_{CE} V C E from 15.
Note that this structure leverages all our predictive information, but does not necessarily translate into model performance in the following case: taking a small l l l may artificially reduce the loss without improving performance due to coarseness.
For a given data set D D D , we pose the dynamic programming equations for MDP ( l , n , m ) \operatorname{MDP}^{(l,n,m)} MDP ( l , n , m ) as follows
L l , n , m , T ( μ ^ ) : = 1 K ∑ k = 1 K CE ^ ( μ ^ T k , N , y ^ k ) \mathcal{L}_{l,n,m,T}(\hat{\mu}) := \frac{1}{K}\sum_{k=1}^{K}\widehat{\operatorname{CE}}(\hat{\mu}^{k,N}_{T},\hat{y}^{k}) L l , n , m , T ( μ ^ ) := K 1 k = 1 ∑ K CE ( μ ^ T k , N , y ^ k )
L l , n , m , t ( μ ^ ) : = min U ∈ U m ∑ μ ^ t + 1 ∈ P ( l ) ( X n ) K η ( l , n , m ) ( μ ^ t + 1 ∣ μ ^ t , U ) L l , n , m , t + 1 ( μ ^ t + 1 ) = min U ∈ U m L l , n , m , t + 1 ( Φ ( l , n , m ) ( μ ^ , U ) ) (16) \begin{aligned}
\mathcal{L}_{l,n,m,t}(\hat{\mu}) := \min_{U\in\mathbb{U}_m}\sum_{\hat{\mu}_{t+1}\in\mathcal{P}^{(l)}(\mathbb{X}_n)^K}\eta^{(l,n,m)}(\hat{\mu}_{t+1}\mid\hat{\mu}_t,U)\mathcal{L}_{l,n,m,t+1}(\hat{\mu}_{t+1}) \\
&= \min_{U\in\mathbb{U}_m}\mathcal{L}_{l,n,m,t+1}\left(\Phi^{(l,n,m)}(\hat{\mu},U)\right) \tag*{(16)}
\end{aligned} L l , n , m , t ( μ ^ ) := U ∈ U m min μ ^ t + 1 ∈ P ( l ) ( X n ) K ∑ η ( l , n , m ) ( μ ^ t + 1 ∣ μ ^ t , U ) L l , n , m , t + 1 ( μ ^ t + 1 ) = U ∈ U m min L l , n , m , t + 1 ( Φ ( l , n , m ) ( μ ^ , U ) ) (16)
for all μ ^ = ( μ ^ 1 , … , μ ^ K ) ∈ P ( l ) ( X n ) K \hat{\mu}=(\hat{\mu}^{1},\ldots,\hat{\mu}^{K})\in\mathcal{P}^{(l)}(\mathbb{X}_n)^K μ ^ = ( μ ^ 1 , … , μ ^ K ) ∈ P ( l ) ( X n ) K and t ∈ T t\in\mathcal{T} t ∈ T . The last equality is due to the deterministic nature of Φ ( l , n , m ) \Phi^{(l,n,m)} Φ ( l , n , m ) . Following [3 Theorem 17] , it follows that, under the compactness of X \mathbb{X} X and U \mathbb{U} U , due to the weak continuity property of the constructed MDP, the quantized training procedure with the dynamic programming equations (16) is asymptotically globally optimal for the original problem as quantization gets finer, which then results in a near-optimal open-loop controls under fine enough quantization.
Construction of an Approximating Transformer
With the machinery of Section 2, we relax the next token prediction problem for observations generated by latent ergodic stochastic processes into a filtering problem with finite-window and quantized data. The question then becomes: Does there exist a Transformer that can realize such filter? The answer is affirmative and mostly expected since such predictive distribution is a lookup table. In this part, we give a step-by-step recipe for how to construct such Transformer.
Our construction in this section follows a strategy similar to the one used in Yun et al., [51 ] to show that fixed-width Transformers with positional encodings are universal approximators of continuous sequence-to-sequence functions on compact domains, see also Yun et al., [52 ] ; Geshkovski et al., [18 ] ; Jiang and Li, [23 ] ; Kajitsuka and Sato, [24 ] ; Wang et al., [49 ] ; Furuya et al., [16 ] . Their argument quantizes the input, computes a contextual mapping with attention layers (which is a distinct identifier for each quantized input), and maps identifiers to outputs with feed-forward layers. Our inputs are already quantized, the gatherer layers of § 6.1.2 compute and collect the contextual mapping at the readout token, and the ReLU network of § 6.1.3 performs the value mapping by interpolation.
Figure 5. Description of the Transformer built in this section.
Transformer Layers and Token Embeddings
Token Embeddings
Throughout this section, fix the window length M M M and the quantization level s s s . We fix an enumeration ι \iota ι of the 1 / s 1/s 1/ s -net Λ s \Lambda_s Λ s , meaning that ι : Λ s → { 1 , … , R ( s ) } \iota: \Lambda_s \to\{1,\ldots,R(s)\} ι : Λ s → { 1 , … , R ( s )} is a bijective map. Recall that R ( s ) R(s) R ( s ) is the cardinality of Λ s \Lambda_s Λ s . This makes each window w = ( w 1 , … , w M ) w = (w_1,\ldots,w_M) w = ( w 1 , … , w M ) an element of Λ s M \Lambda_s^M Λ s M , which has R ( s ) M R(s)^M R ( s ) M elements. We set the token embedding dimension to d = 2 M + R ( s ) + 1 d = 2M + R(s) + 1 d = 2 M + R ( s ) + 1 with the following decomposition in mind
d = M ⏟ positional + 1 ⏟ token value + M ⏟ gather + R ( s ) ⏟ logits . (17) d = \underbrace{M}_{\text{positional}} + \underbrace{1}_{\text{token value}} + \underbrace{M}_{\text{gather}} + \underbrace{R(s)}_{\text{logits}}. \tag*{(17)} d = positional M + token value 1 + gather M + logits R ( s ) . (17)
According to decomposition (17) , we split each token embedding into four parts: x = ( x p o s , x t o k , x g a t , x l o g ) ∈ R M × R 1 × R M × R R ( s ) = R d x = (x^{\mathrm{pos}}, x^{\mathrm{tok}}, x^{\mathrm{gat}}, x^{\mathrm{log}}) \in\mathbb{R}^{M} \times\mathbb{R}^{1} \times\mathbb{R}^{M} \times\mathbb{R}^{R(s)} = \mathbb{R}^{d} x = ( x pos , x tok , x gat , x log ) ∈ R M × R 1 × R M × R R ( s ) = R d . Let Π ∙ \Pi_{\bullet} Π ∙ be the coordinate projections from R d \mathbb{R}^{d} R d to ∙ \bullet ∙ space where ∙ ∈ { p o s , t o k , g a t , l o g } \bullet\in\{\mathrm{pos},\mathrm{tok},\mathrm{gat},\mathrm{log}\} ∙ ∈ { pos , tok , gat , log } . Lastly, { e i } i = 1 M \{e_i\}_{i=1}^{M} { e i } i = 1 M form the standard basis for R M \mathbb{R}^{M} R M , which we use for positional encodings and gathering tokens .
For any v ∈ Λ s v \in\Lambda_s v ∈ Λ s at position i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } , we define
E E ( v , p i ) : = ( e i , ι ( v ) , 0 M , 0 R ) ∈ R d (18) E_E(v,p_i) := (e_i,\iota(v),0_M,0_R) \in\mathbb{R}^{d} \tag*{(18)} E E ( v , p i ) := ( e i , ι ( v ) , 0 M , 0 R ) ∈ R d (18)
where 0 M 0_M 0 M and 0 R 0_R 0 R are the zero vectors of dimensions M M M and R ( s ) R(s) R ( s ) , respectively. The map E E E_E E E gives rise to an unembedding function satisfying the requirements of Assumption 15 since Π p o s \Pi_{\mathrm{pos}} Π pos recovers the positional encodings. Using the embedding operator, for any window w ∈ Λ s M w \in\Lambda_s^M w ∈ Λ s M , we define x 0 i , ( w ) = E E ( w i , p i ) x_0^{i,(w)} = E_E(w_i,p_i) x 0 i , ( w ) = E E ( w i , p i ) for all i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } and μ 0 ( w ) : = 1 M ∑ i = 1 M δ x 0 i , ( w ) \mu_0^{(w)} := \frac{1}{M}\sum_{i=1}^{M}\delta_{x_0^{i,(w)}} μ 0 ( w ) := M 1 ∑ i = 1 M δ x 0 i , ( w ) .
Gatherer Layers
Let us fix a bijection ρ : { 0 , … , M − 1 } → { 1 , … , M } \rho: \{0,\ldots,M-1\} \to\{1,\ldots,M\} ρ : { 0 , … , M − 1 } → { 1 , … , M } sending each layer to a position. We need it to copy the token at position ρ ( t ) \rho(t) ρ ( t ) into the gather coordinate of the readout token at each layer t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } . We form the first M M M layers as gatherer layers , which are responsible for collecting all the information in the window to the readout position at the M − 1 M-1 M − 1 th layer. As Transformers have feed-forward parts at each layer, we need to give role to them:
Lemma 16. Let σ \sigma σ be ReLU and assign
W A : = [ I d − I d ] W b : = 0 2 d W W : = [ I d − I d ] . W_A := \begin{bmatrix} I_d \\ -I_d \end{bmatrix}
\qquad
W_b := 0_{2d}
\qquad
W_W := \begin{bmatrix} I_d & -I_d \end{bmatrix}. W A := [ I d − I d ] W b := 0 2 d W W := [ I d − I d ] . Then, W W σ ( W A x + W b ) = x W_W\sigma(W_Ax + W_b) = x W W σ ( W A x + W b ) = x for all x ∈ R d x \in\mathbb{R}^{d} x ∈ R d .
We apply ( W W , W A , W b ) (W_W,W_A,W_b) ( W W , W A , W b ) in Lemma 16 for each gatherer layer, that is
( W W , t , W A , t , W b , t ) = ( W W , W A , W b ) (W_{W,t},W_{A,t},W_{b,t}) = (W_W,W_A,W_b) ( W W , t , W A , t , W b , t ) = ( W W , W A , W b )
for each t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } , where the right hand side as in Lemma 16. Consequently, layer-wise updates take the form
x t + 1 i = x t i + ∑ j = 1 M e β ⟨ W Q , t x t i , W K , t x t j ⟩ ∑ j ′ = 1 M e β ⟨ W Q , t x t i , W K , t x t j ′ ⟩ W V , t x t j (19) x_{t+1}^{i} = x_t^{i} + \sum_{j=1}^{M} \frac{e^{\beta\langle W_{Q,t}x_t^{i},W_{K,t}x_t^{j}\rangle}}{\sum_{j'=1}^{M}e^{\beta\langle W_{Q,t}x_t^{i},W_{K,t}x_t^{j'}\rangle}} W_{V,t}x_t^{j} \tag*{(19)} x t + 1 i = x t i + j = 1 ∑ M ∑ j ′ = 1 M e β ⟨ W Q , t x t i , W K , t x t j ′ ⟩ e β ⟨ W Q , t x t i , W K , t x t j ⟩ W V , t x t j (19)
for each i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } and t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } . We now specify the roles of the query, key and value matrices. For keys: W K , t = Π p o s W_{K,t} = \Pi_{\mathrm{pos}} W K , t = Π pos so that W K , t x t i = ( x t i ) p o s = e i W_{K,t}x_t^{i} = (x_t^{i})^{\mathrm{pos}} = e_i W K , t x t i = ( x t i ) pos = e i for all i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } and t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } . The task we assign to queries is a bit more specialized: For each t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } , let A t ∈ R M × M A_t \in\mathbb{R}^{M \times M} A t ∈ R M × M be a matrix defined on the standard basis { e i } i = 1 M \{e_i\}_{i=1}^{M} { e i } i = 1 M of R M \mathbb{R}^{M} R M , as described in § 6.1.1 , whose action is defined by
A t e M = e ρ ( t ) A t e i : = e i ( i ≠ M ) . A_t e_M = e_{\rho(t)} \qquad A_t e_i := e_i \ (i \ne M). A t e M = e ρ ( t ) A t e i := e i ( i = M ) .
Then we set W Q , t : = c A t Π p o s W_{Q,t} := cA_t\Pi_{\mathrm{pos}} W Q , t := c A t Π pos for some constant c > 0 c > 0 c > 0 satisfying
c = max 0 ≤ t ≤ M − 1 c ′ ∥ A t ∥ ≤ M U c ′ (20) c = \max_{\substack{0 \le t \le M-1 \\ c'\lVert A_t\rVert\le M_U}} c' \tag*{(20)} c = 0 ≤ t ≤ M − 1 c ′ ∥ A t ∥ ≤ M U max c ′ (20)
so that query matrix is admissible in U \mathbb{U} U . For the value matrices: Let
G j : = [ 0 M 0 e j 0 R ( s ) ] T Π t o k (21) G_j := \begin{bmatrix} 0_M & 0 & e_j & 0_{R(s)} \end{bmatrix}^{T}\Pi_{\mathrm{tok}} \tag*{(21)} G j := [ 0 M 0 e j 0 R ( s ) ] T Π tok (21)
for each j ∈ { 1 , … , M } j \in\{1,\ldots,M\} j ∈ { 1 , … , M } , which is a rank one matrix (since Π t o k \Pi_{\mathrm{tok}} Π tok projects onto a 1-dimensional space) reading the token-value coordinate and then writing it into the gather coordinate j j j . Then we set the value matrices W V , t : = G ρ ( t ) W_{V,t} := G_{\rho(t)} W V , t := G ρ ( t ) for each j ∈ { 1 , … , M } j \in\{1,\ldots,M\} j ∈ { 1 , … , M } .
To sum up, we separate the dynamics into two parts: the feed-forward layers are responsible for carrying the token value and the positional information across the layers. Since each token except the one at the readout position (i = M i=M i = M ) has null gatherers and logits, the feed-forward flow does not interfere with gatherer and logit positions. On the other hand, by construction of the self-attention layer, it is only concerned with writing the correct information to the gatherer positions of the readout token at each layer by a prescribed manner. Note that W V , t W_{V,t} W V , t reads the token information and writes it to the ρ ( t ) t h \rho(t)^{\mathrm{th}} ρ ( t ) th position of the M t h M^{\mathrm{th}} M th token. As a result, the self-attention layers do not change the positional and token values. Therefore, both layer types act as counterparts of each other. In short, the feed-forward layers carry the relevant information through the Transformer dynamics, while the self-attention layers use that information in a sequential manner. In the following, we make this high-level discussion rigorous.
Lemma 17. For all w ∈ Λ s M w \in\Lambda_s^M w ∈ Λ s M , i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } and t ∈ { 0 , … , M } t \in\{0,\ldots,M\} t ∈ { 0 , … , M } , we have
( x t i ) p o s = e i and ( x t i ) t o k = ι ( w i ) . (x_t^i)^{\mathrm{pos}} = e_i \qquad\text{and} \qquad(x_t^i)^{\mathrm{tok}} = \iota(w_i). ( x t i ) pos = e i and ( x t i ) tok = ι ( w i ) .
Because of Lemma 17 , the decomposition in (17) and choices of network weights are almost clear. To support, this design choice also makes the error propagation analysis simpler: The attention scores depend only on x p o s x^{\mathrm{pos}} x pos while the values are determined by x t o k x^{\mathrm{tok}} x tok in an exact way at each layer. Before proving the complete characterization of the self-attention block under our construction, we define a helper function
sel t ( i ) : = { ρ ( t ) , i = M , i , i ≠ M . \operatorname{sel}_t(i) :=
\begin{cases}
\rho(t), & i=M,\\
i, & i\ne M.
\end{cases} sel t ( i ) := { ρ ( t ) , i , i = M , i = M .
which is defined for all t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } and i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } .
Lemma 18. For every t ≤ M − 1 t \le M-1 t ≤ M − 1 and all i , j ∈ { 1 , … , M } i,j \in\{1,\ldots,M\} i , j ∈ { 1 , … , M } , we have
⟨ W Q , t x t i , W K , t x t j ⟩ = c χ j ( sel t ( i ) ) . \langle W_{Q,t}x_t^i, W_{K,t}x_t^j\rangle= c\chi_j(\operatorname{sel}_t(i)). ⟨ W Q , t x t i , W K , t x t j ⟩ = c χ j ( sel t ( i )) .
Hence,
a t isel ( i ) = e β c e β c + M − 1 and a t i j = 1 e β c + M − 1 ( j ≠ sel ( i ) ) , a_t^{\operatorname{isel}(i)} = \frac{e^{\beta c}}{e^{\beta c}+M-1}
\qquad\text{and}\qquad
a_t^{ij} = \frac{1}{e^{\beta c}+M-1}\quad(j\ne\operatorname{sel}(i)), a t isel ( i ) = e β c + M − 1 e β c and a t ij = e β c + M − 1 1 ( j = sel ( i )) ,
where a t i j a_t^{ij} a t ij ’s are exactly as in (30) and c c c is as in (20).
From Lemma 18, it is clear that we cannot recover the token information without any errors. Ideally, we want to read the token value from ρ ( t ) t h \rho(t)^{\mathrm{th}} ρ ( t ) th position and write it to the corresponding gatherer coordinate. However, the self-attention yields a weighted average of all tokens. The next lemma quantifies this error while providing computed attention scores across all particles.
Lemma 20. Let x ˉ t M \bar{x}^{M}_{t} x ˉ t M be the readout token under (hard) selection, that is x ˉ t + 1 M = x ˉ t M + G ρ ( t ) x ˉ t ρ ( t ) \bar{x}^{M}_{t+1}=\bar{x}^{M}_{t}+G_{\rho(t)}\bar{x}^{\rho(t)}_{t} x ˉ t + 1 M = x ˉ t M + G ρ ( t ) x ˉ t ρ ( t ) for all t ∈ { 0 , … , M − 1 } t\in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } with x ˉ 0 M = x 0 M \bar{x}^{M}_{0}=x^{M}_{0} x ˉ 0 M = x 0 M . Then, the final error between the hard choice and the soft choice1 is quantified as follows:
∥ x M M − x ˉ M M ∥ 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c . \left\|x^{M}_{M}-\bar{x}^{M}_{M}\right\|_{2}\le2M(M-1)R(s)e^{-\beta c}. x M M − x ˉ M M 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c . Moreover, x ˉ M M : = ( e M , ι ( w M ) , ( ι ( w 1 ) , … , ι ( w M ) ) , 0 R ) \bar{x}^{M}_{M}:=(e_{M},\iota(w_{M}),(\iota(w_{1}),\ldots,\iota(w_{M})),0_{\mathbb{R}}) x ˉ M M := ( e M , ι ( w M ) , ( ι ( w 1 ) , … , ι ( w M )) , 0 R ) .
Remaining part of our construction is based on distinguishability of different tokens parametrized by different initial windows, that is, if w ≠ w ′ ∈ Λ s M w\ne w'\in\Lambda^{M}_{s} w = w ′ ∈ Λ s M , then the resulting x ˉ M M , ( w ) \bar{x}^{M,(w)}_{M} x ˉ M M , ( w ) and x ˉ M M , ( w ′ ) \bar{x}^{M,(w')}_{M} x ˉ M M , ( w ′ ) should be identifiable to be distinct in the metric. This is crucial because, at the end, we want to map the readout tokens to probability distributions (thereby we get conditional probability distribution) without any loss of information. The next corollary is a simple result of Lemma 20’s second claim.
Corollary 21. The map Λ s M ∋ w ↦ x ˉ M M , ( w ) \Lambda^{M}_{s}\ni w\mapsto\bar{x}^{M,(w)}_{M} Λ s M ∋ w ↦ x ˉ M M , ( w ) is injective, and ∥ x ˉ M M , ( w ) − x ˉ M M , ( w ′ ) ∥ 2 ≥ 1 \left\|\bar{x}^{M,(w)}_{M}-\bar{x}^{M,(w')}_{M}\right\|_{2}\ge1 x ˉ M M , ( w ) − x ˉ M M , ( w ′ ) 2 ≥ 1 whenever w , w ′ ∈ Λ s M w,w'\in\Lambda^{M}_{s} w , w ′ ∈ Λ s M with w ≠ w ′ w\ne w' w = w ′ .
Proof If w ≠ w ′ w\ne w' w = w ′ , then they differ in at least one coordinate. Since ι \iota ι is an integer-valued enumeration of Λ s M \Lambda^{M}_{s} Λ s M , then ∣ ι ( w ) − ι ( w ′ ) ∣ ≥ 1 \lvert\iota(w)-\iota(w')\rvert\ge1 ∣ ι ( w ) − ι ( w ′ )∣ ≥ 1 , which transfers to ∥ x ˉ M M , ( w ) − x ˉ M M , ( w ′ ) ∥ 2 \left\|\bar{x}^{M,(w)}_{M}-\bar{x}^{M,(w')}_{M}\right\|_{2} x ˉ M M , ( w ) − x ˉ M M , ( w ′ ) 2 directly, also establishing injectivity.
Remark 22. The hard choice in Lemma 20 refers to choosing x ˉ t ρ ( t ) \bar{x}^{\rho(t)}_{t} x ˉ t ρ ( t ) directly without considering attention weights, whereas soft choice is done by choosing the one with the highest attention score. Implementation-wise, we use soft choice unless in an occurrence of an extreme case.
The Interpolator Layer
The machinery of § 6.1.2 collects all data in the window into the gather block in the decomposition (17). In this part, we show that it is possible to map the information in logits part to suitable conditional distributions. We achieve this task doing some ReLU calculus to obtain a single layer ReLU network applied to the readout tokens x M M x_M^M x M M and interpolate them into vectors in R R ( s ) \mathbb{R}^{R(s)} R R ( s ) .
Lemma 23. Let { ζ k } k = 1 n \{\zeta_k\}_{k=1}^n { ζ k } k = 1 n be distinct set of features in R d \mathbb{R}^d R d and { v k } k = 1 n \{v_k\}_{k=1}^n { v k } k = 1 n be arbitrary targets in R R ( s ) \mathbb{R}^{R(s)} R R ( s ) . There exists a one-layer ReLU network φ : R d → R R ( s ) \varphi:\mathbb{R}^d \to\mathbb{R}^{R(s)} φ : R d → R R ( s ) of width n − 1 n-1 n − 1 with φ ( ζ k ) = v k \varphi(\zeta_k)=v_k φ ( ζ k ) = v k for all k ∈ { 1 , … , n } k \in\{1,\ldots,n\} k ∈ { 1 , … , n } with Lipschitz constant L φ ∈ R + L_\varphi\in\mathbb{R}_+ L φ ∈ R + .
The proof of Lemma 23 chooses a generic a a a , on which the whole analysis is built. In the next result, we give an explicit choice for a a a and see its effect on the Lipschitz constant L φ L_\varphi L φ of the ReLU network.
Lemma 24. Take a = [ 0 M 0 ⟨ R ( s ) ⟩ M 0 R ] a=[0_M\ 0\ \langle R(s)\rangle_M\ 0_R] a = [ 0 M 0 ⟨ R ( s ) ⟩ M 0 R ] , where ⟨ R ( s ) ⟩ M = ( 1 , R ( s ) , R ( s ) 2 , … , R ( s ) M − 1 ) \langle R(s)\rangle_M=(1,R(s),R(s)^2,\ldots,R(s)^{M-1}) ⟨ R ( s ) ⟩ M = ( 1 , R ( s ) , R ( s ) 2 , … , R ( s ) M − 1 ) , in the proof of Lemma 23. Then the following assertions are true:
(i) ⟨ a , x ˉ M M , ( w ) ⟩ = ∑ j = 1 M ι ( w j ) R ( s ) j − 1 \langle a,\bar{x}^{M,(w)}_M\rangle=\sum_{j=1}^{M}\iota(w_j)R(s)^{j-1} ⟨ a , x ˉ M M , ( w ) ⟩ = ∑ j = 1 M ι ( w j ) R ( s ) j − 1 , ∥ a ∥ 2 ≤ R ( s ) M − 1 2 \lVert a\rVert_2\le R(s)^{M-\frac{1}{2}} ∥ a ∥ 2 ≤ R ( s ) M − 2 1 and t k + 1 − t k ≥ 1 t_{k+1}-t_k\ge1 t k + 1 − t k ≥ 1 for all k = 1 , … , R ( s ) − 1 k=1,\ldots,R(s)-1 k = 1 , … , R ( s ) − 1 .
(ii) Under Assumptions 3-(A2,4), with n = R ( s ) M n=R(s)^M n = R ( s ) M and targets v w = P ^ r M , s ( ⋅ ∣ w ) v_w=\widehat{P}^{M,s}_r(\cdot\mid w) v w = P r M , s ( ⋅ ∣ w ) in Lemma 23’s statement, we have
L φ ≤ 4 log 1 q min μ min s R ( s ) M ( R ( s ) M − 1 ) . L_\varphi\le4\log\frac{1}{q_{\min}\mu_{\min}^s}R(s)^M(R(s)^M-1). L φ ≤ 4 log q m i n μ m i n s 1 R ( s ) M ( R ( s ) M − 1 ) .
The Approximation Theorem
Now that we have established how we construct a candidate Transformer, all is left to complete the description with an error analysis, which constitutes the purpose of this subsection.
Theorem 25. For any ϵ ∈ ( 0 , 1 / 2 ] \epsilon\in(0,1/2] ϵ ∈ ( 0 , 1/2 ] , r ≥ M r\ge M r ≥ M and all
β ≥ 1 c ( log ( 4 M ( M − 1 ) R ( s ) ) + log L φ + log 1 ϵ ) , \beta\ge\frac{1}{c}\left(\log(4M(M-1)R(s))+\log L_\varphi+\log\frac{1}{\epsilon}\right), β ≥ c 1 ( log ( 4 M ( M − 1 ) R ( s )) + log L φ + log ϵ 1 ) , the Transformer described through § 6.1.1 –§ 6.1.3 satisfies:
(i) max w ∈ Λ s M ∥ P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ T V ≤ ϵ \max_{w\in\Lambda_s^M}\lVert\widehat{P}^{M,s}_r(\cdot\mid w)-T(\cdot\mid w)\rVert_{\mathrm{TV}}\le\epsilon max w ∈ Λ s M ∥ P r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ TV ≤ ϵ .
(ii) min v ∈ Λ s , w ∈ Λ s M T ( v ∣ w ) ≥ q min μ min s e − 2 ϵ \min_{v\in\Lambda_s,\ w\in\Lambda_s^M}T(v\mid w)\ge q_{\min}\mu_{\min}^s e^{-2\epsilon} min v ∈ Λ s , w ∈ Λ s M T ( v ∣ w ) ≥ q m i n μ m i n s e − 2 ϵ .
In this theorem, T ( ⋅ ∣ w ) T(\cdot\mid w) T ( ⋅ ∣ w ) denotes the readout distribution of the Transformer given input sequence w w w .
Main Results: Performance of Trained Transformers
In § 4 , we have studied the effect of memory in next-token prediction for observations of latent stationary ergodic and N t h N^{\mathrm{th}} N th order Markovian sources, with quantization aspects for implementable learning algorithms. Then, § 6 is devoted to construct a Transformer that can realize finite-memory quantized-data predictive distribution in Definition 2 .
In this section, we complete our theoretical excursion by deriving a complete error bound for Transformers trained to perform next-token prediction tasks by the dynamic programming based training scheme presented in § 5.5 building on Akman et al. [3 ] .
The final error bound consists of (i) optimization error due to training, (ii) filter stability bounds due to finite-memory, (iii) sample complexity bounds due to training, and (iv) insufficiency of architecture.
We need to prove some auxiliary results that lead us to the ultimate theorem. We commence with establishing some notation. Throughout this section, the Transformer has the architecture of § 6 : it reads prompts of length L = M L=M L = M , and it has T = M + 1 T=M+1 T = M + 1 layers, namely the M M M gatherer layers of § 6.1.2 followed by the interpolator layer of § 6.1.3 . Hence, an open-loop policy is a sequence γ = ( U 0 , … , U M ) ∈ U m M + 1 \gamma=(U_0,\ldots,U_M)\in\mathcal{U}_m^{M+1} γ = ( U 0 , … , U M ) ∈ U m M + 1 . For such γ \gamma γ and w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , we write T γ ( ⋅ ∣ w ) T^\gamma(\cdot\mid w) T γ ( ⋅ ∣ w ) for the readout distribution of the Transformer with weights given by γ \gamma γ and the input sequence w w w , run as MDP ( l , n , m ) \operatorname{MDP}^{(l,n,m)} MDP ( l , n , m ) of § 5.5 . That is, the state quantizer Q n Q_n Q n and the measure quantizer R l R_l R l act after every layer, and T γ ( ⋅ ∣ w ) = softmax ( E U x M + 1 M ) T^\gamma(\cdot\mid w)=\operatorname{softmax}(E_Ux_{M+1}^M) T γ ( ⋅ ∣ w ) = softmax ( E U x M + 1 M ) , where x M + 1 M x_{M+1}^M x M + 1 M is the token at position M M M after the last layer. Let γ ∗ \gamma^* γ ∗ be the optimal open-loop policy that is obtained via the optimal closed-loop policy given by the dynamic programming recursions (16). Since Φ ( l , n , m ) \Phi^{(l,n,m)} Φ ( l , n , m ) is deterministic, γ ∗ \gamma^* γ ∗ minimizes V C E ( D , ⋅ ) V_{\mathrm{CE}}(D,\cdot) V CE ( D , ⋅ ) over all open-loop policies in U m M + 1 \mathcal{U}_m^{M+1} U m M + 1 .
We also need to specify how the data set is sampled. Fix r ≥ M r\ge M r ≥ M . We assume that the K ~ \widetilde{K} K sequences of the data set construction in Appendix 3 are independent copies of ( q s ( Y r − M + 1 ) , … , q s ( Y r + 1 ) ) (q^s(Y_{r-M+1}),\ldots,q^s(Y_{r+1})) ( q s ( Y r − M + 1 ) , … , q s ( Y r + 1 )) . Equivalently, the training pairs ( x l , y ~ l ) (x^l,\widetilde{y}^l) ( x l , y l ) , l = 1 , … , K ~ l=1,\ldots,\widetilde{K} l = 1 , … , K , are independent copies of ( q M , s ( Y r − M + 1 : r ) , q s ( Y r + 1 ) ) (q^{M,s}(Y_{r-M+1:r}),q^s(Y_{r+1})) ( q M , s ( Y r − M + 1 : r ) , q s ( Y r + 1 )) . If { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + is stationary, the law of this pair does not depend on r r r . For each window w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , we write
p r ( w ) : = Pr ( q M , s ( Y r − M + 1 : r ) = w ) , n w : = ∑ l = 1 K ~ 1 { x l = w } , (22) p_r(w):=\Pr\left(q^{M,s}(Y_{r-M+1:r})=w\right),\qquad n_w:=\sum_{l=1}^{\widetilde{K}}\mathbf{1}_{\{x^l=w\}}, \tag*{(22)} p r ( w ) := Pr ( q M , s ( Y r − M + 1 : r ) = w ) , n w := l = 1 ∑ K 1 { x l = w } , (22)
and, whenever n w ≥ 1 n_w\ge1 n w ≥ 1 , y ~ w : = 1 n w ∑ l = 1 K ~ δ y ~ l 1 { x l = w } ∈ P ( Λ s ) \widetilde{y}^w:=\frac{1}{n_w}\sum_{l=1}^{\widetilde{K}}\delta_{\widetilde{y}^l}\mathbf{1}_{\{x^l=w\}}\in\mathcal{P}(\Lambda_s) y w := n w 1 ∑ l = 1 K δ y l 1 { x l = w } ∈ P ( Λ s ) . In words, p r p_r^{} p r is the law of a test window, n w n_w n w is the number of occurrences of w w w in the data set and y ~ w \widetilde{y}^w y w is the empirical distribution of its labels. If w = x k w=x^k w = x k , then n w = n k n_w=n_k n w = n k and y ~ w = y k \widetilde{y}^w=y^k y w = y k in the notation of Appendix 3.
Finally, the Transformer of § 6 has to be representable on the grids of § 5.4 . To this end, we take X = [ − M X , M X ] d \mathsf{X}=[-M_{\mathsf{X}},M_{\mathsf{X}}]^d X = [ − M X , M X ] d and let U \mathsf{U} U be the set of weights whose entries lie in [ − M U , M U ] [-M_{\mathsf{U}},M_{\mathsf{U}}] [ − M U , M U ] , where M X , M U ∈ N M_{\mathsf{X}},M_{\mathsf{U}}\in\mathbb{N} M X , M U ∈ N satisfy
M X ≥ max { R ( s ) , 1 + log 1 q min μ min s } and M U ≥ max { 2 R ( s ) M , 2 log 1 q min μ min s } . (23) M_{\mathsf{X}}\ge\max\left\{R(s),1+\log\frac{1}{q_{\min}\mu_{\min}^s}\right\}
\qquad\text{and}\qquad
M_{\mathsf{U}}\ge\max\left\{2R(s)^M,2\log\frac{1}{q_{\min}\mu_{\min}^s}\right\}. \tag*{(23)} M X ≥ max { R ( s ) , 1 + log q m i n μ m i n s 1 } and M U ≥ max { 2 R ( s ) M , 2 log q m i n μ m i n s 1 } . (23)
The first condition keeps the positional encodings, the token values, the gather coordinates and the logits of the readout token inside [ − M X , M X ] [-M_X, M_X] [ − M X , M X ] . The second one makes the weights of the interpolator layer admissible; see the proof of Lemma 35.
The cross-entropy loss can be decomposed into two parts:
CE ( P 1 , P 2 ) = H ( P 1 ) + D K L ( P 1 ∥ P 2 ) \operatorname{CE}(P_1,P_2) = H(P_1) + D_{\mathrm{KL}}(P_1 \mathbin\Vert P_2) CE ( P 1 , P 2 ) = H ( P 1 ) + D KL ( P 1 ∥ P 2 )
for two probability measures P 1 , P 2 ∈ P ( Λ s ) P_1,P_2 \in\mathcal{P}(\Lambda_s) P 1 , P 2 ∈ P ( Λ s ) , where H ( P 1 ) : = − ∑ v ∈ Λ s P 1 ( v ) log P 1 ( v ) H(P_1) := -\sum_{v\in\Lambda_s} P_1(v)\log P_1(v) H ( P 1 ) := − ∑ v ∈ Λ s P 1 ( v ) log P 1 ( v ) is the Shannon entropy. Therefore, unless the true distribution, in this case P 1 P_1 P 1 , is deterministic (a Dirac mass), CE ( P 1 , P 2 ) > 0 \operatorname{CE}(P_1,P_2)>0 CE ( P 1 , P 2 ) > 0 . However P 1 P_1 P 1 is often modeled as a non-deterministic distribution. For this reason, we want to get rid of the entropy term, and define the excess loss
E ( γ ) : = V C E ( D , γ ) − ∑ k = 1 K n k K ~ H ( y k ) = ∑ k = 1 K n k K ~ D K L ( y k ∥ T γ ( ⋅ ∣ x k ) ) , \mathcal{E}(\gamma) := V_{\mathrm{CE}}(D,\gamma) - \sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}H(y^k) = \sum_{k=1}^{K}\frac{n_k}{\widetilde{K}}D_{\mathrm{KL}}\left(y^k \mathbin\Vert T^\gamma(\cdot\mid x^k)\right), E ( γ ) := V CE ( D , γ ) − k = 1 ∑ K K n k H ( y k ) = k = 1 ∑ K K n k D KL ( y k ∥ T γ ( ⋅ ∣ x k ) ) ,
where γ ∈ U m M + 1 \gamma\in\mathcal{U}^{M+1}_m γ ∈ U m M + 1 is an open-loop policy. E \mathcal{E} E is always a nonnegative quantity due to the aforementioned decomposition of the cross-entropy loss. Since we do not consider any other data set, we also do not explicitly write the data set dependency for a simpler notation. Note that the optimization task is not changed since the data set is not changed: For fixed data set D D D , E \mathcal{E} E is an affine transformation of V C E ( D , ⋅ ) V_{\mathrm{CE}}(D,\cdot) V CE ( D , ⋅ ) . Therefore, any minimizer of E \mathcal{E} E is a minimizer of V C E ( D , ⋅ ) V_{\mathrm{CE}}(D,\cdot) V CE ( D , ⋅ ) and vice versa. In particular, γ ∗ \gamma^* γ ∗ minimizes E \mathcal{E} E over U m M + 1 \mathcal{U}^{M+1}_m U m M + 1 .
The Unified Bound for Stationary Ergodic Sources
Theorem 26. Suppose Assumptions 3 and 6 hold. Let Y 1 , Y 2 , … Y_1,Y_2,\ldots Y 1 , Y 2 , … be a single trajectory of the source, and let U K ~ ∗ U^*_{\widetilde{K}} U K ∗ be an open-loop policy returned by (16) for the training pairs ( q M , s ( Y j : j + M − 1 ) , q s ( Y j + M ) ) (q^{M,s}(Y_{j:j+M-1}),q^s(Y_{j+M})) ( q M , s ( Y j : j + M − 1 ) , q s ( Y j + M )) , j = 1 , … , K ~ j=1,\ldots,\widetilde{K} j = 1 , … , K . Let the test sequence Y 0 : r Y_{0:r} Y 0 : r be independent of this trajectory. Then, almost surely,
lim sup M → ∞ lim sup s → ∞ lim sup ( n , m , β ) → ∞ lim sup K ~ → ∞ sup r ≥ M E Y 0 : r ∥ P r − Ξ s ( T U K ~ ∗ ( ⋅ ∣ q M , s ( Y r − M + 1 : r ) ) ) ∥ T V = 0. \limsup_{M\to\infty}\limsup_{s\to\infty}\limsup_{(n,m,\beta)\to\infty}\limsup_{\widetilde{K}\to\infty}\sup_{r\ge M}\mathbb{E}_{Y_{0:r}}\left\lVert P_r-\Xi_s\left(T^{U^*_{\widetilde{K}}}\left(\cdot\mid q^{M,s}(Y_{r-M+1:r})\right)\right)\right\rVert_{\mathrm{TV}}=0. M → ∞ lim sup s → ∞ lim sup ( n , m , β ) → ∞ lim sup K → ∞ lim sup r ≥ M sup E Y 0 : r P r − Ξ s ( T U K ∗ ( ⋅ ∣ q M , s ( Y r − M + 1 : r ) ) ) TV = 0.
The Unified Bound for Markovian Sources
Theorem 27. Suppose that Assumption 3 holds. Let r ≥ M ≥ N r\ge M\ge N r ≥ M ≥ N , let s ∈ N s\in\mathbb{N} s ∈ N with R ( s ) ≥ 2 R(s)\ge2 R ( s ) ≥ 2 , let δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) , and let the data set be sampled as above with
K ~ ≥ 8 ( q min μ min s ) − M ( M log R ( s ) + log 3 δ ) . \widetilde{K}\ge8(q_{\min}\mu_{\min}^{s})^{-M}\left(M\log R(s)+\log\frac{3}{\delta}\right). K ≥ 8 ( q m i n μ m i n s ) − M ( M log R ( s ) + log δ 3 ) .
Let ( n , m , l ) ∈ N 3 (n,m,l)\in\mathbb{N}^3 ( n , m , l ) ∈ N 3 be aligning quantization levels (Definition 32), let M X M_X M X and M U M_U M U satisfy (23) , and let β > 0 \beta>0 β > 0 be such that η ( n , m , β ) ≤ 1 \eta(n,m,\beta)\le1 η ( n , m , β ) ≤ 1 , where
η ( n , m , β ) : = 2 L φ M ( M − 1 ) R ( s ) e − β c + ( 1 + L φ M d ) M X n − 1 + M X d R ( s ) 3 M − 1 2 M U d s m − 1 . (24) \eta(n,m,\beta):=2L_{\varphi}M(M-1)R(s)e^{-\beta c}+(1+L_{\varphi}M\sqrt{d})\frac{M_X}{n-1}+M_X\sqrt{d}R(s)^{\frac{3M-1}{2}}\frac{M_Ud_s}{m-1}. \tag*{(24)} η ( n , m , β ) := 2 L φ M ( M − 1 ) R ( s ) e − β c + ( 1 + L φ M d ) n − 1 M X + M X d R ( s ) 2 3 M − 1 m − 1 M U d s . (24)
*Here, L φ L_{\varphi} L φ is the Lipschitz constant of the interpolator layer (Lemmata 23 and 24 ), c = M U c=M_U c = M U as in Definition 32-(ii), d = 2 M + R ( s ) + 1 d=2M+R(s)+1 d = 2 M + R ( s ) + 1 is the embedding dimension in (17) and d s : = d_s:= d s := R ( s ) M + 1 2 R(s)^{\frac{M+1}{2}} R ( s ) 2 M + 1 . Then, with probability at least 1 − δ 1-\delta 1 − δ over the data set,
E Y 0 : r ∥ P r − Ξ s ( T γ ∗ ( ⋅ ∣ q M , s ( Y r − M + 1 : r ) ) ) ∥ T V ≤ α ⌊ M / N ⌋ + ( 1 + 2 M q min ) L ψ s + ( 1 + 2 ) R ( s ) M C δ q min μ min s K ~ + η ( n , m , β ) 2 , (25) \mathbb{E}_{Y_{0:r}}\left\|P_r-\Xi_s\left(T^{\gamma*}\left(\cdot\mid q^{M,s}(Y_{r-M+1:r})\right)\right)\right\|_{\mathrm{TV}}
\le\alpha^{\lfloor M/N\rfloor}+\left(1+\frac{2M}{q_{\min}}\right)\frac{L_\psi}{s}+(1+\sqrt{2})\sqrt{\frac{R(s)^M C_\delta}{q_{\min}\mu_{\min}^s\widetilde{K}}}+\frac{\eta(n,m,\beta)}{\sqrt{2}}, \tag*{(25)} E Y 0 : r P r − Ξ s ( T γ ∗ ( ⋅ ∣ q M , s ( Y r − M + 1 : r ) ) ) TV ≤ α ⌊ M / N ⌋ + ( 1 + q m i n 2 M ) s L ψ + ( 1 + 2 ) q m i n μ m i n s K R ( s ) M C δ + 2 η ( n , m , β ) , (25)
where Y 0 : r Y_{0:r} Y 0 : r is independent of the data set, C δ : = R ( s ) log 2 + M log R ( s ) + log ( 3 / δ ) C_\delta:=R(s)\log2+M\log R(s)+\log(3/\delta) C δ := R ( s ) log 2 + M log R ( s ) + log ( 3/ δ ) , and α = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) \alpha=(1-\delta(\mathsf{T}))(2-\delta(\mathsf{Q})) α = ( 1 − δ ( T )) ( 2 − δ ( Q )) is as in Proposition 10 .
Asymptotic Performance under Filter Stability and Weak Feller Continuity
Theorem 27 is quantitative in its nature. If one only asks that the error vanish as M M M , s s s , ( n , m , β ) (n,m,\beta) ( n , m , β ) and K ~ \widetilde{K} K grow, then neither geometric filter stability (α < 1 \alpha<1 α < 1 ) nor the Lipschitz condition (Assumption 3-(A2)) is needed, and two changes in the proof suffice.
On memory. Let ν ^ \widehat{\nu} ν be the uniform distribution on S S S , let π ^ n λ \widehat{\pi}_n^\lambda π n λ denote the filter started from Z 0 ∼ λ Z_0\sim\lambda Z 0 ∼ λ , and set ε n f s : = sup λ ∈ P ( S ) E λ ∥ π ^ n λ − π ^ n ν ^ ∥ T V \varepsilon_n^{\mathrm{fs}}:=\sup_{\lambda\in\mathcal{P}(S)}\mathbb{E}^{\lambda}\|\widehat{\pi}_n^\lambda-\widehat{\pi}_n^{\widehat{\nu}}\|_{\mathrm{TV}} ε n fs := sup λ ∈ P ( S ) E λ ∥ π n λ − π n ν ∥ TV . Conditioning on Y 0 : r − M Y_{0:r-M} Y 0 : r − M as in the proof of Proposition 2.9 gives sup r ≥ M E ∥ P r − P r M ∥ T V ≤ 2 ε M − 1 f s \sup_{r\ge M}\mathbb{E}\|P_r-P_r^M\|_{\mathrm{TV}}\le2\varepsilon_{M-1}^{\mathrm{fs}} sup r ≥ M E ∥ P r − P r M ∥ TV ≤ 2 ε M − 1 fs , without assuming stationarity.
Under (A1), ε n f s → 0 \varepsilon_n^{\mathrm{fs}}\to0 ε n fs → 0 whenever the filter is stable in total variation in expectation for every prior (McDonald and Yüksel, [34 ] , Definition I.5(iii)). Indeed, since D ( λ ∥ ν ^ ) ≤ log ∣ S ∣ D(\lambda\|\widehat{\nu})\le\log|S| D ( λ ∥ ν ) ≤ log ∣ S ∣ , Theorem II.20 of McDonald and Yüksel [34 ] upgrades this to stability in relative entropy. The expected relative entropy is non-increasing in n n n and continuous in λ \lambda λ , so Dini’s theorem on the compact simplex P ( S ) \mathcal{P}(S) P ( S ) makes the convergence uniform, and Pinsker’s inequality returns to total variation.
By Theorems II.7 and II.19 of McDonald and Yüksel [34 ] , such stability holds whenever the model is observable in their sense (which in turn builds on Handel [22 ] ). For finite S S S , this means that the laws Pr ( Y 1 : N ∈ ⋅ ∣ Z 1 = z ) \Pr(Y_{1:N}\in\cdot\mid Z_1=z) Pr ( Y 1 : N ∈ ⋅ ∣ Z 1 = z ) , z ∈ S z\in S z ∈ S , are linearly independent for some N N N ; linearly independent observation densities suffice. As an additional remark, N N N th-order sources the sliding lift can be used here, since no contraction coefficient is involved.
On quantization. If Assumption 3-(A2) is replaced by continuity of ψ ( ⋅ ∣ z ) \psi(\cdot\mid z) ψ ( ⋅ ∣ z ) with modulus ω ψ \omega_\psi ω ψ , the arguments of Proposition 5 and Lemma 28 hold with 2 L ψ / s 2L_\psi/s 2 L ψ / s replaced by ω ψ ( 2 / s ) \omega_\psi(2/s) ω ψ ( 2/ s ) . Consequently, under Assumptions 3-(A1,A3), the bound of Theorem 27 holds with α ⌊ M / N ⌋ \alpha^{\lfloor M/N\rfloor} α ⌊ M / N ⌋ and ( 1 + 2 M / q min ) L ψ / s (1+2M/q_{\min})L_\psi/s ( 1 + 2 M / q m i n ) L ψ / s replaced by 2 ε M − 1 f s 2\varepsilon_{M-1}^{\mathrm{fs}} 2 ε M − 1 fs and ( 1 2 + M / q min ) ω ψ ( 2 / s ) (\frac{1}{2}+M/q_{\min})\omega_\psi(2/s) ( 2 1 + M / q m i n ) ω ψ ( 2/ s ) , respectively. This bound is uniform in r r r and vanishes in the iterated limit.
This covers cases outside the scope of Theorem 27. A deterministic cyclic transition kernel has δ ( κ ) = 0 \delta(\kappa)=0 δ ( κ ) = 0 , hence α ≥ 1 \alpha\ge1 α ≥ 1 . Yet the observation matrices θ k J + ( 1 − θ ) A \frac{\theta}{k}J+(1-\theta)A k θ J + ( 1 − θ ) A —see §6.2.1—are invertible for every θ < 1 \theta<1 θ < 1 , so the model is observable for all 0 < θ < 1 0<\theta<1 0 < θ < 1 . Finally, since S S S is finite, the weak Feller-type conditions in McDonald and Yüksel [34 ] hold automatically, so continuity is needed only in the observation variable.
Numerical Experiments
For the following trials, unless stated otherwise, we use T = 2 T=2 T = 2 layers, l = 9 l=9 l = 9 probability quantization levels, n = 5 n=5 n = 5 state space quantization levels ranging from − 2.5 -2.5 − 2.5 to 2.5 2.5 2.5 , attention temperature β = 0.3 \beta= 0.3 β = 0.3 , N = 1 N = 1 N = 1 , L = 2 L = 2 L = 2 with K ~ = 400 \widetilde{K} = 400 K = 400 training samples. We use m = 5 m = 5 m = 5 action quantization levels, ranging entries in W W W , A A A , b b b , Q Q Q , V V V from − 2.5 -2.5 − 2.5 to 2.5 2.5 2.5 , keeping K = I K = I K = I as done by Geshkovski et al. [19 ] , since we are using scalars in R \mathbb{R} R where Q Q Q absorbs K K K by commutativity. We take E E = I E_E = I E E = I and E U = e U ⋅ I E_U = e_U \cdot I E U = e U ⋅ I for a trainable parameter e U e_U e U . This ensures that Assumption 15 holds and allows us to vary the divergence of the predictive distribution via e U e_U e U to approximate the empirical distribution. We therefore have m 6 m^6 m 6 trainable parameters per layer. We use cross-entropy with a floor of ε = 10 − 3 \varepsilon= 10^{-3} ε = 1 0 − 3 to cap the maximum prompt-wise loss at − log ( ε ) ≈ 6.91 -\log(\varepsilon) \approx6.91 − log ( ε ) ≈ 6.91 nats, to avoid taking log ( 0 ) \log(0) log ( 0 ) . First, we test the effect of memory on prediction by varying the observation channel noise, which affects the decay rate of Δ M \Delta_M Δ M . For the stability tests, we run three trials: varying the sources mixing rate α = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) \alpha= (1-\delta(T))(2-\delta(Q)) α = ( 1 − δ ( T )) ( 2 − δ ( Q )) by sweeping T T T , Q Q Q values, varying the granularity of the action space via n n n , and varying the granularity of the state space via m m m .
Memory of data in Transformer training
We conduct three trials with varying Markov characteristics of the input-generating processes by setting a garbling rate ξ = 0 , 0.5 , 1 \xi= 0, 0.5, 1 ξ = 0 , 0.5 , 1 .
For each trial, we test the model on a distinct data set from the training data set, with the same number of data points and quantization levels. The testing data generation uses the same transition kernel as the training data, which the model is expected to learn. We plot the last index input (before), predicted (after) and label states on the y y y -axis for each input state on the x x x -axis, which can be seen in the top row of Figure 6. Note that the x x x -axis has fewer than K ~ = 98 \widetilde{K} = 98 K = 98 ticks in all cases when we combine identical input labels by converting state labels into distribution labels. We also plot the difference between the label state and the last index input state (before), and the label state and the predicted state (after), which can be seen in the bottom row of Figure 6.
Figure 6.
Figure 6 (PDF p. 30). The first group shows the value of the input, prediction, and the label. The second group illustrates the losses calculated from discrepancy between the predicted states and the labels.
Final loss decreases as the source becomes more Markovian. However, the variation between the initial data set losses show that the difference between the original loss and the final loss is highest (even increases after training) in the completely non-Markovian case, but remains relatively unchanging between the partially non-Markovian and completely Markovian case.
Figure 7. The radius of the label circle corresponds to occurrences in the distribution
Filtering via Transformers Trained with Optimal Control
Effect of mixing rate
Our goal is to control the Markovianness of our generated input sequence { Y t } t = 0 K ~ \{Y_t\}_{t=0}^{\tilde{K}} { Y t } t = 0 K ~ via α \alpha α described by McDonald and Yüksel [33 ] . α = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) \alpha= (1-\delta(T))(2-\delta(Q)) α = ( 1 − δ ( T )) ( 2 − δ ( Q )) signifies the rate of agreement between two posterior estimates beginning at different starting state distributions given observations Y [ 0 , t ] Y_{[0,t]} Y [ 0 , t ] , where α ≈ 1 \alpha\approx1 α ≈ 1 has slow or no convergence and α ≪ 1 \alpha\ll1 α ≪ 1 has fast convergence to a single estimate.
We hand-pick matrices for transition and measure kernels T T T and Q Q Q on finite spaces to obtain the desired Dobrushin coefficients δ ( T ) \delta(T) δ ( T ) and δ ( Q ) \delta(Q) δ ( Q ) , determining α \alpha α . We took T , Q ∈ R 3 × 3 T,Q \in\mathbb{R}^{3 \times3} T , Q ∈ R 3 × 3 , mapping between n = 3 n=3 n = 3 quantized states. Several examples for T T T are shown below:
δ ( ( 0 1 0 0 0 1 1 0 0 ) ) = 0 , δ ( ( 1 6 2 3 1 6 1 6 1 6 2 3 2 3 1 6 1 6 ) ) = 1 2 , δ ( ( 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 ) ) = 1 \delta\left(\begin{pmatrix}0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0\end{pmatrix}\right)=0,\qquad
\delta\left(\begin{pmatrix}\frac{1}{6} & \frac{2}{3} & \frac{1}{6} \\ \frac{1}{6} & \frac{1}{6} & \frac{2}{3} \\ \frac{2}{3} & \frac{1}{6} & \frac{1}{6}\end{pmatrix}\right)=\frac{1}{2},\qquad
\delta\left(\begin{pmatrix}\frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3}\end{pmatrix}\right)=1 δ 0 0 1 1 0 0 0 1 0 = 0 , δ 6 1 6 1 3 2 3 2 6 1 6 1 6 1 3 2 6 1 = 2 1 , δ 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 = 1
with the matrices used for different Dobrushin coefficients δ ( T ) \delta(T) δ ( T ) following a similar pattern of uniformly distributing mass outside the single-step transition matrix, which is shown above on the left. We construct the Q Q Q matrix entry values to obtain the desired Dobrushin coefficients δ ( Q ) \delta(Q) δ ( Q ) with a similar matrix pattern but different row ordering.
This setup allows us to vary δ ( T ) \delta(T) δ ( T ) and δ ( Q ) \delta(Q) δ ( Q ) independently by selecting the corresponding matrix to observe the independent effect of the transition and observation kernel on the Transformer’s performance. We test six different values for each δ ( T ) , δ ( Q ) \delta(T),\delta(Q) δ ( T ) , δ ( Q ) , for 36 total trials.
We generate an input sequence by taking observation Y t ∼ Q δ X t Y_t \sim Q\delta_{X_t} Y t ∼ Q δ X t of the underlying Markov process ( X t ) t = 0 K ~ (X_t)_{t=0}^{\tilde{K}} ( X t ) t = 0 K ~ , beginning at X 0 X_0 X 0 and evolving as X t + 1 ∼ T δ X t X_{t+1} \sim T\delta_{X_t} X t + 1 ∼ T δ X t . The numerical experiment ran for 90 hours. Each training set was comprised of K ~ = 98 \tilde{K}=98 K ~ = 98 (prompt, label) pairs. The sweep varied the transition and observation kernel independently over the irregularly spaced Dobrushin coefficient set { 0 , 1 6 , 1 3 , 1 2 , 2 3 , 1 } \{0,\frac{1}{6},\frac{1}{3},\frac{1}{2},\frac{2}{3},1\} { 0 , 6 1 , 3 1 , 2 1 , 3 2 , 1 } selected to show interesting behaviour at small Dobrushin coefficients. The matrices ranged from fully deterministic cyclic to fully uniform/mixing. We conduct 3 trials and average the loss for each value of δ ( T ) \delta(T) δ ( T ) and δ ( Q ) \delta(Q) δ ( Q ) . In doing so, we obtain the losses for Dobrushin coefficients ranging from 0 to 1, as shown in Figure 8 .
Figure 8. Test prediction loss for varying values of δ ( Q ) \delta(Q) δ ( Q ) and δ ( T ) \delta(T) δ ( T )
Note that the right-most column corresponds to α = 0 \alpha=0 α = 0 , the bottom-left cell to α = 2 \alpha=2 α = 2 , and other values can be found via the equation for α \alpha α . The loss is the lowest at purely non-mixing, deterministic kernels at ( δ ( T ) , δ ( Q ) ) = ( 0 , 0 ) (\delta(T),\delta(Q))=(0,0) ( δ ( T ) , δ ( Q )) = ( 0 , 0 ) . At δ ( T ) ≥ 0.67 \delta(T)\geq0.67 δ ( T ) ≥ 0.67 the loss is consistently low regardless of Q Q Q .
The near-deterministic region is prone to occasional confident incorrect predictions, which is strongly punished by cross-entropy loss. This is seen at ( 0.17 , 0.00 ) (0.17,0.00) ( 0.17 , 0.00 ) and ( 0.50 , 0.33 ) (0.50,0.33) ( 0.50 , 0.33 ) with loss 7.35 and 4.99, respectively. These occasional errors may be due to the relatively low sample size of 3; thus, regional trends may be more indicative of Transformer performance.
Overall, the bottom-left quadrant (high α \alpha α ) attains the highest average loss (2.84), while the top-right quadrant (low α \alpha α ) attains the lowest (1.26), suggesting a positive relationship between stability and Transformer performance. While this trend is partially driven by the outlier at ( δ ( T ) , δ ( Q ) ) = ( 0.17 , 0 ) (\delta(T),\delta(Q)) = (0.17, 0) ( δ ( T ) , δ ( Q )) = ( 0.17 , 0 ) , if we exclude it, the bottom left quadrant average is still elevated (2.42), so the overall direction still holds.
Thus, as δ ( T ) , δ ( Q ) \delta(T),\delta(Q) δ ( T ) , δ ( Q ) increase and α \alpha α decreases, loss tends to decrease while stability increases. This experiment suggests that stability is positively related to Transformer performance.
Effect of action space quantization
For this trial, we keep δ ( Q ) = δ ( T ) = 1 3 \delta(Q) = \delta(T) = \frac{1}{3} δ ( Q ) = δ ( T ) = 3 1 to attain α = 10 9 \alpha= \frac{10}{9} α = 9 10 , and sweep m m m , the quantization level of the action space parameters, through { 1 , 2 , 3 , 4 , 5 } \{1,2,3,4,5\} { 1 , 2 , 3 , 4 , 5 } . We keep the action space constant with n = 3 n = 3 n = 3 for all trials. The resulting loss is displayed in Figure 9 .
Figure 9. Test prediction loss for varying values of m m m
There is a nonlinear dependence on the granularity of the action space for smaller values of m m m . Loss is higher for very coarse action spaces, and actually increases as we refine the action space, only to decrease for the highest tested value of m = 5 m = 5 m = 5 . Note that due to computational challenges of using dynamic programming, we only tested relatively coarse action spaces.
A possible explanation for the non-monotonic pattern is the following: for coarse action spaces (m ∈ { 1 , … , 4 } m \in\{1,\ldots,4\} m ∈ { 1 , … , 4 } ), the model struggles to cleanly fit to the training data set, and distributes the output uniformly to hedge against badly punished incorrect guesses. All coarse-spaced losses cluster around 1.12 ± 0.02 1.12 \pm0.02 1.12 ± 0.02 , so the difference is small, and any increase with m m m may reflect overfitting with insufficient generalization due to the small m m m . That is, when more fine-grained models make more confident, non-distributional guesses, they end up even more incorrect because the parameters overfit to loose data trends. For m = 5 m = 5 m = 5 , the model begins to confidently and correctly model more localized data set tendencies, not solely distributional.
Effect of state space quantization
We now sweep varying values of n n n , the quantization level of the state space, keeping the transition kernel Dobrushin coefficients δ ( T ) \delta(T) δ ( T ) and δ ( Q ) \delta(Q) δ ( Q ) , and the action space constant. We take m = 5 m = 5 m = 5 , K ~ = 400 \widetilde{K} = 400 K = 400 , and δ ( Q ) = δ ( T ) = 1 3 \delta(Q) = \delta(T) = \frac{1}{3} δ ( Q ) = δ ( T ) = 3 1 for all trials. Note that although δ ( Q ) \delta(Q) δ ( Q ) and δ ( T ) \delta(T) δ ( T ) are constant, the transition kernels have different coefficients due to the difference in state space shape. We create a general kernel matrix Ω \Omega Ω using the equation shown below. Given an action space with n n n levels and a desired Dobrushin coefficient δ ( Ω ) \delta(\Omega) δ ( Ω ) , we take
Ω = δ ( Ω ) n J + ( 1 − δ ( Ω ) ) A \Omega= \frac{\delta(\Omega)}{n}J + (1-\delta(\Omega))A Ω = n δ ( Ω ) J + ( 1 − δ ( Ω )) A
where J J J is the all-ones matrix and A A A is any permutation matrix. Note that constructing Ω \Omega Ω this way ensures that the desired δ ( Ω ) \delta(\Omega) δ ( Ω ) is always obtained. Note also that this corresponds to the T , Q T,Q T , Q used in 6.2.1 with n = 3 n = 3 n = 3 , taking
A = [ 0 1 0 0 0 1 1 0 0 ] . A =
\begin{bmatrix}
0 & 1 & 0 \\
0 & 0 & 1 \\
1 & 0 & 0
\end{bmatrix}. A = 0 0 1 1 0 0 0 1 0 .
Figure 10. Figure 10 shows the trained model’s predicted distributions for varying state space quantizations, where the size of the squares corresponds to the mass in the predicted measure.
Figure 10 (PDF p. 34). Shape of the predicted distributions with respect to varying state quantization level n n n .
These predictions resulted in actual test losses and per-state losses plotted with linear interpolation in Figure 11 for varying state quantization levels:
Figure 11. Test prediction loss (left) and per-state loss (right) for varying values of n n n
Actual test loss tends to increase with n n n in Figure 11 (left), except at n = 6 n = 6 n = 6 , where the trend breaks and test loss decreases. However, since cross-entropy has no intrinsic normalization for the size of the state space, this loss increase reflects the increased difficulty in the task of classification, which is expected since there are more possible states to classify. Once we normalize by the number of possible states (n N n^N n N ) in Figure 11 (right), per-state loss monotonically decreases near-linearly. Thus, model performance outpaces the growth rate of the state space itself.
The cumulative training runs took 75 hours. The runtime breakdown for each trial is shown in Figure 12 .
Figure 12. Numerical experiment runtime for varying values of n n n
A least-squares quadratic fit of the runtime in seconds as a function of n n n yields t r u n t i m e ( n ) = 8542.9 n 2 − 31702.9 n + 27200.0 t_{\mathrm{runtime}}(n) = 8542.9n^2 - 31702.9n + 27200.0 t runtime ( n ) = 8542.9 n 2 − 31702.9 n + 27200.0 with R 2 ≈ 0.994 R^2 \approx0.994 R 2 ≈ 0.994 .
Conclusion
We studied next-token prediction by optimally trained Transformers for observations generated by a latent process. We truncated the context to a length M M M , and quantified the resulting error with entropy gaps for stationary ergodic process; with filter stability results for N N N th order Markov sources with the explicit rate α ⌊ M / N ⌋ \alpha^{\lfloor M/N \rfloor} α ⌊ M / N ⌋ , where α \alpha α is a mixing rate determined by the Dobrushin coefficients of the transition kernel and the observation kernel. We then constructed a Transformer that realizes the quantized finite-window predictor, trained it with dynamic programming over a quantized set of weights. We finally showed that the resulting learning error can be decomposed into a sum of four factors: loss due to finite memory, quantization error, sample complexity error, and error due to insufficiency of architecture. Finally, through extensive experiments, we measured how important the memory of data is in Transformer training, and the effect of the mixing rate in filtering via Transformers.
Funding
The first author was supported by the Scientific and Technological Research Council of Türkiye (TÜBİTAK) through the 2211-E program. The third author was supported by Turkish Academy of Sciences through the 2025 GEBIP Award. The last author was supported in part by the Natural Sciences and Engineering Research Council (NSERC) of Canada.
The Training Algorithm
Algorithm 1 Next Token Prediction with Dynamic Programming
Input: data set D ~ = { ( x k , y ~ k ) } k = 1 K ~ \widetilde{D} = \{(x^k,\widetilde{y}^k)\}_{k=1}^{\widetilde{K}} D = {( x k , y k ) } k = 1 K , horizon T T T , quantization levels ( l , n , m ) (l,n,m) ( l , n , m )
Construct embedding space grid X n \mathbb{X}_n X n from X \mathbb{X} X and for x ∈ X x \in\mathbb{X} x ∈ X define Q n ( ⋅ ) = arg min x ′ ∈ X n ∥ ⋅ − x ′ ∥ Q_n(\cdot) = \arg\min_{x' \in\mathbb{X}_n} \lVert\cdot- x' \rVert Q n ( ⋅ ) = arg min x ′ ∈ X n ∥ ⋅ − x ′ ∥
Construct finite action set U m = { U 1 , … , U m } ⊂ U \mathbb{U}_m = \{U^1,\ldots,U^m\} \subset\mathbb{U} U m = { U 1 , … , U m } ⊂ U
Construct measure grid P ( l ) ( X n ) \mathcal{P}^{(l)}(\mathbb{X}_n) P ( l ) ( X n ) and for ν ∈ P ( X n ) \nu\in\mathcal{P}(\mathbb{X}_n) ν ∈ P ( X n ) define
R l ( ν ) = arg min ν ^ ∈ P ( l ) ( X n ) W 2 ( ν , ν ^ ) R_l(\nu) = \arg\min_{\widehat{\nu} \in\mathcal{P}^{(l)}(\mathbb{X}_n)} W_2(\nu,\widehat{\nu}) R l ( ν ) = arg ν ∈ P ( l ) ( X n ) min W 2 ( ν , ν )
for k = 1 , … , K ~ k = 1,\ldots,\widetilde{K} k = 1 , … , K do
μ ^ 0 k ← R l ( 1 N ∑ i = 1 N δ Q n ( p i , x i k ) ) \widehat{\mu}_0^k \leftarrow R_l\left(\frac{1}{N}\sum_{i=1}^{N}\delta_{Q_n(p_i,x_i^k)}\right) μ 0 k ← R l ( N 1 ∑ i = 1 N δ Q n ( p i , x i k ) )
y ^ k ← R l ( ∑ j = 1 K ~ y ~ j 1 { x j = x k } ∑ j = 1 K ~ 1 { x j = x k } ) \widehat{y}^k \leftarrow R_l\left(\frac{\sum_{j=1}^{\widetilde{K}}\widetilde{y}^j\mathbf{1}_{\{x_j=x^k\}}}{\sum_{j=1}^{\widetilde{K}}\mathbf{1}_{\{x_j=x^k\}}}\right) y k ← R l ( ∑ j = 1 K 1 { x j = x k } ∑ j = 1 K y j 1 { x j = x k } )
end for
Construct data set D = { ( x k , y ^ k ) } k = 1 K D = \{(x^k,\widehat{y}^k)\}_{k=1}^{K} D = {( x k , y k ) } k = 1 K
Define dynamics for U ∈ U m U \in\mathbb{U}_m U ∈ U m
Φ ( l , n , m ) ( μ ^ , U ) = R l ( Φ ( n ) ( μ ^ , U ) ) \Phi^{(l,n,m)}(\widehat{\mu},U) = R_l\left(\Phi^{(n)}(\widehat{\mu},U)\right) Φ ( l , n , m ) ( μ , U ) = R l ( Φ ( n ) ( μ , U ) )
Define terminal cost
E l , n , m , T ( μ ^ ) = 1 K ∑ k = 1 K CE ( y k , softmax ( E U x T , γ k , L ) ) \mathcal{E}_{l,n,m,T}(\widehat{\mu}) = \frac{1}{K}\sum_{k=1}^{K}\operatorname{CE}\left(y^k,\operatorname{softmax}\left(E_U x_{T,\gamma}^{k,L}\right)\right) E l , n , m , T ( μ ) = K 1 k = 1 ∑ K CE ( y k , softmax ( E U x T , γ k , L ) )
for t = T − 1 t = T-1 t = T − 1 down to 0 0 0 do
for all μ ^ = ( μ ^ 1 , … , μ ^ K ) ∈ P l ( X n ) K \widehat{\mu} = (\widehat{\mu}^1,\ldots,\widehat{\mu}^K) \in\mathcal{P}^{l}(\mathbb{X}_n)^K μ = ( μ 1 , … , μ K ) ∈ P l ( X n ) K do 14.
E l , n , m , t ( μ ^ ) = min U ∈ U m E l , n , m , t + 1 ( Φ ( l , n , m ) ( μ ^ 1 , U ) , … , Φ ( l , n , m ) ( μ ^ K , U ) ) \mathcal{E}_{l,n,m,t}(\widehat{\mu}) = \min_{U \in\mathbb{U}_m}\mathcal{E}_{l,n,m,t+1}\left(\Phi^{(l,n,m)}(\widehat{\mu}^1,U),\ldots,\Phi^{(l,n,m)}(\widehat{\mu}^K,U)\right) E l , n , m , t ( μ ) = U ∈ U m min E l , n , m , t + 1 ( Φ ( l , n , m ) ( μ 1 , U ) , … , Φ ( l , n , m ) ( μ K , U ) )
15.
γ t ∗ ( μ ^ ) = arg min U ∈ U m E l , n , m , t + 1 ( Φ ( l , n , m ) ( μ ^ 1 , U ) , … , Φ ( l , n , m ) ( μ ^ K , U ) ) \gamma_t^*(\widehat{\mu}) = \arg\min_{U \in\mathbb{U}_m}\mathcal{E}_{l,n,m,t+1}\left(\Phi^{(l,n,m)}(\widehat{\mu}^1,U),\ldots,\Phi^{(l,n,m)}(\widehat{\mu}^K,U)\right) γ t ∗ ( μ ) = arg U ∈ U m min E l , n , m , t + 1 ( Φ ( l , n , m ) ( μ 1 , U ) , … , Φ ( l , n , m ) ( μ K , U ) )
end for
end for
Forward Pass:
for t = 0 , … , T − 1 t = 0,\ldots,T-1 t = 0 , … , T − 1 do
U t ∗ ← γ t ∗ ( μ ^ t 1 , … , μ ^ t K ) U_t^* \leftarrow\gamma_t^*(\widehat{\mu}_t^1,\ldots,\widehat{\mu}_t^K) U t ∗ ← γ t ∗ ( μ t 1 , … , μ t K )
for k = 1 , … , K k = 1,\ldots,K k = 1 , … , K do
μ ^ t + 1 k ← Φ ( l , n , m ) ( μ ^ K , t W , U t ∗ ) \widehat{\mu}_{t+1}^k \leftarrow\Phi^{(l,n,m)}(\widehat{\mu}_{K,t}^W,U_t^*) μ t + 1 k ← Φ ( l , n , m ) ( μ K , t W , U t ∗ )
end for
end for
Output: ( U t ∗ ) t = 0 T − 1 (U_t^*)_{t=0}^{T-1} ( U t ∗ ) t = 0 T − 1
Proofs of the Results in Section 2
Auxiliary Results
Lemma 28. Under Assumptions 3-(A2, A3), for all r ∈ Z + r \in\mathbb{Z}_{+} r ∈ Z + and s ∈ N s \in\mathbb{N} s ∈ N ,
max Y 0 : r ∈ Y r ∥ P r ( ⋅ ∣ Y 0 : r ) − Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) ∥ T V ≤ L ψ s . \max_{Y_{0:r}\in\mathbb{Y}^{r}} \left\|P_r(\cdot\mid Y_{0:r})-\Xi_s(q_{\#}^{s}P_r)(\cdot\mid Y_{0:r})\right\|_{\mathrm{TV}}\leq\frac{L_{\psi}}{s}. Y 0 : r ∈ Y r max P r ( ⋅ ∣ Y 0 : r ) − Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) TV ≤ s L ψ .
Proof. Taking the Radon-Nikodym derivative of P r P_r P r with respect to μ \mu μ , we get a μ \mu μ -integrable function p r ( y ) : = ∑ z ∈ S ψ ( y ∣ z ) Pr ( Z r + 1 = z ∣ Y 0 : r ) p_r(y):=\sum_{z\in S}\psi(y\mid z)\Pr(Z_{r+1}=z\mid Y_{0:r}) p r ( y ) := ∑ z ∈ S ψ ( y ∣ z ) Pr ( Z r + 1 = z ∣ Y 0 : r ) . Then, for all y , y ′ ∈ Y y,y'\in\mathbb{Y} y , y ′ ∈ Y ,
∣ p r ( y ) − p r ( y ′ ) ∣ = ∣ ∑ z ∈ S ( ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ) Pr ( Z r + 1 = z ∣ Y 0 : r ) ∣ ≤ ∑ z ∈ S ∣ ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ∣ Pr ( Z r + 1 = z ∣ Y 0 : r ) ≤ L ψ ρ ( y , y ′ ) ∑ z ∈ S Pr ( Z r + 1 = z ∣ Y 0 : r ) ⏟ 1 (by Assumption 3-(A2)) = L ψ ρ ( y , y ′ ) . \begin{aligned}
|p_r(y)-p_r(y')|&=\left|\sum_{z\in S}\bigl(\psi(y\mid z)-\psi(y'\mid z)\bigr)\Pr(Z_{r+1}=z\mid Y_{0:r})\right|\\
&\leq\sum_{z\in S}|\psi(y\mid z)-\psi(y'\mid z)|\Pr(Z_{r+1}=z\mid Y_{0:r})\\
&\leq L_{\psi}\rho(y,y')\underbrace{\sum_{z\in S}\Pr(Z_{r+1}=z\mid Y_{0:r})}_{1}\qquad\text{(by Assumption 3-(A2))}\\
&=L_{\psi}\rho(y,y').
\end{aligned} ∣ p r ( y ) − p r ( y ′ ) ∣ = z ∈ S ∑ ( ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ) Pr ( Z r + 1 = z ∣ Y 0 : r ) ≤ z ∈ S ∑ ∣ ψ ( y ∣ z ) − ψ ( y ′ ∣ z ) ∣ Pr ( Z r + 1 = z ∣ Y 0 : r ) ≤ L ψ ρ ( y , y ′ ) 1 z ∈ S ∑ Pr ( Z r + 1 = z ∣ Y 0 : r ) (by Assumption 3-(A2)) = L ψ ρ ( y , y ′ ) .
So, p r p_r p r is also L ψ L_{\psi} L ψ -Lipschitz. For each i = 1 , … , R ( s ) i=1,\ldots,R(s) i = 1 , … , R ( s ) , on the cell C ( s , i ) C(s,i) C ( s , i ) , the μ \mu μ -density of Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) \Xi_s(q_{\#}^{s}P_r)(\cdot\mid Y_{0:r}) Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) , denoted p ^ r \hat{p}_r p ^ r , is constant and equal to the μ \mu μ -average of p r p_r p r . Hence,
sup y ∈ C ( s , i ) ∣ p r ( y ) − p ^ r ( y ) ∣ ≤ L ψ diam ( C ( s , i ) ) ≤ 2 L ψ s . \sup_{y\in C(s,i)}|p_r(y)-\hat{p}_r(y)|\leq L_{\psi}\operatorname{diam}(C(s,i))\leq\frac{2L_{\psi}}{s}. y ∈ C ( s , i ) sup ∣ p r ( y ) − p ^ r ( y ) ∣ ≤ L ψ diam ( C ( s , i )) ≤ s 2 L ψ .
We use the density representation of the total variation distance:
∥ P r ( ⋅ ∣ Y 0 : r ) − Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) ∥ T V = 1 2 ∫ Y μ ( d y ) ∣ p r ( y ) − p ^ r ( y ) ∣ ≤ 1 2 ⋅ 2 L ψ s = L ψ s . \left\|P_r(\cdot\mid Y_{0:r})-\Xi_s(q_{\#}^{s}P_r)(\cdot\mid Y_{0:r})\right\|_{\mathrm{TV}}=\frac{1}{2}\int_{\mathbb{Y}}\mu(\mathrm{d}y)|p_r(y)-\hat{p}_r(y)|\leq\frac{1}{2}\cdot\frac{2L_{\psi}}{s}=\frac{L_{\psi}}{s}. P r ( ⋅ ∣ Y 0 : r ) − Ξ s ( q # s P r ) ( ⋅ ∣ Y 0 : r ) TV = 2 1 ∫ Y μ ( d y ) ∣ p r ( y ) − p ^ r ( y ) ∣ ≤ 2 1 ⋅ s 2 L ψ = s L ψ .
The above bound does not depend on the choice of trajectory Y 0 : r Y_{0:r} Y 0 : r at any step of this proof, thereby, the claim holds and the proof is now concluded. ■
Lemma 29. Under Assumptions 3-(A1) and (A2), for all y = ( y 1 , … , y M ) , y ′ = ( y 1 ′ , … , y M ′ ) ∈ Y M \mathbf{y}=(y_1,\ldots,y_M),\mathbf{y}'=(y'_1,\ldots,y'_M)\in\mathbb{Y}^{M} y = ( y 1 , … , y M ) , y ′ = ( y 1 ′ , … , y M ′ ) ∈ Y M , for all r ≥ M r\geq M r ≥ M , we have
∥ Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) ∥ T V ≤ L ψ q min ∑ i = 1 M ρ ( y i , y i ′ ) . \left\|\Pr(Z_{r-M+1:r}\in\cdot\mid Y_{r-M+1:r}=\mathbf{y})-\Pr(Z_{r-M+1:r}\in\cdot\mid Y_{r-M+1:r}=\mathbf{y}')\right\|_{\mathrm{TV}}\leq\frac{L_{\psi}}{q_{\min}}\sum_{i=1}^{M}\rho(y_i,y'_i). ∥ Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) ∥ TV ≤ q m i n L ψ i = 1 ∑ M ρ ( y i , y i ′ ) .
Proof. Let P ~ ( z ) : = Pr { Z r − M + 1 : r = z } \widetilde{P}(z):=\Pr\{Z_{r-M+1:r}=z\} P ( z ) := Pr { Z r − M + 1 : r = z } for all z ∈ S M z\in S^{M} z ∈ S M . Conditional independence of Y r − M + 1 : r Y_{r-M+1:r} Y r − M + 1 : r gives the likelihood
ψ y ~ ( z ) : = ∏ i = 1 M ψ ( y ~ i ∣ z i ) \psi_{\widetilde{\mathbf{y}}}(z):=\prod_{i=1}^{M}\psi(\widetilde{y}_i\mid z_i) ψ y ( z ) := i = 1 ∏ M ψ ( y i ∣ z i )
for all y ~ : = ( y ~ 1 , … , y ~ M ) ∈ Y M \widetilde{\mathbf{y}} := (\widetilde{y}_1,\ldots,\widetilde{y}_M) \in\mathcal{Y}^M y := ( y 1 , … , y M ) ∈ Y M . The posterior is then
μ y ~ ( z ) : = P ~ ( z ) ψ y ~ ( z ) ∑ z ′ ∈ S M P ~ ( z ′ ) ψ y ~ ( z ′ ) . \mu_{\widetilde{\mathbf{y}}}(z) := \frac{\widetilde{P}(z)\psi_{\widetilde{\mathbf{y}}}(z)}{\sum_{z'\in\mathcal{S}^M}\widetilde{P}(z')\psi_{\widetilde{\mathbf{y}}}(z')}. μ y ( z ) := ∑ z ′ ∈ S M P ( z ′ ) ψ y ( z ′ ) P ( z ) ψ y ( z ) .
We continue after the following intermezzo : For any two vectors u , v ∈ R + d ∖ { 0 } u,v \in\mathbb{R}_+^d \setminus\{0\} u , v ∈ R + d ∖ { 0 } for some d ∈ N d \in\mathbb{N} d ∈ N , we denote their normalizations by u ^ = u / ∥ u ∥ 1 \widehat{u}=u/\lVert u\rVert_1 u = u / ∥ u ∥ 1 and v ^ = v / ∥ v ∥ 1 \widehat{v}=v/\lVert v\rVert_1 v = v / ∥ v ∥ 1 . Then, we can write
u ^ − v ^ = u − v ∥ u ∥ 1 + v ( 1 ∥ u ∥ 1 − 1 ∥ v ∥ 1 ) . (26) \widehat{u}-\widehat{v}=\frac{u-v}{\lVert u\rVert_1}+v\left(\frac{1}{\lVert u\rVert_1}-\frac{1}{\lVert v\rVert_1}\right). \tag*{(26)} u − v = ∥ u ∥ 1 u − v + v ( ∥ u ∥ 1 1 − ∥ v ∥ 1 1 ) . (26)
The term on the right hand side has the norm
∥ v ( 1 ∥ u ∥ 1 − 1 ∥ v ∥ 1 ) ∥ 1 ≤ ∣ ∥ v ∥ 1 − ∥ u ∥ 1 ∣ ∥ u ∥ 1 ≤ ∥ v − u ∥ 1 ∥ u ∥ 1 . (27) \left\lVert v\left(\frac{1}{\lVert u\rVert_1}-\frac{1}{\lVert v\rVert_1}\right)\right\rVert_1\leq\frac{\left|\lVert v\rVert_1-\lVert u\rVert_1\right|}{\lVert u\rVert_1}\leq\frac{\lVert v-u\rVert_1}{\lVert u\rVert_1}. \tag*{(27)} v ( ∥ u ∥ 1 1 − ∥ v ∥ 1 1 ) 1 ≤ ∥ u ∥ 1 ∣ ∥ v ∥ 1 − ∥ u ∥ 1 ∣ ≤ ∥ u ∥ 1 ∥ v − u ∥ 1 . (27)
Therefore, by (26) and (27), we have
∥ u ^ − v ^ ∥ T V = 1 2 ∥ u ^ − v ^ ∥ 1 ≤ ∥ v − u ∥ 1 ∥ u ∥ 1 . (28) \lVert\widehat{u}-\widehat{v}\rVert_{\mathrm{TV}}=\frac{1}{2}\lVert\widehat{u}-\widehat{v}\rVert_1\leq\frac{\lVert v-u\rVert_1}{\lVert u\rVert_1}. \tag*{(28)} ∥ u − v ∥ TV = 2 1 ∥ u − v ∥ 1 ≤ ∥ u ∥ 1 ∥ v − u ∥ 1 . (28)
We resume from where we left: Let a , b ∈ Y M \mathbf{a},\mathbf{b}\in\mathcal{Y}^M a , b ∈ Y M differ at the coordinate k k k with ρ ( a k , b k ) = δ \rho(a_k,b_k)=\delta ρ ( a k , b k ) = δ . We define c ( z ) : = P ~ ( z ) ∏ i ≠ k ψ ( a i ∣ z i ) ≥ 0 c(\mathbf{z}):=\widetilde{P}(\mathbf{z})\prod_{i\ne k}\psi(a_i\mid z_i)\geq0 c ( z ) := P ( z ) ∏ i = k ψ ( a i ∣ z i ) ≥ 0 (as a matter of fact, Assumption 3-(A1) gives that ∥ c ∥ 1 ≥ q min M − 1 > 0 \lVert c\rVert_1\geq q_{\min}^{M-1}>0 ∥ c ∥ 1 ≥ q m i n M − 1 > 0 ). Writing u ( z ) = c ( z ) ψ ( a k ∣ z k ) u(\mathbf{z})=c(\mathbf{z})\psi(a_k\mid z_k) u ( z ) = c ( z ) ψ ( a k ∣ z k ) and v ( z ) = c ( z ) ψ ( b k ∣ z k ) v(\mathbf{z})=c(\mathbf{z})\psi(b_k\mid z_k) v ( z ) = c ( z ) ψ ( b k ∣ z k ) . We have
from Assumption 3-(A2) that ∥ u − v ∥ 1 = ∑ z ∈ S M c ( z ) ∣ ψ ( a k ∣ z k ) − ψ ( b k ∣ z k ) ∣ ≤ L ψ δ ∥ c ∥ 1 \lVert u-v\rVert_1=\sum_{\mathbf{z}\in\mathcal{S}^M}c(\mathbf{z})\lvert\psi(a_k\mid z_k)-\psi(b_k\mid z_k)\rvert\leq L_\psi\delta\lVert c\rVert_1 ∥ u − v ∥ 1 = ∑ z ∈ S M c ( z ) ∣ ψ ( a k ∣ z k ) − ψ ( b k ∣ z k )∣ ≤ L ψ δ ∥ c ∥ 1 .
from Assumption 3-(A1) that ∥ u ∥ 1 = ∑ z ∈ S M c ( z ) ψ ( a k ∣ z k ) ≥ q min ∥ c ∥ 1 \lVert u\rVert_1=\sum_{\mathbf{z}\in\mathcal{S}^M}c(\mathbf{z})\psi(a_k\mid z_k)\geq q_{\min}\lVert c\rVert_1 ∥ u ∥ 1 = ∑ z ∈ S M c ( z ) ψ ( a k ∣ z k ) ≥ q m i n ∥ c ∥ 1 .
Since c c c is non-degenerate (∥ c ∥ 1 > 0 \lVert c\rVert_1>0 ∥ c ∥ 1 > 0 ), from the observation above and from (28), we have
∥ μ a − μ b ∥ T V ≤ L ψ δ q min . (29) \lVert\mu_{\mathbf{a}}-\mu_{\mathbf{b}}\rVert_{\mathrm{TV}}\leq\frac{L_\psi\delta}{q_{\min}}. \tag*{(29)} ∥ μ a − μ b ∥ TV ≤ q m i n L ψ δ . (29)
Now define y ( 0 ) = y \mathbf{y}^{(0)}=\mathbf{y} y ( 0 ) = y , y ( k ) = ( y 1 ′ , … , y k ′ , y k + 1 , … , y M ) \mathbf{y}^{(k)}=(y'_1,\ldots,y'_k,y_{k+1},\ldots,y_M) y ( k ) = ( y 1 ′ , … , y k ′ , y k + 1 , … , y M ) for all k = 1 , … , M k=1,\ldots,M k = 1 , … , M and y ( M ) = y ′ \mathbf{y}^{(M)}=\mathbf{y}' y ( M ) = y ′ . Then, from (29), we have
∥ μ y − μ y ′ ∥ T V ≤ ∑ k = 1 M ∥ μ y ( k − 1 ) − μ y ( k ) ∥ T V ≤ L ψ q min ∑ k = 1 M ρ ( y k , y k ′ ) . \lVert\mu_{\mathbf{y}}-\mu_{\mathbf{y}'}\rVert_{\mathrm{TV}}\leq\sum_{k=1}^{M}\lVert\mu_{\mathbf{y}^{(k-1)}}-\mu_{\mathbf{y}^{(k)}}\rVert_{\mathrm{TV}}\leq\frac{L_\psi}{q_{\min}}\sum_{k=1}^{M}\rho(y_k,y'_k). ∥ μ y − μ y ′ ∥ TV ≤ k = 1 ∑ M ∥ μ y ( k − 1 ) − μ y ( k ) ∥ TV ≤ q m i n L ψ k = 1 ∑ M ρ ( y k , y k ′ ) .
Seeing μ a \mu_{\mathbf{a}} μ a is equivalent with Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = a ) \Pr(Z_{r-M+1:r}\in\cdot\mid Y_{r-M+1:r}=\mathbf{a}) Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = a ) concludes this proof. ■
Lemma 30. Under Assumption 6, { Y r } r ∈ Z + \{Y_r\}_{r\in\mathbb{Z}_+} { Y r } r ∈ Z + is stationary and ergodic.
Proof. By the randomization lemma (Kallenberg, [25 ] ), there exists H : S × [ 0 , 1 ] → Y H:\mathcal{S}\times[0,1]\to\mathcal{Y} H : S × [ 0 , 1 ] → Y and an i.i.d. [ 0 , 1 ] [0,1] [ 0 , 1 ] -valued noise process { V r } r ∈ Z + \{V_r\}_{r\in\mathbb{Z}_+} { V r } r ∈ Z + independent of { Z r } r ∈ Z + \{Z_r\}_{r\in\mathbb{Z}_+} { Z r } r ∈ Z + such that Y r = H ( Z r , V r ) Y_r=H(Z_r,V_r) Y r = H ( Z r , V r ) for all r ∈ Z + r\in\mathbb{Z}_+ r ∈ Z + . Since mixing of an ergodic process with a noise is still ergodic (Walters, [48 ] ), the claim follows. ■
Lemma 31. The block process { ( X i , Y i ) } i ≥ 0 \{(\mathbf{X}_i,\mathbf{Y}_i)\}_{i\geq0} {( X i , Y i ) } i ≥ 0 is a partially observed Markov process with the state transition kernel T \mathbf{T} T and the observation channel Q \mathbf{Q} Q .
Proof. Fix i ≥ 0 i \geq0 i ≥ 0 . From (10) and the definition of T \mathbf{T} T , X i + 1 \mathbf{X}_{i+1} X i + 1 is generated from X i \mathbf{X}_i X i via the kernel T \mathbf{T} T , hence it is Markov. By the stochastic realization results, each Y i \mathbf{Y}_i Y i is a function of Z i \mathbf{Z}_i Z i and an independent noise V i \mathbf{V}_i V i . As we block, Y i \mathbf{Y}_i Y i is then generated only by X i \mathbf{X}_i X i via a noise block V i \mathbf{V}_i V i for all i i i . Hence, { ( X i , Y i ) } i ≥ 0 \{(\mathbf{X}_i,\mathbf{Y}_i)\}_{i\geq0} {( X i , Y i ) } i ≥ 0 is indeed a POMP. ■
Proof of Proposition 5
Since the prediction kernel is non-expansive in total variation distance (as all stochastic kernels are), writing y ′ : = q M , s ( y ) \mathbf{y}' := q^{M,s}(\mathbf{y}) y ′ := q M , s ( y ) we get
∥ P r M ( ⋅ ∣ y ) − P r M , s ( ⋅ ∣ q M , s ( y ) ) ∥ T V = ∥ Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) P r e d − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) P r e d ∥ T V ≤ ∥ Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) ∥ T V . \begin{aligned}
\left\|P_r^M(\cdot\mid\mathbf{y})-P_r^{M,s}(\cdot\mid q^{M,s}(\mathbf{y}))\right\|_{\mathrm{TV}}
=
\left\|\Pr(\mathbf{Z}_{r-M+1:r}\in\cdot\mid\mathbf{Y}_{r-M+1:r}=\mathbf{y})^{\mathrm{Pred}}-\Pr(\mathbf{Z}_{r-M+1:r}\in\cdot\mid\mathbf{Y}_{r-M+1:r}=\mathbf{y}')^{\mathrm{Pred}}\right\|_{\mathrm{TV}} \\
&\leq
\left\|\Pr(\mathbf{Z}_{r-M+1:r}\in\cdot\mid\mathbf{Y}_{r-M+1:r}=\mathbf{y})-\Pr(\mathbf{Z}_{r-M+1:r}\in\cdot\mid\mathbf{Y}_{r-M+1:r}=\mathbf{y}')\right\|_{\mathrm{TV}}.
\end{aligned} P r M ( ⋅ ∣ y ) − P r M , s ( ⋅ ∣ q M , s ( y )) TV = Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) Pred − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) Pred TV ≤ ∥ Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ) − Pr ( Z r − M + 1 : r ∈ ⋅ ∣ Y r − M + 1 : r = y ′ ) ∥ TV .
Then, we apply Lemma 29 with the fact that ρ ( y i , q s ( y i ) ) ≤ 1 / s \rho(y_i,q^s(y_i))\leq1/s ρ ( y i , q s ( y i )) ≤ 1/ s for all i = 1 , … , M i=1,\ldots,M i = 1 , … , M . The factor 2 is due to each cell having diameter at most 2 / s 2/s 2/ s because of quantization. ■
Proof of Proposition 7
By Lemma 30, for all r ≥ M r\geq M r ≥ M , H ( Y r + 1 ∣ Y r − M + 1 : r ) = H ( Y M ∣ Y 0 : M − 1 ) = H M H(Y_{r+1}\mid Y_{r-M+1:r})=H(Y_M\mid Y_{0:M-1})=H_M H ( Y r + 1 ∣ Y r − M + 1 : r ) = H ( Y M ∣ Y 0 : M − 1 ) = H M and H r + 1 = H ( Y r + 1 ∣ Y 0 : r ) H_{r+1}=H(Y_{r+1}\mid Y_{0:r}) H r + 1 = H ( Y r + 1 ∣ Y 0 : r ) by definition. Then Δ M , r = H M − H r + 1 \Delta_{M,r}=H_M-H_{r+1} Δ M , r = H M − H r + 1 for all r ≥ M r\geq M r ≥ M . So, sup r ≥ M Δ M , r = H M − H ∞ \sup_{r\geq M}\Delta_{M,r}=H_M-H_\infty sup r ≥ M Δ M , r = H M − H ∞ . Note that H M ≥ H ∞ H_M\geq H_\infty H M ≥ H ∞ for all M ∈ N M\in\mathbb{N} M ∈ N and H M → H ∞ H_M\to H_\infty H M → H ∞ as M → ∞ M\to\infty M → ∞ . Then, by monotone convergence theorem for a real-valued non-increasing sequence, Δ M ↓ 0 \Delta_M\downarrow0 Δ M ↓ 0 .
For the second claim, for any r ≥ M r\geq M r ≥ M , we have from Pinsker’s inequality [38 Theorem 7.10]
E Y 0 : r ∥ P r − P r M ∥ T V ≤ E Y 0 : r 1 2 D K L ( P r ∥ P r M ) ≤ 1 2 E Y 0 : r D K L ( P r ∥ P r M ) = 1 2 Δ M , r , \begin{aligned}
\mathbb{E}_{Y_{0:r}}\left\|P_r-P_r^M\right\|_{\mathrm{TV}}
\leq
\mathbb{E}_{Y_{0:r}}\sqrt{\frac{1}{2}D_{\mathrm{KL}}(P_r\mathbin{\|}P_r^M)} \\
&\leq
\sqrt{\frac{1}{2}\mathbb{E}_{Y_{0:r}}D_{\mathrm{KL}}(P_r\mathbin{\|}P_r^M)}
=
\sqrt{\frac{1}{2}\Delta_{M,r}},
\end{aligned} E Y 0 : r P r − P r M TV ≤ E Y 0 : r 2 1 D KL ( P r ∥ P r M ) ≤ 2 1 E Y 0 : r D KL ( P r ∥ P r M ) = 2 1 Δ M , r ,
where the last inequality follows from Jensen’s inequality for concave functions applied to ⋅ \sqrt{\cdot} ⋅ and the last equality holds by (6) and (7) applied to A = Y r + 1 A=Y_{r+1} A = Y r + 1 , B = Y 0 : r − M B=Y_{0:r-M} B = Y 0 : r − M and C = Y r − M + 1 : r C=Y_{r-M+1:r} C = Y r − M + 1 : r and by the definition of Δ M , r \Delta_{M,r} Δ M , r in (3). Taking the suprema over r ≥ M r\geq M r ≥ M of both sides concludes this proof. ■
Proof of Proposition 9
Define the one-step Bayesian update map
F ( λ , y ) ( z ) : = ψ ( y ∣ z ) ( λ κ ( z ) ) ∑ z ′ ∈ S ψ ( y ∣ z ′ ) ( λ κ ( z ′ ) ) . F(\lambda,y)(z):=\frac{\psi(y\mid z)(\lambda\kappa(z))}{\sum_{z'\in S}\psi(y\mid z')(\lambda\kappa(z'))}. F ( λ , y ) ( z ) := ∑ z ′ ∈ S ψ ( y ∣ z ′ ) ( λκ ( z ′ )) ψ ( y ∣ z ) ( λκ ( z )) .
We define the initializations of filters:
π 0 ( ⋅ ) : = Pr ( Z r − M ∈ ⋅ ∣ Y 0 : r − M ) \pi_0(\cdot) := \Pr(Z_{r-M} \in\cdot\mid Y_{0:r-M}) π 0 ( ⋅ ) := Pr ( Z r − M ∈ ⋅ ∣ Y 0 : r − M )
π 0 ′ : = π Z \pi'_0 := \pi_Z π 0 ′ := π Z
using which we write the filter update equations
π i : = F ( π i − 1 , Y r − M + i ) π i ′ : = F ( π i − 1 ′ , Y r − M + i ) for all i ∈ { 1 , … , M } \begin{aligned}
\pi_i &:= F(\pi_{i-1},Y_{r-M+i})\\
\pi'_i &:= F(\pi'_{i-1},Y_{r-M+i})
\end{aligned}
\qquad\text{for all } i \in\{1,\ldots,M\} π i π i ′ := F ( π i − 1 , Y r − M + i ) := F ( π i − 1 ′ , Y r − M + i ) for all i ∈ { 1 , … , M }
so that we have
π M ( ⋅ ) : = Pr ( Z r ∈ ⋅ ∣ Y 0 : r ) \pi_M(\cdot) := \Pr(Z_r \in\cdot\mid Y_{0:r}) π M ( ⋅ ) := Pr ( Z r ∈ ⋅ ∣ Y 0 : r )
π M ′ ( ⋅ ) : = Pr ( Z r ∈ ⋅ ∣ Y r − M + 1 : r ) \pi'_M(\cdot) := \Pr(Z_r \in\cdot\mid Y_{r-M+1:r}) π M ′ ( ⋅ ) := Pr ( Z r ∈ ⋅ ∣ Y r − M + 1 : r )
If we define Pred ( y ∣ z ) : = ∑ z ′ ∈ S Q ( y ∣ z ′ ) κ ( z ′ ∣ z ) \operatorname{Pred}(y \mid z) := \sum_{z'\in S} Q(y \mid z')\kappa(z' \mid z) Pred ( y ∣ z ) := ∑ z ′ ∈ S Q ( y ∣ z ′ ) κ ( z ′ ∣ z ) for all z ∈ S z \in S z ∈ S and y ∈ Y y \in\mathcal{Y} y ∈ Y , then we have P r = π M Pred P_r = \pi_M\operatorname{Pred} P r = π M Pred and P r M = π M ′ Pred P_r^M = \pi'_M\operatorname{Pred} P r M = π M ′ Pred .
Using non-expansiveness of stochastic kernel in total variation distance, we get
∥ P r − P r M ∥ T V ≤ ∥ π M Pred − π M ′ Pred ∥ T V ≤ ∥ π M − π M ′ ∥ T V . \lVert P_r - P_r^M\rVert_{\mathrm{TV}} \leq\lVert\pi_M\operatorname{Pred} - \pi'_M\operatorname{Pred}\rVert_{\mathrm{TV}} \leq\lVert\pi_M - \pi'_M\rVert_{\mathrm{TV}}. ∥ P r − P r M ∥ TV ≤ ∥ π M Pred − π M ′ Pred ∥ TV ≤ ∥ π M − π M ′ ∥ TV .
Since π 0 ′ = E π 0 \pi'_0 = \mathbb{E}\pi_0 π 0 ′ = E π 0 , then π 0 ′ ≪ π 0 \pi'_0 \ll\pi_0 π 0 ′ ≪ π 0 almost surely, and hence π 0 ′ κ ≪ π 0 κ \pi'_0\kappa\ll\pi_0\kappa π 0 ′ κ ≪ π 0 κ a.s. Now, conditioning on σ ( Y 0 : r − M ) \sigma(Y_{0:r-M}) σ ( Y 0 : r − M ) , the process { ( Z r − M + 1 + i , Y r − M + 1 + i ) } i ≥ 0 \{(Z_{r-M+1+i},Y_{r-M+1+i})\}_{i\geq0} {( Z r − M + 1 + i , Y r − M + 1 + i ) } i ≥ 0 is then a partially observed Markov process whose initial state Z r − M + 1 Z_{r-M+1} Z r − M + 1 has the law π 0 κ \pi_0\kappa π 0 κ . Then the sequences { π i } i ≥ 1 \{\pi_i\}_{i\geq1} { π i } i ≥ 1 and { π i ′ } i ≥ 1 \{\pi'_i\}_{i\geq1} { π i ′ } i ≥ 1 are its filters started from the true prior π 0 κ \pi_0\kappa π 0 κ and the false prior π 0 ′ κ \pi'_0\kappa π 0 ′ κ . Then, [33 Corollary 3.7] applies:
E [ ∥ π M − π M ′ ∥ T V ∣ Y 0 : r − M ] ≤ α M ∥ π 0 − π 0 ′ ∥ T V ≤ α M . \mathbb{E}[\lVert\pi_M-\pi'_M\rVert_{\mathrm{TV}} \mid Y_{0:r-M}] \leq\alpha^M\lVert\pi_0-\pi'_0\rVert_{\mathrm{TV}} \leq\alpha^M. E [∥ π M − π M ′ ∥ TV ∣ Y 0 : r − M ] ≤ α M ∥ π 0 − π 0 ′ ∥ TV ≤ α M .
Taking the expectations of both sides concludes this proof. ■
Proof of Proposition 10
Define the one-step Bayesian update map
F ( λ , y ) ( z ) : = ψ ( y ∣ z ) ( λ T ( z ) ) ∑ z ′ ∈ S N ψ ( y ∣ z ′ ) ( λ T ( z ′ ) ) . F(\lambda,y)(z) := \frac{\psi(y \mid z)(\lambda T(z))}{\sum_{z'\in S^N}\psi(y \mid z')(\lambda T(z'))}. F ( λ , y ) ( z ) := ∑ z ′ ∈ S N ψ ( y ∣ z ′ ) ( λ T ( z ′ )) ψ ( y ∣ z ) ( λ T ( z )) .
for all λ ∈ P ( S N ) \lambda\in\mathcal{P}(S^N) λ ∈ P ( S N ) and y ∈ Y N y \in\mathcal{Y}^N y ∈ Y N where ψ ( y ∣ z ) : = ∏ i = 1 N ψ ( y i ∣ z i ) \psi(y \mid z) := \prod_{i=1}^N \psi(y_i \mid z_i) ψ ( y ∣ z ) := ∏ i = 1 N ψ ( y i ∣ z i ) . We also define λ 0 ′ : = Pr ( X 0 ∈ ⋅ ∣ Y r − M + 1 : r e s ) \lambda'_0 := \Pr(X_0 \in\cdot\mid Y_{r-M+1:r_{\mathrm{es}}}) λ 0 ′ := Pr ( X 0 ∈ ⋅ ∣ Y r − M + 1 : r es ) and λ 0 : = Pr ( X 0 ∈ ⋅ ∣ Y 0 : r e s ) \lambda_0 := \Pr(X_0 \in\cdot\mid Y_{0:r_{\mathrm{es}}}) λ 0 := Pr ( X 0 ∈ ⋅ ∣ Y 0 : r es ) . Using these, we write the filter update equations:
π i : = F ( π i − 1 , y i ) with π 0 = λ 0 \pi_i := F(\pi_{i-1},y_i) \text{ with } \pi_0 = \lambda_0 π i := F ( π i − 1 , y i ) with π 0 = λ 0
and
π i ′ : = F ( π i − 1 ′ , y i ) with π 0 ′ = λ 0 ′ . \pi'_i := F(\pi'_{i-1},y_i) \text{ with } \pi'_0 = \lambda'_0. π i ′ := F ( π i − 1 ′ , y i ) with π 0 ′ = λ 0 ′ .
Conditionally on X 0 X_0 X 0 , the past Y 0 : r e s Y_{0:r_{\mathrm{es}}} Y 0 : r es is independent of ( X 1 : m , Y 1 : m ) (X_{1:m},Y_{1:m}) ( X 1 : m , Y 1 : m ) . Hence,
π m = Pr ( X m ∈ ⋅ ∣ Y 0 : r ) and π m ′ = Pr ( X m ∈ ⋅ ∣ Y r − M + 1 : r ) . \pi_m = \Pr(X_m \in\cdot\mid Y_{0:r}) \text{ and } \pi'_m = \Pr(X_m \in\cdot\mid Y_{r-M+1:r}). π m = Pr ( X m ∈ ⋅ ∣ Y 0 : r ) and π m ′ = Pr ( X m ∈ ⋅ ∣ Y r − M + 1 : r ) .
As Y r + 1 Y_{r+1} Y r + 1 depends on the past only through X m X_m X m , the predictive distributions take the shape P r = π m P r e d P_r=\pi_m\mathbf{Pred} P r = π m Pred and P r M = π m ′ P r e d P_r^M=\pi'_m\mathbf{Pred} P r M = π m ′ Pred . As stochastic kernels are non-expansive in total variation, we have
∥ P r − P r M ∥ T V = ∥ π m P r e d − π m ′ P r e d ∥ T V ≤ ∥ π m − π m ′ ∥ T V . \lVert P_r-P_r^M\rVert_{\mathrm{TV}}=\lVert\pi_m\mathbf{Pred}-\pi'_m\mathbf{Pred}\rVert_{\mathrm{TV}}\leq\lVert\pi_m-\pi'_m\rVert_{\mathrm{TV}}. ∥ P r − P r M ∥ TV = ∥ π m Pred − π m ′ Pred ∥ TV ≤ ∥ π m − π m ′ ∥ TV .
Condition on Y 0 : r e s Y_{0:\mathrm{res}} Y 0 : res and apply the same steps in the proof of Proposition 9 (see §B.5): applying [33 Corollary 3.7] , we get:
E λ 0 [ ∥ π m − π m ′ ∥ T V ∣ Y 0 : r e s ] ≤ α ⌊ M / N ⌋ . \mathbb{E}_{\lambda_0}\left[\lVert\pi_m-\pi'_m\rVert_{\mathrm{TV}}\mid Y_{0:\mathrm{res}}\right]\leq\alpha^{\lfloor M/N\rfloor}. E λ 0 [ ∥ π m − π m ′ ∥ TV ∣ Y 0 : res ] ≤ α ⌊ M / N ⌋ .
Taking the expectation and writing m = ⌊ M / N ⌋ m=\lfloor M/N\rfloor m = ⌊ M / N ⌋ conclude this proof. ■
Proof of Theorem 12
For each r ≥ M r\geq M r ≥ M , we decompose E ∥ P r − P r M , s ∥ T V \mathbb{E}\lVert P_r-P_r^{M,s}\rVert_{\mathrm{TV}} E ∥ P r − P r M , s ∥ TV into two parts:
E Y 0 : r ∥ P r − P r M , s ∥ T V ≤ E Y 0 : r ∥ P r − P r M ∥ T V + E Y 0 : r ∥ P r M − P r M , s ∥ T V . \mathbb{E}_{Y_{0:r}}\lVert P_r-P_r^{M,s}\rVert_{\mathrm{TV}}\leq\mathbb{E}_{Y_{0:r}}\lVert P_r-P_r^M\rVert_{\mathrm{TV}}+\mathbb{E}_{Y_{0:r}}\lVert P_r^M-P_r^{M,s}\rVert_{\mathrm{TV}}. E Y 0 : r ∥ P r − P r M , s ∥ TV ≤ E Y 0 : r ∥ P r − P r M ∥ TV + E Y 0 : r ∥ P r M − P r M , s ∥ TV .
On the right hand side, the first summand is bounded by Proposition 9 for (i) and by Proposition 10 for (ii). The second summand is handled by Proposition 5. As a note, expectation in the second term is not needed since the objects vary only because of the quantized data. Since the bound holds independent of r ≥ M r\geq M r ≥ M , the statement follows. ■
Proof of Corollary 13
We allocate ε \varepsilon ε equally to the two summand in the bound of Theorem 12. First, we solve the inequality
ε 2 ≥ α ⌊ M / N ⌋ \frac{\varepsilon}{2}\geq\alpha^{\lfloor M/N\rfloor} 2 ε ≥ α ⌊ M / N ⌋
for M M M to get:
M ≥ N log ( 2 / ε ) log ( 1 / α ) . M\geq N\frac{\log(2/\varepsilon)}{\log(1/\alpha)}. M ≥ N log ( 1/ α ) log ( 2/ ε ) .
Then we solve
ε 2 ≥ 2 M L ψ q min s \frac{\varepsilon}{2}\geq\frac{2ML_{\psi}}{q_{\min}s} 2 ε ≥ q m i n s 2 M L ψ
for s s s . This concludes the proof for (ii). The argument for (i) is same with the exception that N N N does not appear since the latent source is Markovian, i.e. N = 1 N=1 N = 1 . ■
Proofs of the Results in Section 4
Proof of Lemma 16
Write x + : = σ ( x ) x_+:=\sigma(x) x + := σ ( x ) and x − : = σ ( − x ) x_-:=\sigma(-x) x − := σ ( − x ) for the coordinate-wise positive and negative parts of x x x , respectively. A sequence of simple calculations shows that
W W σ ( W A x + W b ) = W W σ ( [ x − x ] ) = [ I d − I d ] [ x + x − ] = x + − x − = x , \begin{aligned}
W_W\sigma(W_Ax+W_b)=W_W\sigma\left(\begin{bmatrix}x\\-x\end{bmatrix}\right) \\
&=\begin{bmatrix}I_d&-I_d\end{bmatrix}\begin{bmatrix}x_+\\x_-\end{bmatrix}=x_+-x_-=x,
\end{aligned} W W σ ( W A x + W b ) = W W σ ( [ x − x ] ) = [ I d − I d ] [ x + x − ] = x + − x − = x ,
which concludes this proof. ■
Proof of Lemma 17
We prove by induction. At t = 0 t=0 t = 0 , this is true by construction in (18) . Suppose that the claim is true for t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } . Then we get
x t + 1 i = x t i + ∑ j = 1 M a t i j G ρ ( t ) x t j x_{t+1}^{i}=x_t^{i}+\sum_{j=1}^{M}a_t^{ij}G_{\rho(t)}x_t^{j} x t + 1 i = x t i + j = 1 ∑ M a t ij G ρ ( t ) x t j
as in (19) for all i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } , where
a t i j : = exp ( β ⟨ W Q , t x t i , W K , t x t j ⟩ ) ∑ j ′ = 1 M exp ( β ⟨ W Q , t x t i , W K , t x t j ′ ⟩ ) , i , j ∈ { 1 , … , M } . (30) a_t^{ij}:=\frac{\exp\left(\beta\langle W_{Q,t}x_t^{i},W_{K,t}x_t^{j}\rangle\right)}{\sum_{j'=1}^{M}\exp\left(\beta\langle W_{Q,t}x_t^{i},W_{K,t}x_t^{j'}\rangle\right)},\qquad i,j\in\{1,\ldots,M\}. \tag*{(30)} a t ij := ∑ j ′ = 1 M exp ( β ⟨ W Q , t x t i , W K , t x t j ′ ⟩ ) exp ( β ⟨ W Q , t x t i , W K , t x t j ⟩ ) , i , j ∈ { 1 , … , M } . (30)
By the construction of G ρ ( t ) G_{\rho(t)} G ρ ( t ) in (21) , ∑ j = 1 M a t i j G ρ ( t ) x t j \sum_{j=1}^{M}a_t^{ij}G_{\rho(t)}x_t^{j} ∑ j = 1 M a t ij G ρ ( t ) x t j has no non-zero component in positional encodings and token values, regardless of the attention scores. Therefore, the positional encodings and token values of x t + 1 i x_{t+1}^{i} x t + 1 i are equal to those of x t i x_t^{i} x t i .
Proof of Lemma 18
Using the definitions of W Q , t W_{Q,t} W Q , t , W K , t W_{K,t} W K , t , A t A_t A t and sel t \operatorname{sel}_t sel t , we have
⟨ W Q , t x t i , W K , t x t j ⟩ = ⟨ c A t Π p o s x t i , Π p o s x t j ⟩ = c ⟨ A t e i , e j ⟩ = { c ⟨ e ρ ( t ) , e j ⟩ , i = M , c ⟨ e i , e j ⟩ , i ≠ M . = c χ j ( sel t ( i ) ) . \begin{aligned}
\langle W_{Q,t}x_t^{i},W_{K,t}x_t^{j}\rangle=\langle cA_t\Pi_{\mathrm{pos}}x_t^{i},\Pi_{\mathrm{pos}}x_t^{j}\rangle\\
&=c\langle A_te_i,e_j\rangle=
\begin{cases}
c\langle e_{\rho(t)},e_j\rangle, & i=M,\\
c\langle e_i,e_j\rangle, & i\ne M.
\end{cases}
=c\chi_j(\operatorname{sel}_t(i)).
\end{aligned} ⟨ W Q , t x t i , W K , t x t j ⟩ = ⟨ c A t Π pos x t i , Π pos x t j ⟩ = c ⟨ A t e i , e j ⟩ = { c ⟨ e ρ ( t ) , e j ⟩ , c ⟨ e i , e j ⟩ , i = M , i = M . = c χ j ( sel t ( i )) .
Consequently, the attention scores are in the following form: If j = sel t ( i ) j=\operatorname{sel}_t(i) j = sel t ( i ) , then
a t i sel t ( i ) = exp ( β c χ j ( sel t ( i ) ) ) ∑ j ′ = 1 M exp ( β c χ j ′ ( sel t ( i ) ) ) = exp ( β c χ j ( sel t ( i ) ) ) exp ( β c χ j ( sel t ( i ) ) ) + ∑ j ′ = 1 , j ′ ≠ j M exp ( β c χ j ′ ( sel t ( i ) ) ) = exp ( β c ) exp ( β c ) + M − 1 . \begin{aligned}
a_t^{i\operatorname{sel}_t(i)}=\frac{\exp\left(\beta c\chi_j(\operatorname{sel}_t(i))\right)}{\sum_{j'=1}^{M}\exp\left(\beta c\chi_{j'}(\operatorname{sel}_t(i))\right)} \\
&=\frac{\exp\left(\beta c\chi_j(\operatorname{sel}_t(i))\right)}{\exp\left(\beta c\chi_j(\operatorname{sel}_t(i))\right)+\sum_{j'=1,j'\ne j}^{M}\exp\left(\beta c\chi_{j'}(\operatorname{sel}_t(i))\right)}
=\frac{\exp(\beta c)}{\exp(\beta c)+M-1}.
\end{aligned} a t i sel t ( i ) = ∑ j ′ = 1 M exp ( β c χ j ′ ( sel t ( i )) ) exp ( β c χ j ( sel t ( i )) ) = exp ( β c χ j ( sel t ( i )) ) + ∑ j ′ = 1 , j ′ = j M exp ( β c χ j ′ ( sel t ( i )) ) exp ( β c χ j ( sel t ( i )) ) = exp ( β c ) + M − 1 exp ( β c ) .
If j ≠ sel t ( i ) j\ne\operatorname{sel}_t(i) j = sel t ( i ) , then there exists j ′ ∈ { 1 , … , M } j'\in\{1,\ldots,M\} j ′ ∈ { 1 , … , M } with j ′ ≠ j j'\ne j j ′ = j such that j ′ = sel t ( i ) j'=\operatorname{sel}_t(i) j ′ = sel t ( i ) since ρ \rho ρ is a bijection. Hence, we have
a t i j = exp ( β c ) exp ( β c ) + M − 1 . a_t^{ij}=\frac{\exp(\beta c)}{\exp(\beta c)+M-1}. a t ij = exp ( β c ) + M − 1 exp ( β c ) .
This conclude the proof.
Proof of Lemma 20
Fix t ∈ { 0 , … , M − 1 } t\in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } . By Lemma 17 , the values G ρ ( t ) x t j = ι ( w j ) ( 0 M , 0 , e j , 0 R ) G_{\rho(t)}x_t^{j}=\iota(w_j)(0_M,0,e_j,0_R) G ρ ( t ) x t j = ι ( w j ) ( 0 M , 0 , e j , 0 R ) are deterministically obtained for all j ∈ { 1 , … , M } j\in\{1,\ldots,M\} j ∈ { 1 , … , M } , and they are bounded by R ( s ) R(s) R ( s ) in 2-norm. Then the single layer can be calculated by
∥ ∑ j = 1 M a t M j G ρ ( t ) x t j − G ρ ( t ) x t ρ ( t ) ∥ 2 = ∥ ( a t M ρ ( t ) − 1 ) G ρ ( t ) x t ρ ( t ) + ∑ j = 1 j ≠ ρ ( t ) M a t M j G ρ ( t ) x t j ∥ 2 ≤ ( 1 − a t M ρ ( t ) ) ∥ G ρ ( t ) x t ρ ( t ) ∥ 2 + ∑ j = 1 , j ≠ ρ ( t ) M a t M j ∥ G ρ ( t ) x t j ∥ 2 \begin{aligned}
\left\|\sum_{j=1}^{M}a_t^{Mj}G_{\rho(t)}x_t^{j}-G_{\rho(t)}x_t^{\rho(t)}\right\|_2
=
\left\|(a_t^{M\rho(t)}-1)G_{\rho(t)}x_t^{\rho(t)}
+\sum_{\substack{j=1\\j\ne\rho(t)}}^{M}a_t^{Mj}G_{\rho(t)}x_t^{j}\right\|_2 \\
&\le\left(1-a_t^{M\rho(t)}\right)\lVert G_{\rho(t)}x_t^{\rho(t)}\rVert_2+\sum_{\substack{j=1,\,j\ne\rho(t)}}^{M}a_t^{Mj}\lVert G_{\rho(t)}x_t^j\rVert_2
\end{aligned} j = 1 ∑ M a t M j G ρ ( t ) x t j − G ρ ( t ) x t ρ ( t ) 2 = ( a t M ρ ( t ) − 1 ) G ρ ( t ) x t ρ ( t ) + j = 1 j = ρ ( t ) ∑ M a t M j G ρ ( t ) x t j 2 ≤ ( 1 − a t M ρ ( t ) ) ∥ G ρ ( t ) x t ρ ( t ) ∥ 2 + j = 1 , j = ρ ( t ) ∑ M a t M j ∥ G ρ ( t ) x t j ∥ 2
By Lemma 17, ∥ G ρ ( t ) x t j ∥ 2 = ι ( w j ) ≤ R ( s ) \lVert G_{\rho(t)}x_t^j\rVert_2=\iota(w_j)\le R(s) ∥ G ρ ( t ) x t j ∥ 2 = ι ( w j ) ≤ R ( s ) for all j ∈ { 1 , … , M } j\in\{1,\ldots,M\} j ∈ { 1 , … , M } , ∑ j = 1 j ≠ ρ ( t ) M a t M j = 1 − a t M ρ ( t ) \sum_{\substack{j=1\\j\ne\rho(t)}}^{M}a_t^{Mj}=1-a_t^{M\rho(t)} ∑ j = 1 j = ρ ( t ) M a t M j = 1 − a t M ρ ( t ) , and 1 − a t M ( t ) ≤ ( M − 1 ) e − β c 1-a_t^{M(t)}\le(M-1)e^{-\beta c} 1 − a t M ( t ) ≤ ( M − 1 ) e − β c by Lemma 18, then
≤ R ( s ) ( M − 1 ) e − β c + R ( s ) ( M − 1 ) e − β c = 2 ( M − 1 ) R ( s ) e − β c . \le R(s)(M-1)e^{-\beta c}+R(s)(M-1)e^{-\beta c}
=2(M-1)R(s)e^{-\beta c}. ≤ R ( s ) ( M − 1 ) e − β c + R ( s ) ( M − 1 ) e − β c = 2 ( M − 1 ) R ( s ) e − β c .
Since both recursions of the form z t + 1 = z t + ⋆ z_{t+1}=z_t+\star z t + 1 = z t + ⋆ , the errors are added:
x M M − x ˉ M M = ∑ t = 0 M − 1 ∑ j = 1 M a t M j G ρ ( t ) x t j − G ρ ( t ) x t ρ ( t ) . x_M^M-\bar{x}_M^M=\sum_{t=0}^{M-1}\sum_{j=1}^{M}a_t^{Mj}G_{\rho(t)}x_t^j-G_{\rho(t)}x_t^{\rho(t)}. x M M − x ˉ M M = t = 0 ∑ M − 1 j = 1 ∑ M a t M j G ρ ( t ) x t j − G ρ ( t ) x t ρ ( t ) .
Passing to the norm and applying the triangle inequality, we obtain
∥ x M M − x ˉ M M ∥ 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c , \lVert x_M^M-\bar{x}_M^M\rVert_2\le2M(M-1)R(s)e^{-\beta c}, ∥ x M M − x ˉ M M ∥ 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c ,
which verifies the statement’s claim. ■
Proof of Lemma 23
We write σ \sigma σ for ReLU. Since ζ k \zeta_k ζ k ’s are distinct, the set H k , j : = { a ∈ R d : ⟨ a , ζ k − ζ j ⟩ = 0 } H_{k,j}:=\{a\in\mathbb{R}^d:\langle a,\zeta_k-\zeta_j\rangle=0\} H k , j := { a ∈ R d : ⟨ a , ζ k − ζ j ⟩ = 0 } is a hyperplane in R d \mathbb{R}^d R d , therefore, is of p p p -dimensional Lebesgue measure 0 0 0 . So, the finite union H = ⋃ k ≠ j H k , j H=\bigcup_{k\ne j}H_{k,j} H = ⋃ k = j H k , j is also of d d d -dimensional Lebesgue measure 0 0 0 . Let us pick a ∈ R d ∖ H a\in\mathbb{R}^d\setminus H a ∈ R d ∖ H so that t k t_k t k ’s defined by t k : = ⟨ a , ζ k ⟩ t_k:=\langle a,\zeta_k\rangle t k := ⟨ a , ζ k ⟩ are pairwise distinct. Relabel them so that t 1 < ⋯ < t n t_1<\cdots<t_n t 1 < ⋯ < t n .
We define the slopes
s k = v k + 1 − v k t k + 1 − t k ∈ R ( s ) , t ∈ R + s_k=\frac{v_{k+1}-v_k}{t_{k+1}-t_k}\in\mathbb{R}(s),\qquad t\in\mathbb{R}_+ s k = t k + 1 − t k v k + 1 − v k ∈ R ( s ) , t ∈ R +
for all k = 1 , … , n k=1,\ldots,n k = 1 , … , n with s 0 = 0 s_0=0 s 0 = 0 . Set
g ( t ) : = v 1 + ∑ k = 1 n − 1 ( s k − s k − 1 ) σ ( t − t k ) . g(t):=v_1+\sum_{k=1}^{n-1}(s_k-s_{k-1})\sigma(t-t_k). g ( t ) := v 1 + k = 1 ∑ n − 1 ( s k − s k − 1 ) σ ( t − t k ) .
Then, with an induction argument on k k k , one can easily show that g ( t k ) = v k g(t_k)=v_k g ( t k ) = v k for every k = 1 , … , n − 1 k=1,\ldots,n-1 k = 1 , … , n − 1 .
Finally, we compose φ ( ζ ) : = g ( ⟨ a , ζ ⟩ ) \varphi(\zeta):=g(\langle a,\zeta\rangle) φ ( ζ ) := g (⟨ a , ζ ⟩) , which gives the desired interpolation property φ ( ζ k ) = g ( t k ) = v k \varphi(\zeta_k)=g(t_k)=v_k φ ( ζ k ) = g ( t k ) = v k . For the Lipschitz constant, take ζ , ζ ′ ∈ R d \zeta,\zeta'\in\mathbb{R}^d ζ , ζ ′ ∈ R d
∥ φ ( ζ ) − φ ( ζ ′ ) ∥ 2 ≤ ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 ∣ σ ( ⟨ a , ζ ⟩ ) − σ ( ⟨ a , ζ ′ ⟩ ) ∣ ≤ ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 ∣ ⟨ a , ζ ⟩ − ⟨ a , ζ ′ ⟩ ∣ ( ⋆ ) ≤ ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 ∣ ⟨ a , ζ − ζ ′ ⟩ ∣ ≤ ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 ∥ a ∥ 2 ∥ ζ − ζ ′ ∥ 2 . \begin{aligned}
\lVert\varphi(\zeta)-\varphi(\zeta')\rVert_2\le\sum_{k=0}^{n-1}\lVert s_k-s_{k-1}\rVert_2\lvert\sigma(\langle a,\zeta\rangle)-\sigma(\langle a,\zeta'\rangle)\rvert\\
&\le\sum_{k=0}^{n-1}\lVert s_k-s_{k-1}\rVert_2\lvert\langle a,\zeta\rangle-\langle a,\zeta'\rangle\rvert\qquad(\star) \\
&\le\sum_{k=0}^{n-1}\lVert s_k-s_{k-1}\rVert_2\lvert\langle a,\zeta-\zeta'\rangle\rvert
\le\sum_{k=0}^{n-1}\lVert s_k-s_{k-1}\rVert_2\lVert a\rVert_2\lVert\zeta-\zeta'\rVert_2.
\end{aligned} ∥ φ ( ζ ) − φ ( ζ ′ ) ∥ 2 ≤ k = 0 ∑ n − 1 ∥ s k − s k − 1 ∥ 2 ∣ σ (⟨ a , ζ ⟩) − σ (⟨ a , ζ ′ ⟩)∣ ≤ k = 0 ∑ n − 1 ∥ s k − s k − 1 ∥ 2 ∣⟨ a , ζ ⟩ − ⟨ a , ζ ′ ⟩∣ ( ⋆ ) ≤ k = 0 ∑ n − 1 ∥ s k − s k − 1 ∥ 2 ∣⟨ a , ζ − ζ ′ ⟩∣ ≤ k = 0 ∑ n − 1 ∥ s k − s k − 1 ∥ 2 ∥ a ∥ 2 ∥ ζ − ζ ′ ∥ 2 .
Therefore L φ : = ∥ a ∥ 2 ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 < + ∞ L_{\varphi} := \lVert a\rVert_{2}\sum_{k=0}^{n-1}\lVert s_k-s_{k-1}\rVert_{2}<+\infty L φ := ∥ a ∥ 2 ∑ k = 0 n − 1 ∥ s k − s k − 1 ∥ 2 < + ∞ since it is a finite sum. In above, ( ⋆ ) (\star) ( ⋆ ) is due to 1-Lipschitzness of ReLU and the last majorization is due to the Cauchy-Bunyakovsky-Schwarz inequality.
Proof of Lemma 24
We prove step-by-step:
Proof of (i). By Lemma 20, we have x ˉ M M : = [ e M ι ( w M ) ( ι ( w 1 ) , … , ι ( w M ) ) 0 R ] \bar{x}^{M}_{M}:=[e_M\ \iota(w_M)\ (\iota(w_1),\ldots,\iota(w_M))\ 0_{\mathbb{R}}] x ˉ M M := [ e M ι ( w M ) ( ι ( w 1 ) , … , ι ( w M )) 0 R ] . With the choice of a a a , the result is evident. For the norm:
∥ a ∥ 2 2 = ∑ j = 1 M ( R ( s ) 2 ) j − 1 = R ( s ) 2 M − 1 R ( s ) 2 − 1 ≤ R ( s ) 2 M − 1 R ( s ) ≤ R ( s ) 2 M − 1 . \lVert a\rVert_2^2=\sum_{j=1}^{M}(R(s)^2)^{j-1}=\frac{R(s)^{2M}-1}{R(s)^2-1}\leq\frac{R(s)^{2M}-1}{R(s)}\leq R(s)^{2M-1}. ∥ a ∥ 2 2 = j = 1 ∑ M ( R ( s ) 2 ) j − 1 = R ( s ) 2 − 1 R ( s ) 2 M − 1 ≤ R ( s ) R ( s ) 2 M − 1 ≤ R ( s ) 2 M − 1 .
This gives that ∥ a ∥ 2 ≤ R ( s ) M − 1 / 2 ≤ R ( s ) M \lVert a\rVert_2\leq R(s)^{M-1/2}\leq R(s)^M ∥ a ∥ 2 ≤ R ( s ) M − 1/2 ≤ R ( s ) M . Finally, considering that ι ( w ) ↦ ι ( w ) − 1 \iota(w)\mapsto\iota(w)-1 ι ( w ) ↦ ι ( w ) − 1 is an injective map from { 1 , … , R ( s ) M } \{1,\ldots,R(s)^M\} { 1 , … , R ( s ) M } to { 0 , … , R ( s ) M − 1 } \{0,\ldots,R(s)^M-1\} { 0 , … , R ( s ) M − 1 } for any w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , t k + 1 − t k ≥ 1 t_{k+1}-t_k\geq1 t k + 1 − t k ≥ 1 can be obtained via the same argument in Corollary 21.
Proof of (ii). First we note that P ^ r M , s \hat{P}^{M,s}_r P ^ r M , s satisfies: min y ^ ∈ Λ s , w ^ ∈ Λ s M P ^ r M , s ( y ^ ∣ w ^ ) ≥ q min μ min s \min_{\hat{y}\in\Lambda_s,\ \hat{w}\in\Lambda_s^M}\hat{P}^{M,s}_r(\hat{y}\mid\hat{w})\geq q_{\min}\mu_{\min}^s min y ^ ∈ Λ s , w ^ ∈ Λ s M P ^ r M , s ( y ^ ∣ w ^ ) ≥ q m i n μ m i n s since for any y ^ ∈ Λ s \hat{y}\in\Lambda_s y ^ ∈ Λ s and w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M we have
P ^ r M , s ( y ^ ∣ w ^ ) = E [ Pr ( Y r + 1 ∈ C ( s , i ) ∣ Z r + 1 ) ∣ q M , s ( Y r − M + 1 : r ) = w ^ ] = ∫ C ( s , i ) μ ( d y ) ψ ( y ∣ Z r + 1 ) ≥ q min ∫ C ( s , i ) μ ( d y ) (by Assumption 3-(A2)) ≥ q min μ min s (by Assumption 3-(A4)) . \begin{aligned}
\hat{P}^{M,s}_r(\hat{y}\mid\hat{w})=\mathbb{E}\left[\Pr(Y_{r+1}\in C(s,i)\mid Z_{r+1})\mid q^{M,s}(Y_{r-M+1:r})=\hat{w}\right] \\
&=\int_{C(s,i)}\mu(\mathrm{d}y)\,\psi(y\mid Z_{r+1}) \\
&\geq q_{\min}\int_{C(s,i)}\mu(\mathrm{d}y)\qquad\text{(by Assumption 3-(A2))} \\
&\geq q_{\min}\mu_{\min}^s\qquad\text{(by Assumption 3-(A4))}.
\end{aligned} P ^ r M , s ( y ^ ∣ w ^ ) = E [ Pr ( Y r + 1 ∈ C ( s , i ) ∣ Z r + 1 ) ∣ q M , s ( Y r − M + 1 : r ) = w ^ ] = ∫ C ( s , i ) μ ( d y ) ψ ( y ∣ Z r + 1 ) ≥ q m i n ∫ C ( s , i ) μ ( d y ) (by Assumption 3-(A2)) ≥ q m i n μ m i n s (by Assumption 3-(A4)) .
Since the targets are of the form v w = log P ^ r M , s ( ⋅ ∣ w ) v_w=\log\hat{P}^{M,s}_r(\cdot\mid w) v w = log P ^ r M , s ( ⋅ ∣ w ) , we have { ( v w ) y } y ∈ Λ s ∈ [ − log 1 q min μ min s , 0 ] \{(v_w)_y\}_{y\in\Lambda_s}\in\left[-\log\frac{1}{q_{\min}\mu_{\min}^s},0\right] {( v w ) y } y ∈ Λ s ∈ [ − log q m i n μ m i n s 1 , 0 ] . Fix k = 1 , … , R ( s ) M − 1 k=1,\ldots,R(s)^M-1 k = 1 , … , R ( s ) M − 1 , then
∥ v w ∥ 2 = ∑ y ∈ Λ s ( v w ) y 2 ≤ log 1 q min μ min s R ( s ) . \lVert v_w\rVert_2=\sqrt{\sum_{y\in\Lambda_s}(v_w)_y^2}\leq\log\frac{1}{q_{\min}\mu_{\min}^s}\sqrt{R(s)}. ∥ v w ∥ 2 = y ∈ Λ s ∑ ( v w ) y 2 ≤ log q m i n μ m i n s 1 R ( s ) .
From here, by an application of the triangle inequality, we obtain
∥ v k + 1 − v k ∥ 2 ≤ 2 log 1 q min μ min s R ( s ) . \lVert v_{k+1}-v_k\rVert_2\leq2\log\frac{1}{q_{\min}\mu_{\min}^s}\sqrt{R(s)}. ∥ v k + 1 − v k ∥ 2 ≤ 2 log q m i n μ m i n s 1 R ( s ) .
With t k + 1 − t k ≥ 1 t_{k+1}-t_k\geq1 t k + 1 − t k ≥ 1 from (i), it follows that ∥ s k ∥ 2 ≤ 2 log 1 q min μ min s R ( s ) \lVert s_k\rVert_2\leq2\log\frac{1}{q_{\min}\mu_{\min}^s}\sqrt{R(s)} ∥ s k ∥ 2 ≤ 2 log q m i n μ m i n s 1 R ( s ) . Likewise, this leads us to ∥ s k + 1 − s k ∥ 2 ≤ 4 log 1 q min μ min s R ( s ) \lVert s_{k+1}-s_k\rVert_2\leq4\log\frac{1}{q_{\min}\mu_{\min}^s}\sqrt{R(s)} ∥ s k + 1 − s k ∥ 2 ≤ 4 log q m i n μ m i n s 1 R ( s ) . Hence,
L φ ≤ ∥ a ∥ 2 ∑ k = 1 R ( s ) M − 1 ∥ s k + 1 − s k ∥ 2 ≤ R ( s ) M − 1 / 2 ( R ( s ) M − 1 ) 4 R ( s ) log 1 q min μ min s = 4 R ( s ) M ( R ( s ) M − 1 ) log 1 q min μ min s , \begin{aligned}
L_{\varphi}\leq\lVert a\rVert_2\sum_{k=1}^{R(s)^M-1}\lVert s_{k+1}-s_k\rVert_2\leq R(s)^{M-1/2}(R(s)^M-1)4\sqrt{R(s)}\log\frac{1}{q_{\min}\mu_{\min}^s} \\
&=4R(s)^M(R(s)^M-1)\log\frac{1}{q_{\min}\mu_{\min}^s},
\end{aligned} L φ ≤ ∥ a ∥ 2 k = 1 ∑ R ( s ) M − 1 ∥ s k + 1 − s k ∥ 2 ≤ R ( s ) M − 1/2 ( R ( s ) M − 1 ) 4 R ( s ) log q m i n μ m i n s 1 = 4 R ( s ) M ( R ( s ) M − 1 ) log q m i n μ m i n s 1 ,
which gives the bound in the statement.
Proof of Theorem 25
Fix w ∈ Λ s M w \in\Lambda_s^M w ∈ Λ s M . Let z ( w ) : = Π log x M + 1 M z(w) := \Pi_{\log x_{M+1}^M} z ( w ) := Π l o g x M + 1 M for the logits produced from the interpolator layer and z ˉ ( w ) : = log P ^ r M , s ( ⋅ ∣ w ) \bar{z}(w) := \log\hat{P}_r^{M,s}(\cdot\mid w) z ˉ ( w ) := log P ^ r M , s ( ⋅ ∣ w ) for the log-targets. Let { x t M , ( w ) } t = 0 M + 1 \{x_t^{M,(w)}\}_{t=0}^{M+1} { x t M , ( w ) } t = 0 M + 1 be the hard-choice trajectory as in Lemma 20. By Corollary 21, the readouts are separated by at least 1 in norm, which enables us to invoke Lemma 23 to construct a one layer ReLU network φ : R d → R R ( s ) \varphi: \mathbb{R}^d \to\mathbb{R}^{R(s)} φ : R d → R R ( s ) with φ ( x ˉ M M , ( w ) ) = z ˉ ( w ) \varphi(\bar{x}_M^{M,(w)}) = \bar{z}(w) φ ( x ˉ M M , ( w ) ) = z ˉ ( w ) . Since P ^ r M , s ( ⋅ ∣ w ) \hat{P}_r^{M,s}(\cdot\mid w) P ^ r M , s ( ⋅ ∣ w ) is a probability vector, we get
softmax ( z ˉ ( w ) ) v = exp ( log P ^ r M , s ( v ∣ w ) ) ∑ v ′ ∈ Λ s exp ( log P ^ r M , s ( v ′ ∣ w ) ) = P ^ r M , s ( v ∣ w ) ∑ v ′ ∈ Λ s P ^ r M , s ( v ′ ∣ w ) = P ^ r M , s ( v ∣ w ) \operatorname{softmax}(\bar{z}(w))_v = \frac{\exp(\log\hat{P}_r^{M,s}(v \mid w))}{\sum_{v' \in\Lambda_s} \exp(\log\hat{P}_r^{M,s}(v' \mid w))} = \frac{\hat{P}_r^{M,s}(v \mid w)}{\sum_{v' \in\Lambda_s} \hat{P}_r^{M,s}(v' \mid w)} = \hat{P}_r^{M,s}(v \mid w) softmax ( z ˉ ( w ) ) v = ∑ v ′ ∈ Λ s exp ( log P ^ r M , s ( v ′ ∣ w )) exp ( log P ^ r M , s ( v ∣ w )) = ∑ v ′ ∈ Λ s P ^ r M , s ( v ′ ∣ w ) P ^ r M , s ( v ∣ w ) = P ^ r M , s ( v ∣ w )
exactly. Let us compute the error now: By Lemma 20, we already know
∥ x M M , ( w ) − x ˉ M M , ( w ) ∥ 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c . \left\|x_M^{M,(w)}-\bar{x}_M^{M,(w)}\right\|_2 \leq2M(M-1)R(s)e^{-\beta c}. x M M , ( w ) − x ˉ M M , ( w ) 2 ≤ 2 M ( M − 1 ) R ( s ) e − β c .
Since z ( w ) = φ ( x M ( w ) ) z(w)=\varphi(x_M^{(w)}) z ( w ) = φ ( x M ( w ) ) and x ˉ ( w ) = φ ( x ˉ M M , ( w ) ) \bar{x}(w)=\varphi(\bar{x}_M^{M,(w)}) x ˉ ( w ) = φ ( x ˉ M M , ( w ) ) ,
∥ z ( w ) − z ˉ ( w ) ∥ ∞ ≤ ∥ z ( w ) − z ˉ ( w ) ∥ 2 ≤ L φ ∥ x M M , ( w ) − x ˉ M M , ( w ) ∥ 2 ≤ 8 log 1 q min μ min s R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c (31) \begin{aligned}
\|z(w)-\bar{z}(w)\|_\infty&\leq\|z(w)-\bar{z}(w)\|_2 \\
&\leq L_\varphi\|x_M^{M,(w)}-\bar{x}_M^{M,(w)}\|_2 \\
&\leq8\log\frac{1}{q_{\min}\mu_{\min}^s}R(s)^{M+1}(R(s)^M-1)M(M-1)e^{-\beta c} \tag*{(31)}
\end{aligned} ∥ z ( w ) − z ˉ ( w ) ∥ ∞ ≤ ∥ z ( w ) − z ˉ ( w ) ∥ 2 ≤ L φ ∥ x M M , ( w ) − x ˉ M M , ( w ) ∥ 2 ≤ 8 log q m i n μ m i n s 1 R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c (31)
by Lemmata 24 and 23, which are invoked to obtain the fact that the ReLU network is Lipschitz and the explicit Lipschitz constant L φ L_\varphi L φ . We choose β \beta β large enough to ensure that
8 log 1 q min μ min s R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c ≤ ϵ 2 . (32) 8\log\frac{1}{q_{\min}\mu_{\min}^s}R(s)^{M+1}(R(s)^M-1)M(M-1)e^{-\beta c}\leq\frac{\epsilon}{2}. \tag*{(32)} 8 log q m i n μ m i n s 1 R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c ≤ 2 ϵ . (32)
Solving for β \beta β gives exactly the same bound in the hypothesis.
Recall that T ( ⋅ ∣ w ) = softmax ( z ( w ) ) T(\cdot\mid w)=\operatorname{softmax}(z(w)) T ( ⋅ ∣ w ) = softmax ( z ( w )) and P ^ r M , s ( ⋅ ∣ w ) : = softmax ( z ˉ ( w ) ) \hat{P}_r^{M,s}(\cdot\mid w):=\operatorname{softmax}(\bar{z}(w)) P ^ r M , s ( ⋅ ∣ w ) := softmax ( z ˉ ( w )) . Then
∥ P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ T V = ∥ softmax ( z ˉ ( w ) ) − softmax ( z ( w ) ) ∥ T V = 1 2 ∥ softmax ( z ˉ ( w ) ) − softmax ( z ( w ) ) ∥ 1 = 1 2 ∑ v ∈ Λ s ∣ softmax ( z ˉ ( w ) ) v − softmax ( z ( w ) ) v ∣ = 1 2 ∑ v ∈ Λ s softmax ( z ˉ ( w ) ) v ∣ softmax ( z ( w ) ) v softmax ( z ˉ ( w ) ) v − 1 ∣ = 1 2 ∑ v ∈ Λ s softmax ( z ˉ ( w ) ) v ∣ e z ( w ) v ∑ u ∈ Λ s e z ( w ) u ⋅ ∑ u ∈ Λ s e z ˉ ( w ) u e z ˉ ( w ) v − 1 ∣ = 1 2 ∑ v ∈ Λ s softmax ( z ˉ ( w ) ) v ∣ e z ( w ) v − z ˉ ( w ) v ∑ u ∈ Λ s e z ˉ ( w ) u ∑ u ∈ Λ s e z ( w ) u ⏟ ( b ) − 1 ∣ . \begin{aligned}
\|\hat{P}_r^{M,s}(\cdot\mid w)-T(\cdot\mid w)\|_{\mathrm{TV}}
&=\|\operatorname{softmax}(\bar{z}(w))-\operatorname{softmax}(z(w))\|_{\mathrm{TV}}\\
&=\frac{1}{2}\|\operatorname{softmax}(\bar{z}(w))-\operatorname{softmax}(z(w))\|_1\\
&=\frac{1}{2}\sum_{v\in\Lambda_s}\left|\operatorname{softmax}(\bar{z}(w))_v-\operatorname{softmax}(z(w))_v\right|\\
&=\frac{1}{2}\sum_{v\in\Lambda_s}\operatorname{softmax}(\bar{z}(w))_v\left|\frac{\operatorname{softmax}(z(w))_v}{\operatorname{softmax}(\bar{z}(w))_v}-1\right|\\
&=\frac{1}{2}\sum_{v\in\Lambda_s}\operatorname{softmax}(\bar{z}(w))_v\left|\frac{e^{z(w)_v}}{\sum_{u\in\Lambda_s}e^{z(w)_u}}\cdot\frac{\sum_{u\in\Lambda_s}e^{\bar{z}(w)_u}}{e^{\bar{z}(w)_v}}-1\right|\\
&=\frac{1}{2}\sum_{v\in\Lambda_s}\operatorname{softmax}(\bar{z}(w))_v\left|e^{z(w)_v-\bar{z}(w)_v}\underbrace{\frac{\sum_{u\in\Lambda_s}e^{\bar{z}(w)_u}}{\sum_{u\in\Lambda_s}e^{z(w)_u}}}_{(b)}-1\right|.
\end{aligned} ∥ P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ TV = ∥ softmax ( z ˉ ( w )) − softmax ( z ( w )) ∥ TV = 2 1 ∥ softmax ( z ˉ ( w )) − softmax ( z ( w )) ∥ 1 = 2 1 v ∈ Λ s ∑ ∣ softmax ( z ˉ ( w ) ) v − softmax ( z ( w ) ) v ∣ = 2 1 v ∈ Λ s ∑ softmax ( z ˉ ( w ) ) v softmax ( z ˉ ( w ) ) v softmax ( z ( w ) ) v − 1 = 2 1 v ∈ Λ s ∑ softmax ( z ˉ ( w ) ) v ∑ u ∈ Λ s e z ( w ) u e z ( w ) v ⋅ e z ˉ ( w ) v ∑ u ∈ Λ s e z ˉ ( w ) u − 1 = 2 1 v ∈ Λ s ∑ softmax ( z ˉ ( w ) ) v e z ( w ) v − z ˉ ( w ) v ( b ) ∑ u ∈ Λ s e z ( w ) u ∑ u ∈ Λ s e z ˉ ( w ) u − 1 .
( ⋆ ) (\star) ( ⋆ ) : Writing ε ′ : = 8 log 1 q min μ min s R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c \varepsilon' := 8\log\frac{1}{q_{\min}\mu_{\min}^{s}}R(s)^{M+1}(R(s)^M-1)M(M-1)e^{-\beta c} ε ′ := 8 log q m i n μ m i n s 1 R ( s ) M + 1 ( R ( s ) M − 1 ) M ( M − 1 ) e − β c from (31), it follows that ( a ) ∈ [ e − ε ′ , e ε ′ ] (a) \in[e^{-\varepsilon'},e^{\varepsilon'}] ( a ) ∈ [ e − ε ′ , e ε ′ ] , which also gives e − ε ′ e z ˉ ( w ) u ≤ e z ( w ) u ≤ e ε ′ e z ˉ ( w ) u e^{-\varepsilon'}e^{\bar{z}(w)u} \le e^{z(w)u} \le e^{\varepsilon'}e^{\bar{z}(w)u} e − ε ′ e z ˉ ( w ) u ≤ e z ( w ) u ≤ e ε ′ e z ˉ ( w ) u . Summing over u u u and taking the reciprocals yield the fact that ( b ) ∈ [ e − ε ′ , e ε ′ ] (b) \in[e^{-\varepsilon'},e^{\varepsilon'}] ( b ) ∈ [ e − ε ′ , e ε ′ ] as well. Thus,
≤ max { e 2 ε ′ − 1 , 1 − e − 2 ε ′ } = e 2 ε ′ − 1. \le\max\{e^{2\varepsilon'}-1,1-e^{-2\varepsilon'}\}=e^{2\varepsilon'}-1. ≤ max { e 2 ε ′ − 1 , 1 − e − 2 ε ′ } = e 2 ε ′ − 1.
By the convexity of the exponential function e 2 ε ′ − 1 ≤ 2 ε ′ e^{2\varepsilon'}-1 \le2\varepsilon' e 2 ε ′ − 1 ≤ 2 ε ′ . Hence,
∥ P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ T V ≤ 2 ε ′ . \left\|\hat{P}^{M,s}_r(\cdot\mid w)-T(\cdot\mid w)\right\|_{\mathrm{TV}}\le2\varepsilon'. P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) TV ≤ 2 ε ′ .
From (32) and the definition of ε ′ \varepsilon' ε ′ , we have
∥ P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) ∥ T V ≤ ε , \left\|\hat{P}^{M,s}_r(\cdot\mid w)-T(\cdot\mid w)\right\|_{\mathrm{TV}}\le\varepsilon, P ^ r M , s ( ⋅ ∣ w ) − T ( ⋅ ∣ w ) TV ≤ ε ,
which concludes the part (i) since the bounds are independent of the choice of w ∈ Λ s M w \in\Lambda^M_s w ∈ Λ s M .
Proof of (ii). By ( ⋆ ) (\star) ( ⋆ ) , T ( v ∣ w ) = softmax ( z ( w ) ) v ≥ softmax ( z ˉ ( w ) ) v e − 2 ε ′ T(v \mid w)=\operatorname{softmax}(z(w))_v \ge\operatorname{softmax}(\bar{z}(w))_v e^{-2\varepsilon'} T ( v ∣ w ) = softmax ( z ( w ) ) v ≥ softmax ( z ˉ ( w ) ) v e − 2 ε ′ for all v ∈ Λ s v \in\Lambda_s v ∈ Λ s . Since softmax ( z ˉ ( w ) ) = P ^ r M , s ( ⋅ ∣ w ) \operatorname{softmax}(\bar{z}(w))=\hat{P}^{M,s}_r(\cdot\mid w) softmax ( z ˉ ( w )) = P ^ r M , s ( ⋅ ∣ w ) and from the proof of Lemma 24,
T ( v ∣ w ) ≥ softmax ( z ˉ ( w ) ) v e − 2 ε ′ = P ^ r M , s ( v ∣ w ) e − 2 ε ′ ≥ q min μ min s e − 2 ε ′ ≥ q min μ min s e − 2 ε . T(v \mid w)\ge\operatorname{softmax}(\bar{z}(w))_v e^{-2\varepsilon'}=\hat{P}^{M,s}_r(v \mid w)e^{-2\varepsilon'}\ge q_{\min}\mu_{\min}^{s}e^{-2\varepsilon'}\ge q_{\min}\mu_{\min}^{s}e^{-2\varepsilon}. T ( v ∣ w ) ≥ softmax ( z ˉ ( w ) ) v e − 2 ε ′ = P ^ r M , s ( v ∣ w ) e − 2 ε ′ ≥ q m i n μ m i n s e − 2 ε ′ ≥ q m i n μ m i n s e − 2 ε .
The bound is uniform for all v ∈ Λ s v \in\Lambda_s v ∈ Λ s , thereby, the claim follows. ■
Proofs of the Results in Section 5
Auxiliary Results
In this part, we give all the necessary tools for proving Theorem 27. Throughout, we fix M M M and s s s in accordance with Corollary 13 and the conditions therein, that are; under Assumption 3 and α = ( 1 − δ ( T ) ) ( 2 − δ ( Q ) ) < 1 \alpha=(1-\delta(\mathbb{T}))(2-\delta(\mathbb{Q}))<1 α = ( 1 − δ ( T )) ( 2 − δ ( Q )) < 1 , M M M and s s s have to satisfy:
M ≥ N ⌈ log ( 2 / ε ) / log ( 1 / α ) ⌉ M \ge N\lceil\log(2/\varepsilon)/\log(1/\alpha)\rceil M ≥ N ⌈ log ( 2/ ε ) / log ( 1/ α )⌉ ,
s ≥ 4 M L ψ / ( q min ε ) s \ge4ML\psi/(q_{\min}\varepsilon) s ≥ 4 M L ψ / ( q m i n ε ) .
Definition 32. Let M X , M U ∈ N M_{\mathsf{X}},M_{\mathsf{U}}\in\mathbb{N} M X , M U ∈ N . We say that the triple ( n , m , l ) ∈ N 3 (n,m,l)\in\mathbb{N}^3 ( n , m , l ) ∈ N 3 are aligning quantization levels if the following hold:
(i) 2 M X n − 1 = 1 K X \frac{2M_{\mathsf{X}}}{n-1}=\frac{1}{K_{\mathsf{X}}} n − 1 2 M X = K X 1 for some K X ∈ N K_{\mathsf{X}}\in\mathbb{N} K X ∈ N ;
(ii) 2 M U m − 1 = 1 K U \frac{2M_{\mathsf{U}}}{m-1}=\frac{1}{K_{\mathsf{U}}} m − 1 2 M U = K U 1 for some K U ∈ N K_{\mathsf{U}}\in\mathbb{N} K U ∈ N and c = M U c=M_{\mathsf{U}} c = M U , where c c c is (20);
(iii) M M M divides l − 1 l-1 l − 1 .
Due to Definition 32, we have that X n ⊃ ( [ − M X , M X ] ∩ Z ) d \mathsf{X}_n \supset([-M_{\mathsf{X}},M_{\mathsf{X}}]\cap\mathbb{Z})^d X n ⊃ ([ − M X , M X ] ∩ Z ) d and the grid of U m \mathsf{U}_m U m contains [ − M U , M U ] ∩ Z [-M_{\mathsf{U}},M_{\mathsf{U}}]\cap\mathbb{Z} [ − M U , M U ] ∩ Z in each entry. Indeed, since M X ∈ N M_{\mathsf{X}}\in\mathbb{N} M X ∈ N , every integer p ∈ [ − M X , M X ] p\in[-M_{\mathsf{X}},M_{\mathsf{X}}] p ∈ [ − M X , M X ] is the grid point − M X + 2 M X k ^ n − 1 -M_{\mathsf{X}}+\frac{2M_{\mathsf{X}}\hat{k}}{n-1} − M X + n − 1 2 M X k ^ with k ^ = ( p + M X ) K X ∈ { 0 , … , n − 1 } \hat{k}=(p+M_{\mathsf{X}})K_{\mathsf{X}}\in\{0,\ldots,n-1\} k ^ = ( p + M X ) K X ∈ { 0 , … , n − 1 } , and the same argument applies to U m \mathsf{U}_m U m . In other words, the state and action quantization preserve integer values within the diameter of the ambient spaces. This is an important feature since the weights in the gatherer layers in §4.1.2 are { − 1 , 0 , c , 1 } \{-1,0,c,1\} { − 1 , 0 , c , 1 } -valued. If ( n , m , l ) (n,m,l) ( n , m , l ) are aligning quantization levels, then the weights of §4.1.2 live in U m \mathsf{U}_m U m . On the other hand, the condition (iii) results in no error due to quantization of measure-states since M ∣ l − 1 M\mid l-1 M ∣ l − 1 ensures that any mass, which is an integer multiple of 1 M \frac{1}{M} M 1 , is a grid value of P l ( X n ) \mathcal{P}_l(\mathsf{X}_n) P l ( X n ) , and hence remains invariant under the measure quantization.
Lemma 33. Assume that ( n , m , l ) ∈ N 3 (n,m,l) \in\mathbb{N}^{3} ( n , m , l ) ∈ N 3 are chosen so that they are aligning quantization levels and that M X ≥ R ( s ) M_{\mathrm{X}} \ge R(s) M X ≥ R ( s ) . Then, along the trajectory of the constructed Transformer, for any w ∈ Λ s M w \in\Lambda_{\mathrm{s}}^{M} w ∈ Λ s M , the following assertions are true:
(a) The weights defined in §4.1.2 live in U m \mathbb{U}_{m} U m ;
(b) Π p o s Q n ( x ) = Π p o s x \Pi_{\mathrm{pos}}Q_{n}(x) = \Pi_{\mathrm{pos}}x Π pos Q n ( x ) = Π pos x and Π t o k Q n ( x ) = Π t o k x \Pi_{\mathrm{tok}}Q_{n}(x) = \Pi_{\mathrm{tok}}x Π tok Q n ( x ) = Π tok x for every token x x x along the trajectory;
(c) the attention scores are exactly c χ selt ( i ) ( j ) c\chi_{\operatorname{selt}(i)}(j) c χ selt ( i ) ( j ) , and the measure states passing through the Transformer layers have atoms carrying mass exactly 1 / M 1/M 1/ M ;
(d) the only quantization error is due to Q n Q_{n} Q n being applied on the gather coordinates, which is of size at most M X d / ( n − 1 ) M_{\mathrm{X}}\sqrt{d}/(n-1) M X d / ( n − 1 ) per layer.
Proof. We prove step-by-step:
Proof of (a). Recall that W W = [ I d − I d ] W_{W} = [I_{d} - I_{d}] W W = [ I d − I d ] and W A = W W T W_{A} = W_{W}^{T} W A = W W T , therefore, all components of W W W_{W} W W and W A W_{A} W A are in { − 1 , 0 , 1 } \{-1,0,1\} { − 1 , 0 , 1 } . In addition, W b W_{b} W b is the zero vector. W K , t = Π p o s W_{K,t} = \Pi_{\mathrm{pos}} W K , t = Π pos is a coordinate projection, hence, all components are 0 , 1 0,1 0 , 1 as well. The value matrix W V , t = G ρ ( t ) = [ 0 M 0 e ρ ( t ) 0 R ( s ) ] T Π t o k W_{V,t} = G_{\rho(t)} = [0_{M}\ 0\ e_{\rho(t)}\ 0_{R(s)}]^{T}\Pi_{\mathrm{tok}} W V , t = G ρ ( t ) = [ 0 M 0 e ρ ( t ) 0 R ( s ) ] T Π tok has components with values in { 0 , 1 } \{0,1\} { 0 , 1 } too. Finally, W Q , t W_{Q,t} W Q , t is c A t Π p o s cA_{t}\Pi_{\mathrm{pos}} c A t Π pos where A t A_{t} A t is a 0 , 1 0,1 0 , 1 matrix. Because of the factor c c c , W Q , t W_{Q,t} W Q , t is component-wise { 0 , c } \{0,c\} { 0 , c } -valued. By Definition 32-(ii), c = M U c=M_{\mathbb{U}} c = M U , so − 1 , 0 , 1 , c -1,0,1,c − 1 , 0 , 1 , c are integers in [ − M U , M U ] [-M_{\mathbb{U}},M_{\mathbb{U}}] [ − M U , M U ] , hence grid points of U m \mathbb{U}_{m} U m . Therefore, ( W W , t , W A , t , W b , t , W Q , t , W K , t , W V , t ) ∈ U m (W_{W,t},W_{A,t},W_{b,t},W_{Q,t},W_{K,t},W_{V,t}) \in\mathbb{U}_{m} ( W W , t , W A , t , W b , t , W Q , t , W K , t , W V , t ) ∈ U m .
Proof of (b). From Definition 32, X n \mathcal{X}_{n} X n contains all integers in [ − M X , M X ] [-M_{\mathrm{X}},M_{\mathrm{X}}] [ − M X , M X ] in each coordinate. Since M X ≥ R ( s ) M_{\mathrm{X}} \ge R(s) M X ≥ R ( s ) and ι ( w i ) ∈ { 1 , … , R ( s ) } \iota(w_{i}) \in\{1,\ldots,R(s)\} ι ( w i ) ∈ { 1 , … , R ( s )} for all w i ∈ Λ s w_{i} \in\Lambda_{s} w i ∈ Λ s , the token values are such integers, and so are the positional coordinates, which lie in { 0 , 1 } \{0,1\} { 0 , 1 } . These coordinates are not changed by the attention blocks (Lemma 17 , whose argument applies verbatim to the quantized trajectory). Since X n \mathcal{X}_{n} X n is a product grid, Q n Q_{n} Q n acts coordinate-wise. Therefore the state quantizer Q n Q_{n} Q n must fix positional and token value components of each token.
Proof of (c). By (b), the attention scores are computed from the exact positional blocks with exact W Q , t , W K , t W_{Q,t},W_{K,t} W Q , t , W K , t by (a). Therefore, Lemma 18 applies directly. For the weights, each measure is supported on M M M atoms of mass 1 / M 1/M 1/ M , since the positional encodings of the tokens are distinct, and 1 / M = ( l − 1 ) / M l − 1 1/M = \frac{(l-1)/M}{l-1} 1/ M = l − 1 ( l − 1 ) / M is a grid value of P l ( X n ) \mathcal{P}_{l}(\mathcal{X}_{n}) P l ( X n ) by Definition 32-(iii). Therefore R l R_{l} R l fixes the measure states.
Proof of (d). Each gather coordinate is of the form ∑ j = 1 M a ^ t i j ( w j ) \sum_{j=1}^{M}\hat{a}_{t}^{ij}(w_{j}) ∑ j = 1 M a ^ t ij ( w j ) , which is not an integer in general. Therefore, Q n Q_{n} Q n does not fix it, but moves it by at most the grid spacings, which is M X d / ( n − 1 ) M_{\mathrm{X}}\sqrt{d}/(n-1) M X d / ( n − 1 ) .
Lemma 34. Assume that ( n , m , l ) ∈ N 3 (n,m,l) \in\mathbb{N}^{3} ( n , m , l ) ∈ N 3 are chosen so that they are aligning quantization levels and that M X , M U M_{\mathrm{X}}, M_{\mathbb{U}} M X , M U satisfy (23) . Then for every w ∈ Λ s M w \in\Lambda_{\mathrm{s}}^{M} w ∈ Λ s M ,
∥ z ^ ( w ) − z ˉ ( w ) ∥ ∞ ≤ M X d R ( s ) 3 M − 1 2 M U d s m − 1 + L φ ( M X d n − 1 + 2 M ( M − 1 ) R ( s ) e − β c ) , \left\|\hat{z}(w)-\bar{z}(w)\right\|_{\infty} \le M_{\mathrm{X}}\sqrt{d}R(s)^{\frac{3M-1}{2}}\frac{M_{\mathbb{U}}d_{\mathrm{s}}}{m-1}+L_{\varphi}\left(\frac{M_{\mathrm{X}}\sqrt{d}}{n-1}+2M(M-1)R(s)e^{-\beta c}\right), ∥ z ^ ( w ) − z ˉ ( w ) ∥ ∞ ≤ M X d R ( s ) 2 3 M − 1 m − 1 M U d s + L φ ( n − 1 M X d + 2 M ( M − 1 ) R ( s ) e − β c ) , where z ˉ \bar{z} z ˉ is as in Theorem 25 and z ^ \hat{z} z ^ is the logits produced by the quantized weights before the last application of Q n Q_{n} Q n .
Proof. Let x ˉ t i \bar{x}^{i}_{t} x ˉ t i be the unquantized trajectory given by Lemma 20 , x ^ t i \hat{x}^{i}_{t} x ^ t i is given by the quantized weights, and let x t i x^{i}_{t} x t i be the usual trajectory (neither a hard choice as in Lemma 20 nor under quantization like x ^ t i \hat{x}^{i}_{t} x ^ t i ).
There are two immediate observations: (i) The attention scores are computed from the positional encodings. From Lemma 33 -(b,c) and Lemma 18 , we know that both the quantized and the unquantized trajectories are computed under the same attention scores. We write a t i j a^{ij}_{t} a t ij for the common attention scores. (ii) From Lemma 33 -(b), the token coordinates are invariant under the state quantizer Q n Q_n Q n . Therefore W V , t x ˉ t i = W V , t x ^ t i W_{V,t}\bar{x}^{i}_{t}=W_{V,t}\hat{x}^{i}_{t} W V , t x ˉ t i = W V , t x ^ t i for all t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } and i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } .
For convenience, we write A i = ∑ j = 1 M a t i j W V , t x ˉ t j A_i=\sum_{j=1}^{M}a^{ij}_{t}W_{V,t}\bar{x}^{j}_{t} A i = ∑ j = 1 M a t ij W V , t x ˉ t j for the i i i th token’s attention part, which is same for both x ˉ t i \bar{x}^{i}_{t} x ˉ t i and x ^ t i \hat{x}^{i}_{t} x ^ t i by (i) and (ii). Then
x t + 1 i − x ^ t + 1 i = ( x t i + A i ) − Q n ( x ^ t i + A i ) = x t i + A i − Q n ( x ^ t i + A i ) + x ^ t i − x ^ t i = ( x t i − x ^ t i ) + ( ( x ^ t i + A i ) − Q n ( x ^ t i + A i ) ) . \begin{aligned}
x^{i}_{t+1}-\hat{x}^{i}_{t+1} &= (x^{i}_{t}+A_i)-Q_n(\hat{x}^{i}_{t}+A_i) \\
&= x^{i}_{t}+A_i-Q_n(\hat{x}^{i}_{t}+A_i)+\hat{x}^{i}_{t}-\hat{x}^{i}_{t} \\
&= (x^{i}_{t}-\hat{x}^{i}_{t})+\left((\hat{x}^{i}_{t}+A_i)-Q_n(\hat{x}^{i}_{t}+A_i)\right).
\end{aligned} x t + 1 i − x ^ t + 1 i = ( x t i + A i ) − Q n ( x ^ t i + A i ) = x t i + A i − Q n ( x ^ t i + A i ) + x ^ t i − x ^ t i = ( x t i − x ^ t i ) + ( ( x ^ t i + A i ) − Q n ( x ^ t i + A i ) ) .
Passing to the norm, we get
∥ x t + 1 i − x ^ t + 1 i ∥ ≤ ∥ x t i − x ^ t i ∥ + ∥ ( x ^ t i + A i ) − Q n ( x ^ t i + A i ) ∥ ≤ M X d n − 1 . (33) \left\|x^{i}_{t+1}-\hat{x}^{i}_{t+1}\right\| \leq\left\|x^{i}_{t}-\hat{x}^{i}_{t}\right\|+\left\|(\hat{x}^{i}_{t}+A_i)-Q_n(\hat{x}^{i}_{t}+A_i)\right\| \leq\frac{M_X\sqrt{d}}{n-1}. \tag*{(33)} x t + 1 i − x ^ t + 1 i ≤ x t i − x ^ t i + ( x ^ t i + A i ) − Q n ( x ^ t i + A i ) ≤ n − 1 M X d . (33)
for all t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } and all i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } . Initial tokens given by [ e i ι ( w i ) 0 M 0 R ( s ) ] [e_i\ \iota(w_i)\ 0_M\ 0_{R(s)}] [ e i ι ( w i ) 0 M 0 R ( s ) ] have integer coordinates, hence, invariant under Q n Q_n Q n . So ∥ x 0 i − x ^ 0 i ∥ = 0 \left\|x^{i}_{0}-\hat{x}^{i}_{0}\right\|=0 x 0 i − x ^ 0 i = 0 for all i ∈ { 1 , … , M } i \in\{1,\ldots,M\} i ∈ { 1 , … , M } . Consequently, the error in the last gatherer layer’s readout position is upper bounded as
∥ x ^ M M − x ˉ M M ∥ ≤ ∥ x ^ M M − x M M ∥ + ∥ x M M − x ˉ M M ∥ ≤ M M X d n − 1 + 2 M ( M − 1 ) R ( s ) e − β c , (34) \left\|\hat{x}^{M}_{M}-\bar{x}^{M}_{M}\right\| \leq\left\|\hat{x}^{M}_{M}-x^{M}_{M}\right\|+\left\|x^{M}_{M}-\bar{x}^{M}_{M}\right\| \leq M\frac{M_X\sqrt{d}}{n-1}+2M(M-1)R(s)e^{-\beta c}, \tag*{(34)} x ^ M M − x ˉ M M ≤ x ^ M M − x M M + x M M − x ˉ M M ≤ M n − 1 M X d + 2 M ( M − 1 ) R ( s ) e − β c , (34)
where the first summand in the last bound is due to (33) accumulated over M M M layers and the the second summand is due to Lemma 20 .
Now we arrive at the interpolator layer, in which we have W V , M W_{V,M} W V , M is the zero matrix, hence the attention part does not contribute the final token. The logit part of the final layer is then given in terms of a one-layer feed-forward network of the form φ ( ζ ) = W W , M σ ( W A , M ζ + W b , M ) \varphi(\zeta)=W_{W,M}\sigma(W_{A,M}\zeta+W_{b,M}) φ ( ζ ) = W W , M σ ( W A , M ζ + W b , M ) . Let φ ^ \hat{\varphi} φ ^ be the corresponding feed-forward with quantized weights, i.e. φ ^ ( ζ ) = W ^ W , M σ ( W A , M ζ + W b , M ) \hat{\varphi}(\zeta)=\hat{W}_{W,M}\sigma(W_{A,M}\zeta+W_{b,M}) φ ^ ( ζ ) = W ^ W , M σ ( W A , M ζ + W b , M ) . We deliberately write W A , M W_{A,M} W A , M and W b , M W_{b,M} W b , M without hats because of Lemma 24 , which implies that their entries are integers in [ − M U , M U ] [-M_U,M_U] [ − M U , M U ] by (23) ; hence, they are not affected by the quantization due to Definition 32-(ii) (see the proof of Lemma 35). So, for any ζ ∈ X \zeta\in\mathcal{X} ζ ∈ X
φ ^ ( ζ ) − φ ( ζ ) = ( W W , M − W ^ W , M ) σ ( W A , M ζ + W b , M ) . \hat{\varphi}(\zeta)-\varphi(\zeta)=(W_{W,M}-\hat{W}_{W,M})\sigma(W_{A,M}\zeta+W_{b,M}). φ ^ ( ζ ) − φ ( ζ ) = ( W W , M − W ^ W , M ) σ ( W A , M ζ + W b , M ) .
In norm, we have
∥ φ ^ ( ζ ) − φ ( ζ ) ∥ ≤ ∥ W W , M − W ^ W , M ∥ F ( ∑ k = 1 R ( s ) M σ ( ⟨ a , ζ ⟩ − t k ) 2 ) 1 2 . \left\|\hat{\varphi}(\zeta)-\varphi(\zeta)\right\| \leq\left\|W_{W,M}-\hat{W}_{W,M}\right\|_{F}\left(\sum_{k=1}^{R(s)M}\sigma(\langle a,\zeta\rangle-t_k)^2\right)^{\frac{1}{2}}. ∥ φ ^ ( ζ ) − φ ( ζ ) ∥ ≤ W W , M − W ^ W , M F k = 1 ∑ R ( s ) M σ (⟨ a , ζ ⟩ − t k ) 2 2 1 .
∥ W W , M − W ^ W , M ∥ F ≤ M U d s m − 1 \lVert W_{W,M}-\widehat{W}_{W,M}\rVert_F\leq\frac{M_U d_s}{m-1} ∥ W W , M − W W , M ∥ F ≤ m − 1 M U d s due to action quantization. Indeed, the only entries of W W , M W_{W,M} W W , M that are not integers are those of its logit block, which has R ( s ) R(s) R ( s ) rows and R ( s ) M R(s)^M R ( s ) M columns, so that there are at most d s 2 = R ( s ) M + 1 d_s^2=R(s)^{M+1} d s 2 = R ( s ) M + 1 of them. By the proof of Lemma 24 -(ii), they lie in [ − 2 log 1 q min μ min s , 2 log 1 q min μ min s ] ⊂ [ − M U , M U ] \left[-2\log\frac{1}{q_{\min}\mu_{\min}^s},2\log\frac{1}{q_{\min}\mu_{\min}^s}\right]\subset[-M_U,M_U] [ − 2 log q m i n μ m i n s 1 , 2 log q m i n μ m i n s 1 ] ⊂ [ − M U , M U ] , and each of them is moved by at most half of the grid spacing 2 M U m − 1 \frac{2M_U}{m-1} m − 1 2 M U . On the other hand,
( ∑ k = 1 R ( s ) M σ ( ⟨ a , ζ ⟩ − t k ) 2 ) 1 2 ≤ R ( s ) M ∥ a ∥ 2 M X d . \left(\sum_{k=1}^{R(s)^M}\sigma(\langle a,\zeta\rangle-t_k)^2\right)^{\frac{1}{2}}\leq\sqrt{R(s)^M}\lVert a\rVert_2M_X\sqrt{d}. k = 1 ∑ R ( s ) M σ (⟨ a , ζ ⟩ − t k ) 2 2 1 ≤ R ( s ) M ∥ a ∥ 2 M X d .
By Lemma 24, a = ( 1 , R ( s ) , … , R ( s ) M − 1 ) a=(1,R(s),\ldots,R(s)^{M-1}) a = ( 1 , R ( s ) , … , R ( s ) M − 1 ) , hence ∥ a ∥ 2 ≤ R ( s ) M − 1 / 2 \lVert a\rVert_2\leq R(s)^{M-1/2} ∥ a ∥ 2 ≤ R ( s ) M − 1/2 , which implies
∥ φ − φ ^ ∥ ∞ ≤ M X d R ( s ) 3 M − 1 2 M U d s m − 1 . (35) \lVert\varphi-\widehat{\varphi}\rVert_\infty\leq M_X\sqrt{d}R(s)^{\frac{3M-1}{2}}\frac{M_Ud_s}{m-1}. \tag*{(35)} ∥ φ − φ ∥ ∞ ≤ M X d R ( s ) 2 3 M − 1 m − 1 M U d s . (35)
By definition, z ^ ( w ) = φ ^ ( x ^ M M ) \widehat{z}(w)=\widehat{\varphi}(\widehat{x}_M^M) z ( w ) = φ ( x M M ) and z ‾ ( w ) = φ ( x ‾ M M ) \overline{z}(w)=\varphi(\overline{x}_M^M) z ( w ) = φ ( x M M ) . With an “add and subtract” trick:
∥ z ^ ( w ) − z ‾ ( w ) ∥ ∞ ≤ ∥ z ^ ( w ) − φ ( x ^ M M ) ∥ ∞ + ∥ φ ( x ^ M M ) − z ‾ ( w ) ∥ ∞ . \lVert\widehat{z}(w)-\overline{z}(w)\rVert_\infty\leq\lVert\widehat{z}(w)-\varphi(\widehat{x}_M^M)\rVert_\infty+\lVert\varphi(\widehat{x}_M^M)-\overline{z}(w)\rVert_\infty. ∥ z ( w ) − z ( w ) ∥ ∞ ≤ ∥ z ( w ) − φ ( x M M ) ∥ ∞ + ∥ φ ( x M M ) − z ( w ) ∥ ∞ .
For the first term, we have
∥ z ^ ( w ) − φ ( x ^ M M ) ∥ ∞ ≤ M X d R ( s ) 3 M − 1 2 M U d s m − 1 \lVert\widehat{z}(w)-\varphi(\widehat{x}_M^M)\rVert_\infty\leq M_X\sqrt{d}R(s)^{\frac{3M-1}{2}}\frac{M_Ud_s}{m-1} ∥ z ( w ) − φ ( x M M ) ∥ ∞ ≤ M X d R ( s ) 2 3 M − 1 m − 1 M U d s
from (35) , and the second term is bounded as
∥ φ ( x ^ M M ) − z ‾ ( w ) ∥ ∞ ≤ L φ ( M M X d n − 1 + 2 M ( M − 1 ) R ( s ) e − β c ) \lVert\varphi(\widehat{x}_M^M)-\overline{z}(w)\rVert_\infty\leq L_\varphi\left(M\frac{M_X\sqrt{d}}{n-1}+2M(M-1)R(s)e^{-\beta c}\right) ∥ φ ( x M M ) − z ( w ) ∥ ∞ ≤ L φ ( M n − 1 M X d + 2 M ( M − 1 ) R ( s ) e − β c )
by Lemma 23 and (34). Therefore, we get
∥ z ^ ( w ) − z ‾ ( w ) ∥ ∞ ≤ M X d R ( s ) 3 M − 1 2 M U d s m − 1 + L φ ( M M X d n − 1 + 2 M ( M − 1 ) R ( s ) e − β c ) . \lVert\widehat{z}(w)-\overline{z}(w)\rVert_\infty\leq M_X\sqrt{d}R(s)^{\frac{3M-1}{2}}\frac{M_Ud_s}{m-1}+L_\varphi\left(M\frac{M_X\sqrt{d}}{n-1}+2M(M-1)R(s)e^{-\beta c}\right). ∥ z ( w ) − z ( w ) ∥ ∞ ≤ M X d R ( s ) 2 3 M − 1 m − 1 M U d s + L φ ( M n − 1 M X d + 2 M ( M − 1 ) R ( s ) e − β c ) .
Lemma 35. Assume that ( n , m , l ) ∈ N 3 (n,m,l)\in\mathbb{N}^3 ( n , m , l ) ∈ N 3 are chosen so that they are aligning quantization levels, that M X , M U M_X,M_U M X , M U satisfy (23), that R ( s ) ≥ 2 R(s)\geq2 R ( s ) ≥ 2 , and let Assumptions 3-(A1, A3) hold. Let β > 0 \beta>0 β > 0 be such that η ( n , m , β ) ≤ 1 \eta(n,m,\beta)\leq1 η ( n , m , β ) ≤ 1 , where η ( n , m , β ) \eta(n,m,\beta) η ( n , m , β ) is as in (24). Then there exists an open-loop policy U ^ ∈ U m M + 1 \widehat{U}\in\mathcal{U}^{M+1}_m U ∈ U m M + 1 such that, for every w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , T ^ U ^ ( ⋅ ∣ w ) = softmax ( z ^ o u t ( w ) ) \widehat{T}^{\widehat{U}}(\cdot\mid w)=\operatorname{softmax}(\widehat{z}_{\mathrm{out}}(w)) T U ( ⋅ ∣ w ) = softmax ( z out ( w )) for a logit vector z ^ o u t ( w ) ∈ R R ( s ) \widehat{z}_{\mathrm{out}}(w)\in\mathbb{R}^{R(s)} z out ( w ) ∈ R R ( s ) with
∥ z ^ o u t ( w ) − z ‾ ( w ) ∥ ∞ ≤ η ( n , m , β ) , (36) \lVert\widehat{z}_{\mathrm{out}}(w)-\overline{z}(w)\rVert_\infty\leq\eta(n,m,\beta), \tag*{(36)} ∥ z out ( w ) − z ( w ) ∥ ∞ ≤ η ( n , m , β ) , (36) where z ‾ ( w ) = log P ^ r M , s ( ⋅ ∣ w ) \overline{z}(w)=\log\widehat{P}^{M,s}_r(\cdot\mid w) z ( w ) = log P r M , s ( ⋅ ∣ w ) is as in Theorem 25 . Consequently,
max w ∈ Λ s M ∥ P ^ r M , s ( ⋅ ∣ w ) − T ^ U ^ ( ⋅ ∣ w ) ∥ T V ≤ η ( n , m , β ) 2 . \max_{w\in\Lambda_s^M}\left\lVert\widehat{P}^{M,s}_r(\cdot\mid w)-\widehat{T}^{\widehat{U}}(\cdot\mid w)\right\rVert_{\mathrm{TV}}\leq\frac{\eta(n,m,\beta)}{2}. w ∈ Λ s M max P r M , s ( ⋅ ∣ w ) − T U ( ⋅ ∣ w ) TV ≤ 2 η ( n , m , β ) .
In particular, if β \beta β is as in Theorem 25 for some ε 0 ∈ ( 0 , 1 / 2 ] \varepsilon_{0} \in(0,1/2] ε 0 ∈ ( 0 , 1/2 ] , then
max w ∈ Λ ε M ∥ P ^ r M , s ( ⋅ ∣ w ) − T U ^ ( ⋅ ∣ w ) ∥ T V ≤ ε 0 4 + ( 1 + L φ M d ) M X 2 ( n − 1 ) + M X d R ( s ) 3 M M − 1 2 M U d s 2 ( m − 1 ) . \max_{w \in\Lambda_{\varepsilon}^{M}} \left\|\widehat{P}_{r}^{M,s}(\cdot\mid w)-T^{\widehat{U}}(\cdot\mid w)\right\|_{\mathrm{TV}} \leq\frac{\varepsilon_{0}}{4}+(1+L_{\varphi}M\sqrt{d})\frac{M_{\mathrm{X}}}{2(n-1)}
+M_{\mathrm{X}}\sqrt{d}R(s)\frac{3M^{M-1}}{2}\frac{M_{\mathrm{U}}d s}{2(m-1)}. w ∈ Λ ε M max P r M , s ( ⋅ ∣ w ) − T U ( ⋅ ∣ w ) TV ≤ 4 ε 0 + ( 1 + L φ M d ) 2 ( n − 1 ) M X + M X d R ( s ) 2 3 M M − 1 2 ( m − 1 ) M U d s .
Proof We prove step-by-step:
Step 1. Let U ^ = ( U ^ 0 , … , U ^ M ) \widehat{U}=(\widehat{U}_{0},\ldots,\widehat{U}_{M}) U = ( U 0 , … , U M ) be the weights of § 6 in which only the output matrix of the interpolator layer is moved onto the grid. That is, for t ∈ { 0 , … , M − 1 } t \in\{0,\ldots,M-1\} t ∈ { 0 , … , M − 1 } , U ^ t \widehat{U}_{t} U t consists of the gatherer weights of § 6.1.2 , and U ^ 0 \widehat{U}_{0} U 0 also holds the embedding E E E_{E} E E in (18) . The last layer U ^ M \widehat{U}_{M} U M consists of W V , M = 0 W_{V,M}=0 W V , M = 0 , so that its attention block is switched off, of the matrices W A , M W_{A,M} W A , M and W b , M W_{b,M} W b , M of the ReLU network φ \varphi φ of Lemma 23 with the choice of a a a in Lemma 24 , of W ^ W , M \widehat{W}_{W,M} W W , M , the entry-wise closest grid point to W W , M W_{W,M} W W , M , and of the unembedding E U = Π log E_{U}=\Pi_{\log} E U = Π l o g . Since the feed-forward block has no output bias, the constant term v 1 v_{1} v 1 of the interpolant g g g in the proof of Lemma 23 is produced by one additional hidden unit with zero input weights and bias 1 1 1 , whose output column is v 1 v_{1} v 1 . In addition, the interpolator layer carries the positional block through: W A , M W_{A,M} W A , M has the additional rows ( e i T , 0 , 0 M T , 0 R T ) (e_{i}^{\mathsf{T}},0,0_{M}^{\mathsf{T}},0_{R}^{\mathsf{T}}) ( e i T , 0 , 0 M T , 0 R T ) and W W , M W_{W,M} W W , M the corresponding columns ( e i , 0 , 0 M , 0 R ) (e_{i},0,0_{M},0_{R}) ( e i , 0 , 0 M , 0 R ) , i = 1 , … , M i=1,\ldots,M i = 1 , … , M . Since the positional coordinates are nonnegative, σ \sigma σ acts on them as the identity. These additional weights do not interact with the logit block, and they keep Assumption 15 in force after the last layer, so that the readout token is identified by its position.
Step 2. We show that U ^ ∈ U m M + 1 \widehat{U} \in\mathcal{U}_{m}^{M+1} U ∈ U m M + 1 . The gatherer weights live in U m \mathcal{U}_{m} U m by Lemma 33 -(a), and the entries of E E E_{E} E E , of E U E_{U} E U and of the positional entries are in { 0 , 1 , … , R ( s ) } \{0,1,\ldots,R(s)\} { 0 , 1 , … , R ( s )} . The entries of W A , M W_{A,M} W A , M are 0 0 0 , 1 1 1 or R ( s ) j − 1 ≤ R ( s ) M − 1 R(s)^{j-1} \leq R(s)^{M-1} R ( s ) j − 1 ≤ R ( s ) M − 1 , j = 1 , … , M j=1,\ldots,M j = 1 , … , M , the latter coming from a a a in Lemma 24 . The entries of W b , M W_{b,M} W b , M are 1 1 1 (for the constant unit) and − t k -t_{k} − t k , where, by Lemma 24 -(i) and R ( s ) ≥ 2 R(s) \geq2 R ( s ) ≥ 2 ,
0 ≤ t k ≤ ∑ j = 1 M R ( s ) R ( s ) j − 1 = R ( s ) R ( s ) M − 1 R ( s ) − 1 ≤ 2 R ( s ) M . 0 \leq t_{k} \leq\sum_{j=1}^{M} R(s)R(s)^{j-1}=R(s)\frac{R(s)^{M}-1}{R(s)-1}\leq2R(s)^{M}. 0 ≤ t k ≤ j = 1 ∑ M R ( s ) R ( s ) j − 1 = R ( s ) R ( s ) − 1 R ( s ) M − 1 ≤ 2 R ( s ) M .
Therefore, all these entries are integers in [ − M U , M U ] [-M_{\mathrm{U}},M_{\mathrm{U}}] [ − M U , M U ] by (23) , hence grid points of U m \mathcal{U}_{m} U m by Definition 32-(ii). Finally, W ^ W , M \widehat{W}_{W,M} W W , M is a grid point by construction. So, U ^ ∈ U m M + 1 \widehat{U} \in\mathcal{U}_{m}^{M+1} U ∈ U m M + 1 .
Step 3. Fix w ∈ Λ M w \in\Lambda^{M} w ∈ Λ M . The positional carry uses exact integer weights, so Lemma 34 applies without change to the logit vector z ^ ( w ) = φ ^ ( x ^ M M ) \widehat{z}(w)=\widehat{\varphi}(\widehat{x}_{M}^{M}) z ( w ) = φ ( x M M ) produced by the interpolator layer before the last application of Q n Q_{n} Q n . By the definition (24) , we have
∥ z ^ ( w ) − z ‾ ( w ) ∥ ∞ ≤ η ( n , m , β ) − M X n − 1 . \left\|\widehat{z}(w)-\overline{z}(w)\right\|_{\infty}\leq\eta(n,m,\beta)-\frac{M_{\mathrm{X}}}{n-1}. ∥ z ( w ) − z ( w ) ∥ ∞ ≤ η ( n , m , β ) − n − 1 M X .
Since z ‾ ( w ) ∈ [ − log 1 q min μ min s , 0 ] R ( s ) \overline{z}(w)\in\left[-\log\frac{1}{q_{\min}\mu_{\min}^{s}},0\right]^{R(s)} z ( w ) ∈ [ − log q m i n μ m i n s 1 , 0 ] R ( s ) by the proof of Lemma 24 -(ii) and η ( n , m , β ) ≤ 1 \eta(n,m,\beta)\leq1 η ( n , m , β ) ≤ 1 , the logit coordinates of the readout token lie in [ − M X , M X ] [-M_{\mathrm{X}},M_{\mathrm{X}}] [ − M X , M X ] by (23) . Hence, the last application of Q n Q_{n} Q n moves each of them by at most half of the grid spacing, that is, by at most M X / ( n − 1 ) M_{\mathrm{X}}/(n-1) M X / ( n − 1 ) , and it fixes the positional block by Lemma 33 -(b). The atoms of the last measure state still carry mass exactly 1 / M 1/M 1/ M since their positional encodings are distinct, so R l R_{l} R l does not move them either by Lemma 33 -(c). Consequently, T U ^ ( ⋅ ∣ w ) = softmax ( z ^ o u t ( w ) ) T^{\widehat{U}}(\cdot\mid w)=\operatorname{softmax}(\widehat{z}_{\mathrm{out}}(w)) T U ( ⋅ ∣ w ) = softmax ( z out ( w )) with z ^ o u t ( w ) : = Π log Q n ( x ^ M + 1 M ) , \widehat{z}_{\mathrm{out}}(w) := \Pi_{\log Q_n}(\widehat{x}_{M+1}^{M}), z out ( w ) := Π l o g Q n ( x M + 1 M ) , and
∥ z ^ o u t ( w ) − z ˉ ( w ) ∥ ∞ ≤ ∥ z ^ o u t ( w ) − z ^ ( w ) ∥ ∞ + ∥ z ^ ( w ) − z ˉ ( w ) ∥ ∞ ≤ M χ n − 1 + η ( n , m , β ) − M χ n − 1 = η ( n , m , β ) , \lVert\widehat{z}_{\mathrm{out}}(w)-\bar{z}(w)\rVert_{\infty}\leq\lVert\widehat{z}_{\mathrm{out}}(w)-\widehat{z}(w)\rVert_{\infty}+\lVert\widehat{z}(w)-\bar{z}(w)\rVert_{\infty}\leq\frac{M_{\chi}}{n-1}+\eta(n,m,\beta)-\frac{M_{\chi}}{n-1}=\eta(n,m,\beta), ∥ z out ( w ) − z ˉ ( w ) ∥ ∞ ≤ ∥ z out ( w ) − z ( w ) ∥ ∞ + ∥ z ( w ) − z ˉ ( w ) ∥ ∞ ≤ n − 1 M χ + η ( n , m , β ) − n − 1 M χ = η ( n , m , β ) ,
which is (36) .
Step 4. Since P ^ r M , s ( ⋅ ∣ w ) = softmax ( z ˉ ( w ) ) \widehat{P}^{M,s}_{r}(\cdot\mid w)=\operatorname{softmax}(\bar{z}(w)) P r M , s ( ⋅ ∣ w ) = softmax ( z ˉ ( w )) (see the proof of Theorem 25 ), Lemma 37 -(i) below and (36) give
∥ P ^ r M , s ( ⋅ ∣ w ) − T U ^ ( ⋅ ∣ w ) ∥ T V ≤ 1 2 ∥ z ˉ ( w ) − z ^ o u t ( w ) ∥ ∞ ≤ η ( n , m , β ) 2 \left\lVert\widehat{P}^{M,s}_{r}(\cdot\mid w)-T^{\widehat{U}}(\cdot\mid w)\right\rVert_{\mathrm{TV}}\leq\frac{1}{2}\lVert\bar{z}(w)-\widehat{z}_{\mathrm{out}}(w)\rVert_{\infty}\leq\frac{\eta(n,m,\beta)}{2} P r M , s ( ⋅ ∣ w ) − T U ( ⋅ ∣ w ) TV ≤ 2 1 ∥ z ˉ ( w ) − z out ( w ) ∥ ∞ ≤ 2 η ( n , m , β )
for every w ∈ Λ s M w\in\Lambda^{M}_{s} w ∈ Λ s M . Finally, if β \beta β is as in Theorem 25 with ε = ε 0 \varepsilon=\varepsilon_{0} ε = ε 0 , then β c ≥ log ( 4 M ( M − 1 ) R ( s ) L φ / ε 0 ) \beta c\geq\log(4M(M-1)R(s)L_{\varphi}/\varepsilon_{0}) β c ≥ log ( 4 M ( M − 1 ) R ( s ) L φ / ε 0 ) , that is, 2 L φ M ( M − 1 ) R ( s ) e − β c ≤ ε 0 / 2 2L_{\varphi}M(M-1)R(s)e^{-\beta c}\leq\varepsilon_{0}/2 2 L φ M ( M − 1 ) R ( s ) e − β c ≤ ε 0 /2 . Plugging this into (24) gives the last claim.
Lemma 36. Suppose Assumptions 3-(A1, A3) hold and that the data set is sampled as in the beginning of this section. Then the following assertions are true:
(i) p r ( w ) ≥ ( q min μ min s ) M p_r(w)\geq(q_{\min}\mu_{\min}^{s})^{M} p r ( w ) ≥ ( q m i n μ m i n s ) M and min v ∈ Λ s P ^ r M , s ( v ∣ w ) ≥ q min μ min s \min_{v\in\Lambda_s}\widehat{P}^{M,s}_{r}(v\mid w)\geq q_{\min}\mu_{\min}^{s} min v ∈ Λ s P r M , s ( v ∣ w ) ≥ q m i n μ m i n s for all w ∈ Λ s M w\in\Lambda^{M}_{s} w ∈ Λ s M .
(ii) Let δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) and K ~ ≥ 8 ( q min μ min s ) − M ( M log R ( s ) + log 3 δ ) \widetilde{K}\geq8(q_{\min}\mu_{\min}^{s})^{-M}(M\log R(s)+\log\frac{3}{\delta}) K ≥ 8 ( q m i n μ m i n s ) − M ( M log R ( s ) + log δ 3 ) . Then, with probability at least 1 − δ 1-\delta 1 − δ , the following two events occur simultaneously:
G 1 : = { n w ≥ 1 2 K ~ p r ( w ) for all w ∈ Λ s M } , G_{1}:=\left\{n_{w}\geq\frac{1}{2}\widetilde{K}p_{r}(w)\ \text{for all }w\in\Lambda^{M}_{s}\right\}, G 1 := { n w ≥ 2 1 K p r ( w ) for all w ∈ Λ s M } , G 2 : = { ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V ≤ C δ 2 n w for all w ∈ Λ s M with n w ≥ 1 } , G_{2}:=\left\{\lVert y^{w}-\widehat{P}^{M,s}_{r}(\cdot\mid w)\rVert_{\mathrm{TV}}\leq\sqrt{\frac{C_{\delta}}{2n_{w}}}\ \text{for all }w\in\Lambda^{M}_{s}\text{ with }n_{w}\geq1\right\}, G 2 := { ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV ≤ 2 n w C δ for all w ∈ Λ s M with n w ≥ 1 } , where C δ : = R ( s ) log 2 + M log R ( s ) + log ( 3 / δ ) C_{\delta}:=R(s)\log2+M\log R(s)+\log(3/\delta) C δ := R ( s ) log 2 + M log R ( s ) + log ( 3/ δ ) . On G 1 G_{1} G 1 , every window w ∈ Λ s M w\in\Lambda^{M}_{s} w ∈ Λ s M appears in the data set; hence, K = R ( s ) M K=R(s)^{M} K = R ( s ) M and { x k : k ∈ K } = Λ s M \{x^{k}:k\in K\}=\Lambda^{M}_{s} { x k : k ∈ K } = Λ s M .
(iii) On G 1 ∩ G 2 G_{1}\cap G_{2} G 1 ∩ G 2 , we have
∑ w ∈ Λ s M p r ( w ) ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V ≤ R ( s ) M C δ K ~ \sum_{w\in\Lambda^{M}_{s}}p_r(w)\lVert y^{w}-\widehat{P}^{M,s}_{r}(\cdot\mid w)\rVert_{\mathrm{TV}}\leq\sqrt{\frac{R(s)^{M}C_{\delta}}{\widetilde{K}}} w ∈ Λ s M ∑ p r ( w ) ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV ≤ K R ( s ) M C δ and
∑ w ∈ Λ s M n w K ~ ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V 2 ≤ R ( s ) M C δ 2 K ~ . \sum_{w\in\Lambda^{M}_{s}}\frac{n_{w}}{\widetilde{K}}\lVert y^{w}-\widehat{P}^{M,s}_{r}(\cdot\mid w)\rVert_{\mathrm{TV}}^{2}\leq\frac{R(s)^{M}C_{\delta}}{2\widetilde{K}}. w ∈ Λ s M ∑ K n w ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV 2 ≤ 2 K R ( s ) M C δ .
Proof We prove step-by-step:
Proof of (i). Conditionally on Z 0 : r + 1 Z_{0:r+1} Z 0 : r + 1 , the observations Y 0 , … , Y r + 1 Y_{0},\ldots,Y_{r+1} Y 0 , … , Y r + 1 are independent with Y t ∼ Q ( ⋅ ∣ Z t ) Y_{t}\sim Q(\cdot\mid Z_{t}) Y t ∼ Q ( ⋅ ∣ Z t ) ; see the representation Y t = H ( Z t , V t ) Y_{t}=H(Z_{t},V_{t}) Y t = H ( Z t , V t ) with i.i.d. noise independent of { Z r } r ∈ Z + \{Z_{r}\}_{r\in\mathbb{Z}_{+}} { Z r } r ∈ Z + in the proof of Lemma 30 . For every v ∈ Λ s v\in\Lambda_{s} v ∈ Λ s , the preimage ( q s ) − 1 ( v ) (q^{s})^{-1}(v) ( q s ) − 1 ( v ) is one of the cells C ( s , i ) C(s,i) C ( s , i ) , so that, for all z ∈ S z\in S z ∈ S ,
Q ( ( q s ) − 1 ( v ) ∣ z ) = ∫ ( q s ) − 1 ( v ) μ ( d y ) ψ ( y ∣ z ) ≥ q min μ ( ( q s ) − 1 ( v ) ) ≥ q min μ min s Q((q^{s})^{-1}(v)\mid z)=\int_{(q^{s})^{-1}(v)}\mu(dy)\,\psi(y\mid z)\geq q_{\min}\mu((q^{s})^{-1}(v))\geq q_{\min}\mu_{\min}^{s} Q (( q s ) − 1 ( v ) ∣ z ) = ∫ ( q s ) − 1 ( v ) μ ( d y ) ψ ( y ∣ z ) ≥ q m i n μ (( q s ) − 1 ( v )) ≥ q m i n μ m i n s
by Assumptions 3-(A1) and (A3). Therefore, for w = ( w 1 , … , w M ) ∈ Λ s M w=(w_1,\ldots,w_M)\in\Lambda_s^M w = ( w 1 , … , w M ) ∈ Λ s M ,
p r ( w ) = E [ ∏ j = 1 M Q ( ( q s ) − 1 ( w j ) ∣ Z r − M + j ) ] ≥ ( q min μ min s ) M . p_r(w)=\mathbb{E}\left[\prod_{j=1}^{M}Q\left((q^s)^{-1}(w_j)\mid Z_{r-M+j}\right)\right]\ge(q_{\min}\mu_{\min}^s)^M. p r ( w ) = E [ j = 1 ∏ M Q ( ( q s ) − 1 ( w j ) ∣ Z r − M + j ) ] ≥ ( q m i n μ m i n s ) M .
In particular, { q M , s ( Y r − M + 1 : r ) = w } \{q^{M,s}(Y_{r-M+1:r})=w\} { q M , s ( Y r − M + 1 : r ) = w } has positive probability, and, by the same conditional independence,
P ^ r M , s ( v ∣ w ) = E [ Q ( ( q s ) − 1 ( v ) ∣ Z r + 1 ) ∣ q M , s ( Y r − M + 1 : r ) = w ] ≥ q min μ min s \widehat{P}_r^{M,s}(v\mid w)=\mathbb{E}\left[Q\left((q^s)^{-1}(v)\mid Z_{r+1}\right)\mid q^{M,s}(Y_{r-M+1:r})=w\right]\ge q_{\min}\mu_{\min}^s P r M , s ( v ∣ w ) = E [ Q ( ( q s ) − 1 ( v ) ∣ Z r + 1 ) ∣ q M , s ( Y r − M + 1 : r ) = w ] ≥ q m i n μ m i n s
for all v ∈ Λ s v\in\Lambda_s v ∈ Λ s , as in the proof of Lemma 24-(ii).
Proof of (ii). Since the prompts are independent copies of q M , s ( Y r − M + 1 : r ) q^{M,s}(Y_{r-M+1:r}) q M , s ( Y r − M + 1 : r ) , n w n_w n w is binomially distributed with K ~ \widetilde{K} K trials and success probability p r ( w ) p_r(w) p r ( w ) . The multiplicative Chernoff bound [37 Corollary 4.2] and (i) give
Pr ( n w < 1 2 K ~ p r ( w ) ) ≤ exp ( − K ~ p r ( w ) 8 ) ≤ exp ( − K ~ ( q min μ min s ) M 8 ) . \Pr\left(n_w<\frac{1}{2}\widetilde{K}p_r(w)\right)\le\exp\left(-\frac{\widetilde{K}p_r(w)}{8}\right)\le\exp\left(-\frac{\widetilde{K}(q_{\min}\mu_{\min}^s)^M}{8}\right). Pr ( n w < 2 1 K p r ( w ) ) ≤ exp ( − 8 K p r ( w ) ) ≤ exp ( − 8 K ( q m i n μ m i n s ) M ) .
A union bound over the R ( s ) M R(s)^M R ( s ) M windows and the lower bound on K ~ \widetilde{K} K yield
Pr ( G 1 c ) ≤ R ( s ) M exp ( − K ~ ( q min μ min s ) M 8 ) ≤ R ( s ) M exp ( − M log R ( s ) − log 3 δ ) = δ 3 . \Pr(\mathcal{G}_1^c)\le R(s)^M\exp\left(-\frac{\widetilde{K}(q_{\min}\mu_{\min}^s)^M}{8}\right)\le R(s)^M\exp\left(-M\log R(s)-\log\frac{3}{\delta}\right)=\frac{\delta}{3}. Pr ( G 1 c ) ≤ R ( s ) M exp ( − 8 K ( q m i n μ m i n s ) M ) ≤ R ( s ) M exp ( − M log R ( s ) − log δ 3 ) = 3 δ .
For G 2 \mathcal{G}_2 G 2 , since the training pairs are independent and identically distributed, conditionally on the prompts x 1 , … , x K ~ x^1,\ldots,x^{\widetilde{K}} x 1 , … , x K , the labels are independent and y ~ l ∼ P ^ r M , s ( ⋅ ∣ x l ) \widetilde{y}^l\sim\widehat{P}_r^{M,s}(\mathord\cdot\mid x^l) y l ∼ P r M , s ( ⋅ ∣ x l ) . Hence, conditionally on the prompts, for every w w w with n w ≥ 1 n_w\ge1 n w ≥ 1 , the label counts ( n w y w ( v ) ) v ∈ Λ s (n_w y^w(v))_{v\in\Lambda_s} ( n w y w ( v ) ) v ∈ Λ s form a multinomial vector with n w n_w n w trials and cell probabilities P ^ r M , s ( ⋅ ∣ w ) \widehat{P}_r^{M,s}(\mathord\cdot\mid w) P r M , s ( ⋅ ∣ w ) . By the Bretagnolle-Huber-Carol inequality [47 Proposition A.6.6] , such a vector satisfies
Pr ( ∑ v ∈ Λ s ∣ n w y w ( v ) − n w P ^ r M , s ( v ∣ w ) ∣ ≥ 2 n w λ ) ≤ 2 R ( s ) e − 2 λ 2 , λ > 0. \Pr\left(\sum_{v\in\Lambda_s}\left|n_w y^w(v)-n_w\widehat{P}_r^{M,s}(v\mid w)\right|\ge2\sqrt{n_w\lambda}\right)\le2^{R(s)}e^{-2\lambda^2},\qquad\lambda>0. Pr ( v ∈ Λ s ∑ n w y w ( v ) − n w P r M , s ( v ∣ w ) ≥ 2 n w λ ) ≤ 2 R ( s ) e − 2 λ 2 , λ > 0.
Since ∥ ⋅ ∥ T V = 1 2 ∥ ⋅ ∥ 1 \|\cdot\|_{\mathrm{TV}}=\frac{1}{2}\|\cdot\|_1 ∥ ⋅ ∥ TV = 2 1 ∥ ⋅ ∥ 1 on P ( Λ s ) \mathcal{P}(\Lambda_s) P ( Λ s ) , the event on the left hand side is { ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V ≥ λ / n w } \{\|y^w-\widehat{P}_r^{M,s}(\mathord\cdot\mid w)\|_{\mathrm{TV}}\ge\lambda/\sqrt{n_w}\} { ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV ≥ λ / n w } . Choosing λ = C δ / 2 \lambda=\sqrt{C_\delta/2} λ = C δ /2 , we get
Pr ( ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V > C δ 2 n w | x 1 , … , x K ~ ) ≤ 2 R ( s ) e − C δ = δ 3 R ( s ) M . \Pr\left(\|y^w-\widehat{P}_r^{M,s}(\mathord\cdot\mid w)\|_{\mathrm{TV}}>\sqrt{\frac{C_\delta}{2n_w}}\ \middle|\ x^1,\ldots,x^{\widetilde{K}}\right)\le2^{R(s)}e^{-C_\delta}=\frac{\delta}{3R(s)^M}. Pr ( ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV > 2 n w C δ x 1 , … , x K ) ≤ 2 R ( s ) e − C δ = 3 R ( s ) M δ .
A union bound over at most R ( s ) M R(s)^M R ( s ) M windows and taking the expectation give Pr ( G 2 c ) ≤ δ / 3 \Pr(\mathcal{G}_2^c)\le\delta/3 Pr ( G 2 c ) ≤ δ /3 . Therefore, Pr ( G 1 ∩ G 2 ) ≥ 1 − 2 δ / 3 ≥ 1 − δ \Pr(\mathcal{G}_1\cap\mathcal{G}_2)\ge1-2\delta/3\ge1-\delta Pr ( G 1 ∩ G 2 ) ≥ 1 − 2 δ /3 ≥ 1 − δ . Finally, on G 1 \mathcal{G}_1 G 1 , we have n w ≥ K ~ p r ( w ) / 2 > 0 n_w\ge\widetilde{K}p_r(w)/2>0 n w ≥ K p r ( w ) /2 > 0 for every w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M by (i), that is, every window appears in the data set.
Proof of (iii). On G 1 ∩ G 2 \mathcal{G}_1\cap\mathcal{G}_2 G 1 ∩ G 2 , we have n w ≥ K ~ p r ( w ) / 2 n_w\ge\widetilde{K}p_r(w)/2 n w ≥ K p r ( w ) /2 , and therefore
∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V ≤ C δ 2 n w ≤ C δ K ~ p r ( w ) . \|y^w-\widehat{P}_r^{M,s}(\mathord\cdot\mid w)\|_{\mathrm{TV}}\le\sqrt{\frac{C_\delta}{2n_w}}\le\sqrt{\frac{C_\delta}{\widetilde{K}p_r(w)}}. ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV ≤ 2 n w C δ ≤ K p r ( w ) C δ .
for every w ∈ Λ s M w \in\Lambda_s^M w ∈ Λ s M . By the Cauchy-Bunyakovsky-Schwarz inequality and ∑ w ∈ Λ s M p r ( w ) = 1 \sum_{w \in\Lambda_s^M} p_r(w)=1 ∑ w ∈ Λ s M p r ( w ) = 1 ,
∑ w ∈ Λ s M p r ( w ) ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V ≤ C δ K ∑ w ∈ Λ s M p r ( w ) ≤ C δ K R ( s ) M . \sum_{w \in\Lambda_s^M} p_r(w)\left\|y^w-\widehat{P}_r^{M,s}(\cdot\mid w)\right\|_{\mathrm{TV}}
\leq\sqrt{\frac{C_\delta}{K}}\sum_{w \in\Lambda_s^M}\sqrt{p_r(w)}
\leq\sqrt{\frac{C_\delta}{K}}\sqrt{R(s)^M}. w ∈ Λ s M ∑ p r ( w ) y w − P r M , s ( ⋅ ∣ w ) TV ≤ K C δ w ∈ Λ s M ∑ p r ( w ) ≤ K C δ R ( s ) M .
For the second claim,
∑ w ∈ Λ s M n w K ~ ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V 2 ≤ ∑ w ∈ Λ s M n w K ~ C δ 2 n w = R ( s ) M C δ 2 K ~ . \sum_{w \in\Lambda_s^M}\frac{n_w}{\widetilde{K}}\left\|y^w-\widehat{P}_r^{M,s}(\cdot\mid w)\right\|_{\mathrm{TV}}^2
\leq\sum_{w \in\Lambda_s^M}\frac{n_w}{\widetilde{K}}\frac{C_\delta}{2n_w}
=\frac{R(s)^M C_\delta}{2\widetilde{K}}. w ∈ Λ s M ∑ K n w y w − P r M , s ( ⋅ ∣ w ) TV 2 ≤ w ∈ Λ s M ∑ K n w 2 n w C δ = 2 K R ( s ) M C δ .
Lemma 37. Let z , z ′ ∈ R R ( s ) z,z' \in\mathbb{R}^{R(s)} z , z ′ ∈ R R ( s ) , indexed by Λ s \Lambda_s Λ s , and let ν , P , P ′ ∈ P ( Λ s ) \nu,P,P' \in\mathcal{P}(\Lambda_s) ν , P , P ′ ∈ P ( Λ s ) . Then the following assertions are true:
(i) ∥ softmax ( z ) − softmax ( z ′ ) ∥ T V ≤ 1 2 ∥ z − z ′ ∥ ∞ \left\|\operatorname{softmax}(z)-\operatorname{softmax}(z')\right\|_{\mathrm{TV}} \leq\frac{1}{2}\left\|z-z'\right\|_\infty ∥ softmax ( z ) − softmax ( z ′ ) ∥ TV ≤ 2 1 ∥ z − z ′ ∥ ∞ ;
(ii) D K L ( ν ∥ softmax ( z ′ ) ) ≤ D K L ( ν ∥ softmax ( z ) ) + 2 ∥ ν − softmax ( z ) ∥ T V ∥ z − z ′ ∥ ∞ + 1 2 ∥ z − z ′ ∥ ∞ 2 D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z')) \leq D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z))+2\left\|\nu-\operatorname{softmax}(z)\right\|_{\mathrm{TV}}\left\|z-z'\right\|_\infty+\frac{1}{2}\left\|z-z'\right\|_\infty^2 D KL ( ν ∥ softmax ( z ′ )) ≤ D KL ( ν ∥ softmax ( z )) + 2 ∥ ν − softmax ( z ) ∥ TV ∥ z − z ′ ∥ ∞ + 2 1 ∥ z − z ′ ∥ ∞ 2 ;
(iii) if min v ∈ Λ s P ′ ( v ) ≥ p > 0 \min_{v \in\Lambda_s}P'(v)\geq p>0 min v ∈ Λ s P ′ ( v ) ≥ p > 0 , then D K L ( P ∥ P ′ ) ≤ 4 p ∥ P − P ′ ∥ T V 2 D_{\mathrm{KL}}(P\mathbin\Vert P')\leq\frac{4}{p}\left\|P-P'\right\|_{\mathrm{TV}}^2 D KL ( P ∥ P ′ ) ≤ p 4 ∥ P − P ′ ∥ TV 2 .
Proof Throughout, write h : = z ′ − z h:=z'-z h := z ′ − z and π τ : = softmax ( z + τ h ) \pi_\tau:=\operatorname{softmax}(z+\tau h) π τ := softmax ( z + τ h ) for τ ∈ [ 0 , 1 ] \tau\in[0,1] τ ∈ [ 0 , 1 ] . For π ∈ P ( Λ s ) \pi\in\mathcal{P}(\Lambda_s) π ∈ P ( Λ s ) , write ⟨ π , h ⟩ : = ∑ v π ( v ) h v \langle\pi,h\rangle:=\sum_v\pi(v)h_v ⟨ π , h ⟩ := ∑ v π ( v ) h v and Var π ( h ) : = ∑ v π ( v ) ( h v − ⟨ π , h ⟩ ) 2 \operatorname{Var}_\pi(h):=\sum_v\pi(v)(h_v-\langle\pi,h\rangle)^2 Var π ( h ) := ∑ v π ( v ) ( h v − ⟨ π , h ⟩ ) 2 for the mean and the variance of h h h under π \pi π . We have that
Var π ( h ) ≤ ⟨ π , h 2 ⟩ ≤ ∥ h ∥ ∞ 2 (37) \operatorname{Var}_\pi(h)\leq\langle\pi,h^2\rangle\leq\|h\|_\infty^2 \tag*{(37)} Var π ( h ) ≤ ⟨ π , h 2 ⟩ ≤ ∥ h ∥ ∞ 2 (37)
since π \pi π is a probability vector and h h h is bounded.
Moreover, a direct computation gives d d τ π τ ( v ) = π τ ( v ) ( h v − ⟨ π τ , h ⟩ ) \frac{\mathrm{d}}{\mathrm{d}\tau}\pi_\tau(v)=\pi_\tau(v)(h_v-\langle\pi_\tau,h\rangle) d τ d π τ ( v ) = π τ ( v ) ( h v − ⟨ π τ , h ⟩) for all v ∈ Λ s v\in\Lambda_s v ∈ Λ s .
Proof of (i). By the fundamental theorem of calculus, the Cauchy-Bunyakovsky-Schwarz inequality and (37),
∥ softmax ( z ′ ) − softmax ( z ) ∥ 1 ≤ ∫ 0 1 ∑ v ∈ Λ s π τ ( v ) ∣ h v − ⟨ π τ , h ⟩ ∣ d τ ≤ ∫ 0 1 Var π τ ( h ) 1 / 2 d τ ≤ ∥ h ∥ ∞ . \begin{aligned}
\left\|\operatorname{softmax}(z')-\operatorname{softmax}(z)\right\|_1
\leq\int_0^1\sum_{v\in\Lambda_s}\pi_\tau(v)\left|h_v-\langle\pi_\tau,h\rangle\right|\,\mathrm{d}\tau\\
&\leq\int_0^1\operatorname{Var}_{\pi_\tau}(h)^{1/2}\,\mathrm{d}\tau
\leq\|h\|_\infty.
\end{aligned} ∥ softmax ( z ′ ) − softmax ( z ) ∥ 1 ≤ ∫ 0 1 v ∈ Λ s ∑ π τ ( v ) ∣ h v − ⟨ π τ , h ⟩ ∣ d τ ≤ ∫ 0 1 Var π τ ( h ) 1/2 d τ ≤ ∥ h ∥ ∞ .
Since ∥ ⋅ ∥ T V = 1 2 ∥ ⋅ ∥ 1 \|\cdot\|_{\mathrm{TV}}=\frac{1}{2}\|\cdot\|_1 ∥ ⋅ ∥ TV = 2 1 ∥ ⋅ ∥ 1 on P ( Λ s ) \mathcal{P}(\Lambda_s) P ( Λ s ) , (i) follows.
Proof of (ii). Write LSE ( u ) : = log ∑ v e u v \operatorname{LSE}(u):=\log\sum_v e^{u_v} LSE ( u ) := log ∑ v e u v , so that log softmax ( u ) v = u v − LSE ( u ) \log\operatorname{softmax}(u)_v=u_v-\operatorname{LSE}(u) log softmax ( u ) v = u v − LSE ( u ) . Since the softmax map has full support, both divergences in (ii) are finite, and
D K L ( ν ∥ softmax ( z ′ ) ) − D K L ( ν ∥ softmax ( z ) ) = ∑ v ∈ Λ s ν ( v ) log softmax ( z ) v softmax ( z ′ ) v = − ⟨ ν , h ⟩ + LSE ( z + h ) − LSE ( z ) . \begin{aligned}
D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z'))-D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z))
=\sum_{v\in\Lambda_s}\nu(v)\log\frac{\operatorname{softmax}(z)_v}{\operatorname{softmax}(z')_v} \\
&=-\langle\nu,h\rangle+\operatorname{LSE}(z+h)-\operatorname{LSE}(z).
\end{aligned} D KL ( ν ∥ softmax ( z ′ )) − D KL ( ν ∥ softmax ( z )) = v ∈ Λ s ∑ ν ( v ) log softmax ( z ′ ) v softmax ( z ) v = − ⟨ ν , h ⟩ + LSE ( z + h ) − LSE ( z ) .
The map τ ↦ LSE ( z + τ h ) \tau\mapsto\operatorname{LSE}(z+\tau h) τ ↦ LSE ( z + τ h ) has the first derivative ⟨ π τ , h ⟩ \langle\pi_\tau,h\rangle ⟨ π τ , h ⟩ and, by the computation above, the second derivative Var π τ ( h ) ≤ ∥ h ∥ ∞ 2 \operatorname{Var}_{\pi_\tau}(h) \le\lVert h\rVert_\infty^2 Var π τ ( h ) ≤ ∥ h ∥ ∞ 2 . By Taylor’s theorem, we have the first order approximation: LSE ( z + h ) − LSE ( z ) ≤ ⟨ π 0 , h ⟩ + 1 2 ∥ h ∥ ∞ 2 \operatorname{LSE}(z+h)-\operatorname{LSE}(z) \le\langle\pi_0,h\rangle+\frac{1}{2}\lVert h\rVert_\infty^2 LSE ( z + h ) − LSE ( z ) ≤ ⟨ π 0 , h ⟩ + 2 1 ∥ h ∥ ∞ 2 with π 0 = softmax ( z ) \pi_0=\operatorname{softmax}(z) π 0 = softmax ( z ) . Therefore,
D K L ( ν ∥ softmax ( z ′ ) ) − D K L ( ν ∥ softmax ( z ) ) ≤ ⟨ softmax ( z ) − ν , h ⟩ + 1 2 ∥ h ∥ ∞ 2 ≤ ∥ softmax ( z ) − ν ∥ 1 ∥ h ∥ ∞ + 1 2 ∥ h ∥ ∞ 2 , \begin{aligned}
D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z'))-D_{\mathrm{KL}}(\nu\mathbin\Vert\operatorname{softmax}(z)) \le\langle\operatorname{softmax}(z)-\nu,h\rangle+\frac{1}{2}\lVert h\rVert_\infty^2 \\
&\le\lVert\operatorname{softmax}(z)-\nu\rVert_1\lVert h\rVert_\infty+\frac{1}{2}\lVert h\rVert_\infty^2,
\end{aligned} D KL ( ν ∥ softmax ( z ′ )) − D KL ( ν ∥ softmax ( z )) ≤ ⟨ softmax ( z ) − ν , h ⟩ + 2 1 ∥ h ∥ ∞ 2 ≤ ∥ softmax ( z ) − ν ∥ 1 ∥ h ∥ ∞ + 2 1 ∥ h ∥ ∞ 2 ,
and ∥ ⋅ ∥ 1 = 2 ∥ ⋅ ∥ T V \lVert\cdot\rVert_1=2\lVert\cdot\rVert_{\mathrm{TV}} ∥ ⋅ ∥ 1 = 2 ∥ ⋅ ∥ TV concludes (ii).
Proof of (iii). By Jensen’s inequality for the concave logarithm,
D K L ( P ∥ P ′ ) = ∑ v : P ( v ) > 0 P ( v ) log P ( v ) P ′ ( v ) ≤ log ∑ v ∈ Λ s P ( v ) 2 P ′ ( v ) = log ( 1 + ∑ v ∈ Λ s ( P ( v ) − P ′ ( v ) ) 2 P ′ ( v ) ) , \begin{aligned}
D_{\mathrm{KL}}(P\mathbin\Vert P')=\sum_{v:P(v)>0}P(v)\log\frac{P(v)}{P'(v)} \\
&\le\log\sum_{v\in\Lambda_s}\frac{P(v)^2}{P'(v)} \\
&=\log\left(1+\sum_{v\in\Lambda_s}\frac{(P(v)-P'(v))^2}{P'(v)}\right),
\end{aligned} D KL ( P ∥ P ′ ) = v : P ( v ) > 0 ∑ P ( v ) log P ′ ( v ) P ( v ) ≤ log v ∈ Λ s ∑ P ′ ( v ) P ( v ) 2 = log ( 1 + v ∈ Λ s ∑ P ′ ( v ) ( P ( v ) − P ′ ( v ) ) 2 ) ,
where the last equality follows from expanding P ( v ) 2 = ( P ( v ) − P ′ ( v ) ) 2 + 2 P ( v ) P ′ ( v ) − P ′ ( v ) 2 P(v)^2=(P(v)-P'(v))^2+2P(v)P'(v)-P'(v)^2 P ( v ) 2 = ( P ( v ) − P ′ ( v ) ) 2 + 2 P ( v ) P ′ ( v ) − P ′ ( v ) 2 and summing over v v v . Using log ( 1 + x ) ≤ x \log(1+x)\le x log ( 1 + x ) ≤ x , P ′ ( v ) ≥ p P'(v)\ge p P ′ ( v ) ≥ p and ∑ v ( P ( v ) − P ′ ( v ) ) 2 ≤ ( ∑ v ∣ P ( v ) − P ′ ( v ) ∣ ) 2 \sum_v(P(v)-P'(v))^2\le\left(\sum_v\lvert P(v)-P'(v)\rvert\right)^2 ∑ v ( P ( v ) − P ′ ( v ) ) 2 ≤ ( ∑ v ∣ P ( v ) − P ′ ( v )∣ ) 2 , we obtain
D K L ( P ∥ P ′ ) ≤ 1 p ( ∑ v ∈ Λ s ∣ P ( v ) − P ′ ( v ) ∣ ) 2 = 4 p ∥ P − P ′ ∥ T V 2 . D_{\mathrm{KL}}(P\mathbin\Vert P')\le\frac{1}{p}\left(\sum_{v\in\Lambda_s}\lvert P(v)-P'(v)\rvert\right)^2=\frac{4}{p}\lVert P-P'\rVert_{\mathrm{TV}}^2. D KL ( P ∥ P ′ ) ≤ p 1 ( v ∈ Λ s ∑ ∣ P ( v ) − P ′ ( v )∣ ) 2 = p 4 ∥ P − P ′ ∥ TV 2 .
Proof of Theorem 27
Fix r ≥ M r\ge M r ≥ M and write w r : = q M , s ( Y r − M + 1 : r ) w_r:=q^{M,s}(Y_{r-M+1:r}) w r := q M , s ( Y r − M + 1 : r ) for the quantized test window. Then P r M , s = P r M , s ( ⋅ ∣ w r ) P_r^{M,s}=P_r^{M,s}(\cdot\mid w_r) P r M , s = P r M , s ( ⋅ ∣ w r ) and P ^ r M , s = P ^ r M , s ( ⋅ ∣ w r ) \widehat{P}_r^{M,s}=\widehat{P}_r^{M,s}(\cdot\mid w_r) P r M , s = P r M , s ( ⋅ ∣ w r ) in Definition 2, and the law of w r w_r w r is p r p_r p r in (22) . The data set enters only through γ ∗ \gamma^* γ ∗ and it is independent of Y 0 : r Y_{0:r} Y 0 : r ; so, in Steps 1–3, we fix the data set and take the expectation over Y 0 : r Y_{0:r} Y 0 : r only. We prove step-by-step:
Step 1. For every realization of Y 0 : r Y_{0:r} Y 0 : r , all measures below are probability measures on Y \mathcal{Y} Y , and the triangle inequality gives
∥ P r − Ξ s ( T ∗ ( ⋅ ∣ w r ) ) ∥ T V ≤ ∥ P r − P r M , s ∥ T V + ∥ P r M , s ( ⋅ ∣ w r ) − Ξ s ( P ^ r M , s ( ⋅ ∣ w r ) ) ∥ T V + ∥ Ξ s ( P ^ r M , s ( ⋅ ∣ w r ) ) − Ξ s ( T ∗ ( ⋅ ∣ w r ) ) ∥ T V . (38) \left\lVert P_r-\Xi_s\left(T^*(\cdot\mid w_r)\right)\right\rVert_{\mathrm{TV}}
\le\left\lVert P_r-P_r^{M,s}\right\rVert_{\mathrm{TV}}+\left\lVert P_r^{M,s}(\cdot\mid w_r)-\Xi_s\left(\widehat{P}_r^{M,s}(\cdot\mid w_r)\right)\right\rVert_{\mathrm{TV}}
+\left\lVert\Xi_s\left(\widehat{P}_r^{M,s}(\cdot\mid w_r)\right)-\Xi_s\left(T^*(\cdot\mid w_r)\right)\right\rVert_{\mathrm{TV}}. \tag*{(38)} ∥ P r − Ξ s ( T ∗ ( ⋅ ∣ w r ) ) ∥ TV ≤ P r − P r M , s TV + P r M , s ( ⋅ ∣ w r ) − Ξ s ( P r M , s ( ⋅ ∣ w r ) ) TV + Ξ s ( P r M , s ( ⋅ ∣ w r ) ) − Ξ s ( T ∗ ( ⋅ ∣ w r ) ) TV . (38)
By Theorem 12-(ii), the first term satisfies
E Y 0 : r ∥ P r − P r M , s ∥ T V ≤ α ⌊ M / N ⌋ + 2 M L ψ q min s . \mathbb{E}_{Y_{0:r}}\left\lVert P_r-P_r^{M,s}\right\rVert_{\mathrm{TV}}\le\alpha^{\lfloor M/N\rfloor}+\frac{2ML_\psi}{q_{\min}s}. E Y 0 : r P r − P r M , s TV ≤ α ⌊ M / N ⌋ + q m i n s 2 M L ψ .
Step 2. Fix w ∈ Λ s M w \in\Lambda_s^M w ∈ Λ s M . Conditionally on Z r + 1 Z_{r+1} Z r + 1 , the next observation Y r + 1 Y_{r+1} Y r + 1 is independent of Y r − M + 1 : r Y_{r-M+1:r} Y r − M + 1 : r and has the law Q ( ⋅ ∣ Z r + 1 ) Q(\cdot\mid Z_{r+1}) Q ( ⋅ ∣ Z r + 1 ) . Hence, the μ \mu μ -density of P r M , s ( ⋅ ∣ w ) P_r^{M,s}(\cdot\mid w) P r M , s ( ⋅ ∣ w ) is
p r M , s ( y ∣ w ) : = ∑ z ∈ S ψ ( y ∣ z ) Pr ( Z r + 1 = z ∣ q M , s ( Y r − M + 1 : r ) = w ) , y ∈ Y , p_r^{M,s}(y \mid w) := \sum_{z \in S} \psi(y \mid z) \Pr\left(Z_{r+1}=z \mid q^{M,s}(Y_{r-M+1:r})=w\right), \qquad y \in\mathcal{Y}, p r M , s ( y ∣ w ) := z ∈ S ∑ ψ ( y ∣ z ) Pr ( Z r + 1 = z ∣ q M , s ( Y r − M + 1 : r ) = w ) , y ∈ Y ,
which is a convex combination of { ψ ( ⋅ ∣ z ) } z ∈ S \{\psi(\cdot\mid z)\}_{z \in S} { ψ ( ⋅ ∣ z ) } z ∈ S . Exactly as for p r p_r p r in the proof of Lemma 28, Assumption 3-(A2) shows that p r M , s ( ⋅ ∣ w ) p_r^{M,s}(\cdot\mid w) p r M , s ( ⋅ ∣ w ) is L ψ L_\psi L ψ -Lipschitz. Since P ^ r M , s ( ⋅ ∣ w ) = q # s P r M , s ( ⋅ ∣ w ) \widehat{P}_r^{M,s}(\cdot\mid w)=q_{\#}^{s}P_r^{M,s}(\cdot\mid w) P r M , s ( ⋅ ∣ w ) = q # s P r M , s ( ⋅ ∣ w ) by Definition 2, the μ \mu μ -density of Ξ s ( P ^ r M , s ( ⋅ ∣ w ) ) \Xi_s(\widehat{P}_r^{M,s}(\cdot\mid w)) Ξ s ( P r M , s ( ⋅ ∣ w )) is constant on each cell C ( s , i ) C(s,i) C ( s , i ) and equal to the μ \mu μ -average of p r M , s ( ⋅ ∣ w ) p_r^{M,s}(\cdot\mid w) p r M , s ( ⋅ ∣ w ) over C ( s , i ) C(s,i) C ( s , i ) . The remaining lines of the proof of Lemma 28 then apply verbatim and give
∥ P r M , s ( ⋅ ∣ w ) − Ξ s ( P ^ r M , s ( ⋅ ∣ w ) ) ∥ T V ≤ L ψ s , w ∈ Λ s M . \left\|P_r^{M,s}(\cdot\mid w)-\Xi_s(\widehat{P}_r^{M,s}(\cdot\mid w))\right\|_{\mathrm{TV}} \le\frac{L_\psi}{s}, \qquad w \in\Lambda_s^M. P r M , s ( ⋅ ∣ w ) − Ξ s ( P r M , s ( ⋅ ∣ w )) TV ≤ s L ψ , w ∈ Λ s M .
So, the second term in (38) is at most L ψ / s L_\psi/s L ψ / s for every realization of Y 0 : r Y_{0:r} Y 0 : r .
Step 3. For ν , ν ′ ∈ P ( Λ s ) \nu,\nu' \in\mathcal{P}(\Lambda_s) ν , ν ′ ∈ P ( Λ s ) and a Borel set A ⊂ Y A \subset\mathcal{Y} A ⊂ Y , Definition 4 gives
Ξ s ( ν ) ( A ) − Ξ s ( ν ′ ) ( A ) = ∑ i = 1 R ( s ) ( ν ( y s , i ) − ν ′ ( y s , i ) ) μ ( A ∩ C ( s , i ) ) μ ( C ( s , i ) ) . \Xi_s(\nu)(A)-\Xi_s(\nu')(A)=\sum_{i=1}^{R(s)}\left(\nu(y_{s,i})-\nu'(y_{s,i})\right)\frac{\mu(A\cap C(s,i))}{\mu(C(s,i))}. Ξ s ( ν ) ( A ) − Ξ s ( ν ′ ) ( A ) = i = 1 ∑ R ( s ) ( ν ( y s , i ) − ν ′ ( y s , i ) ) μ ( C ( s , i )) μ ( A ∩ C ( s , i )) .
Each ratio on the right hand side is in the interval [ 0 , 1 ] [0,1] [ 0 , 1 ] , and ∑ i ( ν ( y s , i ) − ν ′ ( y s , i ) ) = 0 \sum_i(\nu(y_{s,i})-\nu'(y_{s,i}))=0 ∑ i ( ν ( y s , i ) − ν ′ ( y s , i )) = 0 . Therefore, the absolute value of the right hand side is at most ∑ i ( ν ( y s , i ) − ν ′ ( y s , i ) ) + = ∥ ν − ν ′ ∥ T V \sum_i(\nu(y_{s,i})-\nu'(y_{s,i}))^+=\|\nu-\nu'\|_{\mathrm{TV}} ∑ i ( ν ( y s , i ) − ν ′ ( y s , i ) ) + = ∥ ν − ν ′ ∥ TV , where x + : = max { x , 0 } x^+:=\max\{x,0\} x + := max { x , 0 } . Hence, ∥ Ξ s ( ν ) − Ξ s ( ν ′ ) ∥ T V ≤ ∥ ν − ν ′ ∥ T V \|\Xi_s(\nu)-\Xi_s(\nu')\|_{\mathrm{TV}}\le\|\nu-\nu'\|_{\mathrm{TV}} ∥ Ξ s ( ν ) − Ξ s ( ν ′ ) ∥ TV ≤ ∥ ν − ν ′ ∥ TV , and the third term in (38) is at most ∥ P ^ r M , s ( ⋅ ∣ w r ) − T γ ∗ ( ⋅ ∣ w r ) ∥ T V \|\widehat{P}_r^{M,s}(\cdot\mid w_r)-T^{\gamma^*}(\cdot\mid w_r)\|_{\mathrm{TV}} ∥ P r M , s ( ⋅ ∣ w r ) − T γ ∗ ( ⋅ ∣ w r ) ∥ TV . Taking the expectation and collecting Steps 1–3, we have shown
E Y 0 : r ∥ P r − Ξ s ( T γ ∗ ( ⋅ ∣ w r ) ) ∥ T V ≤ α ⌊ M / N ⌋ + ( 1 + 2 M q min ) L ψ s + ∑ w ∈ Λ s M p r ( w ) ∥ P ^ r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) ∥ T V . (39) \mathbb{E}_{Y_{0:r}}\left\|P_r-\Xi_s\left(T^{\gamma^*}(\cdot\mid w_r)\right)\right\|_{\mathrm{TV}}
\le\alpha^{\lfloor M/N\rfloor}+\left(1+\frac{2M}{q_{\min}}\right)\frac{L_\psi}{s}+\sum_{w\in\Lambda_s^M}p_r(w)\left\|\widehat{P}_r^{M,s}(\cdot\mid w)-T^{\gamma^*}(\cdot\mid w)\right\|_{\mathrm{TV}}. \tag*{(39)} E Y 0 : r P r − Ξ s ( T γ ∗ ( ⋅ ∣ w r ) ) TV ≤ α ⌊ M / N ⌋ + ( 1 + q m i n 2 M ) s L ψ + w ∈ Λ s M ∑ p r ( w ) P r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) TV . (39)
Step 4. Let G 1 \mathcal{G}_1 G 1 and G 2 \mathcal{G}_2 G 2 be the events of Lemma 36-(ii). Their intersection has probability at least 1 − δ 1-\delta 1 − δ , and we fix a realization of the data set in G 1 ∩ G 2 \mathcal{G}_1\cap\mathcal{G}_2 G 1 ∩ G 2 for the rest of the proof. By Lemma 36-(ii), every window appears in the data set, so the sums over k ∈ K k\in\mathcal{K} k ∈ K in (15) and in the definition of E \mathcal{E} E are sums over w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , and
E ( γ ) = ∑ w ∈ Λ s M n w K ~ D K L ( y w ∥ T γ ( ⋅ ∣ w ) ) , γ ∈ U m M + 1 . \mathcal{E}(\gamma)=\sum_{w\in\Lambda_s^M}\frac{n_w}{\widetilde{K}}D_{\mathrm{KL}}\left(y^w\mathbin\Vert T^\gamma(\cdot\mid w)\right), \qquad\gamma\in\mathcal{U}_m^{M+1}. E ( γ ) = w ∈ Λ s M ∑ K n w D KL ( y w ∥ T γ ( ⋅ ∣ w ) ) , γ ∈ U m M + 1 .
By the triangle inequality,
∑ w ∈ Λ s M p r ( w ) ∥ P ^ r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) ∥ T V ≤ ∑ w ∈ Λ s M p r ( w ) ∥ P ^ r M , s ( ⋅ ∣ w ) − y w ∥ T V \sum_{w\in\Lambda_s^M}p_r(w)\left\|\widehat{P}_r^{M,s}(\cdot\mid w)-T^{\gamma^*}(\cdot\mid w)\right\|_{\mathrm{TV}}
\le
\sum_{w\in\Lambda_s^M}p_r(w)\left\|\widehat{P}_r^{M,s}(\cdot\mid w)-y^w\right\|_{\mathrm{TV}} w ∈ Λ s M ∑ p r ( w ) P r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) TV ≤ w ∈ Λ s M ∑ p r ( w ) P r M , s ( ⋅ ∣ w ) − y w TV
+ ∑ w ∈ Λ s M p r ( w ) ∥ y w − T γ ∗ ( ⋅ ∣ w ) ∥ T V . (40) \qquad+\sum_{w\in\Lambda_s^M}p_r(w)\left\|y^w-T^{\gamma^*}(\cdot\mid w)\right\|_{\mathrm{TV}}. \tag*{(40)} + w ∈ Λ s M ∑ p r ( w ) y w − T γ ∗ ( ⋅ ∣ w ) TV . (40)
The first sum is at most R ( s ) M C δ / K ~ \sqrt{R(s)^M C_\delta/\widetilde{K}} R ( s ) M C δ / K by Lemma 36-(iii). For the second sum, we use Pinsker’s inequality [38 Theorem 7.10] , Jensen’s inequality for the concave function ⋅ \sqrt{\cdot} ⋅ with the weights p r ( w ) p_r(w) p r ( w ) , which sum to 1, and the inequality p r ( w ) ≤ 2 n w / K ~ p_r(w) \le2n_w/\widetilde{K} p r ( w ) ≤ 2 n w / K , which holds on G 1 \mathcal{G}_1 G 1 :
∑ w ∈ Λ s M p r ( w ) ∥ y w − T γ ∗ ( ⋅ ∣ w ) ∥ T V ≤ ∑ w ∈ Λ s M p r ( w ) 1 2 D K L ( y w ∥ T γ ∗ ( ⋅ ∣ w ) ) ≤ 1 2 ∑ w ∈ Λ s M p r ( w ) D K L ( y w ∥ T γ ∗ ( ⋅ ∣ w ) ) ≤ ∑ w ∈ Λ s M n w K ~ D K L ( y w ∥ T γ ∗ ( ⋅ ∣ w ) ) = E ( γ ∗ ) . (41) \begin{aligned}
\sum_{w\in\Lambda_s^M}p_r(w)\lVert y^w-T^{\gamma^*}(\cdot\mid w)\rVert_{\mathrm{TV}}
\le\sum_{w\in\Lambda_s^M}p_r(w)\sqrt{\frac{1}{2}D_{\mathrm{KL}}(y^w\mathbin\Vert T^{\gamma^*}(\cdot\mid w))} \\
&\le\sqrt{\frac{1}{2}\sum_{w\in\Lambda_s^M}p_r(w)D_{\mathrm{KL}}(y^w\mathbin\Vert T^{\gamma^*}(\cdot\mid w))} \\
&\le\sqrt{\sum_{w\in\Lambda_s^M}\frac{n_w}{\widetilde{K}}D_{\mathrm{KL}}(y^w\mathbin\Vert T^{\gamma^*}(\cdot\mid w))}=\sqrt{\mathcal{E}(\gamma^*)}. \tag*{(41)}
\end{aligned} w ∈ Λ s M ∑ p r ( w ) ∥ y w − T γ ∗ ( ⋅ ∣ w ) ∥ TV ≤ w ∈ Λ s M ∑ p r ( w ) 2 1 D KL ( y w ∥ T γ ∗ ( ⋅ ∣ w )) ≤ 2 1 w ∈ Λ s M ∑ p r ( w ) D KL ( y w ∥ T γ ∗ ( ⋅ ∣ w )) ≤ w ∈ Λ s M ∑ K n w D KL ( y w ∥ T γ ∗ ( ⋅ ∣ w )) = E ( γ ∗ ) . (41)
Finally, γ ∗ \gamma^* γ ∗ minimizes E \mathcal{E} E over U m M + 1 \mathcal{U}_m^{M+1} U m M + 1 , and the policy U ^ \widehat{U} U of Lemma 35 belongs to U m M + 1 \mathcal{U}_m^{M+1} U m M + 1 . Therefore,
E ( γ ∗ ) ≤ E ( U ^ ) . (42) \mathcal{E}(\gamma^*)\le\mathcal{E}(\widehat{U}). \tag*{(42)} E ( γ ∗ ) ≤ E ( U ) . (42)
Step 5. Fix w ∈ Λ s M w\in\Lambda_s^M w ∈ Λ s M , write η : = η ( n , m , β ) \eta:=\eta(n,m,\beta) η := η ( n , m , β ) and a w : = ∥ y w − P ^ r M , s ( ⋅ ∣ w ) ∥ T V a_w:=\lVert y^w-\widehat{P}_r^{M,s}(\cdot\mid w)\rVert_{\mathrm{TV}} a w := ∥ y w − P r M , s ( ⋅ ∣ w ) ∥ TV . By Lemma 35, T U ^ ( ⋅ ∣ w ) = softmax ( z ^ o u t ( w ) ) T^{\widehat{U}}(\cdot\mid w)=\operatorname{softmax}(\widehat{z}_{\mathrm{out}}(w)) T U ( ⋅ ∣ w ) = softmax ( z out ( w )) with ∥ z ^ o u t ( w ) − z ˉ ( w ) ∥ ∞ ≤ η \lVert\widehat{z}_{\mathrm{out}}(w)-\bar{z}(w)\rVert_\infty\le\eta ∥ z out ( w ) − z ˉ ( w ) ∥ ∞ ≤ η , and P ^ r M , s ( ⋅ ∣ w ) = softmax ( z ˉ ( w ) ) \widehat{P}_r^{M,s}(\cdot\mid w)=\operatorname{softmax}(\bar{z}(w)) P r M , s ( ⋅ ∣ w ) = softmax ( z ˉ ( w )) . We apply Lemma 37-(ii) with ν = y w \nu=y^w ν = y w , z = z ˉ ( w ) z=\bar{z}(w) z = z ˉ ( w ) and z ′ = z ^ o u t ( w ) z'=\widehat{z}_{\mathrm{out}}(w) z ′ = z out ( w ) , and then Lemma 37-(iii) with P = y w P=y^w P = y w and P ′ = P ^ r M , s ( ⋅ ∣ w ) P'=\widehat{P}_r^{M,s}(\cdot\mid w) P ′ = P r M , s ( ⋅ ∣ w ) , whose entries are at least q min μ min s q_{\min}\mu_{\min}^s q m i n μ m i n s by Lemma 36-(i):
D K L ( y w ∥ T U ^ ( ⋅ ∣ w ) ) ≤ D K L ( y w ∥ P ^ r M , s ( ⋅ ∣ w ) ) + 2 a w η + η 2 2 ≤ 4 a w 2 q min μ min s + 2 a w η + η 2 2 . D_{\mathrm{KL}}(y^w\mathbin\Vert T^{\widehat{U}}(\cdot\mid w))\le D_{\mathrm{KL}}(y^w\mathbin\Vert\widehat{P}_r^{M,s}(\cdot\mid w))+2a_w\eta+\frac{\eta^2}{2}\le\frac{4a_w^2}{q_{\min}\mu_{\min}^s}+2a_w\eta+\frac{\eta^2}{2}. D KL ( y w ∥ T U ( ⋅ ∣ w )) ≤ D KL ( y w ∥ P r M , s ( ⋅ ∣ w )) + 2 a w η + 2 η 2 ≤ q m i n μ m i n s 4 a w 2 + 2 a w η + 2 η 2 .
We multiply by n w / K ~ n_w/\widetilde{K} n w / K and sum over w w w . Write A : = ( ∑ w n w K ~ a w 2 ) 1 / 2 A:=\left(\sum_w\frac{n_w}{\widetilde{K}}a_w^2\right)^{1/2} A := ( ∑ w K n w a w 2 ) 1/2 . Since ∑ w n w / K ~ = 1 \sum_w n_w/\widetilde{K}=1 ∑ w n w / K = 1 , the Cauchy-Bunyakovsky-Schwarz inequality gives ∑ w n w K ~ a w ≤ A \sum_w\frac{n_w}{\widetilde{K}}a_w\le A ∑ w K n w a w ≤ A , and therefore
E ( U ^ ) ≤ 4 A 2 q min μ min s + 2 A η + η 2 2 ≤ ( 2 A q min μ min s + η 2 ) 2 , \mathcal{E}(\widehat{U})\le\frac{4A^2}{q_{\min}\mu_{\min}^s}+2A\eta+\frac{\eta^2}{2}\le\left(\frac{2A}{\sqrt{q_{\min}\mu_{\min}^s}}+\frac{\eta}{\sqrt{2}}\right)^2, E ( U ) ≤ q m i n μ m i n s 4 A 2 + 2 A η + 2 η 2 ≤ ( q m i n μ m i n s 2 A + 2 η ) 2 ,
where, for the last inequality, we expanded the square and used 2 A η ≤ 2 2 A η / q min μ min s 2A\eta\le2\sqrt{2}A\eta/\sqrt{q_{\min}\mu_{\min}^s} 2 A η ≤ 2 2 A η / q m i n μ m i n s . The latter holds since q min μ min s ≤ Q ( ( q s ( v ) ∣ z ) ) ≤ 1 q_{\min}\mu_{\min}^s\le Q((q^s(v)\mid z))\le1 q m i n μ m i n s ≤ Q (( q s ( v ) ∣ z )) ≤ 1 for all v ∈ Λ s v\in\Lambda_s v ∈ Λ s and z ∈ S z\in\mathcal{S} z ∈ S by the proof of Lemma 36-(i). By Lemma 36-(iii), A 2 ≤ R ( s ) M C δ / ( 2 K ~ ) A^2\le R(s)^M C_\delta/(2\widetilde{K}) A 2 ≤ R ( s ) M C δ / ( 2 K ) , hence
E ( U ^ ) ≤ 2 R ( s ) M C δ q min μ min s K ~ + η 2 . (43) \sqrt{\mathcal{E}(\widehat{U})}\le\sqrt{\frac{2R(s)^M C_\delta}{q_{\min}\mu_{\min}^s\widetilde{K}}}+\frac{\eta}{\sqrt{2}}. \tag*{(43)} E ( U ) ≤ q m i n μ m i n s K 2 R ( s ) M C δ + 2 η . (43)
Step 6. Combining (40) –(43) with the bound on the first sum in (40) , and using 1 ≤ ( q min μ min s ) − 1 / 2 1\le(q_{\min}\mu_{\min}^s)^{-1/2} 1 ≤ ( q m i n μ m i n s ) − 1/2 , we get
∑ w ∈ Λ s M p r ( w ) ∥ P ^ r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) ∥ T V ≤ R ( s ) M C δ K ~ + 2 R ( s ) M C δ q min μ min s K ~ + η 2 ≤ ( 1 + 2 ) R ( s ) M C δ q min μ min s K ~ + η 2 . \begin{aligned}
\sum_{w\in\Lambda_s^M}p_r(w)\lVert\widehat{P}_r^{M,s}(\cdot\mid w)-T^{\gamma^*}(\cdot\mid w)\rVert_{\mathrm{TV}}
\le\sqrt{\frac{R(s)^M C_\delta}{\widetilde{K}}}+\sqrt{\frac{2R(s)^M C_\delta}{q_{\min}\mu_{\min}^s\widetilde{K}}}+\frac{\eta}{\sqrt{2}} \\
&\le(1+\sqrt{2})\sqrt{\frac{R(s)^M C_\delta}{q_{\min}\mu_{\min}^s\widetilde{K}}}+\frac{\eta}{\sqrt{2}}.
\end{aligned} w ∈ Λ s M ∑ p r ( w ) ∥ P r M , s ( ⋅ ∣ w ) − T γ ∗ ( ⋅ ∣ w ) ∥ TV ≤ K R ( s ) M C δ + q m i n μ m i n s K 2 R ( s ) M C δ + 2 η ≤ ( 1 + 2 ) q m i n μ m i n s K R ( s ) M C δ + 2 η .
Plugging this into (39) gives (25) . Since the realization of the data set in G 1 ∩ G 2 \mathcal{G}_1 \cap\mathcal{G}_2 G 1 ∩ G 2 is arbitrary, the bound holds with probability at least 1 − δ 1-\delta 1 − δ , and the proof is now concluded. ■
Proof of Theorem 26
By Lemma 30 , { ( Z r , Y r ) } \{(Z_r,Y_r)\} {( Z r , Y r )} is stationary. Hence the window law p ( w ) : = Pr q M , s ( Y r − M + 1 : r = w ) p(w) := \Pr^{q^{M,s}}(Y_{r-M+1:r}=w) p ( w ) := Pr q M , s ( Y r − M + 1 : r = w ) and the objects P r M P_r^M P r M , P r M , s P_r^{M,s} P r M , s and P ^ r M , s = : P ^ ( ⋅ ∣ w ) \hat{P}_r^{M,s} =: \hat{P}(\cdot\mid w) P ^ r M , s =: P ^ ( ⋅ ∣ w ) do not depend on r ≥ M r \ge M r ≥ M . Fix M M M and s s s with R ( s ) ≥ 2 R(s) \ge2 R ( s ) ≥ 2 , and let U U U be any open-loop policy. We proceed in four steps.
Step 1. Replacing the memory bound of Theorem 12 with that of Proposition 7 , we obtain
sup r ≥ M E Y 0 : r ∥ P r − Ξ s ( T U ( ⋅ ∣ w r ) ) ∥ T V ≤ Δ M 2 + ( 1 + 2 M q min ) L ψ s + ∑ w ∈ Λ s M p ( w ) ∥ P ^ ( ⋅ ∣ w ) − T U ( ⋅ ∣ w ) ∥ T V , (44) \sup_{r\ge M}\mathbb{E}_{Y_{0:r}}\left\|P_r-\Xi_s\left(T^U(\cdot\mid w_r)\right)\right\|_{\mathrm{TV}}
\le\sqrt{\frac{\Delta_M}{2}}+\left(1+\frac{2M}{q_{\min}}\right)\frac{L_\psi}{s}
+\sum_{w\in\Lambda_s^M}p(w)\left\|\hat{P}(\cdot\mid w)-T^U(\cdot\mid w)\right\|_{\mathrm{TV}}, \tag*{(44)} r ≥ M sup E Y 0 : r P r − Ξ s ( T U ( ⋅ ∣ w r ) ) TV ≤ 2 Δ M + ( 1 + q m i n 2 M ) s L ψ + w ∈ Λ s M ∑ p ( w ) P ^ ( ⋅ ∣ w ) − T U ( ⋅ ∣ w ) TV , (44)
where w r : = q M , s ( Y r − M + 1 : r ) w_r := q^{M,s}(Y_{r-M+1:r}) w r := q M , s ( Y r − M + 1 : r ) .
Step 2. Let ξ j : = ( q M , s ( Y j : j + M − 1 ) , q s ( Y j + M ) ) \xi_j := \left(q^{M,s}(Y_{j:j+M-1}),q^s(Y_{j+M})\right) ξ j := ( q M , s ( Y j : j + M − 1 ) , q s ( Y j + M ) ) . This is a fixed measurable function of finitely many coordinates of the shifted sequence ( Y j + i ) i ≥ 0 (Y_{j+i})_{i\ge0} ( Y j + i ) i ≥ 0 . Since { Y r } \{Y_r\} { Y r } is stationary and ergodic (Lemma 30 ), so is { ξ j } j \{\xi_j\}_j { ξ j } j . By Birkhoff’s ergodic theorem, applied to the finitely many indicators 1 { ξ j = ( w , v ) } \mathbb{1}\{\xi_j=(w,v)\} 1 { ξ j = ( w , v )} , there is an event Ω M , s \Omega_{M,s} Ω M , s of probability one on which
n w K ~ → p ( w ) and 1 K ~ ∑ j = 1 K ~ 1 { ξ j = ( w , v ) } → p ( w ) P ^ ( v ∣ w ) \frac{n_w}{\widetilde{K}}\to p(w)
\qquad\text{and}\qquad
\frac{1}{\widetilde{K}}\sum_{j=1}^{\widetilde{K}}\mathbb{1}\{\xi_j=(w,v)\}\to p(w)\hat{P}(v\mid w) K n w → p ( w ) and K 1 j = 1 ∑ K 1 { ξ j = ( w , v )} → p ( w ) P ^ ( v ∣ w )
for all ( w , v ) ∈ Λ s M × Λ s (w,v)\in\Lambda_s^M\times\Lambda_s ( w , v ) ∈ Λ s M × Λ s . The proof of Lemma 36 -(i) uses only the conditional independence of the observations, so p ( w ) ≥ ( q min μ min s ) M > 0 p(w)\ge(q_{\min}\mu_{\min}^s)^M>0 p ( w ) ≥ ( q m i n μ m i n s ) M > 0 . Hence, on Ω M , s \Omega_{M,s} Ω M , s :
there exists K ~ 0 ( ω ) \widetilde{K}_0(\omega) K 0 ( ω ) such that, for all K ~ ≥ K ~ 0 ( ω ) \widetilde{K}\ge\widetilde{K}_0(\omega) K ≥ K 0 ( ω ) , every window appears in the data set and p ( w ) ≤ 2 n w / K ~ p(w)\le2n_w/\widetilde{K} p ( w ) ≤ 2 n w / K for every w w w ;
a w : = ∥ y w − P ^ ( ⋅ ∣ w ) ∥ T V → 0 a_w:=\|y^w-\hat{P}(\cdot\mid w)\|_{\mathrm{TV}}\to0 a w := ∥ y w − P ^ ( ⋅ ∣ w ) ∥ TV → 0 for every w w w , as K ~ → ∞ \widetilde{K}\to\infty K → ∞ .
Step 3. Fix aligning levels ( n , m , l ) (n,m,l) ( n , m , l ) and β \beta β with η : = η ( n , m , β ) ≤ 1 \eta:=\eta(n,m,\beta)\le1 η := η ( n , m , β ) ≤ 1 , and fix ω ∈ Ω M , s \omega\in\Omega_{M,s} ω ∈ Ω M , s and K ~ ≥ K ~ 0 ( ω ) \widetilde{K}\ge\widetilde{K}_0(\omega) K ≥ K 0 ( ω ) . Steps 4 and 5 of §D.2 use only the properties listed at the end of Step 2, the optimality of U K ~ ∗ U_{\widetilde{K}}^* U K ∗ , and Lemmata 34 and 37 . These steps therefore give
∑ w p ( w ) ∥ P ^ ( ⋅ ∣ w ) − T U K ~ ∗ ( ⋅ ∣ w ) ∥ T V ≤ ∑ w p ( w ) a w + 2 A K ~ q min μ min s + η 2 , \sum_w p(w)\left\|\hat{P}(\cdot\mid w)-T^{U_{\widetilde{K}}^*}(\cdot\mid w)\right\|_{\mathrm{TV}}
\le\sum_w p(w)a_w+\frac{2A_{\widetilde{K}}}{\sqrt{q_{\min}\mu_{\min}^s}}+\frac{\eta}{\sqrt{2}}, w ∑ p ( w ) P ^ ( ⋅ ∣ w ) − T U K ∗ ( ⋅ ∣ w ) TV ≤ w ∑ p ( w ) a w + q m i n μ m i n s 2 A K + 2 η ,
with A K ~ 2 : = ∑ w n w K ~ a w 2 A_{\widetilde{K}}^2:=\sum_w\frac{n_w}{\widetilde{K}}a_w^2 A K 2 := ∑ w K n w a w 2 .
By Step 2, a w → 0 a_w\to0 a w → 0 for each of the finitely many w w w , and n w / K ~ ≤ 1 n_w/\widetilde{K}\le1 n w / K ≤ 1 . Hence the first two terms vanish as K ~ → ∞ \widetilde{K}\to\infty K → ∞ . Combining with ( ⋆ ) (\star) ( ⋆ ) , on Ω M , s \Omega_{M,s} Ω M , s we obtain
lim sup K ~ → ∞ sup r ≥ M E Y 0 : r ∥ P r − Ξ s ( T U K ~ ∗ ( ⋅ ∣ w r ) ) ∥ T V ≤ Δ M 2 + ( 1 + 2 M q min ) L ψ s + η ( n , m , β ) 2 . (45) \limsup_{\widetilde{K}\to\infty}\sup_{r\ge M}\mathbb{E}_{Y_{0:r}}\left\|P_r-\Xi_s\left(T^{U_{\widetilde{K}}^*}(\cdot\mid w_r)\right)\right\|_{\mathrm{TV}}
\le\sqrt{\frac{\Delta_M}{2}}+\left(1+\frac{2M}{q_{\min}}\right)\frac{L_\psi}{s}
+\frac{\eta(n,m,\beta)}{\sqrt{2}}. \tag*{(45)} K → ∞ lim sup r ≥ M sup E Y 0 : r P r − Ξ s ( T U K ∗ ( ⋅ ∣ w r ) ) TV ≤ 2 Δ M + ( 1 + q m i n 2 M ) s L ψ + 2 η ( n , m , β ) . (45)
Step 4. The event Ω ∗ : = ⋂ M , s ∈ N Ω M , s \Omega^* := \bigcap_{M,s\in\mathbb{N}} \Omega_{M,s} Ω ∗ := ⋂ M , s ∈ N Ω M , s is a countable intersection, so it has probability one. It does not depend on ( n , m , l , β ) (n,m,l,\beta) ( n , m , l , β ) , and on it ( ⋆ ′ ) (\star') ( ⋆ ′ ) holds for all M M M , s s s , aligning ( n , m , l ) (n,m,l) ( n , m , l ) and β \beta β with η ≤ 1 \eta\le1 η ≤ 1 . For fixed M M M and s s s , we have c = M U c = M_{\mathrm{U}} c = M U , so each term of (24) tends to 0 0 0 as β , n , m → ∞ \beta,n,m \to\infty β , n , m → ∞ along aligning levels; in particular η ≤ 1 \eta\le1 η ≤ 1 eventually. Letting ( n , m , β ) → ∞ (n,m,\beta) \to\infty ( n , m , β ) → ∞ , then s → ∞ s \to\infty s → ∞ , then M → ∞ M \to\infty M → ∞ , and using Δ M ↓ 0 \Delta_M \downarrow0 Δ M ↓ 0 (Proposition 7 ), proves the claim on Ω ∗ \Omega^* Ω ∗ . ▪