Introduction
In-Context Learning (ICL) ([5 ] ) is widely used to adapt Large Language Models (LLMs) through an instruction and a small set of input–output demonstrations, without updating model parameters. A prominent line of theory explains ICL as implicit Bayesian inference over a latent task ([30 , 26 , 22 ] ): the demonstrations provide evidence about which task generated the prompt, and prediction improves as the posterior concentrates on that task. The standard account relies on two support assumptions. First, the posterior ranges over latent tasks or concepts already represented by the pretraining mixture, so the target has positive prior probability under that mixture ([30 , 29 , 26 ] ). Second, the instruction is typically omitted or absorbed into a fixed canonical prompt format, rather than modeled as a task-conditional variable that may differ across demonstrations ([3 , 25 , 2 ] ). In deployment, however, both assumptions can fail.
Consider first the instruction. Real prompts can depart from the pretraining distribution in systematic ways. A user of Indian English may write please revert with the numbers , using revert to mean “reply,” while the same word is associated predominantly with “undo” in the model’s coding data. The term bias may denote a regression intercept to one user and a fairness property to another. A company’s internal service may retain the name of an open-source project even after its behavior has diverged. Other deviations are inconsistent rather than repeated — typos that differ from slot to slot, or demonstrations assembled by retrieval or by multiple annotators, each carrying its own rendering. What matters is the interaction of two axes: whether the instruction was seen paired with the intended task during pretraining, and whether one instruction governs the prompt or each demonstration carries its own. Table 1 formalizes these seven structures. They lead to our first research question: *When can additional demonstrations overcome an instruction outside the task-conditional pretraining support, and when do additional instructions introduce enough new shift to offset the evidence supplied by those demonstrations?
Table 1. Seven prompt formats classified by support and instruction placement. Supported means that the instruction was paired with the intended task with positive probability during pretraining; unsupported means that this probability is zero. Appendix D.2 gives complete examples.
The other support assumption fails at the level of the target task itself. Language-model agents are increasingly asked to execute long-horizon objectives that may never have appeared as complete tasks during pretraining. At the same time, many such objectives admit plans composed of pretraining-supported skills: extracting a field, transforming a record, invoking a known operation, checking an intermediate state, and aggregating the results. A latent-task posterior cannot directly select a target task with zero pretraining probability, but an agent need not execute that task as one indivisible mapping. As an application of the ICL perspective, we ask: When can an out-of-support target task be realized by a plan that decomposes it into pretraining-supported subtasks, and how do step-wise errors accumulate over a long execution horizon? We study execution under a given task decomposition, rather than the separate problem of how an agent discovers that decomposition.
We address both questions in a common latent-task framework. For unsupported instructions, task evidence from demonstrations competes with the shift induced by the instruction structure. For long-horizon tasks, the same perspective is applied along an intermediate-state trajectory of supported subtasks. A pathwise Lipschitz analysis quantifies sensitivity along both types of paths.
Our Contributions. We distinguish instruction-level support from task-level support and characterize how generalization at these two levels is shaped by the number and provenance of demonstrations, instruction placement, and task decomposition. Our main contributions are summarized as follows.
Characterizing ICL with Supported and Unsupported Instructions (§ 3 ). Holding the target task within the pretraining task support, we distinguish instructions that lie inside or outside the corresponding task-conditional instruction support and analyze the seven prompt structures in Table 1 . We show that informative demonstrations identify the target task and, under a fixed model-induced reference extension, preserve their exponential rate despite a fixed unsupported instruction whose continuation cost does not grow with the demonstration count. This is a conditional statement about the specified extension, rather than an identification of its off-support values from the pretraining distribution. For mixed or varying instructions, the instruction-shift cost can instead accumulate; convergence depends on whether task evidence grows faster than that cost.
Applying the ICL View to Long-Horizon Tasks through Supported Subtasks (§ 4 ). We use the preceding ICL framework to interpret a target task with zero pretraining probability. Although such a task cannot be selected directly by the pretrained latent-task posterior, it may be realized by a plan that composes supported subtasks along an intermediate-state trajectory. We bound the final error by the accumulated errors of the execution steps, revealing why a single poorly supported or unstable subtask can become the bottleneck.
Validating the Theoretical Statements through Experiments (§ 5 ). We test the predicted interaction between instruction structure and demonstration count, the pathwise characterization of prompt sensitivity, and the effect of decomposition quality on multi-step task execution.
Taken together, our instruction results offer a unified view of ICL beyond pretraining support. For a specified off-support reference extension, demonstrations can supply evidence for the intended latent task that dominates a fixed instruction-shift cost; realizing this behavior in the actual model further requires controlled model–reference error. Task decomposition, meanwhile, brings a novel long-horizon objective within the model’s repertoire of pretrained skills. In both cases, success depends on whether the useful evidence dominates the sensitivity accumulated along the path from the test prompt to what the model has already learned.
Problem Setup
This section formalizes the latent-task view of ICL and defines the seven prompt formats used throughout our analysis by distinguishing task-conditional instruction support and instruction placement.
Latent Task Model. Let V \mathcal{V} V be a finite vocabulary and let S \mathcal{S} S be a finite space of individual inputs, outputs, and intermediate states. Following Xie et al. [30 ] , we assume that each sample ( x , y ) ∈ S × S (x,y) \in\mathcal{S} \times\mathcal{S} ( x , y ) ∈ S × S is generated from a latent task t t t in a finite task set T \mathcal{T} T . Conditioned on t t t , X ∼ P X ∣ t X \sim P_{X\mid t} X ∼ P X ∣ t , Y = f t ( X ) Y = f_t(X) Y = f t ( X ) , where f t : S → S f_t : \mathcal{S} \to\mathcal{S} f t : S → S is the task-specific mapping.
We write P ( ⋅ ) P(\cdot) P ( ⋅ ) for distributions and p ( ⋅ ) p(\cdot) p ( ⋅ ) for their mass or density functions, and assume π ( t ) = P ( T = t ) > 0 \pi(t)=\mathbb{P}(T=t)>0 π ( t ) = P ( T = t ) > 0 for every t ∈ T t\in\mathcal{T} t ∈ T . § 4 will additionally consider downstream tasks t † ∉ T t^\dagger\notin\mathcal{T} t † ∈ / T , for which we extend the pretraining prior by π ( t † ) = 0 \pi(t^\dagger)=0 π ( t † ) = 0 . An ICL prompt with N N N demonstrations is written as z N = ( i , ( x 1 , y 1 ) , … , ( x N , y N ) , x q u e r y ) z_N=(i,(x_1,y_1),\ldots,(x_N,y_N),x_{\mathrm{query}}) z N = ( i , ( x 1 , y 1 ) , … , ( x N , y N ) , x query ) ; we omit the subscript and write z z z when N N N is clear from context. Here i i i collects the instruction variables under the chosen prompt format and x q u e r y x_{\mathrm{query}} x query is the query input. Let D 0 D_0 D 0 denote the support of the pretraining prompt distribution across all values of N N N . All almost-sure statements as N → ∞ N\to\infty N → ∞ refer to the length-N N N prefixes of one infinite sequence of demonstrations generated by the stated mechanism.
Instructions. A single task may admit multiple instructions and prompt formats. For a pretraining-supported task t ∈ T t\in\mathcal{T} t ∈ T , we model its instructions as draws from the task-conditional distribution P i ∣ t P_{i\mid t} P i ∣ t . Support is therefore task-conditional: for a target task t ∗ ∈ T t^*\in\mathcal{T} t ∗ ∈ T , an instruction i i i is supported if p ( i ∣ t ∗ ) > 0 p(i\mid t^*)>0 p ( i ∣ t ∗ ) > 0 and unsupported if p ( i ∣ t ∗ ) = 0 p(i\mid t^*)=0 p ( i ∣ t ∗ ) = 0 . This definition asks whether pretraining ever paired the instruction with the intended task, not whether the words appeared in pretraining or whether a user regards them as semantically correct. For example, revert may be common in coding data but unsupported for the task of drafting a reply. The distinction matters because p ( i ∣ t ∗ ) p(i\mid t^*) p ( i ∣ t ∗ ) enters the latent-task posterior directly: ordinary Bayesian conditioning applies to supported instructions, whereas an unsupported instruction requires the off-support analysis developed below.
Fix a maximum instruction length L i L_i L i , let e : V ∪ { ⟨ p a d ⟩ } → R d e:\mathcal{V}\cup\{\langle\mathrm{pad}\rangle\}\to\mathbb{R}^d e : V ∪ {⟨ pad ⟩} → R d be the token embedding map with e ( ⟨ p a d ⟩ ) = 0 e(\langle\mathrm{pad}\rangle)=0 e (⟨ pad ⟩) = 0 , and right-pad every instruction to length L i L_i L i . Write V ≤ L i : = ⋃ m = 0 L i V m \mathcal{V}^{\leq L_i}:=\bigcup_{m=0}^{L_i}\mathcal{V}^m V ≤ L i := ⋃ m = 0 L i V m . For i = ( v 1 , … , v m ) ∈ V ≤ L i i=(v_1,\ldots,v_m)\in\mathcal{V}^{\leq L_i} i = ( v 1 , … , v m ) ∈ V ≤ L i , define its padded embedding matrix as E ( i ) : = [ e ( v 1 ) , … , e ( v m ) , 0 , … , 0 ] ⊤ ∈ R L i × d E(i):=[e(v_1),\ldots,e(v_m),0,\ldots,0]^\top\in\mathbb{R}^{L_i\times d} E ( i ) := [ e ( v 1 ) , … , e ( v m ) , 0 , … , 0 ] ⊤ ∈ R L i × d . Thus instructions with different token lengths lie in one common ambient space; Appendix § 14 provides the corresponding padding-stability justification. For each competing task t ≠ t ∗ t\ne t^* t = t ∗ and supported instruction i i i , define the task-relative instruction score r t ( i ) : = log ( p ( i ∣ t ) / p ( i ∣ t ∗ ) ) r_t(i):=\log\left(p(i\mid t)/p(i\mid t^*)\right) r t ( i ) := log ( p ( i ∣ t ) / p ( i ∣ t ∗ ) ) . The score compares how likely the instruction is under the competing task t t t and the target task t ∗ t^* t ∗ . For the continuous-path analysis, we use a fixed model-induced extension of this score along the instruction-embedding path defined below. We do not require the off-support extension to arise from separate normalized densities on the continuous instruction-embedding space. Its values away from the symbolic embeddings are additional structure made explicit in the continuation condition below, rather than something identified by the finite symbolic support. Appendix § 11 shows that an analytic Transformer scoring map supplies one concrete such extension and implies the required finite continuation chain.
Prompt Formats. The formats below model common ways in which prompts are assembled. A user or system message supplies one global instruction; a structured dataset may copy one field or operator into every record; and retrieval or multiple annotators may attach a different rendering to each demonstration. These placement patterns matter because a shared instruction contributes one piece of task evidence, whereas independently varying instructions can contribute a new likelihood factor with every demonstration. Crossing the three placement patterns—single, repeated, and varying—with supported versus unsupported instructions gives formats 1–6. Format 7 captures partial corruption, where a supported template remains in most slots but typos or schema errors affect a subset (Table 1 ). This distinction follows from the assumed generative factorization rather than from the Transformer architecture alone. Appendix § 15 .§ 4 gives a controlled experiment showing that a Transformer can learn the corresponding effective instruction sample sizes from cross-position correlation structure.
The support labels in the table follow directly from the sampling mechanism. In formats 1, 3, and 5, every instruction is drawn from P i ∣ t ∗ P_{i\mid t^*} P i ∣ t ∗ and is therefore supported. Formats 2, 4, and 6 instead select instructions outside its support, so p ( i ∣ t ∗ ) = 0 p(i\mid t^*)=0 p ( i ∣ t ∗ ) = 0 . Format 7 contains both the shared supported template and distinct unsupported corruptions. For notational convenience, we use i i i to denote the collection of all instructions appearing in a prompt, regardless of the specific prompt format. Unless otherwise specified, input-output pairs ( X , Y ) (X,Y) ( X , Y ) are drawn i.i.d. conditional on the latent task.
ICL with Supported and Unsupported Instructions
Throughout this section, the target task is pretraining-supported: t ∗ ∈ T t^*\in\mathcal{T} t ∗ ∈ T and π ( t ∗ ) > 0 \pi(t^*)>0 π ( t ∗ ) > 0 . The distinction studied below concerns only whether the instruction is supported conditional on that task.
Let M ( y ∣ z ) M(y\mid z) M ( y ∣ z ) denote the output probability of the actual pretrained model. The Bayesian predictor p ( y ∣ z ) p(y\mid z) p ( y ∣ z ) on supported prompts, and its fixed continuation p ˉ ( y ∣ z ) \bar{p}(y\mid z) p ˉ ( y ∣ z ) on unsupported prompts, serve as theoretical reference predictors, which need not coincide with M M M exactly (see Appendix D.§ 1 ).
ICL with Pretraining-Supported Instructions
We first consider prompt formats whose instructions lie in the support of the pretraining distribution.
Assumption 3.1 (Identifiability of task evidence). For every pair of distinct tasks t 1 , t 2 ∈ T t_1, t_2 \in\mathcal{T} t 1 , t 2 ∈ T , the demonstration distributions satisfy KL ( P X , Y ∣ t 1 ∥ P X , Y ∣ t 2 ) > 0 \operatorname{KL}(P_{X,Y\mid t_1} \mathbin{\|} P_{X,Y\mid t_2}) > 0 KL ( P X , Y ∣ t 1 ∥ P X , Y ∣ t 2 ) > 0 , and the corresponding demonstration log-likelihood ratio is integrable under P X , Y ∣ t 1 P_{X,Y\mid t_1} P X , Y ∣ t 1 . For format 5, the log-likelihood ratio of the joint instruction–demonstration distribution is also integrable. Under the format-specific generation mechanism described in § 2 ,
KL ( P i ∣ t 1 ⊗ P X , Y ∣ t 1 ∥ P i ∣ t 2 ⊗ P X , Y ∣ t 2 ) = KL ( P i ∣ t 1 ∥ P i ∣ t 2 ) + KL ( P X , Y ∣ t 1 ∥ P X , Y ∣ t 2 ) > 0. (1) \operatorname{KL}(P_{i\mid t_1} \otimes P_{X,Y\mid t_1} \mathbin{\|} P_{i\mid t_2} \otimes P_{X,Y\mid t_2}) = \operatorname{KL}(P_{i\mid t_1} \mathbin{\|} P_{i\mid t_2}) + \operatorname{KL}(P_{X,Y\mid t_1} \mathbin{\|} P_{X,Y\mid t_2}) > 0. \tag*{(1)} KL ( P i ∣ t 1 ⊗ P X , Y ∣ t 1 ∥ P i ∣ t 2 ⊗ P X , Y ∣ t 2 ) = KL ( P i ∣ t 1 ∥ P i ∣ t 2 ) + KL ( P X , Y ∣ t 1 ∥ P X , Y ∣ t 2 ) > 0. (1)
Thus the task evidence is identifiable in formats 1, 3, and 5, while the demonstration KL condition above also supplies the gap used in the unsupported-instruction results below.
Under this assumption, the demonstrations provide exponentially increasing evidence for the target task. In format 5, the independently sampled paraphrases form part of this task evidence rather than a single shared instruction factor.
Theorem 3.2 (Informal: model bound with supported instructions). Consider formats 1, 3, and 5 under Assumption 3.1 . Let t ∗ t^* t ∗ be the target task. Then there exist constants α , β > 0 \alpha, \beta> 0 α , β > 0 and a finite model-approximation error ε M ≥ 0 \varepsilon_M \ge0 ε M ≥ 0 such that, almost surely, for all sufficiently large N N N ,
∣ M ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β e − α N + ε M . (2) \left|M(y_{\mathrm{query}}\mid z) - p(y_{\mathrm{query}}\mid x_{\mathrm{query}}, t^*)\right| \le\beta e^{-\alpha N} + \varepsilon_M. \tag*{(2)} ∣ M ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N + ε M . (2)
The bound shows several key insights. The exponent α \alpha α is controlled by the least distinguishable competing task: when every demonstration provides positive evidence for t ∗ t^* t ∗ , posterior mass on the competitors decays exponentially with N N N . The prefactor β \beta β collects effects that do not grow with the demonstration count, including the task prior, the query distribution, and a shared instruction factor. Thus, in formats 1 and 3, copying the same supported instruction into more positions does not create additional independent evidence; the improvement with N N N comes from the new input–output pairs. In format 5, by contrast, each supported paraphrase is part of an instruction–demonstration triple, so it can contribute additional evidence for identifying the task. See Appendix D.§ 4 for complete proof.
ICL with Pretraining-Unsupported Instructions
Single or repeated unsupported instructions.
We first consider formats 2 and 4 when the same unsupported instruction is used throughout the prompt. Format 2 contains one displayed occurrence; format 4 contains N + 1 N + 1 N + 1 copies of one shared realization. The repeated copies in format 4 are not treated as N + 1 N + 1 N + 1 independent task observations: the instruction template is sampled once and copied deterministically into all displayed slots. Thus, for every task t t t ,
p ( z ∣ t ) = p ( i ∣ t ) p ( x q u e r y ∣ t ) ∏ n = 1 N p ( x n , y n ∣ t ) . (3) p(z \mid t) = p(i \mid t)p(x_{\mathrm{query}} \mid t)\prod_{n=1}^{N}p(x_n, y_n \mid t). \tag*{(3)} p ( z ∣ t ) = p ( i ∣ t ) p ( x query ∣ t ) n = 1 ∏ N p ( x n , y n ∣ t ) . (3)
Format 2 is the corresponding single-occurrence special case.
Let i 0 i_0 i 0 be a supported anchor and i ~ \tilde{i} i ~ the unsupported endpoint. In the padded instruction-embedding space of § 2 , define
E s : = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] . (4) E_s := (1-s)E(i_0) + sE(\tilde{i}), \qquad s \in[0,1]. \tag*{(4)} E s := ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] . (4)
For each competing task, we analytically continue its supported instruction log-likelihood ratio along this path. We denote the corresponding continued predictive probability by p ˉ ( y q u e r y ∣ z ) \bar{p}(y_{\mathrm{query}} \mid z) p ˉ ( y query ∣ z ) . This continuation is a model-induced reference extension; because the endpoint has zero probability, its value is not identified by the pretraining distribution alone.
Under this condition, we can give an exponential bound on the continued reference predictor and a corresponding bound for the actual model.
Theorem 3.3 (Informal: unsupported shared instruction). Suppose Assumption 3.1 holds and, for every t ≠ t ∗ t \ne t^* t = t ∗ , the supported log-likelihood ratio admits a fixed finite analytic continuation from the supported anchor to the unsupported endpoint. Then there exist constants α , β > 0 \alpha, \beta> 0 α , β > 0 , independent of N N N , such that, almost surely for all sufficiently large N N N , the continued reference predictor satisfies
∣ p ˉ ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β e − α N . (5) \left|\bar{p}(y_{\mathrm{query}} \mid z) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right| \le\beta e^{-\alpha N}. \tag*{(5)} ∣ p ˉ ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N . (5) For the actual pretrained model,
∣ M ( y q u e r y ∣ z N ( i ~ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β e − α N + ε M , N ( i ~ ) , (6) \left|M(y_{\mathrm{query}} \mid z_N(\tilde{i})) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right| \le\beta e^{-\alpha N} + \varepsilon_{M,N}(\tilde{i}), \tag*{(6)} M ( y query ∣ z N ( i ~ )) − p ( y query ∣ x query , t ∗ ) ≤ β e − α N + ε M , N ( i ~ ) , (6) where ε M , N ( i ~ ) \varepsilon_{M,N}(\tilde{i}) ε M , N ( i ~ ) is the model–reference transport error along the tied shared-template path, defined formally in Appendix D.§ 1 . Assumption D.21 shows when the transport error is uniformly bounded, and when the actual model converges to the target-task predictor.
Theorem 3.3 handles a prompt outside the pretraining support in the repeated-instruction setting. In particular, the same unsupported instruction i ~ \tilde{i} i ~ is repeated across all demonstrations and satisfies p ( i ~ ∣ t ∗ ) = 0 p(\tilde{i} \mid t^*) = 0 p ( i ~ ∣ t ∗ ) = 0 , so the ordinary Bayes conditional at z N ( i ~ ) z_N(\tilde{i}) z N ( i ~ ) is not determined directly by the pretraining distribution. Because all displayed occurrences are copies of one shared instruction realization, its fixed finite continuation is performed only once and introduces only an N N N -independent factor. At the same time, evidence from the demonstrations that identifies the target task accumulates with N N N . Therefore, even though p ( i ~ ∣ t ∗ ) = 0 p(\tilde{i} \mid t^*) = 0 p ( i ~ ∣ t ∗ ) = 0 , the theoretical continuation error still decreases exponentially for this specified reference extension. Appendix D.1.1 gives sufficient quantitative conditions under which the transport error is small, controlled study in Appendix § 11 .§ 6 complements this result.
Remark 3.4. This setting reflects a common mismatch between the notation represented during LLM pretraining and the notation chosen by a user. A user may consistently express a supported task using a symbol or style of language that never appeared in pretraining. The theorem suggests that, provided the underlying latent task was learned during pretraining and the new notation is used consistently across the demonstrations, sufficiently many examples can still identify the target task within the reference construction. When the model-transport error is also small, the actual model can exhibit the corresponding behavior from the input pattern rather than requiring that notation itself have been observed during pretraining. The continuation perspective is also relevant when p ( i ~ ∣ t ∗ ) > 0 p(\tilde{i} \mid t^*) > 0 p ( i ~ ∣ t ∗ ) > 0 but extremely small, since it may occur too rarely in a finite pretraining corpus for the model to learn its association with t ∗ t^* t ∗ reliably, making it effectively unsupported for the learned model.
Mixed and varying supported and unsupported instructions (format 6-7).
We next consider format 7, in which most demonstrations share a supported instruction while a subset contain distinct unsupported corruptions. The supported occurrences act as a common anchor, and each corrupted occurrence is connected to that anchor by the same construction used in § 3.2.1 , which quantifies how strongly the corruption can favor a competing task (see Appendix D.§ 6 ).
Intuitively, every informative demonstration supplies evidence that separates the target task from its competitors, while each distinct unsupported instruction can shift some of that evidence back toward a competing task. Generalization therefore depends on whether the evidence accumulated from the demonstrations grows faster than the total adverse effect of the corruptions.
Format 6 is the limiting case in which every demonstration has a distinct unsupported instruction. The demonstrations provide accumulating evidence for the target task, but the continuation costs of the unsupported instructions also accumulate with N N N . Convergence remains possible when the demonstration evidence grows faster than the total continuation cost. Thus the analysis gives no unconditional convergence guarantee for format 6. This explains why increasing the number of examples need not remove instruction sensitivity in this setting, consistent with Figure 1 b. Complete details are given in Appendix D.7.
Figure 1. (a) Consistent mismatched instructions. The discrete gradients of the correct-digit log probabilities diminish as the repeated demonstrations identify the intended task. (b) Varying mismatched instructions. The discrete gradients of the correct-digit log probabilities remain irregular when different instruction mismatches accumulate across demonstrations. (c) Step-wise sensitivity under agent task decomposition. The in-distribution execution plan has a smoother gradient profile, whereas the out-of-distribution plan exhibits larger fluctuations. Empirical analogues of (a) consistent and (b) varying instruction mismatch, together with (c) the role of supported, stable subtasks in Theorem 4.2 and § 4.2 . In (a)–(b), the fixed correct answer is 1345; Char “1” , Char “3” , Char “4” , and Char “5” denote the score-gradient traces for these correct digits at the first through fourth output positions, respectively.
Remark 3.5. These setting models typos in user-provided demonstrations. Some demonstrations may use a supported instruction from the pretraining support, whereas a typo may produce an instruction that the model never observed during pretraining. Moreover, different typos need not produce the same unsupported instruction, which distinguishes it from the repeated setting of § 3.2.1 . Their demonstration-dependent cost can still vanish when it grows more slowly than the evidence supplied by the demonstrations, while the actual model retains the displayed transport error.
ICL for task beyond the pretraining task support
Language-model agents are often asked to carry out long-horizon tasks that may not be represented as single latent tasks during pretraining. Such a target has π ( t † ) = 0 \pi(t^\dagger)=0 π ( t † ) = 0 and therefore receives zero posterior mass for every prompt and every N N N . Consequently, the Bayesian latent-task reference for direct ICL can only form a mixture of supported-task predictions, and increasing N N N cannot make this reference predictor select the unsupported target task. In this section, we apply the preceding ICL analysis to an agent that follows a plan decomposing such a task into supported subtasks, and our aim here is to use the ICL framework to explain how support and model–reference errors behave along agent execution, rather than to introduce a separate theory of agent learnability.
Executing Long-Horizon Tasks through Supported Subtasks
Agent execution circumvents the reference-level obstruction by never asking the posterior to represent t † t^\dagger t † as a single latent task. Consider a K K K -step plan with supported subtasks t 0 , … , t K − 1 ∈ T t_0,\ldots,t_{K-1}\in\mathcal{T} t 0 , … , t K − 1 ∈ T . Let x n ( k ) ∈ S x_n^{(k)}\in\mathcal{S} x n ( k ) ∈ S be the state of demonstration n n n after step k k k , where the state contains any execution history needed by the next step. We assume the recursion x n ( k + 1 ) = f t k ( x n ( k ) ) x_n^{(k+1)}=f_{t_k}(x_n^{(k)}) x n ( k + 1 ) = f t k ( x n ( k ) ) , and define f t † ( x ) f_{t^\dagger}(x) f t † ( x ) as the terminal state x ( K ) x^{(K)} x ( K ) obtained by this recursion from x ( 0 ) = x x^{(0)}=x x ( 0 ) = x . Thus f t † = f t K − 1 ∘ ⋯ ∘ f t 0 f_{t^\dagger}=f_{t_{K-1}}\circ\cdots\circ f_{t_0} f t † = f t K − 1 ∘ ⋯ ∘ f t 0 . We reuse z N z_N z N for the full agent-execution prompt, whose N N N demonstrations are the trajectories ( x n ( 0 ) , … , x n ( K ) ) (x_n^{(0)},\ldots,x_n^{(K)}) ( x n ( 0 ) , … , x n ( K ) ) . For step k k k and a current state x x x , let z N ( k ) ( x ) z_N^{(k)}(x) z N ( k ) ( x ) denote the prompt formed by the supported instruction for t k t_k t k , the N N N transition pairs ( x n ( k ) , x n ( k + 1 ) ) (x_n^{(k)},x_n^{(k+1)}) ( x n ( k ) , x n ( k + 1 ) ) , and x x x . Starting from x ( 0 ) = x q u e r y x^{(0)}=x_{\mathrm{query}} x ( 0 ) = x query , the agent produces x ( 1 ) , … , x ( K ) x^{(1)},\ldots,x^{(K)} x ( 1 ) , … , x ( K ) sequentially, with y q u e r y = x ( K ) y_{\mathrm{query}}=x^{(K)} y query = x ( K ) . The latent task of the step-k k k prompt is therefore the supported subtask t k ∈ T t_k\in\mathcal{T} t k ∈ T . This is the decisive structural point: although π ( t † ) = 0 \pi(t^\dagger)=0 π ( t † ) = 0 , every step prompt represents a supported task with π ( t k ) > 0 \pi(t_k)>0 π ( t k ) > 0 .
Assumption 4.1 (Step-wise supported identifiability). There are constants α k , β k > 0 \alpha_k,\beta_k>0 α k , β k > 0 independent of N N N such that, almost surely for all sufficiently large N N N and every state x x x reachable at step k k k ,
1 − p ( f t k ( x ) ∣ z N ( k ) ( x ) ) ≤ β k e − α k N . (7) 1-p\left(f_{t_k}(x)\mid z_N^{(k)}(x)\right)\leq\beta_k e^{-\alpha_kN}. \tag*{(7)} 1 − p ( f t k ( x ) ∣ z N ( k ) ( x ) ) ≤ β k e − α k N . (7)
Note that Assumption 4.1 is not an extra hypothesis about t † t^\dagger t † ; it is the component of Theorem 3.2 applied K K K times, together with the requirement that the bound be uniform over the correct intermediate states rather than at a single query.
Theorem 4.2 (Informal: step-wise ICL bound for a decomposed long-horizon task). Let f t ~ = f t K − 1 ∘ ⋯ ∘ f t 0 f_{\tilde{t}} = f_{t_{K-1}} \circ\cdots\circ f_{t_0} f t ~ = f t K − 1 ∘ ⋯ ∘ f t 0 with t 0 , … , t K − 1 ∈ T t_0,\ldots,t_{K-1} \in\mathcal{T} t 0 , … , t K − 1 ∈ T , and let Assumption 4.1 hold. For each step k k k , let ε M ( k ) ( N ) ≥ 0 \varepsilon^{(k)}_M(N) \ge0 ε M ( k ) ( N ) ≥ 0 be its finite model-transport error, defined formally in Appendix E. Then, almost surely for all sufficiently large N N N ,
∣ M ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t ~ ) ∣ ≤ ∑ k = 0 K − 1 [ β k e − α k N + ε M ( k ) ( N ) ] . (8) \left|M(y_{\mathrm{query}} \mid z_N) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}},\tilde{t})\right| \le\sum_{k=0}^{K-1}\left[\beta_k e^{-\alpha_k N}+\varepsilon^{(k)}_M(N)\right]. \tag*{(8)} M ( y query ∣ z N ) − p ( y query ∣ x query , t ~ ) ≤ k = 0 ∑ K − 1 [ β k e − α k N + ε M ( k ) ( N ) ] . (8)
This bound follows by applying the supported-task ICL guarantee at each step and accumulating the resulting errors across the fixed execution horizon under the explicit step-call protocol above. It connects a standard composition argument to the support distinctions developed above. For each step, α k \alpha_k α k measures how quickly the demonstrations distinguish the intended subtask from competing supported tasks, while β k \beta_k β k collects the N N N -independent difficulty of that step, including its prior, instruction and query factors and the uniformity over reachable intermediate states. The bound is strongest when K K K is moderate, every α k \alpha_k α k is bounded away from zero, and the β k \beta_k β k remain controlled. Its decreasing component is determined by the hardest step through min k α k \min_k \alpha_k min k α k , whereas every step also contributes its model-transport error. Thus one poorly identified or poorly approximated subtask can dominate the entire chain.
The main-text bound uses an explicit step-call protocol: at step k k k , the executor calls the model on exactly the extracted prompt z N ( k ) ( x ( k ) ) z_N^{(k)}(x^{(k)}) z N ( k ) ( x ( k ) ) and retains no additional model-visible history or cache. Full-context autoregressive rollout requires additional rollout and, when applicable, padding corrections, treated in Appendix E and Appendix § 14 .
Remark 4.3. In practice, this interpretation favors agent plans built from supported, well-specified operations with clear intermediate states. Decomposing a difficult long-horizon task into simpler supported steps can make each step easier to identify and therefore improve its exponential rate. However, an unnecessarily long plan creates more opportunities for error, and an ambiguous instruction, an unsupported intermediate representation, or a weakly supported subtask can make one α k \alpha_k α k small or one β k \beta_k β k large. A concise, well-chosen plan can therefore outperform direct prediction, whereas a long or poorly chosen execution plan can be less reliable.
Factors Governing Generalization Beyond Pretraining
The pathwise Lipschitz sensitivity. Recall the instruction path E s E_s E s from (4) , which connects the supported anchor i 0 i_0 i 0 to the unsupported instruction i ~ \tilde{i} i ~ . Define L p a t h \mathcal{L}_{\mathrm{path}} L path as the smallest constant such that, for every competing task t t t and every s , s ′ ∈ [ 0 , 1 ] s,s' \in[0,1] s , s ′ ∈ [ 0 , 1 ] ,
∣ r t ( E s ) − r t ( E s ′ ) ∣ ≤ L p a t h ∥ E s − E s ′ ∥ F , (9) \left|r_t(E_s)-r_t(E_{s'})\right| \le\mathcal{L}_{\mathrm{path}}\left\|E_s-E_{s'}\right\|_F, \tag*{(9)} ∣ r t ( E s ) − r t ( E s ′ ) ∣ ≤ L path ∥ E s − E s ′ ∥ F , (9)
where the reference log-odds along unsupported parts of the path are understood through the continuation in § 3.2.1 . The resulting bound can be written schematically as
error ≲ β exp ( − α N + L p a t h ∥ E ( i ~ ) − E ( i 0 ) ∥ F ) . (10) \operatorname{error} \lesssim\beta\exp\left(-\alpha N+\mathcal{L}_{\mathrm{path}}\left\|E(\tilde{i})-E(i_0)\right\|_F\right). \tag*{(10)} error ≲ β exp ( − α N + L path E ( i ~ ) − E ( i 0 ) F ) . (10)
Thus a good anchor is not merely a point with a small local derivative: it should make the combined anchor and whole-path cost small. The value of L p a t h \mathcal{L}_{\mathrm{path}} L path is determined by the pretrained model, the chosen anchor and path, and the competing tasks. It tends to be smaller when pretraining has learned nearby instructions, representations, or computations that change smoothly toward the test instruction, and can be large when the path crosses a poorly learned or task-ambiguous region. In experiments (§ 5 ), we use the discrete gradient of the correct-output log probability as the prompt changes with the demonstration count as an observable proxy for effective prompt sensitivity. In the agent experiment, changes in output log probability across execution steps provide a qualitative diagnostic of step-wise stability.
The demonstrations sensitivity. The demonstrations determine the evidence rate α \alpha α in (10) : α \alpha α is large when each additional demonstration supplies information that distinguishes the target task from its plausible competitors. Such demonstrations are mutually consistent with one latent rule and include options on which competing rules predict different outputs. By contrast, repetitive examples on which several tasks agree leave the task identity ambiguous and produce a small α \alpha α . Good demonstrations therefore make the favorable term α N \alpha N α N grow rapidly enough to dominate the fixed anchor and path penalties, and they reduce the sensitivity of the final prediction.
For example, consider the prompt
Japan → Tokyo , France → Paris , USA → ? \text{Japan}\to\text{Tokyo},\quad\text{France}\to\text{Paris},\quad\text{USA}\to? Japan → Tokyo , France → Paris , USA → ?
The first two pairs do not distinguish “country to capital” from “country to largest city,” because the two rules agree on both demonstrations. For the query, the two interpretations instead predict Washington DC and New York. The demonstrations thus provide little evidence against either competing task, corresponding to a small α \alpha α and a prediction that can change sharply under a small modification of the prompt. In contrast, consider
Australia → Sydney , Turkey → Istanbul , USA → ? \text{Australia}\to\text{Sydney},\quad\text{Turkey}\to\text{Istanbul},\quad\text{USA}\to? Australia → Sydney , Turkey → Istanbul , USA → ?
The first two pairs rule out the capital interpretation and strongly favor the largest-city interpretation. The resulting larger α \alpha α makes the prediction for USA → ? \text{USA}\to? USA → ? more stable and improves the bound.
Applying the sensitivity view to agent execution. For an unsupported target task, the Bayesian reference for direct ICL cannot select t † t^\dagger t † from its pretraining task posterior. A decomposed agent plan avoids this reference-level obstruction by using supported subtasks t 0 , … , t K − 1 t_0,\ldots,t_{K-1} t 0 , … , t K − 1 . Applying Theorem 3.2 yields two contributions: β k e − α k N \beta_k e^{-\alpha_k N} β k e − α k N measures subtask identification error, and ε M ( k ) ( N ) \varepsilon_M^{(k)}(N) ε M ( k ) ( N ) measures model–reference error. Additional demonstrations reduce the first term, while the second must be controlled separately. The zero prior of the complete task is therefore no longer decisive: the agent only needs to identify and execute the supported steps. However, the errors add across the K K K steps, so one weakly identified or poorly approximated subtask can dominate the final result.
Experiments
Demonstration Evidence for Task Identification
§ 4.2 predicts that ICL performance under prompt shift is governed by the demonstration evidence rate α \alpha α . Here we give a motivational example of the corresponding intuition: demonstrations that better distinguish the target task from plausible competitors should produce more reliable task identification and higher ICL accuracy.
We use Sport Identification as the representative example here. (Setup ) Given a country, the task is to output its associated sport label. We construct two types of demonstrations: identifying demonstrations, where the sport is a distinctive national or traditional sport that strongly pins down a unique latent rule, and ambiguous demonstrations, where the sport is related to the country but can be explained by multiple plausible latent rules, thereby providing weaker evidence about which rule the prompt instantiates. We sample k ∈ { 2 , 4 , 8 } k \in\{2,4,8\} k ∈ { 2 , 4 , 8 } demonstrations from the pool and evaluate on a fixed test set. (Results ) As shown in Table 2 , the identifying pool consistently yields higher accuracy than the ambiguous pool, which is consistent with the prediction that informative demonstrations provide a larger evidence rate, leading to stronger task identification and better generalization. See Appendix § 15 .§ 2 for details, and see Appendix § 15 .§ 3 for a controlled validation.
Table 2. Test accuracy (↑) of ICL under ambiguous and identifying demonstrations (k = 8 k = 8 k = 8 ).
Prompt Sensitivity vs. Demonstration Count
In § 3 , Theorems 3.2 and 3.3 , together with § 3.2.2 , predict different scaling for fixed and varying instruction shifts. We design the following experiment to test the corresponding distinction.
(Setup) We use a pretrained Qwen3-235B-A22B model on a three-digit addition task with a fixed query and target answer. We vary only the operator pattern in the demonstrations: the addition-only regime uses + + + throughout; the consistent-mismatch regime uses the same × \times × symbol throughout while retaining sum outputs; and the varying-mismatch regime independently selects × \times × , / / / , or − - − for each demonstration. These regimes provide an aligned baseline and empirical analogues of consistent and varying instruction mismatch. Because the exact conditional support of a pretrained LLM is not observable, the experiment tests the effect of consistent versus varying instruction mismatch rather than claiming that these symbols have literal zero pretraining probability. (Results) We evaluate the model under the three prompt formats with 1 to 50 demonstrations. We visualize the discrete gradient, as the demonstration count changes, of the model-assigned log probability for each correct output digit in Figure 1 a and Figure 1 b. In the addition-only regime, the gradient remains near zero throughout. Under a consistent mismatch, sensitivity is initially high but gradually decreases as the demonstrations identify addition. Under varying mismatches, the gradients remain irregular and exhibit large spikes even at high demonstration counts. This persistent sensitivity is qualitatively consistent with the theoretical distinction between fixed and varying instruction shifts. See Appendix § 15 .§ 5 for details.
Task Decomposition Quality in Controlled Agent Execution
We instantiate the multi-step execution setting of § 4.1 with an arithmetic agent that follows a fixed plan. The agent maintains an explicit state x ( k ) x^{(k)} x ( k ) and updates it at step k k k by applying the prescribed operation f t k f_{t_k} f t k . We intervene on whether the operations in the plan are supported, while holding the target task and execution horizon fixed. The experiment therefore illustrates the subtask-identification mechanisms summarized by Theorem 4.2 : the ICL view favors execution when the decomposition consists of supported subtasks with controlled step-wise sensitivity. A decomposition containing unsupported subtasks does not receive the same guarantee.
(Setup) We perform two-stage LoRA training for Llama3.2-3B. The base model already performs one- to five-digit addition and simple multiplication reliably, and the first stage adds 20K six-digit addition samples. We treat seven-digit addition as the composed target task. For the In-Distribution Agent Plan , the agent executes six-digit addition, one-digit addition, multiplication by 10, and aggregation as its component operations, and we add 10K step-level training examples for each required operation. The Out-of-Distribution Agent Plan instead requires the agent to perform intermediate seven-digit additions. These operations receive no additional training and cannot be executed reliably in isolation. We evaluate the same model under both plans. (Evaluation) At every execution step, we record whether the state transition is correct and the log probability assigned to the correct output. Variation in the latter across steps is a qualitative diagnostic of step-wise stability. Since adjacent steps generally implement different operations, this quantity is not a direct estimate of the within-step path constant in § 4.2 . (Results) Figure 1 c shows that the in-distribution agent plan has a smoother step-wise log-probability profile. The out-of-distribution agent exhibits larger fluctuations and performs worse than direct prediction without agent execution, illustrating the cost of including a poorly supported operation in the plan. Additional results are provided in Appendix § 15 .§ 6 .
Conclusion
In this work, we separate two forms of generalization in in-context learning (ICL) beyond pretraining support. At the instruction level, supported instructions yield exponential convergence, and the continued reference predictor preserves this rate for a single or repeated unsupported instruction. Mixed prompts also converge when their total continuation burden grows more slowly than the demonstration evidence. At the task level, the Bayesian latent-task reference for direct ICL assigns zero posterior mass to a target outside its supported task set. Within the same reference model, applying the ICL perspective step by step explains how an agent may execute such a long-horizon target without selecting it as a single latent task, provided that a plan decomposes it into supported, identifiable subtasks. The resulting, standard composition bound accumulates the errors of the execution steps. Together, the instruction results and this agent interpretation clarify when more demonstrations, a different prompt format, or a task decomposition may extend model behavior beyond the tasks directly represented in pretraining.
AI Use Statement
Generative AI tools were used to assist with refining the theoretical framework, formulating and checking mathematical claims and proofs, designing experimental methodology, developing and editing experimental code, constructing synthetic experimental pipelines, analyzing and interpreting results, searching and summarizing relevant literature, and drafting, editing, and formatting the manuscript. The authors reviewed all AI-assisted material, checked the mathematical arguments against the stated assumptions, inspected and tested the experimental implementations, and validated reported results through repeated runs and explicit sanity checks. The authors made all final research decisions and take responsibility for the complete contents of the paper, including all text, claims, proofs, code, experiments, and artifacts produced with AI assistance.
Reproducibility Statement
We state the probabilistic setting, assumptions, and model-level distinctions used by the theory in § 2 –§ 4 and Appendix § 11 . Complete proofs of the instruction- and CoT-level results, including the model–reference transport terms, are provided in Appendices D and E. The main experimental protocols are summarized in § 5 ; Appendix § 15 reports the task constructions, model variants, training and evaluation procedures, prompt formats, demonstration counts, random-seed aggregation, metrics, and additional results. It also documents the controlled model–reference, CoT error-propagation, continuation-reach, and Qwen3 soft-prompt interpolation experiments, together with their numerical sanity checks …
List of Common Notations
This appendix summarizes the notation used in the main text. Symbols that are local to a single proof are introduced where they first appear.
Sequences, tasks, and data.
V \mathcal{V} V : the finite token vocabulary; S \mathcal{S} S is the finite space of individual inputs, outputs, and intermediate states.
T \mathcal{T} T : the finite set of latent tasks supported by pretraining; π ( t ) \pi(t) π ( t ) is the pretraining prior on t ∈ T t \in\mathcal{T} t ∈ T .
t ∗ t^{\ast} t ∗ : the target task in § 3 , where t ∗ ∈ T t^{\ast} \in\mathcal{T} t ∗ ∈ T ; t † t^{\dagger} t † is the target task in § 4 , where t † ∉ T t^{\dagger} \notin\mathcal{T} t † ∈ / T and π ( t † ) = 0 \pi(t^{\dagger}) = 0 π ( t † ) = 0 .
( x , y ) (x,y) ( x , y ) : an input–output pair; f t f_t f t is the task-specific mapping, so that y = f t ( x ) y = f_t(x) y = f t ( x ) under a deterministic task t t t .
x q u e r y x_{\mathrm{query}} x query and y q u e r y y_{\mathrm{query}} y query : the query input and its output, respectively.
P ( ⋅ ) P(\cdot) P ( ⋅ ) and p ( ⋅ ) p(\cdot) p ( ⋅ ) : a distribution and its probability mass or density function. In particular, p ( t ∣ z ) p(t \mid z) p ( t ∣ z ) and p ( y q u e r y ∣ z ) p(y_{\mathrm{query}} \mid z) p ( y query ∣ z ) denote the latent-task posterior and posterior predictive distribution.
M ( y ∣ z ) M(y \mid z) M ( y ∣ z ) : the output probability assigned by the actual pretrained model. The Bayesian quantities p p p and p ˉ \bar{p} p ˉ below are its theoretical reference predictors.
D 0 D_0 D 0 : the support of the pretraining prompt distribution across all demonstration counts.
Prompts and instructions.
z z z or z N z_N z N : an ICL prompt containing N N N demonstrations and one query. The seven prompt formats are defined in § 2 .
i i i : an instruction sequence; i ~ \tilde{i} i ~ denotes an instruction unsupported for the target task, and i 0 i_0 i 0 denotes a supported anchor instruction. The notation i i i collects all instruction variables in a prompt when a format contains more than one.
D \mathcal{D} D : the supported instruction domain used in the supported instruction results of § 3 .
L i L_i L i : the fixed maximum instruction length, and V ≤ L i : = ⋃ m = 0 L i V m \mathcal{V}^{\leq L_i} := \bigcup_{m=0}^{L_i} \mathcal{V}^m V ≤ L i := ⋃ m = 0 L i V m .
e : V ∪ { ⟨ p a d ⟩ } → R d e : \mathcal{V} \cup\{\langle\mathrm{pad}\rangle\} \to\mathbb{R}^d e : V ∪ {⟨ pad ⟩} → R d : the token embedding map, with e ( ⟨ p a d ⟩ ) = 0 e(\langle\mathrm{pad}\rangle) = 0 e (⟨ pad ⟩) = 0 .
E ( i ) ∈ R L i × d E(i) \in\mathbb{R}^{L_i \times d} E ( i ) ∈ R L i × d : the right-padded embedding matrix of instruction i i i defined in § 2 .
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) E_s = (1-s)E(i_0) + sE(\tilde{i}) E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] s \in[0,1] s ∈ [ 0 , 1 ] : the straight path in the padded instruction-embedding space from a supported anchor to an unsupported instruction.
r t ( i ) : = log p ( i ∣ t ) p ( i ∣ t ∗ ) r_t(i) := \log\frac{p(i \mid t)}{p(i \mid t^{\ast})} r t ( i ) := log p ( i ∣ t ∗ ) p ( i ∣ t ) : the task-relative instruction score on supported instructions. The notation r t ( U ) r_t(U) r t ( U ) , U ∈ R L i × d U \in\mathbb{R}^{L_i \times d} U ∈ R L i × d , denotes its fixed model-induced extension to instruction-embedding matrices for the continuous-path analysis.
p ˉ \bar{p} p ˉ : the posterior or posterior predictive induced by a fixed analytic continuation at a zero-probability prompt. Ordinary p p p is used when the relevant conditional is determined directly on the support.
Instruction-level convergence.
α > 0 \alpha> 0 α > 0 : a demonstration-evidence rate separating the target task from its competitors; β > 0 \beta> 0 β > 0 denotes a generic N N N -independent prefactor in an exponential error bound.
ε M \varepsilon_M ε M : a finite model-approximation or transport error between the actual model M M M and the theoretical reference predictor. For a shared unsupported instruction, ε M , N ( i ~ ) \varepsilon_{M,N}(\tilde{i}) ε M , N ( i ~ ) is the N N N -dependent error along the tied shared-template path, while ε M ( i ~ ) \varepsilon_M(\tilde{i}) ε M ( i ~ ) denotes its optional uniform upper bound. The pathwise definitions are given in Appendix D.§ 1 .
L p a t h \mathcal{L}_{\mathrm{path}} L path : the pathwise Lipschitz sensitivity of the continued instruction log-likelihood ratios, defined in (9) .
∥ ⋅ ∥ F \lVert\cdot\rVert_F ∥ ⋅ ∥ F denotes the Frobenius norm. In particular, ∥ E ( i ~ ) − E ( i 0 ) ∥ F \lVert E(\tilde{i}) - E(i_0) \rVert_F ∥ E ( i ~ ) − E ( i 0 ) ∥ F is the distance from the supported anchor to the unsupported instruction. Appendix § 14 also denotes this distance by Δ i n s t \Delta_{\mathrm{inst}} Δ inst .
U N ⊆ [ N ] U_N \subseteq[N] U N ⊆ [ N ] : the indices of demonstrations containing unsupported instructions in the mixed setting; Ω n \Omega_n Ω n is the finite continuation cost associated with the n n n -th such instruction.
Agent execution.
K K K : the fixed number of execution steps; t 0 , … , t K − 1 ∈ T t_0,\ldots,t_{K-1} \in\mathcal{T} t 0 , … , t K − 1 ∈ T are the supported subtasks whose composition realizes t † t^\dagger t † .
x n ( k ) x_n^{(k)} x n ( k ) and x ( k ) x^{(k)} x ( k ) : the states after step k k k in demonstration n n n and in the query execution, respectively. In particular, x ( 0 ) = x q u e r y x^{(0)} = x_{\mathrm{query}} x ( 0 ) = x query and x ( k + 1 ) = f t k ( x ( k ) ) x^{(k+1)} = f_{t_k}(x^{(k)}) x ( k + 1 ) = f t k ( x ( k ) ) .
z N ( k ) ( x ) z_N^{(k)}(x) z N ( k ) ( x ) : the step-k k k ICL prompt evaluated at state x x x ; z N z_N z N denotes the full agent-execution prompt.
α k , β k > 0 \alpha_k,\beta_k > 0 α k , β k > 0 : the exponential convergence constants for supported subtask t k t_k t k .
Padding.
Pad M ( z ) \operatorname{Pad}_M(z) Pad M ( z ) : the position-preserving extension of prompt z z z to a fixed length M M M using ⟨ p a d ⟩ \langle\mathrm{pad}\rangle ⟨ pad ⟩ tokens.
m m m : the number of added padding positions; Δ a t t \Delta_{\mathrm{att}} Δ att is the attention-logit gap between a selected informative position and the most competitive visible padding position.
ε p a d \varepsilon_{\mathrm{pad}} ε pad : the model-output log-probability perturbation caused by padding under the conditions of Proposition F.4.
δ k , p a d ( N ) \delta_{k,\mathrm{pad}}(N) δ k , pad ( N ) : the conditional-probability discrepancy between the original and padded step-k k k execution prompts. It is zero when the added positions are strictly future positions removed by the causal mask.
Related Work
Existing theories rely on strong assumptions. A substantial body of theoretical work seeks to understand the mechanisms underlying ICL by analyzing how transformers implement learning procedures over context. At the mechanistic level, studies identify specific architectural patterns such as induction heads and function vectors—that enable example reuse and pattern matching across the context ([21 , 6 , 24 ] ). Complementary algorithmic analyses show that, under well-calibrated assumptions, ICL can be interpreted as implicitly gradient descent or kernel regression in activation space ([3 , 25 , 2 , 17 ] ), or as a form of task selection induced by the prior over pretraining tasks ([4 ] ). While these mechanistic and algorithmic perspectives have significantly advanced our understanding of how ICL is computed, they typically rely on restrictive architectural assumptions, such as linear attention, single-layer or attention-only transformers, or single-head attention—and on idealized data distributions such as random generalized linear regression, which abstract away properties that are critical in practice ([25 , 17 , 32 ] ). A complementary line of work adopts a Bayesian or statistical inference perspective, interpreting ICL as approximate posterior inference over latent tasks conditioned on in-context demonstrations ((Xie et al., 2022; Wang et al., 2023; Panwar et al., 2024). This framing provides a principled account of how generalization improves with more demonstrations, and has been extended to study the effects of noise, misspecification, and pretraining bias on ICL behavior [8 ] . However, existing analyses within this framework uniformly assume a fixed and canonical context format, treating demonstrations as drawn from a coherent, well-specified data-generating process. As a result, they do not characterize how ICL behaves when the format of the context itself varies—a limitation that our work directly addresses.
Practical factors affect ICL generalization. Beyond mechanistic and statistical accounts, a large body of empirical work investigates how practical design choices in prompt construction affect ICL performance. A first line of work focuses on the role of demonstrations themselves: studies show that the number of demonstrations, their selection strategy, and the correctness of their labels each substantially influence downstream performance [1 , 15 , 23 ] . Notably, Min et al. [19 ] find that label correctness in demonstrations matters less than expected, suggesting that ICL generalizes by retrieving a latent task structure rather than learning directly from individual examples. A second line of work examines chain-of-thought prompting, showing that including intermediate reasoning steps in demonstrations can dramatically improve performance on complex tasks [28 , 12 , 20 ] . Subsequent theoretical work explains CoT’s benefit in terms of expressivity: CoT enables deeper computation without additional layers [7 ] , expands the model’s recognition capacity for complex problem classes [18 ] , or supports more serial computation than standard forward passes allow [14 ] . However, these expressivity-based accounts do not characterize how CoT-structured demonstrations affect ICL generalization as the number of reasoning steps grows, which is a gap our work addresses through a multi-step error propagation analysis. A third line of work studies sensitivity to prompt format and template design, finding that surface-level variations in instruction wording, demonstration ordering, and label presentation can lead to large performance swings [31 , 33 , 27 ] . Despite the breadth of these empirical findings, they remain largely descriptive: existing work does not provide a theoretical criterion for when format variation preserves successful generalization and when it fundamentally disrupts consistent task inference. Our work provides such a criterion by formally distinguishing prompt formats under which the posterior predictive converges exponentially with more demonstrations from those under which convergence necessarily fails.
Mechanistic explanations of ICL. A complementary line of work tries to explain ICL at the level of internal representations and computational mechanisms, examining how specific architectural components give rise to in-context behavior. At the representational level, studies identify induction heads and function vectors as key circuits that enable pattern matching and example reuse across the context window [21 , 6 , 24 ] , and related work shows that multi-head softmax attention can implement regression behaviors in simplified settings [9 , 13 ] . At the algorithmic level, several studies argue that transformers implicitly perform gradient descent or kernel regression over in-context examples [3 , 25 , 2 ] , and related perspectives characterize ICL as algorithm selection or prior-induced regularization across tasks [4 , 16 ] . A separate line of work examines whether standard pretraining objectives can produce the representational capacity assumed by these accounts, establishing conditions under which pretrained transformers exhibit ICL-like behavior (Kim and Suzuki, 2024; Kim et al., 2024). While these mechanistic and algorithmic explanations have significantly advanced our understanding of the computational substrate of ICL, they characterize how ICL is implemented within a fixed architecture and format but do not address when and why ICL generalizes across varying prompt formats, nor how practical design choices such as demonstration count, CoT structure, or instruction variation affect the quality of task inference. Our work is therefore complementary to this line, operating at the level of generalization theory rather than mechanistic realization.
Probability Models
This appendix explains how the latent-task probabilities used in the analysis can be related to a Transformer evaluated on continuous instruction embeddings. The argument has three logically distinct parts. Population cross-entropy identifies the Bayes predictor on the support of the pretraining distribution; an analytic Transformer scoring map selects one particular extension away from that support; and a separate model-transport term measures the discrepancy between this reference and the actual pretrained model. In particular, the off-support extension is supplied by the model architecture and is not claimed to be statistically identified by pretraining data of zero probability.
What population cross-entropy identifies
Under the latent-task framework of § 2 , pretraining learns a conditional predictor q ( ⋅ ∣ z ) q(\cdot\mid z) q ( ⋅ ∣ z ) by minimizing population log-loss
R ( q ) : = E ( z , y ) ∼ P [ − log q ( y ∣ z ) ] . (11) \mathcal{R}(q) := \mathbb{E}_{(z,y)\sim P}\left[-\log q(y \mid z)\right]. \tag*{(11)} R ( q ) := E ( z , y ) ∼ P [ − log q ( y ∣ z ) ] . (11)
For every predictor whose probabilities are positive on the support of P P P ,
R ( q ) = R ( p ) + E z KL ( p ( ⋅ ∣ z ) ∥ q ( ⋅ ∣ z ) ) . (12) \mathcal{R}(q) = \mathcal{R}(p) + \mathbb{E}_{z}\operatorname{KL}\left(p(\cdot\mid z)\mathbin{\|}q(\cdot\mid z)\right). \tag*{(12)} R ( q ) = R ( p ) + E z KL ( p ( ⋅ ∣ z ) ∥ q ( ⋅ ∣ z ) ) . (12)
Consequently, the population minimizer equals the Bayes posterior predictive almost surely on the pretraining-prompt support:
q ∗ ( y ∣ z ) = p ( y ∣ z ) = ∑ t ∈ T p ( y ∣ x q u e r y , t ) p ( t ∣ z ) , P z -a.s. (13) q^*(y \mid z) = p(y \mid z) = \sum_{t\in\mathcal{T}} p(y \mid x_{\mathrm{query}},t)p(t \mid z), \qquad P_z\text{-a.s.} \tag*{(13)} q ∗ ( y ∣ z ) = p ( y ∣ z ) = t ∈ T ∑ p ( y ∣ x query , t ) p ( t ∣ z ) , P z -a.s. (13)
Equation (12) also makes the limitation precise: population risk places no restriction on q ( ⋅ ∣ z ) q(\cdot\mid z) q ( ⋅ ∣ z ) when P z ( z ) = 0 P_z(z)=0 P z ( z ) = 0 . Thus cross-entropy optimality by itself neither defines nor identifies a predictor at an unsupported prompt.
For finite data, finite model capacity, or imperfect optimization, exact equality in (13) need not hold. This discrepancy is kept explicit through the supported-model gap r 0 r_0 r 0 in (31) ; it is not absorbed into the analytic continuation assumption.
A Transformer-induced reference extension
We distinguish the following objects throughout the paper:
p p p is the latent-task data-generating distribution. Its symbolic instruction probabilities p ( i ∣ t ) p(i \mid t) p ( i ∣ t ) have their ordinary statistical meaning on the pretraining support.
p r e f p_{\mathrm{ref}} p ref is a hybrid Bayesian reference predictor. It agrees with the Bayes predictor on supported prompts and, on unsupported instruction embeddings, inserts fixed Transformer-induced instruction log-odds into the latent-task posterior while retaining the theoretical demonstration, prior, query, and task-conditional output factors.
M M M is the actual pretrained model. It need not equal p r e f p_{\mathrm{ref}} p ref ; their discrepancy is controlled by ε M \varepsilon_M ε M in Appendix D.§ 1 .
Only instruction log-likelihood ratios, rather than a Lebesgue density over the entire instruction-embedding space, are required by the proofs. It is therefore both sufficient and conceptually cleaner to extend these ratios directly. Let a fixed Transformer-induced scoring map produce task scores
a t ( U ) , t ∈ T , U ∈ R L i × d , (14) a_t(U), \qquad t\in\mathcal{T}, \qquad U\in\mathbb{R}^{L_i\times d}, \tag*{(14)} a t ( U ) , t ∈ T , U ∈ R L i × d , (14)
and define the reference instruction log-odds relative to t ∗ t^* t ∗ by
r t ( U ) : = a t ( U ) − a t ∗ ( U ) + c t , t ≠ t ∗ , (15) r_t(U) := a_t(U)-a_{t^*}(U)+c_t, \qquad t\ne t^*, \tag*{(15)} r t ( U ) := a t ( U ) − a t ∗ ( U ) + c t , t = t ∗ , (15)
where c t c_t c t is independent of U U U . Equivalently, if the scores define q r e f ( t ∣ U ) = softmax ( a ( U ) ) t q_{\mathrm{ref}}(t\mid U)=\operatorname{softmax}(a(U))_t q ref ( t ∣ U ) = softmax ( a ( U ) ) t , then
log q r e f ( t ∣ U ) q r e f ( t ∗ ∣ U ) = a t ( U ) − a t ∗ ( U ) . (16) \log\frac{q_{\mathrm{ref}}(t\mid U)}{q_{\mathrm{ref}}(t^*\mid U)}=a_t(U)-a_{t^*}(U). \tag*{(16)} log q ref ( t ∗ ∣ U ) q ref ( t ∣ U ) = a t ( U ) − a t ∗ ( U ) . (16)
The softmax normalizer cancels, so the extended log-odds inherit the regularity of the task scores directly.
The required connection to the latent-task probabilities is a supported calibration condition: on every supported symbolic instruction used by the analysis,
r t ( E ( i ) ) = log p ( i ∣ t ) p ( i ∣ t ∗ ) . (17) r_t(E(i))=\log\frac{p(i\mid t)}{p(i\mid t^*)}. \tag*{(17)} r t ( E ( i )) = log p ( i ∣ t ∗ ) p ( i ∣ t ) . (17)
For example, if q r e f ( t ∣ E ( i ˉ ) ) = p ( t ∣ i ˉ ) q_{\mathrm{ref}}(t \mid E(\bar{i})) = p(t \mid\bar{i}) q ref ( t ∣ E ( i ˉ )) = p ( t ∣ i ˉ ) on the supported domain, Bayes’ rule gives
log p ( i ∣ t ) p ( i ∣ t ∗ ) = log p ( t ∣ i ) p ( t ∗ ∣ i ) − log π ( t ) π ( t ∗ ) , (18) \log\frac{p(i \mid t)}{p(i \mid t^{*})} = \log\frac{p(t \mid i)}{p(t^{*} \mid i)} - \log\frac{\pi(t)}{\pi(t^{*})}, \tag*{(18)} log p ( i ∣ t ∗ ) p ( i ∣ t ) = log p ( t ∗ ∣ i ) p ( t ∣ i ) − log π ( t ∗ ) π ( t ) , (18)
so (17) follows by taking c t = − log ( π ( t ) / π ( t ∗ ) ) c_t=-\log(\pi(t)/\pi(t^{*})) c t = − log ( π ( t ) / π ( t ∗ )) . More generally, (17) is the factor-level calibration condition associated with the latent-task factorization used in the proofs. Output-level cross-entropy optimality in (13) motivates this idealized calibration but does not, by itself, identify a particular latent decomposition; the latter is part of the reference-model specification.
The Transformer-induced scoring map is not claimed to be statistically identified by next-token cross-entropy. It is a concrete architecture-induced reference extension used to instantiate and quantitatively control the otherwise arbitrary finite off-support perturbation. Supported calibration is stated explicitly in (17) as a separate condition.
At an unsupported U U U , Equation (15) defines a model-selected value. We do not interpret it as the probability of observing a continuous embedding under the original discrete pretraining distribution. This distinction resolves the apparent conflict between p ( i ˉ ∣ t ∗ ) = 0 p(\bar{i}\mid t^{*})=0 p ( i ˉ ∣ t ∗ ) = 0 and the fact that a Transformer nevertheless returns well-defined scores when fed E ( i ˉ ) E(\bar{i}) E ( i ˉ ) or an interpolated instruction embedding.
Thus r t ( U ) r_t(U) r t ( U ) , rather than either individual factor p ( U ∣ t ) p(U\mid t) p ( U ∣ t ) , is the continuous object used in the analysis. It agrees with the ordinary likelihood ratio on the supported symbolic points by (17) and is defined by the scoring map off that support. For example, in the shared-template setting the continuation-induced task posterior is determined by the odds
p r e f ( t ∣ z N ( U ) ) p r e f ( t ∗ ∣ z N ( U ) ) : = B t exp ( r t ( U ) + λ t ) , t ≠ t ∗ , (19) \frac{p_{\mathrm{ref}}(t \mid z_N(U))}{p_{\mathrm{ref}}(t^{*} \mid z_N(U))} := B_t \exp(r_t(U)+\lambda_t), \qquad t\ne t^{*}, \tag*{(19)} p ref ( t ∗ ∣ z N ( U )) p ref ( t ∣ z N ( U )) := B t exp ( r t ( U ) + λ t ) , t = t ∗ , (19)
followed by normalization over the finite task set. Here B t B_t B t is the demonstration likelihood ratio and λ t \lambda_t λ t contains the prior and query factors, as defined in (54) and (76) . The associated reference output predictor is
p r e f ( y ∣ z N ( U ) ) : = ∑ t ∈ T p ( y ∣ x q u e r y , t ) p r e f ( t ∣ z N ( U ) ) . (20) p_{\mathrm{ref}}(y \mid z_N(U)) := \sum_{t\in\mathcal{T}} p(y \mid x_{\mathrm{query}},t)p_{\mathrm{ref}}(t \mid z_N(U)). \tag*{(20)} p ref ( y ∣ z N ( U )) := t ∈ T ∑ p ( y ∣ x query , t ) p ref ( t ∣ z N ( U )) . (20)
Thus the Transformer supplies exactly the single off-support factor needed by the Bayesian concentration proof; the supported demonstration, prior, and query factors retain their original probabilistic meaning.
Analyticity of standard Transformer components
Fix the sequence length, positional convention, attention mask, and computational graph, and regard the instruction embedding U U U as the only continuous input. Affine maps, matrix products, residual additions, and fixed positional embeddings are analytic. The exponential, hyperbolic tangent, error function, exact GELU, and SiLU are real analytic. Hence attention softmax and an output softmax are real analytic at every real input, because their normalizing denominators are strictly positive on the real domain.
Layer normalization with a fixed ϵ > 0 \epsilon>0 ϵ > 0 has the form
LN ( x ) = γ ⊙ x − μ ( x ) σ 2 ( x ) + ϵ + β . (21) \operatorname{LN}(x)=\gamma\odot\frac{x-\mu(x)}{\sqrt{\sigma^2(x)+\epsilon}}+\beta. \tag*{(21)} LN ( x ) = γ ⊙ σ 2 ( x ) + ϵ x − μ ( x ) + β . (21)
Since σ 2 ( x ) + ϵ ≥ ϵ > 0 \sigma^2(x)+\epsilon\ge\epsilon>0 σ 2 ( x ) + ϵ ≥ ϵ > 0 for real x x x , it is real analytic on the entire real domain. The same argument applies to RMS normalization with a strictly positive stabilizer. A causal mask is harmless when it is fixed: masked entries are omitted from the corresponding finite softmax, rather than treated as a variable arithmetic input.
Proposition C.1 (Analytic Transformer scoring map). Suppose that the fixed Transformer scoring map in (14) has finite depth and width and is constructed from the analytic operations above. Suppose also that every normalization uses a strictly positive stabilizer and that the sequence length, masks, and computational graph remain fixed. Then each map U ↦ a t ( U ) U\mapsto a_t(U) U ↦ a t ( U ) , and hence each U ↦ r t ( U ) U\mapsto r_t(U) U ↦ r t ( U ) , is real analytic on R L i × d \mathbb{R}^{L_i\times d} R L i × d .
Proof. Each hidden state is obtained from the preceding hidden states by finitely many sums, products, quotients with nonzero real denominators, and compositions of real-analytic functions. These operations preserve real analyticity. An induction over the finitely many layers proves that every hidden state and output score is real analytic in U U U . Equation (15) then gives the result for the reference log-odds.
Proposition C.1 is an architectural statement, not an assumption that follows from data.
From architectural analyticity to the finite continuation chain
Let
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (22) E_s=(1-s)E(i_0)+sE(\tilde{i}),\qquad s\in[0,1], \tag*{(22)} E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (22)
be the path used in Theorem 3.3 . The following result shows that the finite-chain hypothesis is automatic for the scoring-map-induced extension above.
Proposition C.2 (Analytic Transformer implies a finite continuation chain). Under Proposition C.1 , for every t ≠ t ∗ t\ne t^* t = t ∗ the function
s ⟼ r t ( E s ) (23) s\longmapsto r_t(E_s) \tag*{(23)} s ⟼ r t ( E s ) (23) is real analytic on an open real neighborhood of [ 0 , 1 ] [0,1] [ 0 , 1 ] and admits a finite compatible chain of holomorphic continuations of the form required by Assumption D.15 . The chain is independent of the number N N N of demonstrations.
Proof. The map s ↦ E s s\mapsto E_s s ↦ E s is affine and U ↦ r t ( U ) U\mapsto r_t(U) U ↦ r t ( U ) is real analytic, so their composition in (23) is real analytic on an open neighborhood of every point of [ 0 , 1 ] [0,1] [ 0 , 1 ] . Every real-analytic germ has a local holomorphic complexification. These complexifications agree wherever their domains overlap along the real interval, by uniqueness of analytic continuation. The resulting complex neighborhoods form an open cover of the compact interval [ 0 , 1 ] [0,1] [ 0 , 1 ] . Compactness gives a finite subcover; choosing a sufficiently fine increasing sequence of real centers 0 = s 0 < ⋯ < s L = 1 0=s_0<\cdots<s_L=1 0 = s 0 < ⋯ < s L = 1 and disks inside this subcover yields radii r ℓ r_\ell r ℓ with s ℓ + 1 − s ℓ < r ℓ s_{\ell+1}-s_\ell<r_\ell s ℓ + 1 − s ℓ < r ℓ and compatible holomorphic functions on the disks, exactly as in Assumption D.15 . The function, path, and finite cover concern a single shared instruction template and do not depend on N N N . □
Complexifications of softmax, SiLU, and normalization may have zeros, poles, or branch points away from the real domain. This does not create an additional existence assumption in Proposition C.2 : at every real point of the path, the real-analytic computation supplies some complex neighborhood free of such singularities, and compactness reduces these neighborhoods to a finite chain. Nearby complex singularities do, however, shrink the admissible radii and can enlarge the Cauchy constants M ℓ M_\ell M ℓ and the cumulative continuation cost Ω \Omega Ω defined in Appendix D.§ 5 . Thus architectural analyticity guarantees existence of the chain, whereas quantitative separation from the complex singular set governs the strength of the resulting bound.
For an abstract off-support log-odds extension not parameterized by such a Transformer scoring map, none of the preceding architectural argument is available; in that case the finite-continuation condition remains a substantive regularity hypothesis. The main theorem requires only finite, N N N -independent endpoint log-odds for the chosen extension; Proposition C.2 supplies a concrete model-induced construction and quantitative control of those endpoint values.
The actual model and the transport error
The construction does not assume that the actual pretrained model M M M equals the idealized reference p r e f p_{\mathrm{ref}} p ref . On supported prompts their initial discrepancy is r 0 r_0 r 0 from (31) . Along a compact prompt path γ \gamma γ , Appendix D.§ 1 gives
∣ M ( y ∣ γ ( 1 ) ) − p r e f ( y ∣ γ ( 1 ) ) ∣ ≤ r 0 + ( L M + L r e f ) len ( γ ) . (24) \left|M(y\mid\gamma(1))-p_{\mathrm{ref}}(y\mid\gamma(1))\right|\le r_0+(L_M+L_{\mathrm{ref}})\operatorname{len}(\gamma). \tag*{(24)} ∣ M ( y ∣ γ ( 1 )) − p ref ( y ∣ γ ( 1 )) ∣ ≤ r 0 + ( L M + L ref ) len ( γ ) . (24)
The analytic continuation controls the reference term in the main theorems; ε M \varepsilon_M ε M records the logically separate approximation and transport error for the actual model. Analyticity guarantees that the displayed Lipschitz constants are finite on a fixed compact path, but does not guarantee that they, r 0 r_0 r 0 , or ε M \varepsilon_M ε M are small. Appendix D.1.1 gives an additional quantitative result: supported-anchor calibration and length-independent network stability imply the local certificate r ˉ + ( C M + 2 G ) d \bar r+(C_M+2G)d r ˉ + ( C M + 2 G ) d , uniformly over the specified length family. Appendix D.1.2 relates calibration to population excess loss under an explicit coverage condition, and Appendix D.1.3 gives a sharper certificate using variation of the model–reference residual. These sufficient conditions are separate from the existence of analytic continuation.
When the reference predictor can be evaluated, this discrepancy can also be studied empirically. For a grid 0 = u 0 < ⋯ < u K = 1 0 = u_0 < \cdots< u_K = 1 0 = u 0 < ⋯ < u K = 1 , define
ε ^ M : = max 0 ≤ k ≤ K sup y ∣ M ( y ∣ γ ( u k ) ) − p r e f ( y ∣ γ ( u k ) ) ∣ . (25) \widehat{\varepsilon}_M := \max_{0 \le k \le K} \sup_y \left|M(y \mid\gamma(u_k)) - p_{\mathrm{ref}}(y \mid\gamma(u_k))\right|. \tag*{(25)} ε M := 0 ≤ k ≤ K max y sup ∣ M ( y ∣ γ ( u k )) − p ref ( y ∣ γ ( u k )) ∣ . (25)
If the largest path-segment length max k len ( γ ∣ [ u k , u k + 1 ] ) \max_k \operatorname{len}(\gamma|_{[u_k,u_{k+1}]}) max k len ( γ ∣ [ u k , u k + 1 ] ) is δ \delta δ and the two predictors have pathwise Lipschitz constants L M L_M L M and L r e f L_{\mathrm{ref}} L ref , then every path point is within path length at most δ \delta δ of a grid point and
sup s ∈ [ 0 , 1 ] sup y ∣ M ( y ∣ γ ( s ) ) − p r e f ( y ∣ γ ( s ) ) ∣ ≤ ε ^ M + ( L M + L r e f ) δ . (26) \sup_{s \in[0,1]} \sup_y \left|M(y \mid\gamma(s)) - p_{\mathrm{ref}}(y \mid\gamma(s))\right| \le\widehat{\varepsilon}_M + (L_M + L_{\mathrm{ref}})\delta. \tag*{(26)} s ∈ [ 0 , 1 ] sup y sup ∣ M ( y ∣ γ ( s )) − p ref ( y ∣ γ ( s )) ∣ ≤ ε M + ( L M + L ref ) δ . (26)
Without computable Lipschitz bounds, the grid experiment supplies evidence rather than a uniform certificate. Without access to an evaluable reference predictor, ε M \varepsilon_M ε M remains a theoretical approximation term and cannot be identified from ordinary test accuracy alone.
Empirical validation of the model–reference approximation
We complement the preceding argument with a controlled experiment in which the latent-task probabilities and the hybrid reference predictor are evaluable. The purpose is not to test analyticity itself, which follows from the architectural conditions of Proposition C.1 , but to test the substantive quantitative premise behind the model-level bounds: whether the actual Transformer remains close to the reference predictor along the continuation path, and whether this discrepancy stays controlled as the number of demonstrations increases.
Controlled setting. We use a finite latent-task benchmark with three modular-arithmetic tasks (addition, subtraction, and multiplication). The task prior, supported task-conditional instruction probabilities, demonstration likelihoods, and task-conditional output distributions are known, so the factors B t B_t B t and λ t \lambda_t λ t in (19) and the resulting p r e f p_{\mathrm{ref}} p ref can be computed directly. A finite Transformer with analytic components is trained by cross-entropy using supported instructions only, and an analytic task-scoring map supplies r t r_t r t . We repeat the experiment for five independently initialized models.
For a supported anchor i 0 i_0 i 0 and an instruction endpoint i ~ \tilde{i} i ~ , we evaluate 51 equally spaced points on
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (27) E_s = (1-s)E(i_0) + sE(\tilde{i}), \qquad s \in[0,1], \tag*{(27)} E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (27)
and use N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } N \in\{1,2,4,8,16,32,64\} N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } demonstrations. To avoid confusion with the working radii ρ ℓ \rho_\ell ρ ℓ used in the continuation proof, denote normalized endpoint distance by
δ e m b : = ∥ E ( i ~ ) − E ( i 0 ) ∥ F typical separation between supported instruction embeddings . (28) \delta_{\mathrm{emb}} := \frac{\lVert E(\tilde{i}) - E(i_0)\rVert_F}{\text{typical separation between supported instruction embeddings}}. \tag*{(28)} δ emb := typical separation between supported instruction embeddings ∥ E ( i ~ ) − E ( i 0 ) ∥ F . (28)
For each N N N , define the endpoint and pathwise model–reference gaps
d N e n d : = sup y ∣ M ( y ∣ γ N ( 1 ) ) − p r e f ( y ∣ γ N ( 1 ) ) ∣ , (29) d_N^{\mathrm{end}} := \sup_y \left|M(y \mid\gamma_N(1)) - p_{\mathrm{ref}}(y \mid\gamma_N(1))\right|, \tag*{(29)} d N end := y sup ∣ M ( y ∣ γ N ( 1 )) − p ref ( y ∣ γ N ( 1 )) ∣ , (29)
d N p a t h : = max s ∈ { 0 , .02 , … , 1 } sup y ∣ M ( y ∣ γ N ( s ) ) − p r e f ( y ∣ γ N ( s ) ) ∣ . (30) d_N^{\mathrm{path}} := \max_{s \in\{0,.02,\ldots,1\}} \sup_y \left|M(y \mid\gamma_N(s)) - p_{\mathrm{ref}}(y \mid\gamma_N(s))\right|. \tag*{(30)} d N path := s ∈ { 0 , .02 , … , 1 } max y sup ∣ M ( y ∣ γ N ( s )) − p ref ( y ∣ γ N ( s )) ∣ . (30)
Thus d N p a t h d_N^{\mathrm{path}} d N path is an empirical effective transport error, rather than the analytic upper bound in (24) .
Local-path discrepancies over the tested lengths. Table 3 reports the complete trajectories for two local paths. At δ e m b = 0.25 \delta_{\mathrm{emb}} = 0.25 δ emb = 0.25 , the pathwise gap remains between 0.058 and 0.125 over a 64-fold change in demonstration count. It is 0.099 at N = 64 N = 64 N = 64 , approximately 20% below its value at N = 1 N = 1 N = 1 . Moreover, the measured supported-anchor gap accounts for most of this discrepancy: across the displayed values of N N N , the additional pathwise gap d N p a t h − r 0 d_N^{\mathrm{path}} - r_0 d N path − r 0 is only 0.007–0.037. This provides evidence of a small additional measured error on these short paths. Here the reported r 0 r_0 r 0 is an empirical anchor counterpart, not an evaluation of the supremum over the full supported domain in (31) .
Table 3. Model–reference discrepancy on local paths. Mean ± standard deviation over five independently trained models. The empirical supported-anchor gap (denoted r 0 r_0 r 0 in this table) is common to the endpoint-distance conditions.
At δ e m b = 0.50 \delta_{\mathrm{emb}} = 0.50 δ emb = 0.50 , the pathwise gap remains between 0.139 and 0.316 and again ends below its N = 1 N = 1 N = 1 value. Neither trajectory is monotone, as expected for finite prompts and independently sampled demonstrations, but neither exhibits systematic amplification with N N N . These are precisely the local paths for which the model-level theorem is most informative: the Bayesian term decreases exponentially while the empirical transport term remains controlled.
Distance controls the error floor. Table 4 expands the endpoint distance from one quarter to four times the typical supported-instruction separation. The comparison reveals a favorable and interpretable structure. For the two local paths, the gap at N = 64 N = 64 N = 64 is smaller than at N = 1 N = 1 N = 1 . At larger distances, the gap increases between these two demonstration counts, but remains bounded and the increase is modest relative to the change caused by moving the endpoint farther from the supported anchor. For example, at δ e m b = 4 \delta_{\mathrm{emb}} = 4 δ emb = 4 , the gap changes from 0.525 to 0.562 as N N N increases from 1 to 64. Across distances, the dominant pattern is thus a distance-dependent error floor, as represented explicitly by ε M , N ( n ~ ( i ) ) \varepsilon_{M,N}(\tilde{n}(i)) ε M , N ( n ~ ( i )) in the theorem, rather than systematic amplification with the number of demonstrations.
Table 4. Dependence on normalized endpoint distance. Pathwise model–reference gap at the smallest and largest tested demonstration counts. Mean ± standard deviation over five independently trained models; the last column is the ratio of the two means.
The endpoint and pathwise gaps are also nearly identical throughout the two local conditions and for δ e m b = 1 \delta_{\mathrm{emb}} = 1 δ emb = 1 except at the smallest demonstration count. Hence the maximum discrepancy is generally attained near the unsupported endpoint, rather than at an unstable interior point of the interpolation. This behavior is consistent with the finite-chain picture: the path remains regular, while moving the endpoint farther from supported instructions increases the distance-dependent difficulty of model transport.
What the experiment validates. The measured anchor and path-grid discrepancies support accurate local tracking in this controlled setting over the tested demonstration counts. Larger distances generally produce larger discrepancies. These are means and standard deviations over five trained models, not worst-case bounds over models, demonstration sequences, or the continuum of path points. Small d N p a t h d_N^{\mathrm{path}} d N path does not establish that the analytic upper certificate ε M , N ( n ~ ( i ) ) \varepsilon_{M,N}(\tilde{n}(i)) ε M , N ( n ~ ( i )) is small: the latter uses separate sensitivity bounds that the experiment does not certify. Nor does the tested length grid establish an almost-sure statement for all sufficiently large N N N along one infinite demonstration sequence.
Proposition D.7 identifies a sufficient regime in which the analytic certificate is uniformly small, but its network constants and calibration premises have not been certified for these trained models. A continuous-path certificate additionally requires a valid Lipschitz envelope in (26) , or a certified residual-variation bound from Proposition D.9. Extending the diagnostic to real models also requires an evaluable reference; task accuracy alone does not identify the discrepancy. Thus the experiment provides finite-range evidence compatible with the sufficient conditions, rather than verification of their uniform hypotheses for general LLMs.
In summary, the setting makes two different commitments. Supported calibration connects the reference scores to the latent-task probabilities at prompts that pretraining can identify. Analytic Transformer architecture then selects a well-defined, finite-chain extension of those scores along an instruction-embedding path. The first commitment is statistical and support-restricted; the second is architectural and off-support. Their separation is essential: analyticity provides a principled extension, but does not turn zero-probability prompts into observations from the pretraining distribution.
Proof of sec:instruction
From the reference predictor to the pretrained model
Let M ( y ∣ z ) M(y \mid z) M ( y ∣ z ) denote the output probability of the actual pretrained model, and let p r e f ( y ∣ z ) p_{\mathrm{ref}}(y \mid z) p ref ( y ∣ z ) denote the theoretical reference: it equals the Bayesian predictor p p p on supported prompts and the fixed continued predictor p ˉ \bar{p} p ˉ on unsupported prompts. Define
r 0 : = sup z ∈ D 0 sup y ∣ M ( y ∣ z ) − p ( y ∣ z ) ∣ . (31) r_0 := \sup_{z \in D_0}\sup_y \left|M(y \mid z) - p(y \mid z)\right|. \tag*{(31)} r 0 := z ∈ D 0 sup y sup ∣ M ( y ∣ z ) − p ( y ∣ z ) ∣ . (31)
Consider a compact instruction-embedding path γ \gamma γ from a supported prompt γ ( 0 ) \gamma(0) γ ( 0 ) to a test prompt γ ( 1 ) \gamma(1) γ ( 1 ) . Suppose M ( y ∣ γ ( s ) ) M(y \mid\gamma(s)) M ( y ∣ γ ( s )) and p r e f ( y ∣ γ ( s ) ) p_{\mathrm{ref}}(y \mid\gamma(s)) p ref ( y ∣ γ ( s )) are Lipschitz along this path, uniformly in y y y , with constants L M L_M L M and L r e f L_{\mathrm{ref}} L ref , and let len ( γ ) \operatorname{len}(\gamma) len ( γ ) be its length. These constants are finite, for example, if both functions are real analytic on a neighborhood of the compact path. Define the model-transport error
ε M ( γ ) : = r 0 + ( L M + L r e f ) len ( γ ) . (32) \varepsilon_M(\gamma) := r_0 + (L_M + L_{\mathrm{ref}})\operatorname{len}(\gamma). \tag*{(32)} ε M ( γ ) := r 0 + ( L M + L ref ) len ( γ ) . (32)
Lemma D.1 (Transport from the supported domain). Under the preceding conditions,
∣ M ( y ∣ γ ( 1 ) ) − p r e f ( y ∣ γ ( 1 ) ) ∣ ≤ ε M ( γ ) . (33) \left|M(y \mid\gamma(1)) - p_{\mathrm{ref}}(y \mid\gamma(1))\right| \le\varepsilon_M(\gamma). \tag*{(33)} ∣ M ( y ∣ γ ( 1 )) − p ref ( y ∣ γ ( 1 )) ∣ ≤ ε M ( γ ) . (33)
For a supported test prompt, the constant path gives ε M = r 0 \varepsilon_M = r_0 ε M = r 0 .
Proof. Insert and subtract the two functions at the supported endpoint:
∣ M ( y ∣ γ ( 1 ) ) − p r e f ( y ∣ γ ( 1 ) ) ∣ (34) \left|M(y \mid\gamma(1)) - p_{\mathrm{ref}}(y \mid\gamma(1))\right| \tag*{(34)} ∣ M ( y ∣ γ ( 1 )) − p ref ( y ∣ γ ( 1 )) ∣ (34)
≤ ∣ M ( y ∣ γ ( 0 ) ) − p ( y ∣ γ ( 0 ) ) ∣ + ∣ M ( y ∣ γ ( 1 ) ) − M ( y ∣ γ ( 0 ) ) ∣ + ∣ p r e f ( y ∣ γ ( 1 ) ) − p r e f ( y ∣ γ ( 0 ) ) ∣ (35) \begin{aligned}
&\le\left|M(y \mid\gamma(0)) - p(y \mid\gamma(0))\right| + \left|M(y \mid\gamma(1)) - M(y \mid\gamma(0))\right| \\
&\quad+ \left|p_{\mathrm{ref}}(y \mid\gamma(1)) - p_{\mathrm{ref}}(y \mid\gamma(0))\right| \tag*{(35)}
\end{aligned} ≤ ∣ M ( y ∣ γ ( 0 )) − p ( y ∣ γ ( 0 )) ∣ + ∣ M ( y ∣ γ ( 1 )) − M ( y ∣ γ ( 0 )) ∣ + ∣ p ref ( y ∣ γ ( 1 )) − p ref ( y ∣ γ ( 0 )) ∣ (35)
+ ∣ p r e f ( y ∣ γ ( 1 ) ) − p r e f ( y ∣ γ ( 0 ) ) ∣ (36) \quad+ \left|p_{\mathrm{ref}}(y \mid\gamma(1)) - p_{\mathrm{ref}}(y \mid\gamma(0))\right| \tag*{(36)} + ∣ p ref ( y ∣ γ ( 1 )) − p ref ( y ∣ γ ( 0 )) ∣ (36)
≤ r 0 + ( L M + L r e f ) len ( γ ) . (37) \le r_0 + (L_M + L_{\mathrm{ref}})\operatorname{len}(\gamma). \tag*{(37)} ≤ r 0 + ( L M + L ref ) len ( γ ) . (37)
For the shared-template setting, fix the instruction-coordinate path
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , γ N ( s ) : = z N ( E s ) . E_s = (1-s)E(i_0) + sE(\tilde{i}), \qquad\gamma_N(s) := z_N(E_s). E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , γ N ( s ) := z N ( E s ) .
The copies of the repeated instruction in γ N ( s ) \gamma_N(s) γ N ( s ) are tied to the same coordinate E s E_s E s . Let L M , N L_{M,N} L M , N and L r e f , N L_{\mathrm{ref},N} L ref , N satisfy, for all s , s ′ ∈ [ 0 , 1 ] s,s' \in[0,1] s , s ′ ∈ [ 0 , 1 ] ,
sup y ∣ M ( y ∣ z N ( E s ) ) − M ( y ∣ z N ( E s ′ ) ) ∣ ≤ L M , N ∥ E s − E s ′ ∥ F , (38) \sup_y \left|M(y \mid z_N(E_s)) - M(y \mid z_N(E_{s'}))\right| \le L_{M,N}\left\|E_s - E_{s'}\right\|_F, \tag*{(38)} y sup ∣ M ( y ∣ z N ( E s )) − M ( y ∣ z N ( E s ′ )) ∣ ≤ L M , N ∥ E s − E s ′ ∥ F , (38)
sup y ∣ p r e f ( y ∣ z N ( E s ) ) − p r e f ( y ∣ z N ( E s ′ ) ) ∣ ≤ L r e f , N ∥ E s − E s ′ ∥ F . (39) \sup_y \left|p_{\mathrm{ref}}(y \mid z_N(E_s)) - p_{\mathrm{ref}}(y \mid z_N(E_{s'}))\right| \le L_{\mathrm{ref},N}\left\|E_s - E_{s'}\right\|_F. \tag*{(39)} y sup ∣ p ref ( y ∣ z N ( E s )) − p ref ( y ∣ z N ( E s ′ )) ∣ ≤ L ref , N ∥ E s − E s ′ ∥ F . (39)
Define
r 0 , N : = sup y ∣ M ( y ∣ z N ( i 0 ) ) − p ( y ∣ z N ( i 0 ) ) ∣ (40) r_{0,N} := \sup_y \left|M(y \mid z_N(i_0)) - p(y \mid z_N(i_0))\right| \tag*{(40)} r 0 , N := y sup ∣ M ( y ∣ z N ( i 0 )) − p ( y ∣ z N ( i 0 )) ∣ (40)
and the shared-template transport error
ε M , N ( i ~ ) : = r 0 , N + ( L M , N + L r e f , N ) ∥ E ( i ~ ) − E ( i 0 ) ∥ F . (41) \varepsilon_{M,N}(\tilde{i}) := r_{0,N} + (L_{M,N} + L_{\mathrm{ref},N})\left\|E(\tilde{i}) - E(i_0)\right\|_F. \tag*{(41)} ε M , N ( i ~ ) := r 0 , N + ( L M , N + L ref , N ) E ( i ~ ) − E ( i 0 ) F . (41)
The repeated copies therefore do not introduce an artificial N + 1 \sqrt{N+1} N + 1 factor into the path length; any dependence on their number is recorded in the pullback Lipschitz constants.
Corollary D.2 (Shared-template transport at fixed demonstration count). For every fixed N N N ,
sup y ∣ M ( y ∣ z N ( ı ~ ) ) − p ˉ ( y ∣ z N ( ı ~ ) ) ∣ ≤ ε M , N ( ı ~ ) . (42) \sup_y \left|M(y \mid z_N(\tilde{\imath}))-\bar{p}(y \mid z_N(\tilde{\imath}))\right| \le\varepsilon_{M,N}(\tilde{\imath}). \tag*{(42)} y sup ∣ M ( y ∣ z N ( ~ )) − p ˉ ( y ∣ z N ( ~ )) ∣ ≤ ε M , N ( ~ ) . (42)
Proof. Apply the triangle-inequality argument of Lemma D.1 to γ N \gamma_N γ N , using p r e f = p p_{\mathrm{ref}}=p p ref = p at the supported anchor and the tied instruction coordinate to measure the path length.
For the mixed setting, ε M ( z N ) \varepsilon_M(z_N) ε M ( z N ) is the quantity in (32) on a path that changes the unsupported instruction slots successively. It is finite for each fixed prompt but need not be uniform in N N N or converge to zero. Combining Lemma D.1 with the continuation bounds proved below gives the four model-level bounds stated in the main text.
The transport inequality is an upper certificate, not the actual discrepancy. Write
D N : = sup s ∈ [ 0 , 1 ] sup y ∣ M ( y ∣ z N ( E s ) ) − p r e f ( y ∣ z N ( E s ) ) ∣ . D_N := \sup_{s\in[0,1]}\sup_y \left|M(y \mid z_N(E_s))-p_{\mathrm{ref}}(y \mid z_N(E_s))\right|. D N := s ∈ [ 0 , 1 ] sup y sup ∣ M ( y ∣ z N ( E s )) − p ref ( y ∣ z N ( E s )) ∣ .
Then D N ≤ ε M , N D_N \le\varepsilon_{M,N} D N ≤ ε M , N , but a small measured D N D_N D N does not imply a small value of the particular upper bound in (41) . Even when the two predictors agree everywhere on a path, their separate Lipschitz constants can both be large. We give sufficient conditions for the upper bound itself to be uniform and locally small, followed by a sharper certificate based on their difference.
Why calibration and analyticity alone do not suffice. For finitely many distinct supported embeddings a 1 , … , a m a_1,\ldots,a_m a 1 , … , a m and an endpoint b b b different from all of them, the polynomial
q ( E ) : = ∏ j = 1 m ∥ E − a j ∥ F 2 ∥ b − a j ∥ F 2 q(E) := \prod_{j=1}^{m}\frac{\lVert E-a_j\rVert_F^2}{\lVert b-a_j\rVert_F^2} q ( E ) := j = 1 ∏ m ∥ b − a j ∥ F 2 ∥ E − a j ∥ F 2
vanishes on every a j a_j a j and equals one at b b b . Adding A q ( E ) Aq(E) A q ( E ) to one output logit of an analytic predictor preserves its predictions at the supported embeddings but can change its prediction at b b b arbitrarily strongly as ∣ A ∣ \lvert A\rvert ∣ A ∣ increases. This demonstrates the insufficiency of finite symbolic calibration and real analyticity alone; it does not assert exact representation of this polynomial by a particular fixed Transformer. Quantitative stability or further restrictions on the learned predictor are needed.
Length-independent stability in a tokenwise norm. For token representations H = ( h 1 , … , h m ) H=(h_1,\ldots,h_m) H = ( h 1 , … , h m ) , set ∥ H ∥ ∞ , 2 : = max j ∥ h j ∥ 2 \lVert H\rVert_{\infty,2}:=\max_j\lVert h_j\rVert_2 ∥ H ∥ ∞ , 2 := max j ∥ h j ∥ 2 . Comparisons below are between prompts of the same length and with the same mask; only the tied instruction changes. The bounds will be independent of that length.
Lemma D.3 (Stability of an attention head). Let A i ( H ) = ∑ j ∈ I i a i j ( H ) W V h j A_i(H)=\sum_{j\in I_i}a_{ij}(H)W_Vh_j A i ( H ) = ∑ j ∈ I i a ij ( H ) W V h j , where I i I_i I i is a fixed nonempty mask and a i j a_{ij} a ij is the softmax of ⟨ W Q h i , W K h j ⟩ / d k \langle W_Qh_i,W_Kh_j\rangle/\sqrt{d_k} ⟨ W Q h i , W K h j ⟩ / d k over I i I_i I i . If ∥ H ∥ ∞ , 2 , ∥ H ′ ∥ ∞ , 2 ≤ B \lVert H\rVert_{\infty,2},\lVert H'\rVert_{\infty,2}\le B ∥ H ∥ ∞ , 2 , ∥ H ′ ∥ ∞ , 2 ≤ B , and q = ∥ W Q ∥ 2 q=\lVert W_Q\rVert_2 q = ∥ W Q ∥ 2 , k = ∥ W K ∥ 2 k=\lVert W_K\rVert_2 k = ∥ W K ∥ 2 , v = ∥ W V ∥ 2 v=\lVert W_V\rVert_2 v = ∥ W V ∥ 2 , then
∥ A ( H ) − A ( H ′ ) ∥ ∞ , 2 ≤ v ( 1 + 4 q k B 2 d k ) ∥ H − H ′ ∥ ∞ , 2 . (43) \lVert A(H)-A(H')\rVert_{\infty,2}\le v\left(1+\frac{4qkB^2}{\sqrt{d_k}}\right)\lVert H-H'\rVert_{\infty,2}. \tag*{(43)} ∥ A ( H ) − A ( H ′ ) ∥ ∞ , 2 ≤ v ( 1 + d k 4 q k B 2 ) ∥ H − H ′ ∥ ∞ , 2 . (43) The bound is independent of the number of tokens and of ∣ I i ∣ \lvert I_i\rvert ∣ I i ∣ .
Proof. Put δ = ∥ H − H ′ ∥ ∞ , 2 \delta=\lVert H-H'\rVert_{\infty,2} δ = ∥ H − H ′ ∥ ∞ , 2 . Adding and subtracting a mixed inner product bounds each logit difference by 2 q k B δ / d k 2qkB\delta/\sqrt{d_k} 2 q k B δ / d k . For a softmax vector a a a , its Jacobian maps w w w to ( a i ( w i − ∑ j a j w j ) ) i (a_i(w_i-\sum_j a_jw_j))_i ( a i ( w i − ∑ j a j w j ) ) i , whose ℓ 1 \ell_1 ℓ 1 norm is at most 2 ∥ w ∥ ∞ 2\lVert w\rVert_{\infty} 2 ∥ w ∥ ∞ . Integration along the segment of logits gives ∥ a i ( H ) − a i ( H ′ ) ∥ 1 ≤ 4 q k B δ / d k \lVert a_i(H)-a_i(H')\rVert_1\le4qkB\delta/\sqrt{d_k} ∥ a i ( H ) − a i ( H ′ ) ∥ 1 ≤ 4 q k B δ / d k . The change in values contributes at most v δ v\delta v δ , and the change in weights at most v B ∥ a i ( H ) − a i ( H ′ ) ∥ 1 vB\lVert a_i(H)-a_i(H')\rVert_1 v B ∥ a i ( H ) − a i ( H ′ ) ∥ 1 . Take the maximum over i i i . A fixed additive position bias cancels in the logit difference.
Assumption D.4 (Uniform architectural stability on the path family). Let N \mathcal{N} N be the set of admissible demonstration counts. The model has fixed depth and head counts. On all paths z N ( E s ) z_{\mathcal{N}}(E_s) z N ( E s ) , N ∈ N \mathcal{N} \in\mathcal{N} N ∈ N , and all teacher-forced output prefixes of length at most a fixed H ⋆ H_{\star} H ⋆ :
Inputs to each attention head have a common token-norm bound B ℓ B_{\ell} B ℓ independent of N \mathcal{N} N , s s s , and the prefix. Projection norms are bounded independently of N \mathcal{N} N . Heads have the form of Lemma D.3 , or obey its estimate with uniform constants; bounded affine biases may be included in those constants.
Tokenwise normalization and feed-forward maps, output projections, position-processing maps, and residual and multi-head combination maps are Lipschitz on the relevant domains with constants independent of N \mathcal{N} N . The input representation satisfies ∥ H N ( E ) − H N ( E ′ ) ∥ ∞ , 2 ≤ C i n ∥ E − E ′ ∥ F \lVert H_{\mathcal{N}}(E)-H_{\mathcal{N}}(E')\rVert_{\infty,2} \le C_{\mathrm{in}}\lVert E-E'\rVert_{\mathrm{F}} ∥ H N ( E ) − H N ( E ′ ) ∥ ∞ , 2 ≤ C in ∥ E − E ′ ∥ F on the path with C i n C_{\mathrm{in}} C in independent of N \mathcal{N} N .
Outputs use fixed decoding probabilities and have length at most H ⋆ H_{\star} H ⋆ , including any termination token. The generation kernel is defined at every teacher-forced prefix used above.
The input inequality holds with C i n = 1 C_{\mathrm{in}}=1 C in = 1 for direct insertion of tied embedding copies and unchanged additive positions. A positive fixed normalization stabilizer and bounded normalization parameters give finite tokenwise normalization constants. These observations do not establish all the other uniform bounds for every architecture or length regime. The resulting constants need not be numerically small, and greedy decoding is not a Lipschitz probability map.
Proposition D.5 (Uniform model sensitivity along tied paths). Under Assumption D.4, there is a finite C M C_M C M , independent of N ∈ N \mathcal{N} \in\mathcal{N} N ∈ N , such that
sup y ∣ M ( y ∣ z N ( E s ) ) − M ( y ∣ z N ( E s ′ ) ) ∣ ≤ C M ∥ E s − E s ′ ∥ F . \sup_y \left|M(y \mid z_{\mathcal{N}}(E_s))-M(y \mid z_{\mathcal{N}}(E_{s'}))\right| \le C_M\lVert E_s-E_{s'}\rVert_{\mathrm{F}}. y sup ∣ M ( y ∣ z N ( E s )) − M ( y ∣ z N ( E s ′ )) ∣ ≤ C M ∥ E s − E s ′ ∥ F . Proof. Apply Lemma D.3 to each head. A residual map H ↦ H + F ( H ) H \mapsto H+F(H) H ↦ H + F ( H ) has constant at most 1 + L F 1+L_F 1 + L F . Multi-head concatenation has constant at most the square root of the sum of squared head constants, followed by the output-projection norm. Composing these with the remaining uniform bounds gives a next-token logit constant C log C_{\log} C l o g independent of N \mathcal{N} N and the forced prefix. The softmax estimate above gives a probability-coordinate constant at most 2 C log 2C_{\log} 2 C l o g . For a fixed block y y y , compare its autoregressive factors at the same forced prefixes. The difference of two products of numbers in [ 0 , 1 ] [0,1] [ 0 , 1 ] is at most the sum of the factor differences. Thus C M = 2 H ⋆ C log C_M=2H_{\star}C_{\log} C M = 2 H ⋆ C l o g suffices. □
Lemma D.6 (Uniform reference sensitivity). Let d = ∥ E ( ı ˉ ) − E ( i 0 ) ∥ F d=\lVert E(\bar{\imath})-E(i_0)\rVert_{\mathrm{F}} d = ∥ E ( ˉ ) − E ( i 0 ) ∥ F and suppose ∣ d d s r t ( E s ) ∣ ≤ G d \left|\frac{d}{ds}r_t(E_s)\right|\le Gd d s d r t ( E s ) ≤ G d for every competing task on the fixed path. Suppose the continued task weights are
w t , N ( s ) = c t , N exp ( r t ( E s ) ) 1 + ∑ u ≠ t ⋆ c u , N exp ( r u ( E s ) ) , w_{t,\mathcal{N}}(s)=\frac{c_{t,\mathcal{N}}\exp(r_t(E_s))}{1+\sum_{u\ne t^\star}c_{u,\mathcal{N}}\exp(r_u(E_s))}, w t , N ( s ) = 1 + ∑ u = t ⋆ c u , N exp ( r u ( E s )) c t , N exp ( r t ( E s )) , w t ⋆ , N ( s ) = 1 1 + ∑ u ≠ t ⋆ c u , N exp ( r u ( E s ) ) , w_{t^\star,\mathcal{N}}(s)=\frac{1}{1+\sum_{u\ne t^\star}c_{u,\mathcal{N}}\exp(r_u(E_s))}, w t ⋆ , N ( s ) = 1 + ∑ u = t ⋆ c u , N exp ( r u ( E s )) 1 , where c t , N c_{t,\mathcal{N}} c t , N are nonnegative and finite and do not depend on s s s . Then L r e f , N ≤ 2 G L_{\mathrm{ref},\mathcal{N}}\le2G L ref , N ≤ 2 G is an admissible choice for every N \mathcal{N} N . A finite G G G exists when the finitely many continued scores are continuously differentiable on a neighborhood of the fixed compact path.
Proof. Put a t = p ( y ∣ x q u e r y , t ) ∈ [ 0 , 1 ] a_t=p(y\mid x_{\mathrm{query}},t)\in[0,1] a t = p ( y ∣ x query , t ) ∈ [ 0 , 1 ] and a N ( s ) = ∑ t w t , N ( s ) a t a_{\mathcal{N}}(s)=\sum_t w_{t,\mathcal{N}}(s)a_t a N ( s ) = ∑ t w t , N ( s ) a t . Differentiating the normalized weights yields
a N ′ ( s ) = ∑ t ≠ t ⋆ w t , N ( s ) ( a t − a N ( s ) ) d d s r t ( E s ) . a'_{\mathcal{N}}(s)=\sum_{t\ne t^\star}w_{t,\mathcal{N}}(s)(a_t-a_{\mathcal{N}}(s))\frac{d}{ds}r_t(E_s). a N ′ ( s ) = t = t ⋆ ∑ w t , N ( s ) ( a t − a N ( s )) d s d r t ( E s ) . Thus ∣ a N ′ ( s ) ∣ ≤ G d ∑ t ≠ t ⋆ w t , N ( s ) ≤ G d \lvert a'_{\mathcal{N}}(s)\rvert\le Gd\sum_{t\ne t^\star}w_{t,\mathcal{N}}(s)\le Gd ∣ a N ′ ( s )∣ ≤ G d ∑ t = t ⋆ w t , N ( s ) ≤ G d . Integration and ∥ E s − E s ′ ∥ F = d ∣ s − s ′ ∣ \lVert E_s-E_{s'}\rVert_{\mathrm{F}}=d\lvert s-s'\rvert ∥ E s − E s ′ ∥ F = d ∣ s − s ′ ∣ prove even the constant G G G ; we retain 2 G 2G 2 G as a common upper bound. For d = 0 d=0 d = 0 the path is constant. For d > 0 d>0 d > 0 , compactness and the finite task set bound the directional derivatives divided by d d d .
Proposition D.7 (Uniform local transport certificate). Under Proposition D.5 and Lemma D.6 , suppose the supported anchors satisfy sup N ∈ N r 0 , N ≤ r ˉ \sup_{N \in\mathcal{N}} r_{0,N} \le\bar{r} sup N ∈ N r 0 , N ≤ r ˉ . Admissible constants in (41) can then be chosen so that
sup N ∈ N D N ≤ sup N ∈ N ε M , N ( ı ~ ) ≤ r ˉ + ( C M + 2 G ) d . (44) \sup_{N \in\mathcal{N}} D_N \le\sup_{N \in\mathcal{N}} \varepsilon_{M,N}(\tilde{\imath}) \le\bar{r} + (C_M + 2G)d. \tag*{(44)} N ∈ N sup D N ≤ N ∈ N sup ε M , N ( ~ ) ≤ r ˉ + ( C M + 2 G ) d . (44) For ϵ > r ˉ \epsilon> \bar{r} ϵ > r ˉ and C M + 2 G > 0 C_M + 2G > 0 C M + 2 G > 0 , a path with d ≤ ( ϵ − r ˉ ) / ( C M + 2 G ) d \le(\epsilon- \bar{r})/(C_M + 2G) d ≤ ( ϵ − r ˉ ) / ( C M + 2 G ) has a certificate at most ϵ \epsilon ϵ . If C M + 2 G = 0 C_M + 2G = 0 C M + 2 G = 0 , its certificate is at most r ˉ \bar{r} r ˉ at every admissible distance.
Proof. Apply the fixed-N N N transport argument to every initial path segment. Substitute L M , N ≤ C M L_{M,N} \le C_M L M , N ≤ C M and L r e f , N ≤ 2 G L_{\mathrm{ref},N} \le2G L ref , N ≤ 2 G , then take the supremum over N ∈ N N \in\mathcal{N} N ∈ N .
The proposition is deterministic conditional on the demonstration family. If its hypotheses hold on a probability-one event for prefixes of one infinite demonstration sequence, the conclusion is almost sure and uniform. For a fixed context window, N \mathcal{N} N contains only lengths that fit; no N → ∞ N \to\infty N → ∞ claim is then made. A common radius for a neighborhood of endpoints requires common C M , G C_M,G C M , G over that neighborhood. The proposition does not certify that the experimental endpoints fall inside a numerically useful radius.
Supported calibration from population loss and coverage
Proposition D.8 (Calibration on a covered anchor family). Let Q Q Q be a distribution on supported prompts with true conditional p p p , and use natural logarithms. Define its population excess log loss by
Δ : = E Z ∼ Q D K L ( p ( ⋅ ∣ Z ) ∥ M ( ⋅ ∣ Z ) ) . \Delta:= \mathbb{E}_{Z \sim Q} D_{\mathrm{KL}}(p(\cdot\mid Z)\mathbin{\|}M(\cdot\mid Z)). Δ := E Z ∼ Q D KL ( p ( ⋅ ∣ Z ) ∥ M ( ⋅ ∣ Z )) . For a finite anchor family A \mathcal{A} A with Q ( z ) ≥ q min > 0 Q(z) \ge q_{\min} > 0 Q ( z ) ≥ q m i n > 0 for all z ∈ A z \in\mathcal{A} z ∈ A ,
sup z ∈ A , y ∣ M ( y ∣ z ) − p ( y ∣ z ) ∣ ≤ min { 1 , Δ 2 q min } . (45) \sup_{z \in\mathcal{A},y} \lvert M(y \mid z) - p(y \mid z) \rvert\le\min\left\{1,\sqrt{\frac{\Delta}{2q_{\min}}}\right\}. \tag*{(45)} z ∈ A , y sup ∣ M ( y ∣ z ) − p ( y ∣ z )∣ ≤ min { 1 , 2 q m i n Δ } . (45) If all anchors in Proposition D.7 belong to A \mathcal{A} A , its bound holds with r ˉ = min { 1 , Δ / ( 2 q min ) } \bar{r} = \min\left\{1,\sqrt{\Delta/(2q_{\min})}\right\} r ˉ = min { 1 , Δ/ ( 2 q m i n ) } .
Proof. Nonnegativity gives Q ( z ) D K L ( p ( ⋅ ∣ z ) ∥ M ( ⋅ ∣ z ) ) ≤ Δ Q(z)D_{\mathrm{KL}}(p(\cdot\mid z)\mathbin{\|}M(\cdot\mid z)) \le\Delta Q ( z ) D KL ( p ( ⋅ ∣ z ) ∥ M ( ⋅ ∣ z )) ≤ Δ . For completeness, for discrete probability distributions P P P , R R R let A = { y : P ( y ) ≥ R ( y ) } A = \{y : P(y) \ge R(y)\} A = { y : P ( y ) ≥ R ( y )} . The log-sum inequality gives D K L ( P ∥ R ) ≥ D K L ( Ber ( P ( A ) ) ∥ Ber ( R ( A ) ) ) D_{\mathrm{KL}}(P\|R) \ge D_{\mathrm{KL}}(\operatorname{Ber}(P(A))\|\operatorname{Ber}(R(A))) D KL ( P ∥ R ) ≥ D KL ( Ber ( P ( A )) ∥ Ber ( R ( A ))) . For fixed b ∈ ( 0 , 1 ) b \in(0,1) b ∈ ( 0 , 1 ) the binary divergence as a function of a a a has second derivative 1 / [ a ( 1 − a ) ] ≥ 4 1/[a(1-a)] \ge4 1/ [ a ( 1 − a )] ≥ 4 and vanishes with zero first derivative at a = b a=b a = b . It is at least 2 ( a − b ) 2 2(a-b)^2 2 ( a − b ) 2 ; boundary cases follow by limits. Since P ( A ) − R ( A ) = ∥ P − R ∥ T V P(A)-R(A)=\|P-R\|_{\mathrm{TV}} P ( A ) − R ( A ) = ∥ P − R ∥ TV , this proves Pinsker’s inequality. Apply it at each anchor and bound a coordinate difference by total variation.
Here Δ \Delta Δ is excess population loss, not empirical training loss. A learning-theoretic analysis would also have to control estimation, approximation, and optimization error. Coverage is substantive: a probability distribution cannot assign a common positive mass to infinitely many distinct prompts. This finite-family corollary therefore does not establish uniform calibration over all lengths from one average pretraining-loss bound.
For a distributional alternative, suppose a target anchor law R N R_N R N is dominated by Q Q Q with d R N / d Q ≤ C dR_N/dQ \le C d R N / d Q ≤ C over the chosen lengths. Pinsker’s inequality and Cauchy–Schwarz give
E R N sup y ∣ M ( y ∣ Z ) − p ( y ∣ Z ) ∣ ≤ C Δ / 2 . \mathbb{E}_{R_N}\sup_y \lvert M(y \mid Z)-p(y \mid Z)\rvert\le\sqrt{C\Delta/2}. E R N y sup ∣ M ( y ∣ Z ) − p ( y ∣ Z )∣ ≤ C Δ/2 .
With a common path-stability bound and path length at most d d d , expected off-support discrepancy is at most C Δ / 2 + ( C M + 2 G ) d \sqrt{C\Delta/2} + (C_M + 2G)d C Δ/2 + ( C M + 2 G ) d . This is an expectation guarantee for each N N N , not an almost-sure bound on the supremum over N N N . The density-ratio premise must itself be justified.
A sharper certificate based on residual variation
Proposition D.9 (Residual-variation transport). Suppose g N ( s , y ) : = M ( y ∣ z N ( E s ) ) − p r e f ( y ∣ z N ( E s ) ) g_N(s,y) := M(y \mid z_N(E_s)) - p_{\mathrm{ref}}(y \mid z_N(E_s)) g N ( s , y ) := M ( y ∣ z N ( E s )) − p ref ( y ∣ z N ( E s )) is absolutely continuous in s s s for each output, with an integrable common envelope for its derivatives. Define
ε M , N r e s : = r 0 , N + ∫ 0 1 sup y ∣ ∂ s g N ( s , y ) ∣ d s . (46) \varepsilon^{\mathrm{res}}_{M,N} := r_{0,N} + \int_{0}^{1} \sup_y \lvert\partial_s g_N(s,y) \rvert\,\mathrm{d}s. \tag*{(46)} ε M , N res := r 0 , N + ∫ 0 1 y sup ∣ ∂ s g N ( s , y )∣ d s . (46) Then D N ≤ ε M , N r e s D_N \le\varepsilon^{\mathrm{res}}_{M,N} D N ≤ ε M , N res . With the same Lipschitz constants as in (41) , ε M , N r e s ≤ ε M , N \varepsilon^{\mathrm{res}}_{M,N} \le\varepsilon_{M,N} ε M , N res ≤ ε M , N .
Proof. The fundamental theorem of calculus bounds ∣ g N ( s , y ) ∣ \lvert g_N(s,y) \rvert ∣ g N ( s , y )∣ by ∣ g N ( 0 , y ) ∣ + ∫ 0 s ∣ ∂ u g N ( u , y ) ∣ d u \lvert g_N(0,y) \rvert+ \int_{0}^{s} \lvert\partial_u g_N(u,y) \rvert\,\mathrm{d}u ∣ g N ( 0 , y )∣ + ∫ 0 s ∣ ∂ u g N ( u , y )∣ d u . Take suprema and extend the integral to [ 0 , 1 ] [0,1] [ 0 , 1 ] . The individual derivative bounds are L M , N d L_{M,N}d L M , N d and L r e f , N d L_{\mathrm{ref},N}d L ref , N d almost everywhere, proving the second inequality. □
Every endpoint model bound obtained by transport remains valid with ε M , N r e s \varepsilon^{\mathrm{res}}_{M,N} ε M , N res replacing the coarser certificate. A uniform bound on these residual certificates gives a uniform model bound without asserting a uniform bound on the original certificates. If the predictors agree throughout the path, the residual certificate is zero. Path-grid errors or sampled derivatives alone do not certify the integral; an envelope or a controlled discretization error is still required.
We expand all seven rows of Table 1 below. The first axis is task-conditional support . An instruction may be familiar globally yet unsupported for the target task: support requires p ( i ∣ t ∗ ) > 0 p(i \mid t^*) > 0 p ( i ∣ t ∗ ) > 0 , meaning that pretraining paired that rendering with t ∗ t^* t ∗ with positive probability. Unsupported instructions satisfy p ( i ~ ∣ t ∗ ) = 0 p(\tilde{i} \mid t^*) = 0 p ( i ~ ∣ t ∗ ) = 0 . This is not a judgment of semantic correctness. A dialectal expression or private schema label can express the user’s intended task perfectly while remaining unsupported by the pretraining distribution.
The second axis is placement . A single instruction appears once above the prompt; a repeated instruction is one realization copied into every demonstration and the query; varying instructions are separately generated for the individual slots. Formats 1, 3, and 5 draw their instructions from P i ∣ t ∗ P_{i \mid t^*} P i ∣ t ∗ and are supported by construction. Formats 2, 4, and 6 use renderings outside that distribution’s support. Format 7 begins with a repeated supported template and corrupts only a subset of its occurrences. These cases correspond respectively to ordinary user or system messages, record-level schemas, retrieval or multi-annotator pipelines, and partially corrupted data.
Single supported instruction. A single supported instruction i i i appears once at the start of the prompt and applies to all demonstrations and the query.
z = ( i , ( x 1 , y 1 ) , … , ( x N , y N ) , x q u e r y ) . z = (i, (x_1,y_1), \ldots, (x_N,y_N), x_{\mathrm{query}}). z = ( i , ( x 1 , y 1 ) , … , ( x N , y N ) , x query ) .
Concrete example. A customer-support system places Classify each ticket as billing, technical, or account once above several labeled tickets. This conventional instruction has been paired with ticket classification during pretraining and is modeled as a draw from P i ∣ t ∗ P_{i \mid t^*} P i ∣ t ∗ .
Single unsupported instruction. A single instruction i ~ \tilde{i} i ~ outside the task-conditional support appears once at the start of the prompt. The absent case is recovered by setting i ~ = ⟨ p a d ⟩ \tilde{i} = \langle\mathrm{pad}\rangle i ~ = ⟨ pad ⟩ .
z = ( i ~ , ( x 1 , y 1 ) , … , ( x N , y N ) , x q u e r y ) , z = (\tilde{i}, (x_1,y_1), \ldots, (x_N,y_N), x_{\mathrm{query}}), z = ( i ~ , ( x 1 , y 1 ) , … , ( x N , y N ) , x query ) ,
where i ~ \tilde{i} i ~ is an unsupported instruction or a virtual token ⟨ p a d ⟩ \langle\mathrm{pad}\rangle ⟨ pad ⟩ .
Concrete example. An Indian-English user writes Please revert with a reply , intending revert to mean “reply,” and provides demonstrations mapping incoming emails to reply drafts. The wording is correct for the user, but if pretraining paired revert with operations such as “undo” and never with reply drafting, then p ( i ~ ∣ t ∗ ) = 0 p(\tilde{i} \mid t^*) = 0 p ( i ~ ∣ t ∗ ) = 0 in our idealized model.
Repeated supported instruction. One supported instruction i i i is copied into every demonstration and the query, so the model encounters the same realization N + 1 N+1 N + 1 times.
z = ( ( i , x 1 , y 1 ) , … , ( i , x N , y N ) , ( i , x q u e r y ) ) . z = ((i,x_1,y_1), \ldots, (i,x_N,y_N), (i,x_{\mathrm{query}})). z = (( i , x 1 , y 1 ) , … , ( i , x N , y N ) , ( i , x query )) .
Concrete example. A JSON dataset includes "task": "sentiment" in every demonstration record and in the query record. The standard schema key is supported for sentiment classification, and all displayed occurrences are copies of one shared template rather than independent instruction samples.
Repeated unsupported instruction. One unsupported (or pad) instruction i ~ \tilde{i} i ~ is copied into every demonstration and the query.
z = ( ( i ~ , x 1 , y 1 ) , … , ( i ~ , x N , y N ) , ( i ~ , x q u e r y ) ) . z = ((\tilde{i}, x_1, y_1), \ldots, (\tilde{i}, x_N, y_N), (\tilde{i}, x_{\mathrm{query}})). z = (( i ~ , x 1 , y 1 ) , … , ( i ~ , x N , y N ) , ( i ~ , x query )) .
Concrete example. A company repeatedly inserts "operation": "Atlas" into records for its internal ticket-routing service. The name was borrowed from an unrelated open-source project and was never paired with the company’s current routing behavior during pretraining. Although the label is meaningful inside the company, it is unsupported for t ∗ t^* t ∗ and incurs only one shared instruction factor because the same label is copied throughout.
Varying supported instructions. Each demonstration is paired with an independently sampled supported rendering i n i_n i n , and the query carries another independently sampled rendering i q u e r y i_{\mathrm{query}} i query .
z = ( ( i 1 , x 1 , y 1 ) , … , ( i N , x N , y N ) , ( i q u e r y , x q u e r y ) ) . z = ((i_1, x_1, y_1), \ldots, (i_N, x_N, y_N), (i_{\mathrm{query}}, x_{\mathrm{query}})). z = (( i 1 , x 1 , y 1 ) , … , ( i N , x N , y N ) , ( i query , x query )) .
Concrete example. A retrieval system pools sentiment examples written by different annotators: classify the sentiment, positive or negative? , and identify the review’s tone . These are distinct but familiar renderings sampled from P i ∣ t ∗ P_{i\mid t^*} P i ∣ t ∗ , so every slot is supported even though the surface wording varies.
Varying unsupported instructions. Each demonstration is paired with a distinct unsupported rendering i ~ n \tilde{i}_n i ~ n , and the query carries an analogous i ~ q u e r y \tilde{i}_{\mathrm{query}} i ~ query . Each slot can therefore introduce a separate off-support cost.
z = ( ( i ~ 1 , x 1 , y 1 ) , … , ( i ~ N , x N , y N ) , ( i ~ q u e r y , x q u e r y ) ) . z = ((\tilde{i}_1, x_1, y_1), \ldots, (\tilde{i}_N, x_N, y_N), (\tilde{i}_{\mathrm{query}}, x_{\mathrm{query}})). z = (( i ~ 1 , x 1 , y 1 ) , … , ( i ~ N , x N , y N ) , ( i ~ query , x query )) .
Concrete example. A multi-tenant retrieval pipeline combines ticket-routing demonstrations from companies that use private labels such as triage_acme, route_7G, and dispatch_private. Each tenant intends its label to denote the same routing task, but none of the private labels was paired with that task during pretraining. Unlike format 4, the prompt introduces a new unsupported label in each slot.
Mixed supported and unsupported instructions. Most slots retain one shared supported instruction i i i , while a subset contains distinct unsupported corruptions i ~ n \tilde{i}_n i ~ n :
z = ( ( i n , x n , y n ) n = 1 N , ( i q u e r y , x q u e r y ) ) , i n ∈ { i , i ~ n } . z = ((i_n, x_n, y_n)_{n=1}^{N}, (i_{\mathrm{query}}, x_{\mathrm{query}})), \qquad i_n \in\{i, \tilde{i}_n\}. z = (( i n , x n , y n ) n = 1 N , ( i query , x query )) , i n ∈ { i , i ~ n } .
Concrete example. A sentiment dataset normally repeats the standard field sentiment, but manual entry or OCR produces distinct typos such as sentimnet and sentimemt in a few records. The unchanged records retain a supported anchor, whereas each typo is treated as an unsupported corruption. This differs from format 6, in which every slot carries a distinct unsupported rendering.
Preliminaries
We begin by expanding the posterior distribution over tasks using Bayes’ rule. For any task t ∈ T t \in\mathcal{T} t ∈ T , conditioning on the full prompt z = ( i , { ( x n , y n ) } n = 1 N , x q u e r y ) z = (i, \{(x_n, y_n)\}_{n=1}^{N}, x_{\mathrm{query}}) z = ( i , {( x n , y n ) } n = 1 N , x query ) yields
p ( t ∣ z ) = π ( t ) p ( z ∣ t ) ∑ s ∈ T π ( s ) p ( z ∣ s ) . (47) p(t \mid z) = \frac{\pi(t)\,p(z \mid t)}{\sum_{s \in\mathcal{T}} \pi(s)\,p(z \mid s)}. \tag*{(47)} p ( t ∣ z ) = ∑ s ∈ T π ( s ) p ( z ∣ s ) π ( t ) p ( z ∣ t ) . (47)
For instructions that lie in the support of the pretraining distribution, we use different but compatible factorizations for the repeated and varying formats. In formats 1 and 3, the instruction is sampled once and, in format 3, its displayed occurrences are deterministic copies of the same shared realization. Hence
p ( z ∣ t ) = p ( i ∣ t ) p ( x q u e r y ∣ t ) ∏ n = 1 N p ( x n , y n ∣ t ) . (48) p(z \mid t) = p(i \mid t)\,p(x_{\mathrm{query}} \mid t)\prod_{n=1}^{N} p(x_n, y_n \mid t). \tag*{(48)} p ( z ∣ t ) = p ( i ∣ t ) p ( x query ∣ t ) n = 1 ∏ N p ( x n , y n ∣ t ) . (48)
In format 5, the paraphrases i 1 , … , i N , i q u e r y i_1,\ldots,i_N,i_{\mathrm{query}} i 1 , … , i N , i query are independently sampled from the task-conditional supported instruction law. Conditional on the latent task, they are also independent of the demonstration pairs and query input, so
p ( z ∣ t ) = p ( i q u e r y ∣ t ) p ( x q u e r y ∣ t ) ∏ n = 1 N p ( i n ∣ t ) p ( x n , y n ∣ t ) . (49) p(z\mid t)=p(i_{\mathrm{query}}\mid t)p(x_{\mathrm{query}}\mid t)\prod_{n=1}^{N}p(i_n\mid t)p(x_n,y_n\mid t). \tag*{(49)} p ( z ∣ t ) = p ( i query ∣ t ) p ( x query ∣ t ) n = 1 ∏ N p ( i n ∣ t ) p ( x n , y n ∣ t ) . (49)
To treat all three formats uniformly, define
W n : = { ( x n , y n ) , formats 1 and 3 , ( i n , x n , y n ) , format 5 , i ∘ : = { i , formats 1 and 3 , i q u e r y , format 5 . (50) W_n:=\begin{cases}
(x_n,y_n),&\text{formats 1 and 3},\\
(i_n,x_n,y_n),&\text{format 5},
\end{cases}
\qquad
i_{\circ}:=\begin{cases}
i,&\text{formats 1 and 3},\\
i_{\mathrm{query}},&\text{format 5}.
\end{cases} \tag*{(50)} W n := { ( x n , y n ) , ( i n , x n , y n ) , formats 1 and 3 , format 5 , i ∘ := { i , i query , formats 1 and 3 , format 5 . (50)
For format 5 we therefore have p ( W n ∣ t ) = p ( i n ∣ t ) p ( x n , y n ∣ t ) p(W_n\mid t)=p(i_n\mid t)p(x_n,y_n\mid t) p ( W n ∣ t ) = p ( i n ∣ t ) p ( x n , y n ∣ t ) . In all three cases,
p ( z ∣ t ) = p ( i ∘ ∣ t ) p ( x q u e r y ∣ t ) ∏ n = 1 N p ( W n ∣ t ) . (51) p(z\mid t)=p(i_{\circ}\mid t)p(x_{\mathrm{query}}\mid t)\prod_{n=1}^{N}p(W_n\mid t). \tag*{(51)} p ( z ∣ t ) = p ( i ∘ ∣ t ) p ( x query ∣ t ) n = 1 ∏ N p ( W n ∣ t ) . (51)
For notational simplicity, below we write i i i for the single non-demonstration instruction variable i ∘ i_{\circ} i ∘ . Substituting (51) into (47) , we obtain
p ( t ∣ z ) = π ( t ) p ( i ∣ t ) p ( x q u e r y ∣ t ) ∏ n = 1 N p ( W n ∣ t ) ∑ s ∈ T π ( s ) p ( i ∣ s ) p ( x q u e r y ∣ s ) ∏ n = 1 N p ( W n ∣ s ) . (52) p(t\mid z)=\frac{\pi(t)p(i\mid t)p(x_{\mathrm{query}}\mid t)\prod_{n=1}^{N}p(W_n\mid t)}{\sum_{s\in\mathcal{T}}\pi(s)p(i\mid s)p(x_{\mathrm{query}}\mid s)\prod_{n=1}^{N}p(W_n\mid s)}. \tag*{(52)} p ( t ∣ z ) = ∑ s ∈ T π ( s ) p ( i ∣ s ) p ( x query ∣ s ) ∏ n = 1 N p ( W n ∣ s ) π ( t ) p ( i ∣ t ) p ( x query ∣ t ) ∏ n = 1 N p ( W n ∣ t ) . (52)
To make the dependence on the number of demonstrations explicit, we compare each task t t t against the true task t ∗ t^{*} t ∗ . For any t ≠ t ∗ t\ne t^{*} t = t ∗ ,
p ( t ∣ z ) p ( t ∗ ∣ z ) = π ( t ) π ( t ∗ ) p ( i ∣ t ) p ( i ∣ t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) ∏ n = 1 N p ( W n ∣ t ) ∏ n = 1 N p ( W n ∣ t ∗ ) . (53) \frac{p(t\mid z)}{p(t^{*}\mid z)}
=
\frac{\pi(t)}{\pi(t^{*})}
\frac{p(i\mid t)}{p(i\mid t^{*})}
\frac{p(x_{\mathrm{query}}\mid t)}{p(x_{\mathrm{query}}\mid t^{*})}
\frac{\prod_{n=1}^{N}p(W_n\mid t)}{\prod_{n=1}^{N}p(W_n\mid t^{*})}. \tag*{(53)} p ( t ∗ ∣ z ) p ( t ∣ z ) = π ( t ∗ ) π ( t ) p ( i ∣ t ∗ ) p ( i ∣ t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) ∏ n = 1 N p ( W n ∣ t ∗ ) ∏ n = 1 N p ( W n ∣ t ) . (53)
We define the task-evidence likelihood ratio
B t : = ∏ n = 1 N p ( W n ∣ t ) ∏ n = 1 N p ( W n ∣ t ∗ ) , (54) B_t:=\frac{\prod_{n=1}^{N}p(W_n\mid t)}{\prod_{n=1}^{N}p(W_n\mid t^{*})}, \tag*{(54)} B t := ∏ n = 1 N p ( W n ∣ t ∗ ) ∏ n = 1 N p ( W n ∣ t ) , (54)
and the non-demonstration ratio
A t ( i ) : = π ( t ) π ( t ∗ ) p ( i ∣ t ) p ( i ∣ t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) . (55) A_t(i):=\frac{\pi(t)}{\pi(t^{*})}\frac{p(i\mid t)}{p(i\mid t^{*})}\frac{p(x_{\mathrm{query}}\mid t)}{p(x_{\mathrm{query}}\mid t^{*})}. \tag*{(55)} A t ( i ) := π ( t ∗ ) π ( t ) p ( i ∣ t ∗ ) p ( i ∣ t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) . (55)
Thus
p ( t ∣ z ) p ( t ∗ ∣ z ) = A t ( i ) B t , t ≠ t ∗ , (56) \frac{p(t\mid z)}{p(t^{*}\mid z)}=A_t(i)B_t,\qquad t\ne t^{*}, \tag*{(56)} p ( t ∗ ∣ z ) p ( t ∣ z ) = A t ( i ) B t , t = t ∗ , (56)
and
p ( t ∗ ∣ z ) = 1 1 + ∑ s ≠ t ∗ A s ( i ) B s , p ( t ∣ z ) = A t ( i ) B t 1 + ∑ s ≠ t ∗ A s ( i ) B s , t ≠ t ∗ . (57) p(t^{*}\mid z)=\frac{1}{1+\sum_{s\ne t^{*}}A_s(i)B_s},
\qquad
p(t\mid z)=\frac{A_t(i)B_t}{1+\sum_{s\ne t^{*}}A_s(i)B_s},\qquad t\ne t^{*}. \tag*{(57)} p ( t ∗ ∣ z ) = 1 + ∑ s = t ∗ A s ( i ) B s 1 , p ( t ∣ z ) = 1 + ∑ s = t ∗ A s ( i ) B s A t ( i ) B t , t = t ∗ . (57)
Then we present two lemmas.
Lemma D.10 (Exponential Decay of Task-Evidence Likelihood Ratio). Defining
α : = 1 2 min t ≠ t ∗ κ t > 0 , \alpha:=\frac{1}{2}\min_{t\ne t^{*}}\kappa_t>0, α := 2 1 t = t ∗ min κ t > 0 , there exists N 0 < ∞ N_0<\infty N 0 < ∞ such that almost surely, for all N ≥ N 0 N\ge N_0 N ≥ N 0 and all t ≠ t ∗ t\ne t^{*} t = t ∗ ,
B t ≤ e − α N . B_t\le e^{-\alpha N}. B t ≤ e − α N .
Proof. Fix any t ≠ t ∗ t \ne t^* t = t ∗ . Assume the corresponding log-likelihood ratio is integrable. By the strong law of large numbers and Assumption 3.1 ,
1 N ∑ n = 1 N log p ( W n ∣ t ) p ( W n ∣ t ∗ ) → a . s . − KL ( P W ∣ t ∗ ∥ P W ∣ t ) = : − κ t , (58) \frac{1}{N}\sum_{n=1}^{N}\log\frac{p(W_n\mid t)}{p(W_n\mid t^*)}\xrightarrow{\mathrm{a.s.}}-\operatorname{KL}(P_{W\mid t^*}\mathbin\Vert P_{W\mid t})=:-\kappa_t, \tag*{(58)} N 1 n = 1 ∑ N log p ( W n ∣ t ∗ ) p ( W n ∣ t ) a.s. − KL ( P W ∣ t ∗ ∥ P W ∣ t ) =: − κ t , (58)
where κ t > 0 \kappa_t>0 κ t > 0 . For formats 1 and 3 this is the demonstration KL divergence; for format 5 it is the joint KL divergence of the independently sampled instruction–demonstration triples W n = ( i n , x n , y n ) W_n=(i_n,x_n,y_n) W n = ( i n , x n , y n ) . Hence, almost surely, there exists N t < ∞ N_t<\infty N t < ∞ such that for all N ≥ N t N\ge N_t N ≥ N t ,
B t ≤ exp ( − ( κ t / 2 ) N ) . (59) B_t\le\exp\left(-(\kappa_t/2)N\right). \tag*{(59)} B t ≤ exp ( − ( κ t /2 ) N ) . (59)
Since T \mathcal{T} T is finite, letting
α : = 1 2 min t ≠ t ∗ κ t > 0 , (60) \alpha:=\frac{1}{2}\min_{t\ne t^*}\kappa_t>0, \tag*{(60)} α := 2 1 t = t ∗ min κ t > 0 , (60)
we have (after enlarging N 0 : = max t ≠ t ∗ N t N_0:=\max_{t\ne t^*}N_t N 0 := max t = t ∗ N t ) that almost surely, for all N ≥ N 0 N\ge N_0 N ≥ N 0 and all t ≠ t ∗ t\ne t^* t = t ∗ ,
B t ≤ e − α N . (61) B_t\le e^{-\alpha N}. \tag*{(61)} B t ≤ e − α N . (61)
Lemma D.11 (Uniform Boundedness of Non-Demonstration Ratio). There exists a finite constant A max A_{\max} A m a x such that
sup i ∈ D max t ≠ t ∗ A t ( i ) ≤ A max < ∞ . \sup_{i\in D}\max_{t\ne t^*}A_t(i)\le A_{\max}<\infty. i ∈ D sup t = t ∗ max A t ( i ) ≤ A m a x < ∞.
Proof. Recall that
A t ( i ) = π ( t ) π ( t ∗ ) p ( i ∣ t ) p ( i ∣ t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) . A_t(i)=\frac{\pi(t)}{\pi(t^*)}\frac{p(i\mid t)}{p(i\mid t^*)}\frac{p(x_{\mathrm{query}}\mid t)}{p(x_{\mathrm{query}}\mid t^*)}. A t ( i ) = π ( t ∗ ) π ( t ) p ( i ∣ t ∗ ) p ( i ∣ t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) .
The vocabulary is finite and instruction length is bounded by L i L_i L i , so the supported instruction set D ⊆ V ≤ L i D\subseteq\mathcal{V}^{\le L_i} D ⊆ V ≤ L i is finite. Moreover, p ( i ∣ t ∗ ) > 0 p(i\mid t^*)>0 p ( i ∣ t ∗ ) > 0 for every i ∈ D i\in D i ∈ D by the definition of support. Therefore each ratio p ( i ∣ t ) / p ( i ∣ t ∗ ) p(i\mid t)/p(i\mid t^*) p ( i ∣ t ) / p ( i ∣ t ∗ ) is finite, and its maximum over D D D is finite. Since T \mathcal{T} T is finite and x q u e r y x_{\mathrm{query}} x query is fixed,
A max : = max t ≠ t ∗ π ( t ) π ( t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) max i ∈ D p ( i ∣ t ) p ( i ∣ t ∗ ) < ∞ . A_{\max}:=\max_{t\ne t^*}\frac{\pi(t)}{\pi(t^*)}\frac{p(x_{\mathrm{query}}\mid t)}{p(x_{\mathrm{query}}\mid t^*)}\max_{i\in D}\frac{p(i\mid t)}{p(i\mid t^*)}<\infty. A m a x := t = t ∗ max π ( t ∗ ) π ( t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) i ∈ D max p ( i ∣ t ∗ ) p ( i ∣ t ) < ∞.
This proves the claim without a differentiability or gradient assumption. □
Proof of Theorem 3.2
We first recall the statement of the theorem for convenience.
Theorem D.12 (Formal model bound with supported instructions). Consider prompt formats whose instructions lie in the support of the pretraining distribution, including formats 1, 3, and 5. Under the generation mechanism in § 2 and Assumption 3.1 , there exist constants α , β > 0 \alpha,\beta>0 α , β > 0 such that, almost surely, for all sufficiently large numbers of demonstrations N N N ,
∣ p ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β exp ( − α N ) . (62) \left|p(y_{\mathrm{query}}\mid z)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|\le\beta\exp(-\alpha N). \tag*{(62)} ∣ p ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β exp ( − α N ) . (62) Moreover, with r 0 r_0 r 0 defined in (31) and ε M : = r 0 \varepsilon_M:=r_0 ε M := r 0 ,
∣ M ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β e − α N + ε M . (63) \left|M(y_{\mathrm{query}}\mid z)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|\le\beta e^{-\alpha N}+\varepsilon_M. \tag*{(63)} ∣ M ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N + ε M . (63) Consequently, for any two supported instruction realizations i , i ′ i,i' i , i ′ to which the same format-specific assumptions apply (a single shared realization in formats 1 and 3, or two independently sampled paraphrase sequences in format 5), we have
∣ p ( y q u e r y ∣ z ( i ) ) − p ( y q u e r y ∣ z ( i ′ ) ) ∣ ≤ 2 β exp ( − α N ) . (64) \left|p(y_{\mathrm{query}}\mid z(i))-p(y_{\mathrm{query}}\mid z(i'))\right|\le2\beta\exp(-\alpha N). \tag*{(64)} ∣ p ( y query ∣ z ( i )) − p ( y query ∣ z ( i ′ )) ∣ ≤ 2 β exp ( − α N ) . (64)
We now proceed with the proof.
Proof. By definition of the posterior predictive,
p ( y q u e r y ∣ z ) = ∑ t ∈ T p ( y q u e r y ∣ x q u e r y , t ) p ( t ∣ z ) . (65) p(y_{\mathrm{query}} \mid z) = \sum_{t \in\mathcal{T}} p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t)\,p(t \mid z). \tag*{(65)} p ( y query ∣ z ) = t ∈ T ∑ p ( y query ∣ x query , t ) p ( t ∣ z ) . (65)
Subtracting p ( y q u e r y ∣ x q u e r y , t ∗ ) p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*) p ( y query ∣ x query , t ∗ ) and using ∑ t p ( t ∣ z ) = 1 \sum_t p(t \mid z) = 1 ∑ t p ( t ∣ z ) = 1 yields
p ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) = ∑ t ≠ t ∗ ( p ( y q u e r y ∣ x q u e r y , t ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ) p ( t ∣ z ) . (66) p(y_{\mathrm{query}} \mid z) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*) = \sum_{t \ne t^*} \left(p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right)p(t \mid z). \tag*{(66)} p ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) = t = t ∗ ∑ ( p ( y query ∣ x query , t ) − p ( y query ∣ x query , t ∗ ) ) p ( t ∣ z ) . (66)
Since 0 ≤ p ( y q u e r y ∣ x q u e r y , t ) ≤ 1 0 \le p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t) \le1 0 ≤ p ( y query ∣ x query , t ) ≤ 1 , we have ∣ p ( y q u e r y ∣ x q u e r y , t ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ 1 \lvert p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\rvert\le1 ∣ p ( y query ∣ x query , t ) − p ( y query ∣ x query , t ∗ )∣ ≤ 1 for all t t t , hence
∣ p ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ ∑ t ≠ t ∗ p ( t ∣ z ) . (67) \left\lvert p(y_{\mathrm{query}} \mid z) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right\rvert\le\sum_{t \ne t^*} p(t \mid z). \tag*{(67)} ∣ p ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ t = t ∗ ∑ p ( t ∣ z ) . (67)
It remains to upper bound the posterior mass on wrong tasks. From Equation (57) , for any t ≠ t ∗ t \ne t^* t = t ∗ ,
p ( t ∣ z ) = A t ( i ) B t 1 + ∑ s ≠ t ∗ A s ( i ) B s ≤ A t ( i ) B t . (68) p(t \mid z) = \frac{A_t(i)B_t}{1+\sum_{s\ne t^*} A_s(i)B_s} \le A_t(i)B_t. \tag*{(68)} p ( t ∣ z ) = 1 + ∑ s = t ∗ A s ( i ) B s A t ( i ) B t ≤ A t ( i ) B t . (68)
Summing over t ≠ t ∗ t \ne t^* t = t ∗ and applying Lemma D.10 and D.11, we obtain that almost surely for all N ≥ N 0 N \ge N_0 N ≥ N 0 ,
∑ t ≠ t ∗ p ( t ∣ z ) ≤ ∑ t ≠ t ∗ A t ( i ) B t ≤ ( ∣ T ∣ − 1 ) A max e − α N . (69) \sum_{t\ne t^*}p(t \mid z) \le\sum_{t\ne t^*} A_t(i)B_t \le(|\mathcal{T}|-1)A_{\max}e^{-\alpha N}. \tag*{(69)} t = t ∗ ∑ p ( t ∣ z ) ≤ t = t ∗ ∑ A t ( i ) B t ≤ ( ∣ T ∣ − 1 ) A m a x e − α N . (69)
Combining Equation (67) , 69 proves the first statement with β : = ( ∣ T ∣ − 1 ) A max \beta:= (|\mathcal{T}|-1)A_{\max} β := ( ∣ T ∣ − 1 ) A m a x :
∣ p ( y q u e r y ∣ z ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β e − α N . \left\lvert p(y_{\mathrm{query}} \mid z) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right\rvert\le\beta e^{-\alpha N}. ∣ p ( y query ∣ z ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N .
For the equivalent statement comparing two supported instruction realizations i , i ′ i,i' i , i ′ covered by the statement, we use the triangle inequality:
∣ p ( y q u e r y ∣ z ( i ) ) − p ( y q u e r y ∣ z ( i ′ ) ) ∣ (70) \left\lvert p(y_{\mathrm{query}} \mid z(i)) - p(y_{\mathrm{query}} \mid z(i'))\right\rvert \tag*{(70)} ∣ p ( y query ∣ z ( i )) − p ( y query ∣ z ( i ′ )) ∣ (70)
≤ ∣ p ( y q u e r y ∣ z ( i ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ + ∣ p ( y q u e r y ∣ z ( i ′ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ (71) \le\left\lvert p(y_{\mathrm{query}} \mid z(i)) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right\rvert+ \left\lvert p(y_{\mathrm{query}} \mid z(i')) - p(y_{\mathrm{query}} \mid x_{\mathrm{query}}, t^*)\right\rvert \tag*{(71)} ≤ ∣ p ( y query ∣ z ( i )) − p ( y query ∣ x query , t ∗ ) ∣ + ∣ p ( y query ∣ z ( i ′ )) − p ( y query ∣ x query , t ∗ ) ∣ (71)
≤ 2 β e − α N , (72) \le2\beta e^{-\alpha N}, \tag*{(72)} ≤ 2 β e − α N , (72)
Finally, a supported prompt is the constant-path case of Lemma D.1 , so ∣ M ( y q u e r y ∣ z ) − p ( y q u e r y ∣ z ) ∣ ≤ r 0 \lvert M(y_{\mathrm{query}} \mid z) - p(y_{\mathrm{query}} \mid z)\rvert\le r_0 ∣ M ( y query ∣ z ) − p ( y query ∣ z )∣ ≤ r 0 . Combining this inequality with the first bound by the triangle inequality proves (63) and completes the proof. □
Extension to an Unsupported Shared Instruction
We consider prompt format 4, in which the same instruction is prepended to all demonstrations and to the query. Let
z N ( i ) : = ( ( i , x 1 , y 1 ) , … , ( i , x N , y N ) , ( i , x q u e r y ) ) . (73) z_N(i) := ((i,x_1,y_1),\ldots,(i,x_N,y_N),(i,x_{\mathrm{query}})). \tag*{(73)} z N ( i ) := (( i , x 1 , y 1 ) , … , ( i , x N , y N ) , ( i , x query )) . (73)
The shared-instruction likelihood
Although the instruction appears N + 1 N+1 N + 1 times in the surface form of (73) , these occurrences are copies of a single template chosen once for the whole prompt, and not N + 1 N+1 N + 1 independent draws. We therefore model the instruction through a latent template variable.
Assumption D.13 (Shared-instruction factorization). There is a latent template τ \tau τ , drawn once per prompt from a task-conditional law P τ ∣ t P_{\tau\mid t} P τ ∣ t . Conditional on τ = i \tau=i τ = i , every displayed instruction slot is a deterministic copy of the same realization i i i , while the demonstrations and query are conditionally independent of τ \tau τ given the task. Thus, for every t ∈ T t \in\mathcal{T} t ∈ T
p ( z N ( i ) ∣ t ) = p ( i ∣ t ) ∏ n = 1 N p ( x n , y n ∣ t ) p ( x q u e r y ∣ t ) . (74) p(z_N(i) \mid t) = p(i \mid t)\prod_{n=1}^{N}p(x_n,y_n \mid t)\,p(x_{\mathrm{query}} \mid t). \tag*{(74)} p ( z N ( i ) ∣ t ) = p ( i ∣ t ) n = 1 ∏ N p ( x n , y n ∣ t ) p ( x query ∣ t ) . (74)
The instruction likelihood enters (74) once. This is the substantive modelling choice of this subsection: seeing one template repeated N + 1 N+1 N + 1 times is one observation about the task, not N + 1 N+1 N + 1 of them. Consequently, for every t ≠ t ∗ t \ne t^* t = t ∗ ,
p ( t ∣ z N ( i ) ) p ( t ∗ ∣ z N ( i ) ) = B t exp ( r t ( i ) + λ t ) , (75) \frac{p(t \mid z_N(i))}{p(t^* \mid z_N(i))}=B_t\exp(r_t(i)+\lambda_t), \tag*{(75)} p ( t ∗ ∣ z N ( i )) p ( t ∣ z N ( i )) = B t exp ( r t ( i ) + λ t ) , (75)
where
r t ( i ) : = log p ( i ∣ t ) p ( i ∣ t ∗ ) , λ t : = log ( π ( t ) π ( t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) ) , (76) r_t(i):=\log\frac{p(i\mid t)}{p(i\mid t^*)},\qquad\lambda_t:=\log\left(\frac{\pi(t)}{\pi(t^*)}\frac{p(x_{\mathrm{query}}\mid t)}{p(x_{\mathrm{query}}\mid t^*)}\right), \tag*{(76)} r t ( i ) := log p ( i ∣ t ∗ ) p ( i ∣ t ) , λ t := log ( π ( t ∗ ) π ( t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) ) , (76)
and B t B_t B t is the demonstration likelihood ratio of (54) .
Minimal endpoint condition and the role of analyticity
The exponential mechanism does not itself require analytic continuation. Let a chosen off-support reference extension assign each competitor a finite endpoint log-odds c t : = r ˉ t ( i ~ ) ∈ R c_t:=\bar r_t(\tilde i)\in\mathbb{R} c t := r ˉ t ( i ~ ) ∈ R , independent of N N N , and define its endpoint odds by
R ˉ t , N : = B t exp ( c t + λ t ) . (77) \bar R_{t,N}:=B_t\exp(c_t+\lambda_t). \tag*{(77)} R ˉ t , N := B t exp ( c t + λ t ) . (77)
Then Lemma D.10 immediately gives, almost surely for all sufficiently large N N N ,
∑ t ≠ t ∗ R ˉ t , N ≤ ( ∣ T ∣ − 1 ) max t ≠ t ∗ e c t + λ t e − α N . (78) \sum_{t\ne t^*}\bar R_{t,N}\le(|\mathcal{T}|-1)\max_{t\ne t^*}e^{c_t+\lambda_t}e^{-\alpha N}. \tag*{(78)} t = t ∗ ∑ R ˉ t , N ≤ ( ∣ T ∣ − 1 ) t = t ∗ max e c t + λ t e − α N . (78)
Since the predictive deviation is at most the total competing posterior odds, the reference predictor converges at the same exponential rate. Thus the minimal substantive statement for a shared instruction is robustness to an arbitrary fixed finite off-support odds perturbation: demonstration log-evidence grows linearly in N N N , whereas the instruction contributes only an N N N -independent constant.
The fixed-endpoint argument above establishes exponential convergence conditional on arbitrary finite constants c t c_t c t . The analytic-continuation theorem below does not improve the exponent α \alpha α , which is determined by the demonstration likelihood ratios. Its additional content is to replace the unstructured endpoint constants by a Transformer-induced continuation from a supported anchor and to derive the explicit path-dependent bound c t = ϕ t ( 1 ) ≤ γ 0 + Ω c_t=\phi_t(1)\le\gamma_0+\Omega c t = ϕ t ( 1 ) ≤ γ 0 + Ω . Consequently, the unknown factor max t e c t \max_t e^{c_t} max t e c t in (78) is controlled by e γ 0 + Ω e^{\gamma_0+\Omega} e γ 0 + Ω . The Cauchy–Taylor chain further yields local propagation bounds, a comparison bound between two unsupported endpoints, and additive continuation costs used in the mixed and varying-instruction analyses. Thus, the proof burden of the analytic theorem lies in constructing and quantitatively controlling the off-support perturbation, rather than in establishing a different asymptotic domination mechanism. Analyticity does not make the endpoint semantics statistically identified by zero-probability pretraining data.
Let i 0 i_0 i 0 be a supported anchor and i ~ \tilde i i ~ an unsupported instruction. Write
E s : = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , Δ : = ∥ E ( i ~ ) − E ( i 0 ) ∥ F , (79) E_s:=(1-s)E(i_0)+sE(\tilde i),\qquad s\in[0,1],\qquad\Delta:=\lVert E(\tilde i)-E(i_0)\rVert_F, \tag*{(79)} E s := ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , Δ := ∥ E ( i ~ ) − E ( i 0 ) ∥ F , (79)
in the fixed-length instruction-embedding space of § 2 , so s = 0 s=0 s = 0 is supported and s = 1 s=1 s = 1 is the unsupported endpoint. Since the Bayes conditional is not determined at a zero-probability prompt, the object studied below is the posterior predictive induced by a fixed chain of local Taylor expansions of the supported log-odds along (79) .
Assumption D.14 (Supported anchor). The anchor is a supported rendering of the target task with p ( i 0 ∣ t ) > 0 p(i_0\mid t)>0 p ( i 0 ∣ t ) > 0 for every t ∈ T t\in\mathcal{T} t ∈ T . Among admissible supported renderings one may choose the most typical anchor, for example i 0 ∈ arg max i p ( i ∣ t ∗ ) i_0\in\arg\max_i p(i\mid t^*) i 0 ∈ arg max i p ( i ∣ t ∗ ) (such as “+” among supported addition renderings). The proof below uses only support and finiteness. We write
γ 0 : = max t ≠ t ∗ r t ( i 0 ) < ∞ , (80) \gamma_0:=\max_{t\ne t^*}r_t(i_0)<\infty, \tag*{(80)} γ 0 := t = t ∗ max r t ( i 0 ) < ∞ , (80) which satisfies γ 0 ≤ 0 \gamma_0\le0 γ 0 ≤ 0 whenever the selected anchor is task-favoring, i.e. p ( i 0 ∣ t ) ≤ p ( i 0 ∣ t ∗ ) p(i_0\mid t)\le p(i_0\mid t^*) p ( i 0 ∣ t ) ≤ p ( i 0 ∣ t ∗ ) for every t ≠ t ∗ t\ne t^* t = t ∗ .
Under the shared reading γ 0 \gamma_0 γ 0 enters only additively in a constant, so no sign condition on it is required.
The chain hypothesis, and the constants it induces
The hypothesis below specifies a finite chain of overlapping complex disks along which the log-odds continue holomorphically. The constants used in the proof are defined from this chain in Lemma D.16 .
For clarity, the new symbol ϕ t , ℓ \phi_{t,\ell} ϕ t , ℓ denotes the local analytic continuation of the supported pathwise log-odds s ↦ r t ( E s ) s \mapsto r_t(E_s) s ↦ r t ( E s ) on the ℓ \ell ℓ -th disk of the chain. The index t t t specifies the competing task and ℓ \ell ℓ specifies the local neighborhood. Agreement on overlapping disks makes these local functions pieces of one continued function along the whole path; we denote that resulting function by ϕ t \phi_t ϕ t .
Assumption D.15 (Finite chain of analytic continuations). There exist an integer L < ∞ L < \infty L < ∞ and centers
0 = s 0 < s 1 < ⋯ < s L = 1 (81) 0 = s_0 < s_1 < \cdots< s_L = 1 \tag*{(81)} 0 = s 0 < s 1 < ⋯ < s L = 1 (81) with associated open complex disks D ℓ : = { ζ ∈ C : ∣ ζ − s ℓ ∣ < r ℓ } D_\ell:= \{\zeta\in\mathbb{C} : |\zeta- s_\ell| < r_\ell\} D ℓ := { ζ ∈ C : ∣ ζ − s ℓ ∣ < r ℓ } , ℓ = 0 , … , L − 1 \ell= 0,\ldots,L-1 ℓ = 0 , … , L − 1 , all independent of N N N , such that
d ℓ : = s ℓ + 1 − s ℓ < r ℓ , ℓ = 0 , … , L − 1 , (82) d_\ell:= s_{\ell+1} - s_\ell< r_\ell,\qquad\ell= 0,\ldots,L-1, \tag*{(82)} d ℓ := s ℓ + 1 − s ℓ < r ℓ , ℓ = 0 , … , L − 1 , (82) and such that for every t ≠ t ∗ t \ne t^* t = t ∗ there are holomorphic functions ϕ t , ℓ : D ℓ → C \phi_{t,\ell}:D_\ell\to\mathbb{C} ϕ t , ℓ : D ℓ → C with
(i) (compatibility) ϕ t , ℓ = ϕ t , m \phi_{t,\ell} = \phi_{t,m} ϕ t , ℓ = ϕ t , m on D ℓ ∩ D m D_\ell\cap D_m D ℓ ∩ D m whenever this intersection is nonempty;
(ii) (anchoring) ϕ t , 0 ( s ) = r t ( E s ) \phi_{t,0}(s) = r_t(E_s) ϕ t , 0 ( s ) = r t ( E s ) on a nontrivial instruction-embedding interval adjacent to s = 0 s = 0 s = 0 on which the fixed extension is defined.
We write ϕ t \phi_t ϕ t for the function these germs define on [ 0 , 1 ] [0,1] [ 0 , 1 ] , and ϕ t ( 1 ) \phi_t(1) ϕ t ( 1 ) for the value at s L = 1 s_L = 1 s L = 1 , which lies in D L − 1 D_{L-1} D L − 1 by (82) .
Only D 0 D_0 D 0 concerns supported instructions; the remaining L − 1 L - 1 L − 1 disks are the part of the hypothesis that describes continuation outside the support.
Lemma D.16 (Constants induced by the chain). Fix working radii ρ ℓ ∈ ( d ℓ , r ℓ ) \rho_\ell\in(d_\ell,r_\ell) ρ ℓ ∈ ( d ℓ , r ℓ ) and set
M ℓ : = max t ≠ t ∗ max ∣ ζ − s ℓ ∣ = ρ ℓ ∣ ϕ t ( ζ ) − ϕ t ( s ℓ ) ∣ , q ℓ : = d ℓ ρ ℓ ∈ ( 0 , 1 ) . (83) M_\ell:= \max_{t \ne t^*}\ \max_{|\zeta-s_\ell|=\rho_\ell} |\phi_t(\zeta)-\phi_t(s_\ell)|,\qquad q_\ell:= \frac{d_\ell}{\rho_\ell} \in(0,1). \tag*{(83)} M ℓ := t = t ∗ max ∣ ζ − s ℓ ∣ = ρ ℓ max ∣ ϕ t ( ζ ) − ϕ t ( s ℓ ) ∣ , q ℓ := ρ ℓ d ℓ ∈ ( 0 , 1 ) . (83) Then, under Assumption D.15 :
(a) every M ℓ M_\ell M ℓ is finite, and M ℓ , ρ ℓ , q ℓ M_\ell,\rho_\ell,q_\ell M ℓ , ρ ℓ , q ℓ are independent of N N N ;
(b) for every t ≠ t ∗ t \ne t^* t = t ∗ , every ℓ \ell ℓ and every k ≥ 1 k \ge1 k ≥ 1 ,
∣ ϕ t ( k ) ( s ℓ ) ∣ ≤ M ℓ k ! ρ ℓ k ; (84) |\phi_t^{(k)}(s_\ell)| \le\frac{M_\ell k!}{\rho_\ell^k}; \tag*{(84)} ∣ ϕ t ( k ) ( s ℓ ) ∣ ≤ ρ ℓ k M ℓ k ! ; (84) (c) every ϕ t \phi_t ϕ t has real Taylor coefficients at every s ℓ s_\ell s ℓ , and ϕ t ( s ) ∈ R \phi_t(s) \in\mathbb{R} ϕ t ( s ) ∈ R for all s ∈ [ 0 , 1 ] s \in[0,1] s ∈ [ 0 , 1 ] .
Proof. (a) Since ρ ℓ < r ℓ \rho_\ell< r_\ell ρ ℓ < r ℓ , the circle ∣ ζ − s ℓ ∣ = ρ ℓ |\zeta-s_\ell|=\rho_\ell ∣ ζ − s ℓ ∣ = ρ ℓ is a compact subset of D ℓ D_\ell D ℓ , on which the holomorphic—hence continuous—function ϕ t \phi_t ϕ t is bounded. The maximum over the finite set T T T of finitely many finite numbers is finite. None of D ℓ , ρ ℓ , ϕ t D_\ell,\rho_\ell,\phi_t D ℓ , ρ ℓ , ϕ t depends on N N N , by Assumption D.15 and because r t r_t r t in (76) does not.
(b) Apply the Cauchy estimates on the circle of radius ρ ℓ \rho_\ell ρ ℓ to the holomorphic function ψ t : = ϕ t − ϕ t ( s ℓ ) \psi_t:=\phi_t-\phi_t(s_\ell) ψ t := ϕ t − ϕ t ( s ℓ ) , which satisfies max ∣ ζ − s ℓ ∣ = ρ ℓ ∣ ψ t ∣ = M ℓ \max_{|\zeta-s_\ell|=\rho_\ell}|\psi_t|=M_\ell max ∣ ζ − s ℓ ∣ = ρ ℓ ∣ ψ t ∣ = M ℓ by (83) and ψ t ( k ) = ϕ t ( k ) \psi_t^{(k)}=\phi_t^{(k)} ψ t ( k ) = ϕ t ( k ) for k ≥ 1 k\ge1 k ≥ 1 .
(c) By (ii) the germ ϕ t , 0 \phi_{t,0} ϕ t , 0 agrees with the real-valued function s ↦ r t ( E s ) s\mapsto r_t(E_s) s ↦ r t ( E s ) on a nontrivial real interval, so all its derivatives at s 0 s_0 s 0 are real. If ϕ t \phi_t ϕ t has real coefficients at s ℓ s_\ell s ℓ , then by (ii) its coefficients at the real point s ℓ + 1 s_{\ell+1} s ℓ + 1 are obtained by term-by-term differentiation of a real power series, hence are real. Induction on ℓ \ell ℓ gives the claim, and a power series with real coefficients is real on the real axis inside its disk of convergence. □
Inequality (84) is the quantitative form of analyticity at s ℓ s_\ell s ℓ : by Cauchy–Hadamard it says the Taylor series there has radius of convergence at least ρ ℓ \rho_\ell ρ ℓ with coefficients bounded by M ℓ ρ ℓ − k M_\ell\rho_\ell^{-k} M ℓ ρ ℓ − k . It is a consequence of Assumption D.15 , not an additional hypothesis.
One Taylor step, and the cancellation of k k k !
The next lemma is the sole mechanism of the proof. It converts the local coefficient bound (84) at s ℓ s_\ell s ℓ into a bound on the increment of ϕ t \phi_t ϕ t across the link. The factorial k ! k! k ! in (84) is exactly cancelled by the factorial in the Taylor coefficients, leaving a geometric series of ratio q ℓ < 1 q_\ell< 1 q ℓ < 1 .
Lemma D.17 (Taylor transfer across one link). Under Assumption D.15, for every t ≠ t ∗ t \ne t^* t = t ∗ and every ℓ = 0 , … , L − 1 \ell= 0,\ldots,L-1 ℓ = 0 , … , L − 1 :
(a) the increment across the link satisfies
η ℓ : = max t ≠ t ∗ ∣ ϕ t ( s ℓ + 1 ) − ϕ t ( s ℓ ) ∣ ≤ M ℓ q ℓ 1 − q ℓ ; (85) \eta_\ell:= \max_{t \ne t^*} \left|\phi_t(s_{\ell+1})-\phi_t(s_\ell)\right| \le\frac{M_\ell q_\ell}{1-q_\ell}; \tag*{(85)} η ℓ := t = t ∗ max ∣ ϕ t ( s ℓ + 1 ) − ϕ t ( s ℓ ) ∣ ≤ 1 − q ℓ M ℓ q ℓ ; (85) (b) more generally, for 0 ≤ u < 1 0 \le u < 1 0 ≤ u < 1 and ∣ s − s ℓ ∣ ≤ u ρ ℓ \left|s-s_\ell\right| \le u\rho_\ell ∣ s − s ℓ ∣ ≤ u ρ ℓ ,
∣ ϕ t ( s ) − ϕ t ( s ℓ ) ∣ ≤ M ℓ u 1 − u ; (86) \left|\phi_t(s)-\phi_t(s_\ell)\right| \le\frac{M_\ell u}{1-u}; \tag*{(86)} ∣ ϕ t ( s ) − ϕ t ( s ℓ ) ∣ ≤ 1 − u M ℓ u ; (86) (c) the germ at s ℓ + 1 s_{\ell+1} s ℓ + 1 inherited from s ℓ s_\ell s ℓ obeys
∣ ϕ t ( k ) ( s ℓ + 1 ) ∣ ≤ M ℓ 1 − q ℓ ⋅ k ! ( ρ ℓ − d ℓ ) k , k ≥ 1. (87) \left|\phi_t^{(k)}(s_{\ell+1})\right| \le\frac{M_\ell}{1-q_\ell}\cdot\frac{k!}{(\rho_\ell-d_\ell)^k},\qquad k\ge1. \tag*{(87)} ϕ t ( k ) ( s ℓ + 1 ) ≤ 1 − q ℓ M ℓ ⋅ ( ρ ℓ − d ℓ ) k k ! , k ≥ 1. (87)
Proof. (b) Since the Taylor series of ϕ t \phi_t ϕ t at s ℓ s_\ell s ℓ converges for ∣ s − s ℓ ∣ < ρ ℓ \left|s-s_\ell\right|<\rho_\ell ∣ s − s ℓ ∣ < ρ ℓ by (84) ,
∣ ϕ t ( s ) − ϕ t ( s ℓ ) ∣ ≤ ∑ k ≥ 1 ∣ ϕ t ( k ) ( s ℓ ) ∣ k ! ∣ s − s ℓ ∣ k ≤ ∑ k ≥ 1 1 k ! ⋅ M ℓ k ! ρ ℓ k ( u ρ ℓ ) k = M ℓ ∑ k ≥ 1 u k = M ℓ u 1 − u . (88) \left|\phi_t(s)-\phi_t(s_\ell)\right|
\le\sum_{k\ge1}\frac{\left|\phi_t^{(k)}(s_\ell)\right|}{k!}\left|s-s_\ell\right|^k
\le\sum_{k\ge1}\frac{1}{k!}\cdot\frac{M_\ell k!}{\rho_\ell^k}(u\rho_\ell)^k
= M_\ell\sum_{k\ge1}u^k
= \frac{M_\ell u}{1-u}. \tag*{(88)} ∣ ϕ t ( s ) − ϕ t ( s ℓ ) ∣ ≤ k ≥ 1 ∑ k ! ϕ t ( k ) ( s ℓ ) ∣ s − s ℓ ∣ k ≤ k ≥ 1 ∑ k ! 1 ⋅ ρ ℓ k M ℓ k ! ( u ρ ℓ ) k = M ℓ k ≥ 1 ∑ u k = 1 − u M ℓ u . (88)
The middle step is the cancellation of k ! k! k ! against 1 / k ! 1/k! 1/ k ! : without it the series would be ∑ k k ! u k \sum_k k!u^k ∑ k k ! u k , which diverges for every u > 0 u>0 u > 0 .
(a) Apply (b) with u = q ℓ u=q_\ell u = q ℓ , legitimate because d ℓ = q ℓ ρ ℓ d_\ell=q_\ell\rho_\ell d ℓ = q ℓ ρ ℓ and q ℓ < 1 q_\ell<1 q ℓ < 1 , and take the maximum over the finite set T \mathcal{T} T .
(c) Differentiating the Taylor series of ϕ t \phi_t ϕ t at s ℓ s_\ell s ℓ term by term k k k times and evaluating at s ℓ + 1 s_{\ell+1} s ℓ + 1 ,
ϕ t ( k ) ( s ℓ + 1 ) = ∑ j ≥ k ϕ t ( j ) ( s ℓ ) ( j − k ) ! d ℓ j − k , \phi_t^{(k)}(s_{\ell+1})=\sum_{j\ge k}\frac{\phi_t^{(j)}(s_\ell)}{(j-k)!}d_\ell^{j-k}, ϕ t ( k ) ( s ℓ + 1 ) = j ≥ k ∑ ( j − k )! ϕ t ( j ) ( s ℓ ) d ℓ j − k ,
so by (84) and
( m + k ) ! m ! = k ! ( m + k k ) , \frac{(m+k)!}{m!}=k!\binom{m+k}{k}, m ! ( m + k )! = k ! ( k m + k ) ,
∣ ϕ t ( k ) ( s ℓ + 1 ) ∣ ≤ M ℓ ρ ℓ k ∑ m ≥ 0 ( m + k ) ! m ! q ℓ m = M ℓ k ! ρ ℓ k ( 1 − q ℓ ) − ( k + 1 ) , \left|\phi_t^{(k)}(s_{\ell+1})\right|
\le\frac{M_\ell}{\rho_\ell^k}\sum_{m\ge0}\frac{(m+k)!}{m!}q_\ell^m
=\frac{M_\ell k!}{\rho_\ell^k}(1-q_\ell)^{-(k+1)}, ϕ t ( k ) ( s ℓ + 1 ) ≤ ρ ℓ k M ℓ m ≥ 0 ∑ m ! ( m + k )! q ℓ m = ρ ℓ k M ℓ k ! ( 1 − q ℓ ) − ( k + 1 ) ,
using ∑ m ≥ 0 ( m + k k ) q m = ( 1 − q ) − ( k + 1 ) \sum_{m\ge0}\binom{m+k}{k}q^m=(1-q)^{-(k+1)} ∑ m ≥ 0 ( k m + k ) q m = ( 1 − q ) − ( k + 1 ) . Rearranging with ρ ℓ ( 1 − q ℓ ) = ρ ℓ − d ℓ \rho_\ell(1-q_\ell)=\rho_\ell-d_\ell ρ ℓ ( 1 − q ℓ ) = ρ ℓ − d ℓ gives (87) . □
Remark D.18 (The chain hypothesis is not vacuous, and not redundant). Part (c) shows that a germ at s ℓ s_\ell s ℓ automatically induces a germ at s ℓ + 1 s_{\ell+1} s ℓ + 1 with degraded constants ( M ℓ / ( 1 − q ℓ ) , ρ ℓ − d ℓ ) (M_\ell/(1-q_\ell),\rho_\ell-d_\ell) ( M ℓ / ( 1 − q ℓ ) , ρ ℓ − d ℓ ) : the radius shrinks by exactly the step length, which is the classical behaviour of Weierstrass continuation. Iterating from s 0 s_0 s 0 alone would therefore reach only s < ρ 0 s<\rho_0 s < ρ 0 , recovering the single-germ case. Assumption D.15 is binding precisely when some center supplies constants better than those propagated by (c), i.e. when the log-odds regain analytic room further along the path. This is what allows L > 1 L>1 L > 1 to travel a distance exceeding ρ 0 \rho_0 ρ 0 .
Lemma D.19 (Additive propagation along the chain). Define the cumulative continuation cost
Ω : = ∑ ℓ = 0 L − 1 M ℓ q ℓ 1 − q ℓ . (89) \Omega:= \sum_{\ell=0}^{L-1}\frac{M_\ell q_\ell}{1-q_\ell}. \tag*{(89)} Ω := ℓ = 0 ∑ L − 1 1 − q ℓ M ℓ q ℓ . (89)
Under Assumption D.15, Ω < ∞ \Omega< \infty Ω < ∞ automatically, since the chain is finite and every M ℓ M_\ell M ℓ is finite and every q ℓ < 1 q_\ell< 1 q ℓ < 1 . Moreover, under Assumption D.14, for every t ≠ t ∗ t \ne t^* t = t ∗ and every ℓ = 0 , … , L \ell= 0,\ldots,L ℓ = 0 , … , L ,
ϕ t ( s ℓ ) ≤ γ 0 + ∑ j = 0 ℓ − 1 η j ≤ γ 0 + Ω . In particular ϕ t ( 1 ) ≤ γ 0 + Ω = : Ω 0 . (90) \phi_t(s_\ell) \le\gamma_0 + \sum_{j=0}^{\ell-1} \eta_j \le\gamma_0 + \Omega. \qquad\text{In particular}\qquad\phi_t(1) \le\gamma_0 + \Omega=: \Omega_0. \tag*{(90)} ϕ t ( s ℓ ) ≤ γ 0 + j = 0 ∑ ℓ − 1 η j ≤ γ 0 + Ω. In particular ϕ t ( 1 ) ≤ γ 0 + Ω =: Ω 0 . (90)
Proof. By Lemma D.16 (c) all quantities are real. Telescoping,
ϕ t ( s ℓ ) = ϕ t ( s 0 ) + ∑ j = 0 ℓ − 1 ( ϕ t ( s j + 1 ) − ϕ t ( s j ) ) ≤ r t ( i 0 ) + ∑ j = 0 ℓ − 1 η j ≤ γ 0 + ∑ j = 0 ℓ − 1 η j , \phi_t(s_\ell) = \phi_t(s_0) + \sum_{j=0}^{\ell-1}\left(\phi_t(s_{j+1})-\phi_t(s_j)\right) \le r_t(i_0) + \sum_{j=0}^{\ell-1}\eta_j \le\gamma_0 + \sum_{j=0}^{\ell-1}\eta_j, ϕ t ( s ℓ ) = ϕ t ( s 0 ) + j = 0 ∑ ℓ − 1 ( ϕ t ( s j + 1 ) − ϕ t ( s j ) ) ≤ r t ( i 0 ) + j = 0 ∑ ℓ − 1 η j ≤ γ 0 + j = 0 ∑ ℓ − 1 η j ,
and η j ≤ M j q j / ( 1 − q j ) \eta_j \le M_jq_j/(1-q_j) η j ≤ M j q j / ( 1 − q j ) by Lemma D.17 (a). Since every term is nonnegative, the partial sums are bounded by Ω \Omega Ω . □
The propagation is additive because the chain acts on the log-odds. Had the same chain been run on the odds themselves, or on the posterior predictive, each link would have contributed a multiplicative factor and L L L links would produce an L L L -th power; this is the structural reason the present argument succeeds where amplification-based transfers do not.
Main result
Define the continued odds, odds mass and predictive deviation by
R t , N ( s ) : = B t exp ( ϕ t ( s ) + λ t ) , σ N ( s ) : = ∑ t ≠ t ∗ R t , N ( s ) , (91) R_{t,N}(s) := B_t\exp\left(\phi_t(s)+\lambda_t\right), \qquad\sigma_N(s) := \sum_{t\ne t^*}R_{t,N}(s), \tag*{(91)} R t , N ( s ) := B t exp ( ϕ t ( s ) + λ t ) , σ N ( s ) := t = t ∗ ∑ R t , N ( s ) , (91)
h N ( s ) : = ∑ t ≠ t ∗ b t R t , N ( s ) 1 + σ N ( s ) , b t : = p ( y q u e r y ∣ x q u e r y , t ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) , ∣ b t ∣ ≤ 1. (92) h_N(s) := \sum_{t\ne t^*}b_t\frac{R_{t,N}(s)}{1+\sigma_N(s)}, \qquad b_t := p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*), \qquad|b_t|\le1. \tag*{(92)} h N ( s ) := t = t ∗ ∑ b t 1 + σ N ( s ) R t , N ( s ) , b t := p ( y query ∣ x query , t ) − p ( y query ∣ x query , t ∗ ) , ∣ b t ∣ ≤ 1. (92)
At every s s s in the anchored initial instruction-embedding interval, h N ( s ) = p ( y q u e r y ∣ z N ( E s ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) h_N(s)=p(y_{\mathrm{query}}\mid z_N(E_s))-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*) h N ( s ) = p ( y query ∣ z N ( E s )) − p ( y query ∣ x query , t ∗ ) by (75) ; at s = 1 s=1 s = 1 it is the value induced by the chain.
Theorem D.20 (Formal model bound for an unsupported shared instruction). Let Assumptions 3.1, D.13, D.14 and D.15 hold. Then almost surely, for all sufficiently large N N N ,
∣ h N ( 1 ) ∣ ≤ β ~ e − α N , β ~ : = β ∘ e Ω 0 , β ∘ : = ( ∣ T ∣ − 1 ) max t ≠ t ∗ e λ t , (93) |h_N(1)| \le\widetilde{\beta}e^{-\alpha N}, \qquad\widetilde{\beta}:=\beta_\circ e^{\Omega_0}, \qquad\beta_\circ:= (|\mathcal{T}|-1)\max_{t\ne t^*}e^{\lambda_t}, \tag*{(93)} ∣ h N ( 1 ) ∣ ≤ β e − α N , β := β ∘ e Ω 0 , β ∘ := ( ∣ T ∣ − 1 ) t = t ∗ max e λ t , (93) with α = 1 2 min t ≠ t ∗ κ t \alpha=\frac{1}{2}\min_{t\ne t^*}\kappa_t α = 2 1 min t = t ∗ κ t as in Lemma D.10 . Equivalently, the posterior predictive induced by the chain satisfies
∣ p ‾ ( y q u e r y ∣ z N ( ı ~ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β ~ e − α N , (94) \left|\overline{p}(y_{\mathrm{query}}\mid z_N(\widetilde{\imath}))-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right| \le\widetilde{\beta}e^{-\alpha N}, \tag*{(94)} ∣ p ( y query ∣ z N ( )) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N , (94) and, for the actual pretrained model,
∣ M ( y q u e r y ∣ z N ( ı ~ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β ~ e − α N + ε M , N ( ı ~ ) , (95) \left|M(y_{\mathrm{query}}\mid z_N(\widetilde{\imath}))-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right| \le\widetilde{\beta}e^{-\alpha N}+\varepsilon_{M,N}(\widetilde{\imath}), \tag*{(95)} ∣ M ( y query ∣ z N ( )) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β e − α N + ε M , N ( ) , (95) where ε M , N ( ı ~ ) \varepsilon_{M,N}(\widetilde{\imath}) ε M , N ( ) is defined by (41) , and for any two unsupported instructions admitting chains with costs Ω 0 , Ω 0 ′ \Omega_0,\Omega'_0 Ω 0 , Ω 0 ′ ,
∣ p ‾ ( y q u e r y ∣ z N ( ı ~ ) ) − p ‾ ( y q u e r y ∣ z N ( ı ~ ′ ) ) ∣ ≤ 2 β ∘ e max { Ω 0 , Ω 0 ′ } e − α N . (96) \left|\overline{p}(y_{\mathrm{query}}\mid z_N(\widetilde{\imath}))-\overline{p}(y_{\mathrm{query}}\mid z_N(\widetilde{\imath}'))\right| \le2\beta_\circ e^{\max\{\Omega_0,\Omega'_0\}}e^{-\alpha N}. \tag*{(96)} p ( y query ∣ z N ( )) − p ( y query ∣ z N ( ′ )) ≤ 2 β ∘ e m a x { Ω 0 , Ω 0 ′ } e − α N . (96)
Proof. By Lemma D.10 , almost surely for all sufficiently large N N N we have B t ≤ e − α N B_t\le e^{-\alpha N} B t ≤ e − α N for every t ≠ t ∗ t\ne t^* t = t ∗ . By Lemma D.19 , ϕ t ( 1 ) ≤ Ω 0 \phi_t(1)\le\Omega_0 ϕ t ( 1 ) ≤ Ω 0 , and by Lemma D.16 (c) this is a real inequality. Hence
R t , N ( 1 ) = B t exp ( ϕ t ( 1 ) + λ t ) ≤ e λ t e Ω 0 e − α N . (97) R_{t,N}(1)=B_t\exp\left(\phi_t(1)+\lambda_t\right)\le e^{\lambda_t}e^{\Omega_0}e^{-\alpha N}. \tag*{(97)} R t , N ( 1 ) = B t exp ( ϕ t ( 1 ) + λ t ) ≤ e λ t e Ω 0 e − α N . (97)
Summing over the ∣ T ∣ − 1 |\mathcal{T}|-1 ∣ T ∣ − 1 competitors, σ N ( 1 ) ≤ β ∘ e Ω 0 e − α N \sigma_N(1)\le\beta_\circ e^{\Omega_0}e^{-\alpha N} σ N ( 1 ) ≤ β ∘ e Ω 0 e − α N . Since every R t , N ( 1 ) R_{t,N}(1) R t , N ( 1 ) is real and nonnegative we have 1 + σ N ( 1 ) ≥ 1 1+\sigma_N(1)\ge1 1 + σ N ( 1 ) ≥ 1 , so by (92) and ∣ b t ∣ ≤ 1 |b_t|\le1 ∣ b t ∣ ≤ 1 ,
∣ h N ( 1 ) ∣ ≤ σ N ( 1 ) 1 + σ N ( 1 ) ≤ σ N ( 1 ) ≤ β ∘ e Ω 0 e − α N , |h_N(1)|\le\frac{\sigma_N(1)}{1+\sigma_N(1)}\le\sigma_N(1)\le\beta_\circ e^{\Omega_0}e^{-\alpha N}, ∣ h N ( 1 ) ∣ ≤ 1 + σ N ( 1 ) σ N ( 1 ) ≤ σ N ( 1 ) ≤ β ∘ e Ω 0 e − α N ,
which is (93) . Statement (96) follows by the triangle inequality as in Theorem D.12 . Combining (94) with Corollary D.2 gives (95) . □
Assumption D.21 (Uniform model–reference tracking along a shared-template path). For the fixed unsupported instruction i ~ \tilde{i} i ~ , there exist N 0 N_0 N 0 and a finite constant ε ˉ M ( i ~ ) ≥ 0 \bar{\varepsilon}_M(\tilde{i}) \ge0 ε ˉ M ( i ~ ) ≥ 0 such that, almost surely,
sup N ≥ N 0 ε M , N ( i ~ ) ≤ ε ˉ M ( i ~ ) . (98) \sup_{N \ge N_0} \varepsilon_{M,N}(\tilde{i}) \le\bar{\varepsilon}_M(\tilde{i}). \tag*{(98)} N ≥ N 0 sup ε M , N ( i ~ ) ≤ ε ˉ M ( i ~ ) . (98)
Corollary D.22 (Uniform shared-template model tracking). If, in addition, Assumption D.21 holds, then almost surely for all sufficiently large N N N ,
∣ M ( y q u e r y ∣ z N ( i ~ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β ~ e − α N + ε ˉ M ( i ~ ) , (99) \left|M(y_{query}\mid z_N(\tilde{i}))-p(y_{query}\mid x_{query},t^*)\right| \le\tilde{\beta}e^{-\alpha N}+\bar{\varepsilon}_M(\tilde{i}), \tag*{(99)} M ( y q u er y ∣ z N ( i ~ )) − p ( y q u er y ∣ x q u er y , t ∗ ) ≤ β ~ e − α N + ε ˉ M ( i ~ ) , (99) and consequently
lim sup N → ∞ ∣ M ( y q u e r y ∣ z N ( i ~ ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ ε ˉ M ( i ~ ) . \limsup_{N\to\infty}\left|M(y_{query}\mid z_N(\tilde{i}))-p(y_{query}\mid x_{query},t^*)\right| \le\bar{\varepsilon}_M(\tilde{i}). N → ∞ lim sup M ( y q u er y ∣ z N ( i ~ )) − p ( y q u er y ∣ x q u er y , t ∗ ) ≤ ε ˉ M ( i ~ ) . If, more strongly, ε M , N ( i ~ ) → 0 \varepsilon_{M,N}(\tilde{i}) \to0 ε M , N ( i ~ ) → 0 , then M ( y q u e r y ∣ z N ( i ~ ) ) → p ( y q u e r y ∣ x q u e r y , t ∗ ) M(y_{query}\mid z_N(\tilde{i})) \to p(y_{query}\mid x_{query},t^*) M ( y q u er y ∣ z N ( i ~ )) → p ( y q u er y ∣ x q u er y , t ∗ ) almost surely.
Proof. Substitute the uniform bound from Assumption D.21 into (95) and take the limit superior. The final claim follows from the same bound when both terms on its right-hand side vanish. □
Proposition D.7 supplies sufficient conditions for Assumption D.21, with the explicit choice ε ˉ M = r ˉ + ( C M + 2 G ) d \bar{\varepsilon}_M=\bar{r}+(C_M+2G)d ε ˉ M = r ˉ + ( C M + 2 G ) d . Proposition D.8 further relates r ˉ \bar{r} r ˉ to population excess log loss on a covered anchor family. Architectural analyticity alone supplies neither small calibration error nor a small transport constant. For a finite context window these results apply only to admissible N N N and do not imply an infinite-length limit.
Two features distinguish (93) from what the independent-occurrence reading would give. First, the decay rate is the undegraded α \alpha α of Theorem D.12: passing to an unsupported instruction costs a constant factor, not a slower exponential. Second, no upper bound on Ω \Omega Ω is required, so there is no fixed admissible distance; the cost of travelling further is paid once, in the constant.
Corollary D.23 (Certified distance under a uniform path-cost bound). Consider a collection of unsupported endpoints that share the supported anchor i 0 i_0 i 0 and the fixed query contribution λ t \lambda_t λ t . For an endpoint i ~ \tilde{i} i ~ , let Δ ( i ~ ) : = ∥ E ( i ~ ) − E ( i 0 ) ∥ F \Delta(\tilde{i}) := \lVert E(\tilde{i})-E(i_0)\rVert_F Δ ( i ~ ) := ∥ E ( i ~ ) − E ( i 0 ) ∥ F , and write Ω ( i ~ ) \Omega(\tilde{i}) Ω ( i ~ ) for the cumulative cost of its continuation chain. Suppose there is a constant L p a t h > 0 \mathcal{L}_{path}>0 L p a t h > 0 , independent of N N N and of the endpoint, such that
Ω ( i ~ ) ≤ L p a t h Δ ( i ~ ) (100) \Omega(\tilde{i}) \le\mathcal{L}_{path}\Delta(\tilde{i}) \tag*{(100)} Ω ( i ~ ) ≤ L p a t h Δ ( i ~ ) (100) throughout this collection. Set β 0 : = β ∘ e γ 0 \beta_0 := \beta_{\circ}e^{\gamma_0} β 0 := β ∘ e γ 0 . Then
∣ h N ( 1 ) ∣ ≤ β 0 exp ( − α N + L p a t h Δ ( i ~ ) ) . (101) |h_N(1)| \le\beta_0\exp\left(-\alpha N+\mathcal{L}_{path}\Delta(\tilde{i})\right). \tag*{(101)} ∣ h N ( 1 ) ∣ ≤ β 0 exp ( − α N + L p a t h Δ ( i ~ ) ) . (101) Consequently, for any ϵ ∈ ( 0 , 1 ) \epsilon\in(0,1) ϵ ∈ ( 0 , 1 ) , ∣ h N ( 1 ) ∣ ≤ ϵ |h_N(1)|\le\epsilon ∣ h N ( 1 ) ∣ ≤ ϵ whenever
Δ ( i ~ ) ≤ α N − log ( β 0 / ϵ ) L p a t h . (102) \Delta(\tilde{i}) \le\frac{\alpha N-\log(\beta_0/\epsilon)}{\mathcal{L}_{path}}. \tag*{(102)} Δ ( i ~ ) ≤ L p a t h α N − log ( β 0 / ϵ ) . (102) Thus, within an endpoint family satisfying the same uniform path-cost bound, the certified distance grows linearly with N N N .
Proof. The proof of Theorem D.20 gives ∣ h N ( 1 ) ∣ ≤ β ∘ e γ 0 + Ω ( i ~ ) e − α N |h_N(1)|\le\beta_{\circ}e^{\gamma_0+\Omega(\tilde{i})}e^{-\alpha N} ∣ h N ( 1 ) ∣ ≤ β ∘ e γ 0 + Ω ( i ~ ) e − α N . Applying (100) proves (101) . Solving β 0 e − α N + L p a t h Δ ( i ~ ) ≤ ϵ \beta_0e^{-\alpha N+\mathcal{L}_{path}\Delta(\tilde{i})}\le\epsilon β 0 e − α N + L p a t h Δ ( i ~ ) ≤ ϵ for Δ ( i ~ ) \Delta(\tilde{i}) Δ ( i ~ ) gives (102) . □
Mixed Supported and Unsupported Instructions
We next consider a prompt in which most demonstrations display the same supported instruction while a few display corrupted, unsupported surface forms, for example misspellings. Write
z N : = ( ( i 1 , x 1 , y 1 ) , … , ( i N , x N , y N ) , ( i q , x q u e r y ) ) , (103) z_N := ((i_1,x_1,y_1),\ldots,(i_N,x_N,y_N),(i_q,x_{query})), \tag*{(103)} z N := (( i 1 , x 1 , y 1 ) , … , ( i N , x N , y N ) , ( i q , x q u er y )) , (103)
let S N ⊆ [ N ] S_N \subseteq[N] S N ⊆ [ N ] denote the supported instruction indices and U N : = [ N ] ∖ S N U_N := [N] \setminus S_N U N := [ N ] ∖ S N the unsupported ones, and set
m N : = ∣ S N ∣ , r N : = ∣ U N ∣ = N − m N . (104) m_N := |S_N|,\qquad r_N := |U_N| = N - m_N. \tag*{(104)} m N := ∣ S N ∣ , r N := ∣ U N ∣ = N − m N . (104)
All supported slots display the same instruction, which we denote i S i_S i S ; the unsupported slots display arbitrary distinct values { i n } n ∈ U N \{i_n\}_{n\in U_N} { i n } n ∈ U N .
Assumption D.24 (Shared supported template, non-shared corruptions). The m N m_N m N supported occurrences are renderings of one template chosen once for the whole prompt and therefore contribute a single supported factor p ( i S ∣ t ) p(i_S \mid t) p ( i S ∣ t ) , exactly as in Assumption D.13; when m N = 0 m_N = 0 m N = 0 , this factor is omitted. Each unsupported occurrence is treated as a separate instruction slot. On supported values the corresponding slot likelihoods factor independently of the demonstration pairs given the task; at unsupported realized values their log-likelihood ratios are defined by the fixed continuation chains introduced below.
This is the natural mixture of the shared reading for repeated supported copies and the independent-observation reading for distinct corruptions. The latter do not have literal Bayes likelihood ratios at zero-probability values; the object below is therefore a continuation-induced posterior, denoted by p ˉ \bar{p} p ˉ .
For t ≠ t ∗ t \ne t^* t = t ∗ define
ℓ t , n : = log p ( x n , y n ∣ t ) p ( x n , y n ∣ t ∗ ) , r t ( i ) : = log p ( i ∣ t ) p ( i ∣ t ∗ ) (105) \ell_{t,n} := \log\frac{p(x_n,y_n \mid t)}{p(x_n,y_n \mid t^*)},\qquad r_t(i) := \log\frac{p(i \mid t)}{p(i \mid t^*)} \tag*{(105)} ℓ t , n := log p ( x n , y n ∣ t ∗ ) p ( x n , y n ∣ t ) , r t ( i ) := log p ( i ∣ t ∗ ) p ( i ∣ t ) (105)
for supported i i i . For every unsupported slot n ∈ U N n \in U_N n ∈ U N , let r ˉ t , n ( i n ) \bar{r}_{t,n}(i_n) r ˉ t , n ( i n ) be the endpoint value of its specified finite analytic continuation chain. For the query define
λ ˉ t , q : = log ( π ( t ) π ( t ∗ ) p ( x q u e r y ∣ t ) p ( x q u e r y ∣ t ∗ ) ) + { r t ( i q ) , i q supported , r ˉ t , q ( i q ) , i q unsupported , (106) \bar{\lambda}_{t,q} := \log\left(\frac{\pi(t)}{\pi(t^*)}\frac{p(x_{\mathrm{query}} \mid t)}{p(x_{\mathrm{query}} \mid t^*)}\right) +
\begin{cases}
r_t(i_q), & i_q\ \text{supported},\\
\bar{r}_{t,q}(i_q), & i_q\ \text{unsupported},
\end{cases} \tag*{(106)} λ ˉ t , q := log ( π ( t ∗ ) π ( t ) p ( x query ∣ t ∗ ) p ( x query ∣ t ) ) + { r t ( i q ) , r ˉ t , q ( i q ) , i q supported , i q unsupported , (106)
where r ˉ t , q \bar{r}_{t,q} r ˉ t , q is obtained from a fixed finite chain in the unsupported case. We then define the continuation-induced odds by
log R ˉ t , N : = λ ˉ t , q + ∑ n = 1 N ℓ t , n + r t ( i S ) + ∑ n ∈ U N r ˉ t , n ( i n ) , (107) \log\bar{R}_{t,N} := \bar{\lambda}_{t,q} + \sum_{n=1}^{N} \ell_{t,n} + r_t(i_S) + \sum_{n\in U_N} \bar{r}_{t,n}(i_n), \tag*{(107)} log R ˉ t , N := λ ˉ t , q + n = 1 ∑ N ℓ t , n + r t ( i S ) + n ∈ U N ∑ r ˉ t , n ( i n ) , (107)
and normalize them as
p ˉ ( t ∗ ∣ z N ) : = 1 1 + ∑ s ≠ t ∗ R ˉ s , N , p ˉ ( t ∣ z N ) : = R ˉ t , N 1 + ∑ s ≠ t ∗ R ˉ s , N . (108) \bar{p}(t^* \mid z_N) := \frac{1}{1+\sum_{s\ne t^*}\bar{R}_{s,N}},\qquad\bar{p}(t \mid z_N) := \frac{\bar{R}_{t,N}}{1+\sum_{s\ne t^*}\bar{R}_{s,N}}. \tag*{(108)} p ˉ ( t ∗ ∣ z N ) := 1 + ∑ s = t ∗ R ˉ s , N 1 , p ˉ ( t ∣ z N ) := 1 + ∑ s = t ∗ R ˉ s , N R ˉ t , N . (108)
The induced posterior predictive is
p ˉ ( y q u e r y ∣ z N ) : = ∑ t ∈ T p ( y q u e r y ∣ x q u e r y , t ) p ˉ ( t ∣ z N ) . (109) \bar{p}(y_{\mathrm{query}} \mid z_N) := \sum_{t\in\mathcal{T}} p(y_{\mathrm{query}} \mid x_{\mathrm{query}},t)\,\bar{p}(t \mid z_N). \tag*{(109)} p ˉ ( y query ∣ z N ) := t ∈ T ∑ p ( y query ∣ x query , t ) p ˉ ( t ∣ z N ) . (109)
The shared supported contribution r t ( i S ) r_t(i_S) r t ( i S ) is a single N N N -independent term; each distinct unsupported occurrence contributes one continued log-ratio.
Assumption D.25 (Supported template and local continuation of the corruptions). For every t ≠ t ∗ t \ne t^* t = t ∗ the shared supported template satisfies
r t ( i S ) ≤ 0 , (110) r_t(i_S) \le0, \tag*{(110)} r t ( i S ) ≤ 0 , (110) and for every n ∈ U N n \in U_N n ∈ U N there exist a supported anchor i n 0 i_n^0 i n 0 with r t ( i n 0 ) ≤ 0 r_t(i_n^0) \le0 r t ( i n 0 ) ≤ 0 and a finite chain of analytic continuations connecting i n 0 i_n^0 i n 0 to i n i_n i n , in the sense of Assumption D.15 .
Condition (110) is the anchor condition (80) applied to the shared template, and is a single inequality rather than one per slot. The natural choice of anchor for a misspelling is the uncorrupted rendering itself, i n 0 = i S i_n^0 = i_S i n 0 = i S , in which case the continuation distance ∥ i n − i S ∥ 2 \lVert i_n - i_S\rVert_2 ∥ i n − i S ∥ 2 is the size of the typo.
Lemma D.26 (Continuation cost of a corrupted occurrence). Under Assumption D.25, let Ω t , n \Omega_{t,n} Ω t , n denote the cumulative continuation cost (89) of the chain reaching i n i_n i n for the task pair ( t , t ∗ ) (t,t^*) ( t , t ∗ ) , and set
Ω n : = max t ≠ t ∗ Ω t , n < ∞ . (111) \Omega_n := \max_{t\ne t^*}\Omega_{t,n}<\infty. \tag*{(111)} Ω n := t = t ∗ max Ω t , n < ∞. (111) Then, for every n ∈ U N n\in U_N n ∈ U N and every t ≠ t ∗ t\ne t^* t = t ∗ ,
r ˉ t , n ( i n ) ≤ Ω t , n ≤ Ω n . (112) \bar r_{t,n}(i_n)\leq\Omega_{t,n}\leq\Omega_n. \tag*{(112)} r ˉ t , n ( i n ) ≤ Ω t , n ≤ Ω n . (112) Proof. Apply Lemma D.19 to the chain connecting i n 0 i_n^0 i n 0 to i n i_n i n : it gives r ˉ t , n ( i n ) ≤ γ 0 + Ω t , n \bar r_{t,n}(i_n)\leq\gamma_0+\Omega_{t,n} r ˉ t , n ( i n ) ≤ γ 0 + Ω t , n with γ 0 = max t ≠ t ∗ r t ( i n 0 ) ≤ 0 \gamma_0=\max_{t\ne t^*}r_t(i_n^0)\leq0 γ 0 = max t = t ∗ r t ( i n 0 ) ≤ 0 by Assumption D.25. Finiteness of Ω t , n \Omega_{t,n} Ω t , n is Lemma D.16(a), and the maximum over the finite set T \mathcal{T} T is finite. □
The following theorem separates the task information carried by the examples from the continuation burden created by the corrupted occurrences.
Theorem D.27 (Formal mixed supported/unsupported instruction bound). Let Assumptions D.24 and D.25 hold. Suppose that, almost surely for all sufficiently large N N N , there is a sequence a N ≥ 0 a_N\geq0 a N ≥ 0 such that simultaneously for all t ≠ t ∗ t\ne t^* t = t ∗ ,
∑ n = 1 N ℓ t , n ≤ − a N . (113) \sum_{n=1}^{N}\ell_{t,n}\leq-a_N. \tag*{(113)} n = 1 ∑ N ℓ t , n ≤ − a N . (113) Then, almost surely for all sufficiently large N N N ,
p ˉ ( t ∣ z N ) p ˉ ( t ∗ ∣ z N ) ≤ e λ ˉ t , q exp ( − a N + ∑ n ∈ U N Ω n ) , t ≠ t ∗ , (114) \frac{\bar p(t\mid z_N)}{\bar p(t^*\mid z_N)}
\leq e^{\bar\lambda_{t,q}}\exp\left(-a_N+\sum_{n\in U_N}\Omega_n\right),
\qquad t\ne t^*, \tag*{(114)} p ˉ ( t ∗ ∣ z N ) p ˉ ( t ∣ z N ) ≤ e λ ˉ t , q exp ( − a N + n ∈ U N ∑ Ω n ) , t = t ∗ , (114) and consequently, with β q : = ( ∣ T ∣ − 1 ) max t ≠ t ∗ e λ ˉ t , q \beta_q:=(|\mathcal{T}|-1)\max_{t\ne t^*}e^{\bar\lambda_{t,q}} β q := ( ∣ T ∣ − 1 ) max t = t ∗ e λ ˉ t , q ,
∣ p ˉ ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β q exp ( − a N + ∑ n ∈ U N Ω n ) . (115) \left|\bar p(y_{\mathrm{query}}\mid z_N)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|
\leq\beta_q\exp\left(-a_N+\sum_{n\in U_N}\Omega_n\right). \tag*{(115)} ∣ p ˉ ( y query ∣ z N ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β q exp ( − a N + n ∈ U N ∑ Ω n ) . (115) For the actual pretrained model,
∣ M ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β q exp ( − a N + ∑ n ∈ U N Ω n ) + ε M ( z N ) , (116) \left|M(y_{\mathrm{query}}\mid z_N)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|
\leq\beta_q\exp\left(-a_N+\sum_{n\in U_N}\Omega_n\right)+\varepsilon_M(z_N), \tag*{(116)} ∣ M ( y query ∣ z N ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β q exp ( − a N + n ∈ U N ∑ Ω n ) + ε M ( z N ) , (116) where ε M ( z N ) \varepsilon_M(z_N) ε M ( z N ) is the pathwise transport error in (32) . In particular, continued posterior predictive convergence follows whenever
a N − ∑ n ∈ U N Ω n ⟶ + ∞ . (117) a_N-\sum_{n\in U_N}\Omega_n\longrightarrow+\infty. \tag*{(117)} a N − n ∈ U N ∑ Ω n ⟶ + ∞. (117) Proof. From (107) , (113) , (110) and Lemma D.26,
log p ˉ ( t ∣ z N ) p ˉ ( t ∗ ∣ z N ) ≤ λ ˉ t , q − a N + r t ( i S ) ⏟ ≤ 0 + ∑ n ∈ U N Ω n ≤ λ ˉ t , q − a N + ∑ n ∈ U N Ω n , \log\frac{\bar p(t\mid z_N)}{\bar p(t^*\mid z_N)}
\leq\bar\lambda_{t,q}-a_N+\underbrace{r_t(i_S)}_{\leq0}+\sum_{n\in U_N}\Omega_n
\leq\bar\lambda_{t,q}-a_N+\sum_{n\in U_N}\Omega_n, log p ˉ ( t ∗ ∣ z N ) p ˉ ( t ∣ z N ) ≤ λ ˉ t , q − a N + ≤ 0 r t ( i S ) + n ∈ U N ∑ Ω n ≤ λ ˉ t , q − a N + n ∈ U N ∑ Ω n , which is (114) . Since p ˉ ( t ∗ ∣ z N ) ≤ 1 \bar p(t^*\mid z_N)\leq1 p ˉ ( t ∗ ∣ z N ) ≤ 1 , we have p ˉ ( t ∣ z N ) ≤ p ˉ ( t ∣ z N ) / p ˉ ( t ∗ ∣ z N ) \bar p(t\mid z_N)\leq\bar p(t\mid z_N)/\bar p(t^*\mid z_N) p ˉ ( t ∣ z N ) ≤ p ˉ ( t ∣ z N ) / p ˉ ( t ∗ ∣ z N ) ; summing over the ∣ T ∣ − 1 |\mathcal{T}|-1 ∣ T ∣ − 1 competing tasks bounds the continued posterior mass outside t ∗ t^* t ∗ , and (115) follows by repeating the calculation of (67) with p ˉ \bar p p ˉ in place of p p p . The triangle inequality and Lemma D.1 then give (116) . □
Remark D.28 (Consistency with Assumption D.13). Under Assumption D.24 the m N m_N m N supported occurrences contribute the single term r t ( i S ) r_t(i_S) r t ( i S ) of (107) , so Lemma D.11 applies to them with an N N N -independent constant. Only the continued corrupted-slot contributions accumulate, and they do so at the rate ∑ n ∈ U N Ω n \sum_{n\in U_N}\Omega_n ∑ n ∈ U N Ω n rather than at rate N N N . Setting U N = ∅ U_N=\varnothing U N = ∅ recovers the shared-supported case of Theorem D.12, and setting S N = ∅ S_N=\varnothing S N = ∅ with a single repeated corruption recovers Theorem D.20.
We now specialize Theorem D.27 to the setting used in the main text: the surface instruction may be unsupported, but its associated pair ( x n , y n ) (x_n,y_n) ( x n , y n ) is still generated by the true task and remains informative. In this case Lemma D.10 gives a N = α N a_N=\alpha N a N = α N directly.
Corollary D.29 (Evidence-preserving typos). Under the hypotheses of Theorem D.27 , suppose ∑ n = 1 N ℓ t , n ≤ − α N \sum_{n=1}^{N}\ell_{t,n}\leq-\alpha N ∑ n = 1 N ℓ t , n ≤ − α N almost surely eventually, uniformly over t ≠ t ∗ t\ne t^* t = t ∗ . Then
∣ p ˉ ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β q exp ( − α N + ∑ n ∈ U N Ω n ) . (118) \left|\bar{p}(y_{\mathrm{query}}\mid z_N)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|\leq\beta_q\exp\left(-\alpha N+\sum_{n\in U_N}\Omega_n\right). \tag*{(118)} ∣ p ˉ ( y query ∣ z N ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β q exp ( − α N + n ∈ U N ∑ Ω n ) . (118) so convergence holds whenever
lim sup N → ∞ 1 N ∑ n ∈ U N Ω n < α . (119) \limsup_{N\to\infty}\frac{1}{N}\sum_{n\in U_N}\Omega_n<\alpha. \tag*{(119)} N → ∞ lim sup N 1 n ∈ U N ∑ Ω n < α . (119) If the corruption costs are uniformly bounded, Ω n ≤ Ω \Omega_n\leq\Omega Ω n ≤ Ω , then
∣ p ˉ ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β q exp ( − N [ α − ( 1 − m N N ) Ω ] ) . (120) \left|\bar{p}(y_{\mathrm{query}}\mid z_N)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|\leq\beta_q\exp\left(-N\left[\alpha-\left(1-\frac{m_N}{N}\right)\Omega\right]\right). \tag*{(120)} ∣ p ˉ ( y query ∣ z N ) − p ( y query ∣ x query , t ∗ ) ∣ ≤ β q exp ( − N [ α − ( 1 − N m N ) Ω ] ) . (120)
Proof. Apply Theorem D.27 with a N = α N a_N=\alpha N a N = α N , and use ∑ n ∈ U N Ω n ≤ r N Ω = ( N − m N ) Ω \sum_{n\in U_N}\Omega_n\leq r_N\Omega=(N-m_N)\Omega ∑ n ∈ U N Ω n ≤ r N Ω = ( N − m N ) Ω for the last display. □
Varying unsupported instructions
Format 6 is the special case of the preceding framework in which every per-demonstration instruction is a distinct unsupported realization. Thus S N = ∅ S_N=\varnothing S N = ∅ , U N = [ N ] U_N=[N] U N = [ N ] , and the prompt is
z N ( 6 ) : = ( ( ı ~ 1 , x 1 , y 1 ) , … , ( ı ~ N , x N , y N ) , ( ı ~ q , x q u e r y ) ) . (121) z_N^{(6)}:=((\tilde{\imath}_1,x_1,y_1),\ldots,(\tilde{\imath}_N,x_N,y_N),(\tilde{\imath}_q,x_{\mathrm{query}})). \tag*{(121)} z N ( 6 ) := (( ~ 1 , x 1 , y 1 ) , … , ( ~ N , x N , y N ) , ( ~ q , x query )) . (121)
For each n n n , let r ˉ t , n ( ı ~ n ) \bar{r}_{t,n}(\tilde{\imath}_n) r ˉ t , n ( ~ n ) be the endpoint value supplied by a fixed finite analytic-continuation chain from a supported anchor, and absorb the single query-instruction continuation into λ ˉ t , q \bar{\lambda}_{t,q} λ ˉ t , q . The continuation-induced odds therefore satisfy the exact identity
log p ˉ ( t ∣ z N ( 6 ) ) p ˉ ( t ∗ ∣ z N ( 6 ) ) = λ ˉ t , q + ∑ n = 1 N ℓ t , n + ∑ n = 1 N r ˉ t , n ( ı ~ n ) , t ≠ t ∗ . (122) \log\frac{\bar{p}(t\mid z_N^{(6)})}{\bar{p}(t^*\mid z_N^{(6)})}=\bar{\lambda}_{t,q}+\sum_{n=1}^{N}\ell_{t,n}+\sum_{n=1}^{N}\bar{r}_{t,n}(\tilde{\imath}_n),\qquad t\ne t^*. \tag*{(122)} log p ˉ ( t ∗ ∣ z N ( 6 ) ) p ˉ ( t ∣ z N ( 6 ) ) = λ ˉ t , q + n = 1 ∑ N ℓ t , n + n = 1 ∑ N r ˉ t , n ( ~ n ) , t = t ∗ . (122)
Unlike format 4, the continuation burden is paid once for every distinct instruction realization and can therefore grow linearly with N N N .
Corollary D.31 (Conditional bound for format 6). Suppose that the demonstration pairs remain informative, so that almost surely, for all sufficiently large N N N and all t ≠ t ∗ t\ne t^* t = t ∗ ,
∑ n = 1 N ℓ t , n ≤ − α N , (123) \sum_{n=1}^{N}\ell_{t,n}\leq-\alpha N, \tag*{(123)} n = 1 ∑ N ℓ t , n ≤ − α N , (123)
and suppose every unsupported instruction admits a finite continuation chain with cost Ω n \Omega_n Ω n as in Lemma D.26 . Then
∣ p ˉ ( y q u e r y ∣ z N ( 6 ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ≤ β q exp ( − α N + ∑ n = 1 N Ω n ) . (124) \left|\bar{p}(y_{\mathrm{query}} \mid z_N^{(6)})-p(y_{\mathrm{query}} \mid x_{\mathrm{query}},t^*)\right| \le\beta_q \exp\left(-\alpha N+\sum_{n=1}^{N}\Omega_n\right). \tag*{(124)} p ˉ ( y query ∣ z N ( 6 ) ) − p ( y query ∣ x query , t ∗ ) ≤ β q exp ( − α N + n = 1 ∑ N Ω n ) . (124)
Consequently, convergence is guaranteed if
α N − ∑ n = 1 N Ω n ⟶ + ∞ , (125) \alpha N-\sum_{n=1}^{N}\Omega_n \longrightarrow+\infty, \tag*{(125)} α N − n = 1 ∑ N Ω n ⟶ + ∞ , (125)
or, more concretely, if
lim sup N → ∞ 1 N ∑ n = 1 N Ω n < α . (126) \limsup_{N\to\infty}\frac{1}{N}\sum_{n=1}^{N}\Omega_n<\alpha. \tag*{(126)} N → ∞ lim sup N 1 n = 1 ∑ N Ω n < α . (126)
The finite-chain assumption alone only gives Ω n < ∞ \Omega_n<\infty Ω n < ∞ separately for each n n n and does not imply either condition.
Proof. Set S N = ∅ S_N=\varnothing S N = ∅ and U N = [ N ] U_N=[N] U N = [ N ] in Theorem D.27 , and take a N = α N a_N=\alpha N a N = α N using (123) . This gives (124) . Conditions (125) and (126) make its right-hand side tend to zero. □
The preceding corollary gives only a sufficient condition. The next result shows that this limitation is intrinsic: under the assumptions used so far, the continued instruction evidence may cancel or dominate the demonstration evidence.
Theorem D.32 (No unconditional convergence guarantee for format 6). Assume the query contribution λ ˉ t , q \bar{\lambda}_{t,q} λ ˉ t , q is fixed, the demonstrations are i.i.d. from P X , Y ∣ t ∗ P_{X,Y\mid t^*} P X , Y ∣ t ∗ , and the log-likelihood ratios are integrable. For every t ≠ t ∗ t\ne t^* t = t ∗ define the average continued instruction pressure
c t , N : = 1 N ∑ n = 1 N r ˉ t , n ( ı ~ n ) . (127) c_{t,N}:=\frac{1}{N}\sum_{n=1}^{N}\bar{r}_{t,n}(\tilde{\imath}_n). \tag*{(127)} c t , N := N 1 n = 1 ∑ N r ˉ t , n ( ~ n ) . (127) Then almost surely
1 N log p ˉ ( t ∣ z N ( 6 ) ) p ˉ ( t ∗ ∣ z N ( 6 ) ) = c t , N − κ t + o ( 1 ) , t ≠ t ∗ , (128) \frac{1}{N}\log\frac{\bar{p}(t\mid z_N^{(6)})}{\bar{p}(t^*\mid z_N^{(6)})}=c_{t,N}-\kappa_t+o(1),\qquad t\ne t^*, \tag*{(128)} N 1 log p ˉ ( t ∗ ∣ z N ( 6 ) ) p ˉ ( t ∣ z N ( 6 ) ) = c t , N − κ t + o ( 1 ) , t = t ∗ , (128) where κ t = KL ( P X , Y ∣ t ∗ ∥ P X , Y ∣ t ) > 0 \kappa_t=\operatorname{KL}(P_{X,Y\mid t^*}\Vert P_{X,Y\mid t})>0 κ t = KL ( P X , Y ∣ t ∗ ∥ P X , Y ∣ t ) > 0 . Consequently:
(i) if
lim sup N → ∞ c t , N < κ t for every t ≠ t ∗ , (129) \limsup_{N\to\infty}c_{t,N}<\kappa_t\qquad\text{for every }t\ne t^*, \tag*{(129)} N → ∞ lim sup c t , N < κ t for every t = t ∗ , (129) then p ˉ ( t ∗ ∣ z N ( 6 ) ) → 1 \bar{p}(t^*\mid z_N^{(6)})\to1 p ˉ ( t ∗ ∣ z N ( 6 ) ) → 1 exponentially fast and the continued posterior predictive converges to p ( y q u e r y ∣ x q u e r y , t ∗ ) p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*) p ( y query ∣ x query , t ∗ ) ;
(ii) if T = { t ∗ , t † } \mathcal{T}=\{t^*,t^\dagger\} T = { t ∗ , t † } and
lim inf N → ∞ c t † , N > κ t † , (130) \liminf_{N\to\infty}c_{t^\dagger,N}>\kappa_{t^\dagger}, \tag*{(130)} N → ∞ lim inf c t † , N > κ t † , (130) then
p ˉ ( t ∗ ∣ z N ( 6 ) ) ⟶ 0 , p ˉ ( t † ∣ z N ( 6 ) ) ⟶ 1. (131) \bar{p}(t^*\mid z_N^{(6)})\longrightarrow0,\qquad\bar{p}(t^\dagger\mid z_N^{(6)})\longrightarrow1. \tag*{(131)} p ˉ ( t ∗ ∣ z N ( 6 ) ) ⟶ 0 , p ˉ ( t † ∣ z N ( 6 ) ) ⟶ 1. (131) Hence, whenever p ( y q u e r y ∣ x q u e r y , t † ) ≠ p ( y q u e r y ∣ x q u e r y , t ∗ ) p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^\dagger)\ne p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*) p ( y query ∣ x query , t † ) = p ( y query ∣ x query , t ∗ ) ,
∣ p ˉ ( y q u e r y ∣ z N ( 6 ) ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ ⟶ ∣ p ( y q u e r y ∣ x q u e r y , t † ) − p ( y q u e r y ∣ x q u e r y , t ∗ ) ∣ > 0. (132) \left|\bar{p}(y_{\mathrm{query}}\mid z_N^{(6)})-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|\longrightarrow\left|p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^\dagger)-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^*)\right|>0. \tag*{(132)} p ˉ ( y query ∣ z N ( 6 ) ) − p ( y query ∣ x query , t ∗ ) ⟶ p ( y query ∣ x query , t † ) − p ( y query ∣ x query , t ∗ ) > 0. (132) Therefore the finite analytic-continuation assumptions by themselves do not imply convergence for format 6.
Proof. Divide (122) by N N N . Since the query term is fixed, λ ˉ t , q / N → 0 \bar{\lambda}_{t,q}/N \to0 λ ˉ t , q / N → 0 . By the strong law of large numbers,
1 N ∑ n = 1 N ℓ t , n → a . s . − κ t . (133) \frac{1}{N}\sum_{n=1}^{N}\ell_{t,n} \xrightarrow{\mathrm{a.s.}} -\kappa_t. \tag*{(133)} N 1 n = 1 ∑ N ℓ t , n a.s. − κ t . (133)
Together with (127) , this proves (128) .
Under (129) , finiteness of T \mathcal{T} T gives a δ > 0 \delta> 0 δ > 0 such that, almost surely for all sufficiently large N N N ,
log p ˉ ( t ∣ z N ( 6 ) ) p ˉ ( t ∗ ∣ z N ( 6 ) ) ≤ − δ N for all t ≠ t ∗ . (134) \log\frac{\bar{p}(t \mid z_N^{(6)})}{\bar{p}(t^* \mid z_N^{(6)})} \le-\delta N \qquad\text{for all } t \ne t^*. \tag*{(134)} log p ˉ ( t ∗ ∣ z N ( 6 ) ) p ˉ ( t ∣ z N ( 6 ) ) ≤ − δ N for all t = t ∗ . (134)
Summing the odds over the finite competing-task set yields 1 − p ˉ ( t ∗ ∣ z N ( 6 ) ) = O ( e − δ N ) 1-\bar{p}(t^* \mid z_N^{(6)})=O(e^{-\delta N}) 1 − p ˉ ( t ∗ ∣ z N ( 6 ) ) = O ( e − δ N ) , and the posterior-predictive claim follows exactly as in (67) .
Under (130) , (128) gives
log p ˉ ( t † ∣ z N ( 6 ) ) p ˉ ( t ∗ ∣ z N ( 6 ) ) ⟶ + ∞ (135) \log\frac{\bar{p}(t^\dagger\mid z_N^{(6)})}{\bar{p}(t^* \mid z_N^{(6)})} \longrightarrow+\infty \tag*{(135)} log p ˉ ( t ∗ ∣ z N ( 6 ) ) p ˉ ( t † ∣ z N ( 6 ) ) ⟶ + ∞ (135)
linearly in N N N . In the two-task case this implies (131) ; substituting it into the definition (109) gives (132) . □
Proof of sec:cot
This appendix formalizes the two claims in § 4.1 : the Bayesian latent-task reference for direct ICL cannot assign posterior mass to a zero-prior target task, whereas its fixed-length, explicitly composed reference can converge by invoking pretraining-supported subtasks. This is not an impossibility result for an arbitrary Transformer. A guarantee for extracted step prompts does not by itself imply the same guarantee for a full-context autoregressive rollout. We quantify this distinction by a rollout discrepancy, prove the actual-model bound without exact rollout compatibility, and recover exact compatibility as a special case. The reference-rollout claim is stated separately.
Reduction of an autoregressive CoT rollout to supported steps
Fix an integer K K K that does not depend on N N N . For every k = 0 , … , K − 1 k=0,\ldots,K-1 k = 0 , … , K − 1 , fix a dependency set J k ⊆ { 0 , … , k } J_k \subseteq\{0,\ldots,k\} J k ⊆ { 0 , … , k } with k ∈ J k k \in J_k k ∈ J k , independent of N N N , and a fixed history map enc k : S ∣ J k ∣ → S \operatorname{enc}_k:\mathcal{S}^{|J_k|}\to\mathcal{S} enc k : S ∣ J k ∣ → S of the selected states into one step input. For any trajectory, write
h ( k ) : = enc k ( ( x ( j ) ) j ∈ J k ) , x ( k + 1 ) : = f t k ( h ( k ) ) , t 0 , … , t K − 1 ∈ T . (136) h^{(k)} := \operatorname{enc}_k\left((x^{(j)})_{j\in J_k}\right), \qquad x^{(k+1)} := f_{t_k}(h^{(k)}), \qquad t_0,\ldots,t_{K-1}\in\mathcal{T}. \tag*{(136)} h ( k ) := enc k ( ( x ( j ) ) j ∈ J k ) , x ( k + 1 ) := f t k ( h ( k ) ) , t 0 , … , t K − 1 ∈ T . (136)
This finite-history recursion defines the target map by f t † ( x ) : = x ( K ) f^\dagger_t(x):=x^{(K)} f t † ( x ) := x ( K ) when x ( 0 ) = x x^{(0)}=x x ( 0 ) = x . The special case J k = { k } J_k=\{k\} J k = { k } recovers ordinary composition of one-step maps. For a query x q u e r y x_{\mathrm{query}} x query , define its correct intermediate states and histories recursively by
x q ( 0 ) : = x q u e r y , h q ( k ) : = enc k ( ( x q ( j ) ) j ∈ J k ) , x q ( k + 1 ) : = f t k ( h q ( k ) ) , k = 0 , … , K − 1. (137) x_q^{(0)} := x_{\mathrm{query}}, \qquad h_q^{(k)} := \operatorname{enc}_k\left((x_q^{(j)})_{j\in J_k}\right), \qquad x_q^{(k+1)} := f_{t_k}(h_q^{(k)}), \qquad k=0,\ldots,K-1. \tag*{(137)} x q ( 0 ) := x query , h q ( k ) := enc k ( ( x q ( j ) ) j ∈ J k ) , x q ( k + 1 ) := f t k ( h q ( k ) ) , k = 0 , … , K − 1. (137)
Thus x q ( K ) = f t † ( x q u e r y ) x_q^{(K)}=f^\dagger_t(x_{\mathrm{query}}) x q ( K ) = f t † ( x query ) . Let H ( k ) \mathcal{H}^{(k)} H ( k ) denote the set of encoded histories h q ( k ) h_q^{(k)} h q ( k ) reachable at step k k k as the initial query ranges over the finite state space S \mathcal{S} S .
The full prompt z N z_N z N contains the demonstration trajectories ( x n ( 0 ) , … , x n ( K ) ) (x_n^{(0)},\ldots,x_n^{(K)}) ( x n ( 0 ) , … , x n ( K ) ) . For each step k k k , let
h n ( k ) : = enc k ( ( x n ( j ) ) j ∈ J k ) , z N ( k ) ( h ) : = ( i ( k ) , ( h n ( k ) , x n ( k + 1 ) ) n = 1 N , h ) (138) h_n^{(k)} := \operatorname{enc}_k\left((x_n^{(j)})_{j\in J_k}\right), \qquad z_N^{(k)}(h) := \left(i^{(k)},(h_n^{(k)},x_n^{(k+1)})_{n=1}^{N},h\right) \tag*{(138)} h n ( k ) := enc k ( ( x n ( j ) ) j ∈ J k ) , z N ( k ) ( h ) := ( i ( k ) , ( h n ( k ) , x n ( k + 1 ) ) n = 1 N , h ) (138)
be the corresponding single-step ICL prompt.
Assumption E.1 (Supported extracted-step domains). Each i ( k ) i^{(k)} i ( k ) is supported for t k t_k t k , and every correct step prompt in (138) lies in the corresponding pretraining-supported step domain. Any use of a padded model evaluation must separately justify the local-model bound below and retain its padding discrepancy.
Assumption E.2 (Exact finite-history rollout compatibility for a specified predictor). For a specified predictor R R R (either p p p or M M M ), every k = 0 , … , K − 1 k=0,\ldots,K-1 k = 0 , … , K − 1 , every output u u u , and every correct prefix x q ( 0 : k ) x_q^{(0:k)} x q ( 0 : k ) , the next-token-block conditional of the full CoT rollout agrees with the conditional induced by the extracted single-step prompt:
R ( x ^ q ( k + 1 ) = u ∣ z N , x ^ q ( 0 : k ) = x q ( 0 : k ) ) = R ( u ∣ z N ( k ) ( h q ( k ) ) ) . (139) R\left(\hat{x}_q^{(k+1)}=u \mid z_N,\hat{x}_q^{(0:k)}=x_q^{(0:k)}\right)=R\left(u\mid z_N^{(k)}(h_q^{(k)})\right). \tag*{(139)} R ( x ^ q ( k + 1 ) = u ∣ z N , x ^ q ( 0 : k ) = x q ( 0 : k ) ) = R ( u ∣ z N ( k ) ( h q ( k ) ) ) . (139)
An assertion for R = p R=p R = p is distinct from one for R = M R=M R = M ; neither implies the other. Conditionals are understood as generation kernels evaluated at the specified prefix, including prefixes with zero rollout probability.
Assumption E.2 is a sufficient condition for transferring a step-prompt bound with no compatibility correction. It is a substantive finite-history conditional-sufficiency assumption: on the correct prefix, the history–next-state demonstrations and the selected history h q ( k ) h_q^{(k)} h q ( k ) contain all information from the full CoT prompt that is relevant to the next step. The states selected by J k J_k J k are not being treated as padding. Rather, under the deterministic subtask model the correct process satisfies
p ( x q ( k + 1 ) ∣ x q ( 0 : k ) , t k ) = p ( x q ( k + 1 ) ∣ h q ( k ) , t k ) , (140) p\left(x_q^{(k+1)}\mid x_q^{(0:k)},t_k\right)=p\left(x_q^{(k+1)}\mid h_q^{(k)},t_k\right), \tag*{(140)} p ( x q ( k + 1 ) ∣ x q ( 0 : k ) , t k ) = p ( x q ( k + 1 ) ∣ h q ( k ) , t k ) , (140)
because x q ( k + 1 ) = f t k ( h q ( k ) ) x_q^{(k+1)}=f_{t_k}(h_q^{(k)}) x q ( k + 1 ) = f t k ( h q ( k ) ) . Thus the selected finite history, rather than the current state alone, summarizes the correct query prefix for the target transition. Equation (139) requires the model conditional to respect the same sufficiency property. This does not follow from virtual padding: padding accounts only for the future query positions that have not yet been generated. States outside J k J_k J k may still appear in the full prompt, but the assumption requires that they provide no additional information about the next step once h q ( k ) h_q^{(k)} h q ( k ) is given. If this finite-history sufficiency fails, then the equality in (139) can fail and an additional approximation error must be included in the final bound. In particular, deterministic sufficiency for the target transition does not establish sufficiency for a learned model’s conditional. Enlarging J k J_k J k to include the complete query history also does not remove dependence on other demonstrations, absolute positions, or prompt formatting; the enlarged step domain must still satisfy supportedness and identifiability.
Quantifying the failure of exact compatibility. Write u k ∗ : = f t k ( h q ( k ) ) u_k^*:=f_{t_k}(h_q^{(k)}) u k ∗ := f t k ( h q ( k ) ) and define
Q k , N M ( u ∣ x q ( 0 : k ) ) : = M ( x ^ q ( k + 1 ) = u ∣ z N , x ^ q ( 0 : k ) = x q ( 0 : k ) ) , (141) Q_{k,N}^{M}(u\mid x_q^{(0:k)}):=M\left(\hat{x}_q^{(k+1)}=u\mid z_N,\hat{x}_q^{(0:k)}=x_q^{(0:k)}\right), \tag*{(141)} Q k , N M ( u ∣ x q ( 0 : k ) ) := M ( x ^ q ( k + 1 ) = u ∣ z N , x ^ q ( 0 : k ) = x q ( 0 : k ) ) , (141)
P k , N M ( u ∣ h q ( k ) ) : = M ( u ∣ z N ( k ) ( h q ( k ) ) ) . (142) P_{k,N}^{M}(u\mid h_q^{(k)}):=M\left(u\mid z_N^{(k)}(h_q^{(k)})\right). \tag*{(142)} P k , N M ( u ∣ h q ( k ) ) := M ( u ∣ z N ( k ) ( h q ( k ) ) ) . (142)
Both kernels are distributions over the same next-state token blocks, including a failure outcome for malformed or nonterminating outputs if needed. The full kernel includes all actually retained context. For fixed demonstrations, take suprema over correct query prefixes and define
ρ k , N : = sup x q ( 0 : k ) ∥ Q k , N M ( ⋅ ∣ x q ( 0 : k ) ) − P k , N M ( ⋅ ∣ h q ( k ) ) ∥ T V , (143) \rho_{k,N}:=\sup_{x_q^{(0:k)}}\left\|Q_{k,N}^{M}(\cdot\mid x_q^{(0:k)})-P_{k,N}^{M}(\cdot\mid h_q^{(k)})\right\|_{\mathrm{TV}}, \tag*{(143)} ρ k , N := x q ( 0 : k ) sup Q k , N M ( ⋅ ∣ x q ( 0 : k ) ) − P k , N M ( ⋅ ∣ h q ( k ) ) TV , (143)
ρ k , N + : = sup x q ( 0 : k ) [ P k , N M ( u k ∗ ∣ h q ( k ) ) − Q k , N M ( u k ∗ ∣ x q ( 0 : k ) ) ] + . (144) \rho_{k,N}^{+}:=\sup_{x_q^{(0:k)}}\left[P_{k,N}^{M}(u_k^*\mid h_q^{(k)})-Q_{k,N}^{M}(u_k^*\mid x_q^{(0:k)})\right]_+. \tag*{(144)} ρ k , N + := x q ( 0 : k ) sup [ P k , N M ( u k ∗ ∣ h q ( k ) ) − Q k , N M ( u k ∗ ∣ x q ( 0 : k ) ) ] + . (144)
Here [ a ] + = max { a , 0 } [a]_+=\max\{a,0\} [ a ] + = max { a , 0 } and ∥ P − Q ∥ T V = 1 2 ∑ u ∣ P ( u ) − Q ( u ) ∣ \lVert P-Q\rVert_{\mathrm{TV}}=\frac{1}{2}\sum_u\lvert P(u)-Q(u)\rvert ∥ P − Q ∥ TV = 2 1 ∑ u ∣ P ( u ) − Q ( u )∣ . In particular 0 ≤ ρ k , N + ≤ ρ k , N ≤ 1 0\leq\rho_{k,N}^{+}\leq\rho_{k,N}\leq1 0 ≤ ρ k , N + ≤ ρ k , N ≤ 1 . The one-sided discrepancy measures only a decrease in correct-transition probability caused by the full context. Additional context that improves that probability does not incur a penalty. Neither quantity is assumed small by definition. The actual-model theorem below uses ρ k , N + \rho_{k,N}^{+} ρ k , N + and therefore also holds with the more conservative ρ k , N \rho_{k,N} ρ k , N .
Virtual padding for the step-k k k length mismatch. At step k k k , the current input may be shorter than its pretraining reference for two closely related reasons. First, the suffix x q ( k + 1 ) , … , x q ( K ) x_q^{(k+1)},\ldots,x_q^{(K)} x q ( k + 1 ) , … , x q ( K ) has not yet been generated. Second, the user’s prompt may simply be shorter than the longer contexts commonly observed during pretraining. These are the same dimensional-alignment problem: in both cases we choose the pretraining reference length M k M_k M k and pad the shorter step prompt to that length. The only difference is where the padding tokens are inserted. Let
Pad M k ( z N ( k ) ( h ) ) (145) \operatorname{Pad}_{M_k}\left(z_N^{(k)}(h)\right) \tag*{(145)} Pad M k ( z N ( k ) ( h ) ) (145)
denote the resulting prompt after inserting m k m_k m k virtual padding tokens while leaving all informative tokens unchanged and preserving their relative order. The padded step prompt and the pretraining prompt then belong to the same fixed-length ambient space.
When the padding occupies only future positions, a causal mask gives those positions zero attention weight, so the padding has no effect on the current conditional. For padding inserted elsewhere to match a longer pretraining context, or in an abstract fixed-length attention model without an exact mask, the effect is only approximately zero. Lemma F.2 controls the attention perturbation by the aggregate padding mass, of order
m k e − Δ a t t , k , (146) m_k e^{-\Delta_{\mathrm{att},k}}, \tag*{(146)} m k e − Δ att , k , (146)
where Δ a t t , k \Delta_{\mathrm{att},k} Δ att , k is the attention-logit gap between an informative token and the most competitive padding token. Thus a large amount of weakly masked padding can still be non-negligible.
To record this approximation explicitly, define the padding discrepancy
δ k , p a d ( N ) : = sup h , u ∣ M ( u ∣ z N ( k ) ( h ) ) − M ( u ∣ Pad M k ( z N ( k ) ( h ) ) ) ∣ . (147) \delta_{k,\mathrm{pad}}(N) := \sup_{h,u}\left|\mathcal{M}\left(u \mid z_N^{(k)}(h)\right)-\mathcal{M}\left(u \mid\operatorname{Pad}_{M_k}\left(z_N^{(k)}(h)\right)\right)\right|. \tag*{(147)} δ k , pad ( N ) := h , u sup M ( u ∣ z N ( k ) ( h ) ) − M ( u ∣ Pad M k ( z N ( k ) ( h ) ) ) . (147)
Under exact causal masking this discrepancy is zero for padding placed only in future positions. Under the attention-stability conditions of Appendix § 14 .§ 3 , it is small when the induced network-output perturbation is small. Combining the padded reference bound with the model-transport inequality in § 3 , the corresponding unpadded model error is at most
sup h ∈ H ( k ) [ 1 − M ( f t k ( h ) ∣ z N ( k ) ( h ) ) ] ≤ β k e − α k N + ε M ( k ) ( N ) + δ k , p a d ( N ) . (148) \sup_{h\in\mathcal{H}^{(k)}}\left[1-\mathcal{M}\left(f_{t_k}(h)\mid z_N^{(k)}(h)\right)\right]\le\beta_k e^{-\alpha_k N}+\varepsilon_{\mathcal{M}}^{(k)}(N)+\delta_{k,\mathrm{pad}}(N). \tag*{(148)} h ∈ H ( k ) sup [ 1 − M ( f t k ( h ) ∣ z N ( k ) ( h ) ) ] ≤ β k e − α k N + ε M ( k ) ( N ) + δ k , pad ( N ) . (148)
Here ε M ( k ) ( N ) \varepsilon_{\mathcal{M}}^{(k)}(N) ε M ( k ) ( N ) is an upper bound, uniform over h ∈ H ( k ) h\in\mathcal{H}^{(k)} h ∈ H ( k ) , on the transport certificates in (32) for the step-k k k prompts being compared with the reference. For supported unpadded step prompts one may take r 0 r_0 r 0 ; otherwise the supremum over the finitely many correct-history paths suffices at fixed N N N . The reference bound must apply to the same local or padded prompts used in this comparison; inserting padding alone does not establish supportedness or reference invariance. A smaller residual-variation certificate from Proposition D.9 may be used when its hypotheses hold uniformly over these histories.
Including the one-sided rollout discrepancy, the sequential argument below gives
final CoT error ≤ ∑ k = 0 K − 1 ( β k e − α k N + ε M ( k ) ( N ) + δ k , p a d ( N ) + ρ k , N + ) . (149) \operatorname{final\ CoT\ error}\le\sum_{k=0}^{K-1}\left(\beta_k e^{-\alpha_k N}+\varepsilon_{\mathcal{M}}^{(k)}(N)+\delta_{k,\mathrm{pad}}(N)+\rho_{k,N}^{+}\right). \tag*{(149)} final CoT error ≤ k = 0 ∑ K − 1 ( β k e − α k N + ε M ( k ) ( N ) + δ k , pad ( N ) + ρ k , N + ) . (149)
The formal theorem below retains both corrections explicitly. Padding controls the local prompt versus its padded version; it does not control the full prompt versus the extracted local prompt.
For deterministic subtasks, define the step error by
ϵ k ( N ) : = sup h ∈ H ( k ) [ 1 − p ( f t k ( h ) ∣ z N ( k ) ( h ) ) ] , (150) \epsilon_k(N):=\sup_{h\in\mathcal{H}^{(k)}}\left[1-p\left(f_{t_k}(h)\mid z_N^{(k)}(h)\right)\right], \tag*{(150)} ϵ k ( N ) := h ∈ H ( k ) sup [ 1 − p ( f t k ( h ) ∣ z N ( k ) ( h ) ) ] , (150)
where H ( k ) \mathcal{H}^{(k)} H ( k ) is the set of encoded histories reachable at step k k k under the correct recursion. The desired next state for history h h h is explicitly f t k ( h ) f_{t_k}(h) f t k ( h ) .
Lemma E.3 (Uniform supported-step convergence ). Suppose that, for every k k k , the extracted pairs ( h n ( k ) , x n ( k + 1 ) ) n = 1 N \left(h_n^{(k)},x_n^{(k+1)}\right)_{n=1}^{N} ( h n ( k ) , x n ( k + 1 ) ) n = 1 N follow the supported single-step generation mechanism and satisfy Assumption 3.1 for task t k t_k t k . Then there are constants α k , β k > 0 \alpha_k,\beta_k>0 α k , β k > 0 , independent of N N N , such that, almost surely for all sufficiently large N N N ,
ϵ k ( N ) ≤ β k e − α k N . (151) \epsilon_k(N)\le\beta_k e^{-\alpha_k N}. \tag*{(151)} ϵ k ( N ) ≤ β k e − α k N . (151)
Proof. Fix k k k and h ∈ H ( k ) h\in\mathcal{H}^{(k)} h ∈ H ( k ) . Theorem 3.2 , applied to the supported step task t k t_k t k and the correct output f t k ( h ) f_{t_k}(h) f t k ( h ) , gives constants α k , h , β k , h > 0 \alpha_{k,h},\beta_{k,h}>0 α k , h , β k , h > 0 and an almost-sure finite threshold N k , h N_{k,h} N k , h such that
1 − p ( f t k ( h ) ∣ z N ( k ) ( h ) ) ≤ β k , h e − α k , h N 1-p\left(f_{t_k}(h)\mid z_N^{(k)}(h)\right)\le\beta_{k,h}e^{-\alpha_{k,h}N} 1 − p ( f t k ( h ) ∣ z N ( k ) ( h ) ) ≤ β k , h e − α k , h N
for all N ≥ N k , h N \ge N_{k,h} N ≥ N k , h . Because J k J_k J k is finite and each state has bounded length over the finite vocabulary V \mathcal{V} V , the reachable encoded-history set H ( k ) \mathcal{H}^{(k)} H ( k ) is finite. We may therefore take
α k : = min h ∈ H ( k ) α k , h > 0 , β k : = max h ∈ H ( k ) β k , h < ∞ , N k : = max h ∈ H ( k ) N k , h < ∞ . \alpha_k := \min_{h\in\mathcal{H}^{(k)}} \alpha_{k,h} > 0,\qquad\beta_k := \max_{h\in\mathcal{H}^{(k)}} \beta_{k,h} < \infty,\qquad N_k := \max_{h\in\mathcal{H}^{(k)}} N_{k,h} < \infty. α k := h ∈ H ( k ) min α k , h > 0 , β k := h ∈ H ( k ) max β k , h < ∞ , N k := h ∈ H ( k ) max N k , h < ∞.
The intersection of the finitely many probability-one events also has probability one. Taking the supremum over h ∈ H ( k ) h\in\mathcal{H}^{(k)} h ∈ H ( k ) proves (151) for all N ≥ N k N \ge N_k N ≥ N k . □ \square □
Theorem E.4 (Model bound with rollout discrepancy). Let the fixed-length finite-history decomposition (136) , Assumption E.1, and the hypotheses of Lemma E.3 hold, with the local-model bound (148) . If the theoretical rollout additionally satisfies Assumption E.2 for R = p R=p R = p , then almost surely for all sufficiently large N N N and every output y y y ,
∣ p ( y ∣ z N ) − p ( y ∣ x q u e r y , t † ) ∣ ≤ ∑ k = 0 K − 1 β k e − α k N ≤ K β max e − α min N , (152) \left|p(y\mid z_N)-p(y\mid x_{\mathrm{query}},t^\dagger)\right| \le\sum_{k=0}^{K-1}\beta_k e^{-\alpha_k N} \le K\beta_{\max}e^{-\alpha_{\min}N}, \tag*{(152)} p ( y ∣ z N ) − p ( y ∣ x query , t † ) ≤ k = 0 ∑ K − 1 β k e − α k N ≤ K β m a x e − α m i n N , (152) where β max : = max k β k \beta_{\max}:=\max_k\beta_k β m a x := max k β k and α min : = min k α k > 0 \alpha_{\min}:=\min_k\alpha_k>0 α m i n := min k α k > 0 . For the actual pretrained model, define
η k ( N ) : = β k e − α k N + ε M ( k ) ( N ) + δ k , p a d ( N ) + ρ k , N + . (153) \eta_k(N):=\beta_k e^{-\alpha_k N}+\varepsilon_M^{(k)}(N)+\delta_{k,\mathrm{pad}}(N)+\rho_{k,N}^{+}. \tag*{(153)} η k ( N ) := β k e − α k N + ε M ( k ) ( N ) + δ k , pad ( N ) + ρ k , N + . (153) Without requiring exact compatibility for either M M M or a theoretical full rollout, the actual full autoregressive rollout satisfies, almost surely for all sufficiently large N N N and every y y y ,
∣ M ( y ∣ z N ) − p ( y ∣ x q u e r y , t † ) ∣ ≤ 1 − ∏ k = 0 K − 1 ( 1 − min { 1 , η k ( N ) } ) (154) \left|M(y\mid z_N)-p(y\mid x_{\mathrm{query}},t^\dagger)\right|
\le1-\prod_{k=0}^{K-1}\left(1-\min\{1,\eta_k(N)\}\right) \tag*{(154)} M ( y ∣ z N ) − p ( y ∣ x query , t † ) ≤ 1 − k = 0 ∏ K − 1 ( 1 − min { 1 , η k ( N )} ) (154) ≤ min { 1 , ∑ k = 0 K − 1 η k ( N ) } . \le\min\left\{1,\sum_{k=0}^{K-1}\eta_k(N)\right\}. ≤ min { 1 , k = 0 ∑ K − 1 η k ( N ) } .
Proof. For the reference claim, assume compatibility only for R = p R=p R = p . Let x ^ q ( 0 ) : = x q u e r y \widehat{x}_q^{(0)}:=x_{\mathrm{query}} x q ( 0 ) := x query and let x ^ q ( 1 ) , … , x ^ q ( K ) \widehat{x}_q^{(1)},\ldots,\widehat{x}_q^{(K)} x q ( 1 ) , … , x q ( K ) be the states generated by the full autoregressive CoT rollout. For each k k k , let h ^ q ( k ) : = enc k ( ( x ^ q ( j ) ) j ∈ J k ) \widehat{h}_q^{(k)}:=\operatorname{enc}_k((\widehat{x}_q^{(j)})_{j\in J_k}) h q ( k ) := enc k (( x q ( j ) ) j ∈ J k ) . Define
E k : = { x ^ q ( k + 1 ) = f t k ( h ^ q ( k ) ) } , F k : = ⋂ j = 0 k E j , (155) E_k:=\left\{\widehat{x}_q^{(k+1)}=f_{t_k}\left(\widehat{h}_q^{(k)}\right)\right\},\qquad F_k:=\bigcap_{j=0}^{k}E_j, \tag*{(155)} E k := { x q ( k + 1 ) = f t k ( h q ( k ) ) } , F k := j = 0 ⋂ k E j , (155)
with F − 1 F_{-1} F − 1 equal to the whole sample space.
On F k − 1 F_{k-1} F k − 1 , induction using (137) gives x ^ q ( j ) = x q ( j ) \widehat{x}_q^{(j)}=x_q^{(j)} x q ( j ) = x q ( j ) for all j ≤ k j\le k j ≤ k , and in particular h ^ q ( k ) = h q ( k ) ∈ H ( k ) \widehat{h}_q^{(k)}=h_q^{(k)}\in\mathcal{H}^{(k)} h q ( k ) = h q ( k ) ∈ H ( k ) . Assumption E.2 and (150) therefore imply
P ( E k c ∣ F k − 1 , z N ) = 1 − p ( f t k ( h q ( k ) ) ∣ z N ( k ) ( h q ( k ) ) ) (156) \mathbb{P}\left(E_k^{c}\mid F_{k-1},z_N\right)
=1-p\left(f_{t_k}\left(h_q^{(k)}\right)\mid z_N^{(k)}\left(h_q^{(k)}\right)\right) \tag*{(156)} P ( E k c ∣ F k − 1 , z N ) = 1 − p ( f t k ( h q ( k ) ) ∣ z N ( k ) ( h q ( k ) ) ) (156)
≤ ϵ k ( N ) . (157) \le\epsilon_k(N). \tag*{(157)} ≤ ϵ k ( N ) . (157)
No independence between the rollout steps is required. The conditional statement is used only when P ( F k − 1 ∣ z N ) > 0 \mathbb{P}(F_{k-1}\mid z_N)>0 P ( F k − 1 ∣ z N ) > 0 ; otherwise the joint event E k c ∩ F k − 1 E_k^c\cap F_{k-1} E k c ∩ F k − 1 has zero probability and the recursion below is immediate. Using F k c = F k − 1 c ∪ ( E k c ∩ F k − 1 ) F_k^c=F_{k-1}^c\cup(E_k^c\cap F_{k-1}) F k c = F k − 1 c ∪ ( E k c ∩ F k − 1 ) and the disjointness of this union,
P ( F k c ∣ z N ) ≤ P ( F k − 1 c ∣ z N ) + P ( E k c ∣ F k − 1 , z N ) P ( F k − 1 ∣ z N ) (158) \mathbb{P}(F_k^c\mid z_N)\le\mathbb{P}(F_{k-1}^c\mid z_N)+\mathbb{P}(E_k^c\mid F_{k-1},z_N)\mathbb{P}(F_{k-1}\mid z_N) \tag*{(158)} P ( F k c ∣ z N ) ≤ P ( F k − 1 c ∣ z N ) + P ( E k c ∣ F k − 1 , z N ) P ( F k − 1 ∣ z N ) (158)
≤ P ( F k − 1 c ∣ z N ) + ϵ k ( N ) . (159) \le\mathbb{P}(F_{k-1}^c\mid z_N)+\epsilon_k(N). \tag*{(159)} ≤ P ( F k − 1 c ∣ z N ) + ϵ k ( N ) . (159)
Iterating this inequality yields
P ( F K − 1 c ∣ z N ) ≤ ∑ k = 0 K − 1 ϵ k ( N ) . (160) \mathbb{P}(F_{K-1}^{c}\mid z_N)\le\sum_{k=0}^{K-1}\epsilon_k(N). \tag*{(160)} P ( F K − 1 c ∣ z N ) ≤ k = 0 ∑ K − 1 ϵ k ( N ) . (160)
On F K − 1 F_{K-1} F K − 1 , every step is correct and
x ^ q ( K ) = f t † ( x q u e r y ) . \hat{x}^{(K)}_q=f_{t^\dagger}(x_{\mathrm{query}}). x ^ q ( K ) = f t † ( x query ) .
Consequently,
p ( f t † ( x q u e r y ) ∣ z N ) ≥ 1 − ∑ k = 0 K − 1 ϵ k ( N ) . (161) p(f_{t^\dagger}(x_{\mathrm{query}})\mid z_N)\ge1-\sum_{k=0}^{K-1}\epsilon_k(N). \tag*{(161)} p ( f t † ( x query ) ∣ z N ) ≥ 1 − k = 0 ∑ K − 1 ϵ k ( N ) . (161)
Because the target-task conditional is deterministic, p ( y ∣ x q u e r y , t † ) = 1 { y = f t † ( x q u e r y ) } p(y\mid x_{\mathrm{query}},t^\dagger)=\mathbb{1}\{y=f_{t^\dagger}(x_{\mathrm{query}})\} p ( y ∣ x query , t † ) = 1 { y = f t † ( x query )} . If y = f t † ( x q u e r y ) y=f_{t^\dagger}(x_{\mathrm{query}}) y = f t † ( x query ) , equation (161) bounds 1 − p ( y ∣ z N ) 1-p(y\mid z_N) 1 − p ( y ∣ z N ) . If y ≠ f t † ( x q u e r y ) y\ne f_{t^\dagger}(x_{\mathrm{query}}) y = f t † ( x query ) , then p ( y ∣ z N ) p(y\mid z_N) p ( y ∣ z N ) is at most the failure probability in (160) . Thus, in both cases,
∣ p ( y ∣ z N ) − p ( y ∣ x q u e r y , t † ) ∣ ≤ ∑ k = 0 K − 1 ϵ k ( N ) . (162) \left|p(y\mid z_N)-p(y\mid x_{\mathrm{query}},t^\dagger)\right|\le\sum_{k=0}^{K-1}\epsilon_k(N). \tag*{(162)} p ( y ∣ z N ) − p ( y ∣ x query , t † ) ≤ k = 0 ∑ K − 1 ϵ k ( N ) . (162)
Finally apply Lemma E.3 and use the finiteness of K K K :
∑ k = 0 K − 1 ϵ k ( N ) ≤ ∑ k = 0 K − 1 β k e − α k N ≤ K β max e − α min N . \sum_{k=0}^{K-1}\epsilon_k(N)\le\sum_{k=0}^{K-1}\beta_k e^{-\alpha_kN}\le K\beta_{\max}e^{-\alpha_{\min}N}. k = 0 ∑ K − 1 ϵ k ( N ) ≤ k = 0 ∑ K − 1 β k e − α k N ≤ K β m a x e − α m i n N .
This proves (152) .
For the model-level claim, start independently with states sampled from M M M . On a correct prefix, (144) gives
1 − Q k , N M ( u k ∗ ∣ x q ( 0 : k ) ) ≤ 1 − P k , N M ( u k ∗ ∣ h q ( k ) ) + ρ k , N + . 1-Q_{k,N}^{M}(u_k^*\mid x_q^{(0:k)})\le1-P_{k,N}^{M}(u_k^*\mid h_q^{(k)})+\rho_{k,N}^{+}. 1 − Q k , N M ( u k ∗ ∣ x q ( 0 : k ) ) ≤ 1 − P k , N M ( u k ∗ ∣ h q ( k ) ) + ρ k , N + .
Together with (148) , this implies, whenever P M ( F k − 1 ∣ z N ) > 0 \mathbb{P}_M(F_{k-1}\mid z_N)>0 P M ( F k − 1 ∣ z N ) > 0 ,
P M ( E k c ∣ F k − 1 , z N ) ≤ min { 1 , η k ( N ) } . \mathbb{P}_M(E_k^c\mid F_{k-1},z_N)\le\min\{1,\eta_k(N)\}. P M ( E k c ∣ F k − 1 , z N ) ≤ min { 1 , η k ( N )} .
Set a k = min { 1 , η k ( N ) } a_k=\min\{1,\eta_k(N)\} a k = min { 1 , η k ( N )} . Multiplication of the conditional success bounds yields P M ( F K − 1 ∣ z N ) ≥ ∏ k ( 1 − a k ) \mathbb{P}_M(F_{K-1}\mid z_N)\ge\prod_k(1-a_k) P M ( F K − 1 ∣ z N ) ≥ ∏ k ( 1 − a k ) . If a preceding success event has probability zero, the recursive inequality P M ( F k ∣ z N ) ≥ ( 1 − a k ) P M ( F k − 1 ∣ z N ) \mathbb{P}_M(F_k\mid z_N)\ge(1-a_k)\mathbb{P}_M(F_{k-1}\mid z_N) P M ( F k ∣ z N ) ≥ ( 1 − a k ) P M ( F k − 1 ∣ z N ) remains valid without conditioning on a null event. The elementary inequality 1 − ∏ k ( 1 − a k ) ≤ ∑ k a k 1-\prod_k(1-a_k)\le\sum_k a_k 1 − ∏ k ( 1 − a k ) ≤ ∑ k a k gives the additive bound. On F K − 1 F_{K-1} F K − 1 the final output is f t † ( x q u e r y ) f_{t^\dagger}(x_{\mathrm{query}}) f t † ( x query ) , so the same two-case argument for y = f t † ( x q u e r y ) y=f_{t^\dagger}(x_{\mathrm{query}}) y = f t † ( x query ) and y ≠ f t † ( x q u e r y ) y\ne f_{t^\dagger}(x_{\mathrm{query}}) y = f t † ( x query ) proves (154) . □
Corollary E.5 (Execution through explicit step calls). Suppose an executor constructs z N ( k ) ( h ) z_N^{(k)}(h) z N ( k ) ( h ) at each step and calls the same model with exactly that context, position convention, and decoding settings. It passes the generated state to the next step and retains no additional model-visible history or cache. Its kernel equals P k , N M P_{k,N}^{M} P k , N M by construction, so ρ k , N = ρ k , N + = 0 \rho_{k,N}=\rho_{k,N}^{+}=0 ρ k , N = ρ k , N + = 0 . Consequently its final error is at most
min { 1 , ∑ k = 0 K − 1 [ β k e − α k N + ε M ( k ) ( N ) + δ k , p a d ( N ) ] } . \min\left\{1,\sum_{k=0}^{K-1}\left[\beta_k e^{-\alpha_kN}+\varepsilon_M^{(k)}(N)+\delta_{k,\mathrm{pad}}(N)\right]\right\}. min { 1 , k = 0 ∑ K − 1 [ β k e − α k N + ε M ( k ) ( N ) + δ k , pad ( N ) ] } .
Proof. The executor’s transition kernel is precisely the model kernel on the constructed step prompt, including on every correct prefix. Substitute zero discrepancy into Theorem E.4. □
Scope of the main-text bound. The bound displayed in Theorem 4.2 is the specialization with zero one-sided rollout discrepancy and zero padding discrepancy (or with such corrections explicitly included in the step error). This is guaranteed by the step-call protocol above with supported, unpadded prompts, or follows under exact model compatibility and exact padding invariance. For ordinary full-context autoregressive execution, the general bound is (154) ; supported subtasks alone do not remove its rollout correction. An exactly composed theoretical reference may be defined using the local reference kernels, but this construction is not an identity with an arbitrary full-context reference predictor.
For fixed K K K , vanishing reference errors and vanishing model, padding, and one-sided rollout corrections imply convergence of the actual final output. Uniformly small nonzero corrections give an error floor bounded by their sum. No independence between steps is needed. Errors following an incorrect prefix need not be controlled: the proof already charges the first failure, and later recovery can only reduce the final error relative to this bound.
Assessing compatibility empirically. On matched demonstrations and a teacher-forced correct prefix, evaluate both the full-context kernel and the extracted-step kernel. In finite-state experiments their total variation and correct-state probability difference can be computed directly; in large-output experiments the latter tests the one-sided quantity without estimating the whole distribution. Varying history, unrelated demonstrations, positions, and formatting while keeping the local transition fixed probes the discarded information. A comparison with explicit step calls separates execution-protocol effects from subtask learning. Measurements on sampled prefixes are diagnostics, not supremum certificates. The inequality between final error and the sum of full-rollout conditional errors holds even without compatibility, so verifying that inequality alone does not validate the local-to-full transfer.
Growing horizons and comparison of supplied plans
The sequential argument is nonasymptotic in the number of steps: for each finite K K K it bounds final error whenever the corresponding local error bounds hold. Fixed K K K was used to obtain a common almost-sure onset of those bounds by taking a maximum over finitely many steps and histories. To allow K = K ( N ) K = K(N) K = K ( N ) , one must control the local bounds simultaneously along the growing plan; pointwise convergence for each fixed step does not suffice.
For each N N N , let Π N \Pi_N Π N be a supplied, valid finite-history plan with K N : = K ( N ) ≥ 1 K_N := K(N) \ge1 K N := K ( N ) ≥ 1 steps, realizing a deterministic target f N † f_N^\dagger f N † . The target, operations, and history maps may depend on N N N . The extracted prompts must satisfy the same supported-domain conditions as above, and the actual executor must be specified. Define its conditional final error by
e N : = 1 − M Π N ( f N † ( x q u e r y ) ∣ z N ) . e_N := 1 - M_{\Pi_N}\left(f_N^\dagger(x_{\mathrm{query}}) \mid z_N\right). e N := 1 − M Π N ( f N † ( x query ) ∣ z N ) .
Here M Π N M_{\Pi_N} M Π N is the final-output law of that executor, which may use full-context rollout or explicit step calls. All claims below are uniform over queries if their local premises are uniform over the associated correct prefixes. Since the target is deterministic, e N e_N e N also bounds every output-probability coordinate difference from the target law.
Corollary E.6 (Growing-horizon execution). Suppose that for each N N N , on an event G N G_N G N in the demonstration randomness, the following local bounds hold simultaneously for every k < K N k < K_N k < K N and every correct history of Π N \Pi_N Π N :
1 − P k , N M ( u k ∗ ∣ h q ( k ) ) ≤ β k , N e − α k , N N + ε M , N ( k ) + δ k , p a d ( N ) , (163) 1 - P^{M}_{k,N}\left(u_k^* \mid h_q^{(k)}\right) \le\beta_{k,N}e^{-\alpha_{k,N}N} + \varepsilon_{M,N}^{(k)} + \delta_{k,\mathrm{pad}}(N), \tag*{(163)} 1 − P k , N M ( u k ∗ ∣ h q ( k ) ) ≤ β k , N e − α k , N N + ε M , N ( k ) + δ k , pad ( N ) , (163) where α k , N , β k , N > 0 \alpha_{k,N}, \beta_{k,N} > 0 α k , N , β k , N > 0 . With the one-sided rollout discrepancy from (144) , put
c k , N : = ε M , N ( k ) + δ k , p a d ( N ) + ρ k , N + , (164) c_{k,N} := \varepsilon_{M,N}^{(k)} + \delta_{k,\mathrm{pad}}(N) + \rho_{k,N}^{+}, \tag*{(164)} c k , N := ε M , N ( k ) + δ k , pad ( N ) + ρ k , N + , (164) a k , N : = min { 1 , β k , N e − α k , N N + c k , N } , (165) a_{k,N} := \min\left\{1,\beta_{k,N}e^{-\alpha_{k,N}N} + c_{k,N}\right\}, \tag*{(165)} a k , N := min { 1 , β k , N e − α k , N N + c k , N } , (165) a N : = min k < K N α k , N , b N : = max k < K N β k , N , C N : = ∑ k < K N c k , N . (166) a_N := \min_{k<K_N}\alpha_{k,N}, \qquad b_N := \max_{k<K_N}\beta_{k,N}, \qquad C_N := \sum_{k<K_N} c_{k,N}. \tag*{(166)} a N := k < K N min α k , N , b N := k < K N max β k , N , C N := k < K N ∑ c k , N . (166) Then on G N G_N G N ,
e N ≤ 1 − ∏ k = 0 K N − 1 ( 1 − a k , N ) ≤ min { 1 , K N b N e − a N N + C N } . (167) e_N \le1-\prod_{k=0}^{K_N-1}(1-a_{k,N}) \le\min\left\{1,K_Nb_Ne^{-a_NN}+C_N\right\}. \tag*{(167)} e N ≤ 1 − k = 0 ∏ K N − 1 ( 1 − a k , N ) ≤ min { 1 , K N b N e − a N N + C N } . (167)
In particular, sufficient conditions for e N → 0 e_N \to0 e N → 0 on sample paths on which G N G_N G N holds eventually are
a N N − log K N − log b N ⟶ + ∞ , C N ⟶ 0. (168) a_N N - \log K_N - \log b_N \longrightarrow+\infty,\qquad C_N \longrightarrow0. \tag*{(168)} a N N − log K N − log b N ⟶ + ∞ , C N ⟶ 0. (168)
If c k , N ≤ c ˉ N c_{k,N} \le\bar c_N c k , N ≤ c ˉ N uniformly, the second condition is implied by K N c ˉ N → 0 K_N\bar c_N \to0 K N c ˉ N → 0 .
Proof. On G N G_N G N , the definition of ρ k , N + \rho^+_{k,N} ρ k , N + transfers (163) to a conditional failure bound a k , N a_{k,N} a k , N for the full executor on a correct prefix. The success-event recursion in Theorem E.4 , applied at this particular N N N for K N K_N K N steps, gives the product bound. The union bound and ∑ k < K N β k , N e − α k , N N ≤ K N b N e − a N N \sum_{k<K_N}\beta_{k,N}e^{-\alpha_{k,N}N}\le K_Nb_Ne^{-a_NN} ∑ k < K N β k , N e − α k , N N ≤ K N b N e − a N N give the second inequality. Under (168) its right-hand side tends to zero. No independence between steps is used. □
When are the simultaneous premises justified? An almost-sure version requires that G N G_N G N hold eventually on a common probability-one event. This does not follow merely from almost-sure convergence for every fixed k k k : step-dependent onset thresholds may grow faster than N N N along newly introduced steps. One sufficient construction is a fixed finite library of supported local prompt problems, with a fixed finite collection of admissible encoded histories. For each library problem, use length-N N N prefixes of the same underlying infinite demonstration stream, and instantiate steps by reusing those local problems. If each library problem satisfies Lemma E.3 , the minimum rate, maximum prefactor, and maximum onset threshold over the finite library and histories are uniform for any number of repetitions. Explicit step calls with a fixed bank of demonstrations for each library problem provide one such protocol; arbitrary trajectory-extracted demonstration marginals need not have this property. This establishes the simultaneous reference part of the local bound; model transport, padding, and rollout discrepancy still require their own controls. Enlarging history encodings with K N K_N K N , or drawing new datasets at every N N N , is not covered by this finite-library argument without additional estimates.
Alternatively, suppose a finite-sample analysis gives Pr ( G N c ) ≤ δ N \Pr(G_N^c)\le\delta_N Pr ( G N c ) ≤ δ N . Then (167) holds with probability at least 1 − δ N 1-\delta_N 1 − δ N . If its right-hand side is bounded on G N G_N G N by a deterministic B N ∈ [ 0 , 1 ] B_N\in[0,1] B N ∈ [ 0 , 1 ] , then
E [ e N ] ≤ B N + ( 1 − B N ) δ N ≤ B N + δ N . (169) \mathbb{E}[e_N]\le B_N+(1-B_N)\delta_N\le B_N+\delta_N. \tag*{(169)} E [ e N ] ≤ B N + ( 1 − B N ) δ N ≤ B N + δ N . (169)
Indeed, split the expectation over G N G_N G N and its complement and use e N ≤ 1 e_N\le1 e N ≤ 1 . If each of the K N K_N K N step bounds, already uniform over its correct histories, fails with probability at most d N d_N d N , a union bound gives δ N ≤ min { 1 , K N d N } \delta_N\le\min\{1,K_Nd_N\} δ N ≤ min { 1 , K N d N } without independence. A per-history guarantee would require a further union bound or another uniformity argument. When ∑ N δ N < ∞ \sum_N\delta_N<\infty ∑ N δ N < ∞ , the first Borel–Cantelli lemma gives eventual validity almost surely. Together with (168) this recovers almost-sure convergence; δ N → 0 \delta_N\to0 δ N → 0 alone yields the corresponding convergence-in-probability statement when B N → 0 B_N\to0 B N → 0 .
Explicit scaling regimes. Suppose a N ≥ α > 0 a_N\ge\alpha>0 a N ≥ α > 0 and b N ≤ β < ∞ b_N\le\beta<\infty b N ≤ β < ∞ uniformly. For a composed reference, or an ideal executor with zero corrections, log K N = o ( N ) \log K_N=o(N) log K N = o ( N ) is sufficient. More generally, for K N = O ( e γ N ) K_N=O(e^{\gamma N}) K N = O ( e γ N ) the reference contribution vanishes when γ < α \gamma<\alpha γ < α . For actual-model execution the correction sum is equally important:
If K N = O ( N q ) K_N=O(N^q) K N = O ( N q ) and c ˉ N = O ( N − p ) \bar c_N=O(N^{-p}) c ˉ N = O ( N − p ) , with 0 ≤ q < p 0\le q<p 0 ≤ q < p , then e N = O ( N q e − α N + N q − p ) e_N=O(N^qe^{-\alpha N}+N^{q-p}) e N = O ( N q e − α N + N q − p ) on the simultaneous good events.
If K N = O ( e γ N ) K_N=O(e^{\gamma N}) K N = O ( e γ N ) and c ˉ N = O ( e − λ N ) \bar c_N=O(e^{-\lambda N}) c ˉ N = O ( e − λ N ) , then e N = O ( e − ( α − γ ) N + e − ( λ − γ ) N ) e_N=O(e^{-(\alpha-\gamma)N}+e^{-(\lambda-\gamma)N}) e N = O ( e − ( α − γ ) N + e − ( λ − γ ) N ) for 0 ≤ γ < min { α , λ } 0\le\gamma<\min\{\alpha,\lambda\} 0 ≤ γ < min { α , λ } .
A fixed positive upper bound on c ˉ N \bar c_N c ˉ N does not provide a vanishing growing-horizon certificate, even if the reference identification term vanishes. This is a limitation of the guarantee, not a lower bound on every model’s error.
These conclusions require the uniform rates and prefactors just stated. If longer plans introduce less identifiable operations or more difficult query states, the general condition involving a N , b N a_N,b_N a N , b N must be used instead.
The accumulation can be unavoidable. Consider an executor which, conditional on a correct prefix, makes an error with probability q N q_N q N at every step, and whose error state is absorbing with an incorrect final output. Its exact final error is 1 − ( 1 − q N ) K N 1-(1-q_N)^{K_N} 1 − ( 1 − q N ) K N . It tends to zero if and only if K N q N → 0 K_Nq_N\to0 K N q N → 0 ; sufficiency follows from the union bound, and necessity from 1 − ( 1 − q N ) K N ≥ 1 − e − K N q N 1-(1-q_N)^{K_N}\ge1-e^{-K_Nq_N} 1 − ( 1 − q N ) K N ≥ 1 − e − K N q N . Thus constant conditional error cannot support arbitrary horizon growth in general. This example concerns actual conditional failures, not the possibly loose upper certificates c k , N c_{k,N} c k , N .
Demonstration complexity for a requested horizon. For a supplied horizon K K K and tolerance 0 < ϵ < 1 0 < \epsilon< 1 0 < ϵ < 1 , uniform constants α , β \alpha,\beta α , β and a correction bound c ˉ N \bar{c}_N c ˉ N give the sufficient conditions
N ≥ max { 0 , α − 1 log ( 2 K β / ϵ ) } , c ˉ N ≤ ϵ 2 K , (170) N \ge\max\{0,\alpha^{-1}\log(2K\beta/\epsilon)\}, \qquad\bar{c}_N \le\frac{\epsilon}{2K}, \tag*{(170)} N ≥ max { 0 , α − 1 log ( 2 K β / ϵ )} , c ˉ N ≤ 2 K ϵ , (170)
provided the simultaneous local bounds are valid at that N N N . Substitution in (167) gives e N ≤ ϵ e_N \le\epsilon e N ≤ ϵ . Only the identification contribution has logarithmic dependence on K K K ; the required accuracy of the corrections tightens as 1 / K 1/K 1/ K . Moreover, N N N counts demonstrations per step, not total tokens. A full prompt containing N N N trajectories of length K K K generally has length of order N K NK N K for bounded-size states. The asymptotic regimes presume that the required contexts and states remain admissible. Explicit step calls can avoid storing all trajectories in each call, but still incur K K K model invocations.
Comparing plans of different lengths. For supplied plans Π \Pi Π realizing the same target at a given N N N , define the untruncated certificate
S N ( Π ) : = ∑ k < K ( Π ) [ β Π , k , N e − α Π , k , N N + c Π , k , N ] . (171) S_N(\Pi) := \sum_{k<K(\Pi)} [\beta_{\Pi,k,N}e^{-\alpha_{\Pi,k,N}N}+c_{\Pi,k,N}]. \tag*{(171)} S N ( Π ) := k < K ( Π ) ∑ [ β Π , k , N e − α Π , k , N N + c Π , k , N ] . (171)
Each plan has e N ( Π ) ≤ min { 1 , S N ( Π ) } e_N(\Pi) \le\min\{1,S_N(\Pi)\} e N ( Π ) ≤ min { 1 , S N ( Π )} whenever its premises hold. Consequently a longer plan may have a smaller certificate if its steps are more identifiable or have smaller corrections. For example, with zero corrections and homogeneous constants within each of two plans, a longer plan Π ℓ \Pi_\ell Π ℓ has a smaller untruncated certificate than Π s \Pi_s Π s exactly when
α ℓ − α s > 1 N log K ( Π ℓ ) β ℓ K ( Π s ) β s . \alpha_\ell-\alpha_s > \frac{1}{N}\log\frac{K(\Pi_\ell)\beta_\ell}{K(\Pi_s)\beta_s}. α ℓ − α s > N 1 log K ( Π s ) β s K ( Π ℓ ) β ℓ .
This follows by taking logarithms of their positive exponential certificates. It compares guarantees, not actual errors, and does not imply that the shortest plan or the plan with the best bound is always empirically best. Selecting among candidate plans using the same data requires simultaneous validity over the candidates; validity for each fixed plan alone does not justify adaptive selection.
Separation from plan discovery. These results analyze a supplied plan family and do not establish that a model can discover a valid decomposition. To record the missing component, let a planner output Π ^ N \hat{\Pi}_N Π ^ N , and let A N A_N A N be the event that it realizes the intended target using admissible supported steps and satisfies the required execution certificates. If Pr ( A N c ) ≤ ξ N \Pr(A_N^{c}) \le\xi_N Pr ( A N c ) ≤ ξ N and, conditional on the planner output and its data, execution error on A N A_N A N is at most a deterministic B N ∈ [ 0 , 1 ] B_N \in[0,1] B N ∈ [ 0 , 1 ] , then the law of total probability gives
Pr ( final failure ) ≤ ξ N + ( 1 − ξ N ) B N . \Pr(\text{final failure}) \le\xi_N + (1-\xi_N)B_N. Pr ( final failure ) ≤ ξ N + ( 1 − ξ N ) B N .
No independence of planning and execution is needed, but the conditional execution guarantee is essential. Bounding ξ N \xi_N ξ N or designing a planner that makes it small is a separate problem not solved by the composition theorem. The growing-horizon result strengthens execution scaling without assuming that plan discovery follows from support of the component operations.
Formal Justification of the Padding Reduction
This appendix formalizes the fixed-length padding reduction used in two places in the paper. First, the instruction path in § 3.2.1 must compare instructions containing different numbers of tokens in one common Euclidean space. Second, the step-wise CoT analysis in Appendix E sometimes compares a partially generated prompt with a longer pretraining reference. These are instances of the same dimensional-alignment problem, although the padding tokens occupy different positions. We define the common padding operator, quantify its effect on attention, and state precisely what this reduction does and does not establish.
Two alignment problems
The first problem is instruction-length alignment . The path
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (172) E_s = (1-s)E(i_0) + sE(\tilde{i}), \qquad s \in[0,1], \tag*{(172)} E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ [ 0 , 1 ] , (172)
requires E ( i 0 ) E(i_0) E ( i 0 ) and E ( i ~ ) E(\tilde{i}) E ( i ~ ) to belong to the same space, even when i 0 i_0 i 0 and i ~ \tilde{i} i ~ contain different numbers of tokens.
The second problem is rollout-length alignment . At CoT step k k k , the prompt z N ( k ) ( h ) z_N^{(k)}(h) z N ( k ) ( h ) may be shorter than the reference prompt used for the corresponding pretraining-supported subtask. One reason is that the future query states x q ( k + 1 ) , … , x q ( K ) x_q^{(k+1)},\ldots,x_q^{(K)} x q ( k + 1 ) , … , x q ( K ) have not yet been generated; another is that the selected pretraining reference may simply contain a longer context. Virtual padding places both prompts in a common fixed-length ambient space.
Padding creates a common representation by definition. Its effect on the model, however, is small only under additional masking or attention-separation conditions. The results below make this distinction explicit.
Right-padded instruction representations
Recall the token embedding map e : V ∪ { ⟨ p a d ⟩ } → R d e:\mathcal{V}\cup\{\langle\mathrm{pad}\rangle\}\to\mathbb{R}^d e : V ∪ {⟨ pad ⟩} → R d from § 2 , with e ( ⟨ p a d ⟩ ) = 0 e(\langle\mathrm{pad}\rangle)=0 e (⟨ pad ⟩) = 0 . For i = ( v 1 , … , v m ) i=(v_1,\ldots,v_m) i = ( v 1 , … , v m ) with m ≤ L i m\leq L_i m ≤ L i , its right-padded representation is
E ( i ) : = [ e ( v 1 ) , … , e ( v m ) , 0 , … , 0 ] T ∈ R L i × d . (173) E(i) := [e(v_1),\ldots,e(v_m),0,\ldots,0]^{\mathsf{T}} \in\mathbb{R}^{L_i\times d}. \tag*{(173)} E ( i ) := [ e ( v 1 ) , … , e ( v m ) , 0 , … , 0 ] T ∈ R L i × d . (173)
Thus every instruction occupies the same L i L_i L i -position instruction slot.
For a general prompt z z z , let Pad M ( z ) \operatorname{Pad}_M(z) Pad M ( z ) denote its position-preserving extension to length M M M : informative tokens and their relative order are unchanged, and the added positions contain ⟨ p a d ⟩ \langle\mathrm{pad}\rangle ⟨ pad ⟩ . In the applications below, the added positions are either trailing positions, reserved instruction-slot positions, or masked future positions.
Attention stability under padding
We first isolate one attention head at a fixed informative query position. Let I \mathcal{I} I and P \mathcal{P} P index the informative and padding positions, respectively, with ∣ P ∣ = m |\mathcal{P}|=m ∣ P ∣ = m . The following result conditions on the query, keys, and values of the informative positions being aligned between the two computations. This condition is automatic for the first layer under the position convention above and is imposed layer by layer in the network-level result that follows.
Write x i x_i x i for the attention logit and v i v_i v i for the value vector at position i i i , and define
y = 1 Z ∑ i ∈ I e x i v i , y ′ = 1 Z + Z m a t h r m p ( ∑ i ∈ I e x i v i + ∑ p ∈ P e x p v p ) . (174) y=\frac{1}{Z}\sum_{i\in\mathcal{I}}e^{x_i}v_i,\qquad
y'=\frac{1}{Z+Z_{\mathrm{mathrmp}}}\left(\sum_{i\in\mathcal{I}}e^{x_i}v_i+\sum_{p\in\mathcal{P}}e^{x_p}v_p\right). \tag*{(174)} y = Z 1 i ∈ I ∑ e x i v i , y ′ = Z + Z mathrmp 1 i ∈ I ∑ e x i v i + p ∈ P ∑ e x p v p . (174)
where Z : = ∑ i ∈ I e x i Z:=\sum_{i\in\mathcal{I}}e^{x_i} Z := ∑ i ∈ I e x i and Z m a t h r m p : = ∑ p ∈ P e x p Z_{\mathrm{mathrmp}}:=\sum_{p\in\mathcal{P}}e^{x_p} Z mathrmp := ∑ p ∈ P e x p .
Lemma F.2 (Attention stability under padding). Suppose ∥ v i ∥ 2 ≤ C V \lVert v_i\rVert_2\leq C_V ∥ v i ∥ 2 ≤ C V at every informative and padding position. Let
x p , max : = max p ∈ P x p , Δ a t t : = x j − x p , max > 0 (175) x_{p,\max}:=\max_{p\in\mathcal{P}}x_p,\qquad\Delta_{\mathrm{att}}:=x_j-x_{p,\max}>0 \tag*{(175)} x p , m a x := p ∈ P max x p , Δ att := x j − x p , m a x > 0 (175) for some informative position j ∈ I j\in\mathcal{I} j ∈ I . Then
∥ y ′ − y ∥ 2 ≤ 2 C V Z p Z + Z p ≤ 2 C V Z p Z ≤ 2 C V m e − Δ a t t . (176) \lVert y'-y\rVert_2\leq2C_V\frac{Z_p}{Z+Z_p}\leq2C_V\frac{Z_p}{Z}\leq2C_Vme^{-\Delta_{\mathrm{att}}}. \tag*{(176)} ∥ y ′ − y ∥ 2 ≤ 2 C V Z + Z p Z p ≤ 2 C V Z Z p ≤ 2 C V m e − Δ att . (176)
Consequently, for any ε > 0 \varepsilon> 0 ε > 0 , the condition
m ≤ ε e Δ a t t 2 C V (177) m \le\frac{\varepsilon e^{\Delta_{\mathrm{att}}}}{2C_V} \tag*{(177)} m ≤ 2 C V ε e Δ att (177)
is sufficient for ∥ y ′ − y ∥ 2 ≤ ε \lVert y' - y\rVert_2 \le\varepsilon ∥ y ′ − y ∥ 2 ≤ ε .
Proof. Let A : = ∑ i ∈ I e x i v i A := \sum_{i \in I} e^{x_i}v_i A := ∑ i ∈ I e x i v i and B : = ∑ p ∈ P e x p v p B := \sum_{p \in P} e^{x_p}v_p B := ∑ p ∈ P e x p v p . Subtracting the two expressions in (174) gives
y ′ − y = B Z + Z p − Z p A Z ( Z + Z p ) . (178) y' - y = \frac{B}{Z + Z_p} - \frac{Z_p A}{Z(Z + Z_p)}. \tag*{(178)} y ′ − y = Z + Z p B − Z ( Z + Z p ) Z p A . (178)
Because ∥ A ∥ 2 ≤ C V Z \lVert A\rVert_2 \le C_V Z ∥ A ∥ 2 ≤ C V Z and ∥ B ∥ 2 ≤ C V Z p \lVert B\rVert_2 \le C_V Z_p ∥ B ∥ 2 ≤ C V Z p , the triangle inequality yields
∥ y ′ − y ∥ 2 ≤ 2 C V Z p Z + Z p . (179) \lVert y' - y\rVert_2 \le2C_V \frac{Z_p}{Z + Z_p}. \tag*{(179)} ∥ y ′ − y ∥ 2 ≤ 2 C V Z + Z p Z p . (179)
Moreover, Z p ≤ m e x p , max Z_p \le m e^{x_{p,\max}} Z p ≤ m e x p , m a x and Z ≥ e x j Z \ge e^{x_j} Z ≥ e x j , and hence Z p / Z ≤ m e − Δ a t t Z_p/Z \le m e^{-\Delta_{\mathrm{att}}} Z p / Z ≤ m e − Δ att . This proves (176) ; (177) follows immediately. □
Remark F.3 (Exactly masked future positions). In the first rollout-alignment case, padding occupies positions representing future query states. If these positions lie strictly after the current prediction position, the causal mask assigns them attention logit − ∞ -\infty − ∞ . Then Z p = 0 Z_p = 0 Z p = 0 , and the perturbation in Lemma F.2 is exactly zero. The quantitative bound is needed only when padding remains visible to an informative query, as may happen in an instruction slot or when matching a longer visible pretraining context.
From attention perturbations to output log-probabilities
Lemma F.2 concerns a single attention call. To obtain a model-level statement, the perturbation must be propagated through all layers. We state this step in a form that accommodates multi-head attention, output projections, residual connections, normalization, and MLP blocks.
Consider a Transformer with H H H blocks. After aligning the informative positions, let η ( ℓ ) \eta^{(\ell)} η ( ℓ ) be the maximum norm of the hidden-state difference over those positions after block ℓ \ell ℓ . Assume that, on the compact set of hidden states reached by the two forward passes,
block ℓ \ell ℓ is K ℓ K_\ell K ℓ -Lipschitz with respect to perturbations of the informative hidden states; and
with the informative input states held fixed, adding the padding positions changes the informative outputs of block ℓ \ell ℓ by at most ε ℓ \varepsilon_\ell ε ℓ .
Lemma F.2 , combined with the head-concatenation and attention-output projection norms, gives a bound of the form
ε ℓ ≤ C a t t , ℓ m e − Δ a t t , ℓ (180) \varepsilon_\ell\le C_{\mathrm{att},\ell} m e^{-\Delta_{\mathrm{att},\ell}} \tag*{(180)} ε ℓ ≤ C att , ℓ m e − Δ att , ℓ (180)
whenever the value norms and attention gaps are controlled uniformly at that layer.
Proposition F.4 (Transformer-output stability under padding). Suppose the position-alignment condition of Remark F.1 holds, so that η ( 0 ) = 0 \eta^{(0)} = 0 η ( 0 ) = 0 . Under conditions (i)–(ii),
η ( H ) ≤ ∑ ℓ = 0 H − 1 ε ℓ ∏ r = ℓ + 1 H − 1 K r , (181) \eta^{(H)} \le\sum_{\ell=0}^{H-1} \varepsilon_\ell\prod_{r=\ell+1}^{H-1} K_r, \tag*{(181)} η ( H ) ≤ ℓ = 0 ∑ H − 1 ε ℓ r = ℓ + 1 ∏ H − 1 K r , (181)
where an empty product equals one. If the output readout is K o u t K_{\mathrm{out}} K out -Lipschitz from the hidden-state norm to the ℓ ∞ \ell_\infty ℓ ∞ logit norm, then, for every output token u u u ,
∣ log M ( u ∣ Pad M ( z ) ) − log M ( u ∣ z ) ∣ ≤ ε p a d : = 2 K o u t ∑ ℓ = 0 H − 1 ε ℓ ∏ r = ℓ + 1 H − 1 K r . (182) \left|\log M(u \mid\operatorname{Pad}_M(z)) - \log M(u \mid z)\right| \le\varepsilon_{\mathrm{pad}} := 2K_{\mathrm{out}}\sum_{\ell=0}^{H-1} \varepsilon_\ell\prod_{r=\ell+1}^{H-1} K_r. \tag*{(182)} ∣ log M ( u ∣ Pad M ( z )) − log M ( u ∣ z ) ∣ ≤ ε pad := 2 K out ℓ = 0 ∑ H − 1 ε ℓ r = ℓ + 1 ∏ H − 1 K r . (182)
Proof. At block ℓ \ell ℓ , add and subtract the padded block output evaluated at the unpadded informative hidden states. Conditions (i)–(ii) then give
η ( ℓ + 1 ) ≤ K ℓ η ( ℓ ) + ϵ ℓ . (183) \eta^{(\ell+1)} \le K_{\ell}\eta^{(\ell)}+\epsilon_{\ell}. \tag*{(183)} η ( ℓ + 1 ) ≤ K ℓ η ( ℓ ) + ϵ ℓ . (183)
Starting from η ( 0 ) = 0 \eta^{(0)}=0 η ( 0 ) = 0 and iterating this recursion proves (181) . For logit vectors a , b a,b a , b ,
∣ log softmax ( a ) u − log softmax ( b ) u ∣ ≤ 2 ∥ a − b ∥ ∞ , (184) \lvert\log\operatorname{softmax}(a)_{u}-\log\operatorname{softmax}(b)_{u}\rvert\le2\lVert a-b\rVert_{\infty}, \tag*{(184)} ∣ log softmax ( a ) u − log softmax ( b ) u ∣ ≤ 2 ∥ a − b ∥ ∞ , (184)
because the log-sum-exp map is one-Lipschitz in the ℓ ∞ \ell_{\infty} ℓ ∞ norm. Combining this fact with the readout bound proves (182) . □
The products of the block Lipschitz constants in (181) are worst-case amplification factors and need not be tight. The substantive quantity inherited from Lemma F.2 is m e − Δ a t t , ℓ m e^{-\Delta_{\mathrm{att},\ell}} m e − Δ att , ℓ : many weakly masked padding positions can produce a non-negligible perturbation, whereas a sufficiently large attention gap suppresses their aggregate effect exponentially.
Consequence for the instruction path
Corollary F.5 (A common space for instructions). If ∣ i ~ 0 ∣ , ∣ i ~ ∣ ≤ L i \lvert\tilde{i}_{0}\rvert,\lvert\tilde{i}\rvert\le L_{i} ∣ i ~ 0 ∣ , ∣ i ~ ∣ ≤ L i , then
Δ i n s t : = ∥ E ( i ~ ) − E ( i 0 ) ∥ F (185) \Delta_{\mathrm{inst}} := \lVert E(\tilde{i})-E(i_{0})\rVert_{F} \tag*{(185)} Δ inst := ∥ E ( i ~ ) − E ( i 0 ) ∥ F (185) is well defined, and the entire path in (172) lies in R L i × d \mathbb{R}^{L_{i}\times d} R L i × d . The number of padding positions in either endpoint is at most L i L_{i} L i and is therefore independent of the number N N N of demonstrations.
The corollary supplies the dimensional fact required by the finite-continuation condition; it does not itself prove the existence of the analytic continuation assumed there. In the paper’s formulation, the continued instruction likelihood is defined directly on the padded instruction-embedding space, so no extra padding term is required in the continuation bound. If an implementation instead compares padded model evaluations with their unpadded counterparts, Proposition F.4 provides an N N N -independent endpoint perturbation. Such a fixed perturbation changes only the prefactor in Theorem 3.3, not its exponential rate in N N N .
Consequence for the CoT rollout
Recall from Appendix E that the padding discrepancy at step k k k is
δ k , p a d ( N ) : = sup h , u ∣ M ( u ∣ z N ( k ) ( h ) ) − M ( u ∣ Pad M k ( z N ( k ) ( h ) ) ) ∣ . (186) \delta_{k,\mathrm{pad}}(N):=\sup_{h,u}\left\lvert M\left(u\mid z_{N}^{(k)}(h)\right)-M\left(u\mid\operatorname{Pad}_{M_{k}}\left(z_{N}^{(k)}(h)\right)\right)\right\rvert. \tag*{(186)} δ k , pad ( N ) := h , u sup M ( u ∣ z N ( k ) ( h ) ) − M ( u ∣ Pad M k ( z N ( k ) ( h ) ) ) . (186)
Corollary F.6 (Padding contribution to the CoT bound). Suppose Proposition F.4 holds uniformly over the encoded histories h h h and outputs u u u in (186) . Then
δ k , p a d ( N ) ≤ ϵ p a d ( k ) ( N ) , (187) \delta_{k,\mathrm{pad}}(N)\le\epsilon_{\mathrm{pad}}^{(k)}(N), \tag*{(187)} δ k , pad ( N ) ≤ ϵ pad ( k ) ( N ) , (187) where ϵ p a d ( k ) ( N ) \epsilon_{\mathrm{pad}}^{(k)}(N) ϵ pad ( k ) ( N ) is obtained from (182) using the step-k k k padding count and layerwise attention gaps. Consequently, the CoT error obeys
∣ M ( y q u e r y ∣ z N ) − p ( y q u e r y ∣ x q u e r y , t † ) ∣ ≤ ∑ k = 0 K − 1 ( β k e − α k N + ϵ M ( k ) ( N ) + δ k , p a d ( N ) ) . (188) \left\lvert M(y_{\mathrm{query}}\mid z_{N})-p(y_{\mathrm{query}}\mid x_{\mathrm{query}},t^{\dagger})\right\rvert
\le\sum_{k=0}^{K-1}\left(\beta_{k}e^{-\alpha_{k}N}+\epsilon_{M}^{(k)}(N)+\delta_{k,\mathrm{pad}}(N)\right). \tag*{(188)} M ( y query ∣ z N ) − p ( y query ∣ x query , t † ) ≤ k = 0 ∑ K − 1 ( β k e − α k N + ϵ M ( k ) ( N ) + δ k , pad ( N ) ) . (188) If the added positions represent only masked future states, then Remark F.3 gives δ k , p a d ( N ) = 0 \delta_{k,\mathrm{pad}}(N)=0 δ k , pad ( N ) = 0 . If the step prompt is itself supported, then ϵ M ( k ) ( N ) = r 0 \epsilon_{M}^{(k)}(N)=r_{0} ϵ M ( k ) ( N ) = r 0 , and (188) reduces to the bound in Theorem 4.2.
Proof. For probabilities a , b ∈ ( 0 , 1 ] a,b\in(0,1] a , b ∈ ( 0 , 1 ] , the mean-value theorem applied to the exponential function on ( − ∞ , 0 ] (-\infty,0] ( − ∞ , 0 ] gives ∣ a − b ∣ ≤ ∣ log a − log b ∣ \lvert a-b\rvert\le\lvert\log a-\log b\rvert ∣ a − b ∣ ≤ ∣ log a − log b ∣ . Hence (182) , uniformly over x x x and u u u , implies (187) . Adding this discrepancy and the model-transport bound from Section 3 to the supported-step error, and repeating the union-bound argument used in the proof of Theorem 4.2 gives (188) . The exactly masked case follows from Remark F.3. □
For visible padding used to match a longer pretraining context, neither the padding count nor the attention gap is automatically favorable; the additional term in (188) must then be retained. In particular, the fact that a prompt becomes longer as N N N grows does not by itself prove that the padded and unpadded conditionals become closer. The original padding-free form of Theorem 4.2 is recovered only when padding is exactly masked or when δ k , p a d ( N ) \delta_{k,\mathrm{pad}}(N) δ k , pad ( N ) is otherwise negligible at the desired rate.
Experiments
In this section we provide detailed introduction of our experiments setup and additional experimental results to supplement those in the main text.
Pretraining Dependence
To isolate the role of intrinsic ICL capability , we construct three variants of Llama3.2-3B that differ only in the amount and format of additional pretraining on a six-digit addition corpus. Throughout, we use the same evaluation protocol in the main text (6–10 digit addition).
Base (Weak). We use the original Llama3.2-3B checkpoint without any additional training.
Fine-tuned (Strong). We randomly generate 20,000 six-digit addition instances and format each instance as a supervised instruction-following sample in JSONL, each training example is serialized as
Instruction: ... Input: ... Response: ...
and we fine-tune the model using LoRA on this dataset.
Fine-tuned (Medium). We use the same 20,000 generated instances, but concatenate all serialized training examples into a single long text sequence and fine-tune on this single sequence. This construction preserves the token-level training signal while substantially reducing the effective diversity and sampling of training contexts, leading to a weaker improvement in intrinsic ICL capability compared to the sample-level training above.
Both Strong and Medium variants are trained with the same LoRA configuration and optimizer settings. We apply LoRA to attention and MLP projection modules. We train a causal LM objective with labels equal to the input tokens (standard next-token prediction over the serialized prompt). Unless otherwise stated, we use a maximum sequence length of 512 tokens with padding/truncation.
Demonstration Choice
In this section, our goal is to isolate how the informativeness of demonstrations affects in-context generalization, under the same prompt template, the same query distribution, and the same number of demonstrations.
Tasks. We consider two retrieval-style tasks constructed as “( x , ? , y ) (x, ?, y) ( x , ? , y ) ” completion: (i) Sports : x x x is a country and y y y is its designated sport label in our benchmark; (ii) People : x x x is a company and y y y is a canonical person name associated with that company in our benchmark (e.g., a founder). The model is queried with an unseen x t e s t x_{\mathrm{test}} x test and asked to predict the corresponding y t e s t y_{\mathrm{test}} y test .
Ambiguous vs. identifying demonstration pools. For each task, we build two disjoint pools of demonstration pairs: ambiguous and identifying . Both pools contain 10 labeled pairs ( x , y ) (x,y) ( x , y ) . Intuitively, the ambiguous pool contains examples that can be explained by multiple plausible latent rules (hence providing weaker evidence about which rule the prompt instantiates), whereas the identifying pool contains examples that more strongly pin down a unique rule. Importantly, the test set (query distribution) is kept the same across the two conditions; only the demonstration pool differs.
Prompt template. Given a demonstration set { ( x j , y j ) } j = 1 k \{(x_j,y_j)\}_{j=1}^{k} {( x j , y j ) } j = 1 k , we format the prompt as
Question: ( x 1 , ? , y 1 ) , … , ( x k , ? , y k ) (x_1, ?, y_1), \ldots, (x_k, ?, y_k) ( x 1 , ? , y 1 ) , … , ( x k , ? , y k ) . x t e s t x_{\mathrm{test}} x test , ?,
and instruct the model to output a single answer token span in English (sport name for Sports; person name for People).
Evaluation. For each task and each condition (ambiguous / identifying), we generate 100 prompts per random seed by sampling k ∈ { 2 , 4 , 8 } k \in\{2, 4, 8\} k ∈ { 2 , 4 , 8 } uniformly and sampling k k k demonstrations uniformly without replacement from the corresponding pool. The query pair ( x t e s t , y t e s t ) (x_{\mathrm{test}}, y_{\mathrm{test}}) ( x test , y test ) is sampled from a fixed test list with ground-truth labels. Model outputs are parsed into JSON and normalized by lowercasing and removing punctuation; accuracy is computed by exact match with the normalized ground truth. We repeat the entire procedure for 5 random seeds and report mean ± \pm ± standard deviation across seeds.
Results. Table 5 –Table 6 summarize the accuracy under the two demonstration pools as a function of k k k on Qwen-235B-A22B and Qwen-30B-A3B, respectively. Across both tasks, the identifying pool consistently yields higher accuracy than the ambiguous pool, and the performance gap generally increases with more demonstrations.
Table 5. Improved Demonstration Experiment. Task: sports, repeated 5 times with different random seeds.
Table 6. Improved Demonstration Experiment. Task: People, repeated 5 times with different random seeds.
Controlled Validation of Demonstration Evidence Rates
The preceding natural-language experiments vary whether demonstrations identify the intended task. We complement them with a controlled modular-arithmetic experiment in which the amount of identifying evidence is known exactly. This isolates the evidence-accumulation mechanism in Assumption 3.1 and tests the exponential concentration predicted by Theorem 3.2 .
Controlled task family. We use three latent tasks on Z 17 \mathbb{Z}_{17} Z 17 , t ∈ { a d d , s u b , m u l } t \in\{\mathrm{add}, \mathrm{sub}, \mathrm{mul}\} t ∈ { add , sub , mul } , with addition as the true task. For an input x = ( a , b ) x=(a,b) x = ( a , b ) , the three clean outputs are a + b a+b a + b , a − b a-b a − b , and a b ab ab modulo 17. Outputs follow a symmetric noise model with probability 0.95 on the task-consistent value and 0.05/16 on each other answer, and the task prior is uniform. The ambiguous distribution q a m b q_{\mathrm{amb}} q amb is concentrated on ( 0 , 0 ) (0,0) ( 0 , 0 ) , where all three tasks agree. The identifying distribution q i d q_{\mathrm{id}} q id is uniform over the 242 inputs for which the three outputs are pairwise distinct. We continuously control evidence through
q λ = ( 1 − λ ) q a m b + λ q i d , λ ∈ { 0 , .25 , .5 , .75 , 1 } . (189) q_{\lambda}=(1-\lambda)q_{\mathrm{amb}}+\lambda q_{\mathrm{id}}, \qquad\lambda\in\{0,.25,.5,.75,1\}. \tag*{(189)} q λ = ( 1 − λ ) q amb + λ q id , λ ∈ { 0 , .25 , .5 , .75 , 1 } . (189)
For either competing task t t t , the population evidence rate is available in closed form:
α t ( λ ) = E x ∼ q λ , y ∼ p ( ⋅ ∣ x , t ∗ ) log p ( y ∣ x , t ∗ ) p ( y ∣ x , t ) = 5.4133106 λ . (190) \alpha_t(\lambda)=\mathbb{E}_{x\sim q_{\lambda},\,y\sim p(\cdot\mid x,t^*)}\log\frac{p(y\mid x,t^*)}{p(y\mid x,t)}=5.4133106\lambda. \tag*{(190)} α t ( λ ) = E x ∼ q λ , y ∼ p ( ⋅ ∣ x , t ∗ ) log p ( y ∣ x , t ) p ( y ∣ x , t ∗ ) = 5.4133106 λ . (190)
Thus λ \lambda λ changes only the frequency of identifying examples, giving a direct experimental control over the rate appearing in the theory.
Reference evidence accumulation. For each λ \lambda λ and N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } N \in\{1, 2, 4, 8, 16, 32, 64\} N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } , we sample 2,000 independent prompts and measure the cumulative log-likelihood ratio S N , t = ∑ n = 1 N log [ p ( y n ∣ x n , t ∗ ) / p ( y n ∣ x n , t ) ] S_{N,t} = \sum_{n=1}^{N} \log[p(y_n \mid x_n, t^*)/p(y_n \mid x_n, t)] S N , t = ∑ n = 1 N log [ p ( y n ∣ x n , t ∗ ) / p ( y n ∣ x n , t )] . Table 7 compares the exact rate in Equation (190) with the fitted slope of E [ S N , t ] E[S_{N,t}] E [ S N , t ] against N N N . The two competing tasks give nearly identical slopes, every fit has R 2 > 0.99999 R^2 > 0.99999 R 2 > 0.99999 , and all empirical slopes are within 0.8% of the exact population value. At λ = 0 \lambda= 0 λ = 0 , the cumulative evidence is identically zero, as predicted.
Table 7. Controlled evidence-rate recovery. Fitted slopes of cumulative evidence versus N N N ; intervals are 95% bootstrap confidence intervals over prompts.
Posterior and predictive concentration. Using the exact Bayesian reference predictor, increasing either N N N or λ \lambda λ sharply reduces task-posterior error. Table 8 shows that the ordering induced by the analytical evidence rate is reproduced throughout the sweep. For example, at λ = 0.25 \lambda= 0.25 λ = 0.25 the posterior error falls from 0.503 at N = 1 N = 1 N = 1 to 1.08 × 10 − 8 1.08 \times10^{-8} 1.08 × 1 0 − 8 at N = 64 N = 64 N = 64 , while larger evidence rates reach the numerical floor earlier. The corresponding predictive error has the same ordering and concentration pattern. This provides a direct finite-sample realization of the theory’s exponential evidence mechanism.
Table 8. Reference task-posterior error. Mean posterior mass on the two competing tasks over 2,000 prompts.
Recovery by a learned Transformer. Finally, we train five independently initialized Transformers to infer the latent task from the same demonstrations. Each model has two layers, width 64, four attention heads, GELU activations, and is trained on uniformly sampled modular-arithmetic inputs; evaluation uses 200 fresh prompts per model, λ \lambda λ , and N N N (35,000 measurements in total). As shown in Table 9 , the learned models recover the same central dependence on demonstration evidence: error decreases strongly with N N N , and larger λ \lambda λ produces faster task identification. The rank correlation between the analytical rate α ( λ ) \alpha(\lambda) α ( λ ) and negative model error is 1.0 for every N ≤ 32 N \le32 N ≤ 32 and remains 0.9 at N = 64 N = 64 N = 64 . At full identification (λ = 1 \lambda= 1 λ = 1 ), mean error decreases from 0.4994 to 0.0028.
Table 9. Learned-Transformer task error. Means over five model seeds and 200 evaluation prompts per model and condition.
Taken together, the exact calculation, reference-predictor simulation, and learned-model experiment consistently support the paper’s central setting: identifying demonstrations contribute a positive per-example evidence rate, that evidence accumulates linearly with context length, and the resulting task and predictive errors contract rapidly with N N N . The controlled design also shows that the advantage of identifying demonstrations in the natural-language experiments is explained by information about the latent task rather than by demonstration count alone.
Empirical Validation of Effective Instruction Sample Size
The shared-template factorization used for repeated instructions treats one instruction realization copied across several displayed positions as one task-conditional draw. By contrast, independently varying realizations may provide separate pieces of instruction evidence. We directly test whether a Transformer can learn this distinction from the cross-position correlation structure of its training distribution. The experiment independently varies the total number N N N of displayed instruction positions and the number K K K of distinct realizations occupying those positions. Each realization is copied exactly N / K N/K N / K times. Thus K = 1 K = 1 K = 1 is the shared-template endpoint and K = N K = N K = N is the independent-realization endpoint.
Tasks and paired measurement. We use the three latent tasks
f 0 ( a , b ) = ( a + b ) m o d 17 , f 1 ( a , b ) = ( a − b ) m o d 17 , f 2 ( a , b ) = a b m o d 17. (191) f_0(a,b) = (a+b) \bmod17,\qquad f_1(a,b) = (a-b) \bmod17,\qquad f_2(a,b) = ab \bmod17. \tag*{(191)} f 0 ( a , b ) = ( a + b ) mod 17 , f 1 ( a , b ) = ( a − b ) mod 17 , f 2 ( a , b ) = ab mod 17. (191)
Every demonstration is ( 0 , 0 ) ↦ 0 (0,0) \mapsto0 ( 0 , 0 ) ↦ 0 , which is equally compatible with all three tasks. Consequently, demonstrations provide no task-identifying information, and the model must infer the task from the instruction realizations alone. Query inputs are selected so that the three tasks produce distinct answers.
For each configuration we measure the paired task-margin shift
C θ ( N , K ) : = m θ ( z N , K m i s m a t c h ) − m θ ( z N , K a n c h o r ) , m θ ( z ) : = log p θ ( y s u b ∣ z ) − log p θ ( y a d d ∣ z ) . (192) C_\theta(N,K) := m_\theta(z^{\mathrm{mismatch}}_{N,K}) - m_\theta(z^{\mathrm{anchor}}_{N,K}),\qquad m_\theta(z) := \log p_\theta(y_{\mathrm{sub}} \mid z) - \log p_\theta(y_{\mathrm{add}} \mid z). \tag*{(192)} C θ ( N , K ) := m θ ( z N , K mismatch ) − m θ ( z N , K anchor ) , m θ ( z ) := log p θ ( y sub ∣ z ) − log p θ ( y add ∣ z ) . (192)
The paired prompts have identical N N N , K K K , cluster identities, repeat counts, cluster ordering, demonstrations, query, positions, attention mask, and nuisance embedding coordinates. They differ only in the task-likelihood coordinates of the instructions: the anchor favors addition and the mismatch favors subtraction. This pairing isolates instruction-induced task pressure from sequence length and demonstration content.
Instruction realizations. Each realization has four coordinates,
U c , j = [ log p ( c ∣ t = 1 ) p ( c ∣ t = 0 ) , log p ( c ∣ t = 2 ) p ( c ∣ t = 0 ) , r cos θ j , r sin θ j ] , (193) U_{c,j} = \left[\log\frac{p(c \mid t=1)}{p(c \mid t=0)},\log\frac{p(c \mid t=2)}{p(c \mid t=0)},r\cos\theta_j,r\sin\theta_j\right], \tag*{(193)} U c , j = [ log p ( c ∣ t = 0 ) p ( c ∣ t = 1 ) , log p ( c ∣ t = 0 ) p ( c ∣ t = 2 ) , r cos θ j , r sin θ j ] , (193)
where c ∈ { 0 , 1 , 2 } c \in\{0,1,2\} c ∈ { 0 , 1 , 2 } is the instruction class, j ∈ { 1 , … , 64 } j \in\{1,\ldots,64\} j ∈ { 1 , … , 64 } is its alias identity, r = 0.5 r = 0.5 r = 0.5 , and θ j = 2 π j / 64 \theta_j = 2\pi j/64 θ j = 2 π j /64 . The first two coordinates contain task evidence; the last two distinguish aliases but contain no task information. We set p ( c = t ∣ t ) = 0.65 p(c=t \mid t) = 0.65 p ( c = t ∣ t ) = 0.65 and p ( c ≠ t ∣ t ) = 0.175 p(c \ne t \mid t) = 0.175 p ( c = t ∣ t ) = 0.175 , so a matching realization has single-sample log-likelihood ratio log ( 0.65 / 0.175 ) ≃ 1.312 \log(0.65/0.175) \simeq1.312 log ( 0.65/0.175 ) ≃ 1.312 . All 64 aliases within a class have the same task likelihood.
Training regimes. We train under three distributions with identical single-position instruction marginals, latent-task distribution, query distribution, sequence-length distribution, architecture, optimization, and total training-token count. They differ only in cross-position correlation:
Shared-template: one realization U ∼ P ( U ∣ t ) U \sim P(U \mid t) U ∼ P ( U ∣ t ) is sampled and copied to all N N N positions, so the independent instruction sample size is one.
Hierarchical: K ∈ { 1 , 2 , 4 , … , N } K \in\{1, 2, 4, \ldots, N\} K ∈ { 1 , 2 , 4 , … , N } is sampled, K K K realizations are drawn independently from P ( U ∣ t ) P(U \mid t) P ( U ∣ t ) , and each is copied N / K N/K N / K times. The exact instruction likelihood therefore contains K K K , rather than N N N , independent factors.
Independent-occurrence: all N N N displayed realizations are sampled independently, giving the endpoint K = N K = N K = N during training.
The model is not given K K K , cluster labels, or cluster boundaries; it must recover the effective sample structure from equality and variation among its input embeddings.
Model and evaluation. The predictor is a two-layer pre-norm Transformer encoder with hidden width 64, four attention heads, FFN width 128, GELU activations, and no dropout. It is trained for 1,600 AdamW steps with batch size 128, learning rate 8 × 10 − 4 8 \times10^{-4} 8 × 1 0 − 4 , and weight decay 10 − 4 10^{-4} 1 0 − 4 . We train five initialization seeds and output a 17-way query-answer distribution. In the principal experiment the target is the exact latent-task posterior mapped to the three distinct query answers. A separate experiment uses sampled hard answer labels.
We evaluate every N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } N \in\{1, 2, 4, 8, 16, 32, 64\} N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } and every K ∈ { 1 , 2 , 4 , … , N } K \in\{1, 2, 4, \ldots, N\} K ∈ { 1 , 2 , 4 , … , N } dividing N N N , using 20 held-out query seeds and 16 realization-identity pools. This yields 44,800 measurements per training regime and 134,400 in total. We fit
C θ ( N , K ) = a + b N N + b K K (194) C_\theta(N, K) = a + b_N N + b_K K \tag*{(194)} C θ ( N , K ) = a + b N N + b K K (194)
and compute 95% confidence intervals using 2,000 model-seed/prompt-seed cluster-bootstrap replicates.
Results. Table 10 shows a clean separation between displayed copies and distinct realizations. For hierarchical training, the coefficient of K K K is strictly positive, whereas no residual dependence on N N N is statistically distinguishable after controlling for K K K . The shared-template control has no significant K K K coefficient. Moreover, the estimated distinct-realization response is ordered with the amount of independence in the training distribution:
Table 10. Effective instruction sample size. Coefficients in C θ ( N , K ) = a + b N N + b K K C_\theta(N, K) = a + b_N N + b_K K C θ ( N , K ) = a + b N N + b K K for posterior-distilled models. Intervals are 95% cluster-bootstrap confidence intervals.
b K s h a r e d < b K h i e r a r c h i c a l < b K o c c u r r e n c e . (195) b_K^{\mathrm{shared}} < b_K^{\mathrm{hierarchical}} < b_K^{\mathrm{occurrence}}. \tag*{(195)} b K shared < b K hierarchical < b K occurrence . (195)
The hierarchical point estimate is 10.8 times the shared-control estimate, and the confidence intervals for the hierarchical and shared coefficients do not overlap. Thus the same Transformer architecture learns different effective instruction sample sizes solely from cross-position correlations.
The hard-label replication confirms that the central result is not an artifact of posterior distillation. Under hierarchical training it gives
b K h i e r a r c h i c a l = 0.000187 , 95 % C I = [ 0.000097 , 0.000283 ] , (196) b_K^{\mathrm{hierarchical}} = 0.000187,\qquad95\% \ \mathrm{CI} = [0.000097, 0.000283], \tag*{(196)} b K hierarchical = 0.000187 , 95% CI = [ 0.000097 , 0.000283 ] , (196)
while the shared-template coefficient remains statistically indistinguishable from zero, b K s h a r e d = 0.000053 b_K^{\mathrm{shared}} = 0.000053 b K shared = 0.000053 with 95% CI [−0.000011, 0.000116]. The fitted hierarchical b N b_N b N is likewise not distinguishable from zero. A distance sweep further recovers the selective K K K response at both medium and full mismatch strength: at interpolation s = 0.5 s = 0.5 s = 0.5 , b K = 0.000116 b_K = 0.000116 b K = 0.000116 with 95% CI [0.000024, 0.000213], and at s = 1 s = 1 s = 1 , b K = 0.000187 b_K = 0.000187 b K = 0.000187 with 95% CI [0.000097, 0.000282].
These results empirically support the factorization used in the theory. When training presents repeated slots as deterministic copies of one shared draw, the learned predictor treats them as a single effective instruction sample. When training contains clustered independent realizations, task pressure grows with the number of distinct draws rather than with the number of displayed copies. The experiment therefore validates the substantive distinction between the shared-template and varying-realization settings: their different scalings can be learned by a Transformer from correlation structure alone, even when all single-position marginals and all non-instruction aspects of the training distribution are held fixed.
Prompt Sensitivity vs. Demonstration Count
We study how token-level numerical predictions respond to changes in the in-context operator pattern while keeping the underlying query answer fixed. We evaluate Qwen3-30B-A3B model and Qwen3-235B-A22B model.
Prompt regimes. Each evaluation prompt consists of a fixed-format arithmetic query paired with a fixed target answer (e.g., 1345). We construct three regimes that differ only in the operator pattern appearing in the demonstrations: (i) addition-only , where all in-context examples use +; (ii) multiplication-only , where all examples use ×; and (iii) mixed-symbol , where different operators are interleaved across demonstrations. Across all regimes, the query problem and its correct final answer remain identical.
Relation to theoretical support. Because the Qwen pretraining corpus and its latent task labels are unavailable, we cannot determine whether any of these operator–task pairings has literal zero conditional probability. Accordingly, this experiment tests consistent versus varying instruction mismatch, rather than directly verifying p ( i ∣ t ∗ ) = 0 p(i \mid t^*) = 0 p ( i ∣ t ∗ ) = 0 . The same fixed-cost mechanism remains relevant when p ( i ∣ t ∗ ) > 0 p(i \mid t^*) > 0 p ( i ∣ t ∗ ) > 0 but is extremely small: a finite corpus may then contain too few such pairings for the model to learn the association reliably, making the instruction effectively unsupported for the learned model, while its fixed instruction pressure can still be overcome by accumulating demonstration evidence. It is natural to expect prompts that use a multiplication symbol while requiring addition outputs to be much rarer in pretraining than ordinary aligned uses, but we do not treat this expectation as a verified property of Qwen’s training distribution.
Token-level score extraction. For each prompt, we extract token-level scores corresponding to the correct digits of the target answer. Concretely, for a target digit string a 1 a 2 ⋯ a L a_1a_2 \cdots a_L a 1 a 2 ⋯ a L , we record, at each output position ℓ \ell ℓ , the model-assigned log-probability of the correct digit a ℓ a_\ell a ℓ . These per-digit log-probabilities serve as a fine-grained proxy for the model’s confidence in the correct numerical prediction at each position. Specifically, in the figures, Char 1, 3, 4, 5 denotes the score trace associated with the 1, 2, 3, 4-th digit position of the fixed target answer 1345.
Findings. Figure 2 and Figure 3 present the token-level score trajectories for the Qwen3-235B-A22B and Qwen3-30B-A3B models, respectively, under the three operator regimes. Corresponding score gradients are shown in Figure 4 and Figure 5 . In homogeneous-symbol regimes (addition-only or multiplication-only), per-digit score trajectories are relatively smooth and exhibit small discrete gradients, indicating stable symbolic behavior. In contrast, the mixed-symbol regime produces larger variance and more frequent sign changes in the gradients, suggesting increased instability when the operator distribution shifts within the context. These patterns are consistent across model scales, although the larger Qwen3-235B-A22B model exhibits systematically smaller gradient magnitudes, indicating improved robustness to symbolic heterogeneity.
Figure 2. Posterior confidence under instruction variation. (Qwen-235B-A22B-Instruct) (a) Equivalent instructions yield stable, high-confidence predictions. (b) Incorrect but consistent instructions allow confidence to recover as more demonstrations are added. (c) Incorrect and inconsistent instructions lead to persistently low and unstable confidence despite increasing context length.
Figure 3. Posterior confidence under instruction variation. (Qwen-30B-A3B-Instruct) (a) Equivalent instructions yield stable, high-confidence predictions. (b) Incorrect but consistent instructions allow confidence to recover as more demonstrations are added. (c) Incorrect and inconsistent instructions lead to persistently low and unstable confidence despite increasing context length.
Figure 4. Discrete gradients of log probability. (Qwen-235B-A22B-Instruct) (a) Equivalent instructions yield small and stable gradients. (b) Incorrect but consistent instructions show gradual stabilization. (c) Incorrect and inconsistent instructions produce large and irregular gradients.
Figure 5. Discrete gradients of log probability. (Qwen-30B-A3B-Instruct) (a) Equivalent instructions yield small and stable gradients. (b) Incorrect but consistent instructions show gradual stabilization.(c) Incorrect and inconsistent instructions produce large and irregular gradients.
Controlled Agent Execution through Explicit Intermediate States
We study a fixed-plan arithmetic agent implemented with Llama3.2-3B. At execution step k k k , the agent reads its current state x ( k ) x^{(k)} x ( k ) , applies the operation prescribed by the plan, and emits the updated state x ( k + 1 ) x^{(k+1)} x ( k + 1 ) . Because the language model serializes these states and updates as an autoregressive text trace, the implementation uses chain-of-thought (CoT)-style prompting. Here CoT is not a separate theoretical object: it is the textual interface through which the agent exposes its state trajectory and executes one transition at a time. This correspondence makes intermediate states and step-level errors observable and lets us test the agent-execution mechanism in § 4.1 and Theorem 4.2 . We compare two agent plans for the same multi-digit addition objective. They have the same correct terminal state but differ in whether their component operations are supported by training.
In-distribution agent plan. In the in-distribution plan, every state transition invokes a well-defined arithmetic operation, such as digit-wise decomposition, carry propagation, or aggregation. To ensure that the agent can execute these operations in isolation, we generate 10,000 training examples for each operation and fine-tune the model on the resulting step-level datasets before evaluation. Each example is formatted as an instruction–input–output triple, analogous to the pretraining setup in Appendix § 15 .§ 1 .
Step 1: 1234561 = 1234560 + 1 1234561 = 1234560 + 1 1234561 = 1234560 + 1
Step 2: 1323212 = 1323210 + 2 1323212 = 1323210 + 2 1323212 = 1323210 + 2
Step 3: 1234560 + 1323210 → ( 123456 + 132321 ) × 10 1234560 + 1323210 \to(123456 + 132321) \times10 1234560 + 1323210 → ( 123456 + 132321 ) × 10
Step 4: 1 + 2 1 + 2 1 + 2
Step 5: Combine results.
Each step corresponds to a sub-computation the model can reliably perform in isolation.
Out-of-distribution agent plan. The out-of-distribution plan reaches the same correct terminal state, but it requires intermediate operations on which the model has not been explicitly trained. No additional fine-tuning is performed for these operations; the agent must execute the prescribed state transitions from the plan supplied in the prompt.
Step 1: 1234561 = 1000000 + 234561 1234561 = 1000000 + 234561 1234561 = 1000000 + 234561
Step 2: 1323212 = 1000000 + 323212 1323212 = 1000000 + 323212 1323212 = 1000000 + 323212
Step 3: Add corresponding components. 1000000 + 1000000 = 2000000 1000000 + 1000000 = 2000000 1000000 + 1000000 = 2000000 , 234561 + 323212 = 557773 234561 + 323212 = 557773 234561 + 323212 = 557773
Step 4: Combine results.
Although the plan is algebraically correct, its intermediate transitions do not correspond to well-supported arithmetic routines in the model’s training distribution and are therefore unreliable during execution.
Training Setup. All fine-tuning for the in-distribution agent plan uses the same LoRA configuration, optimizer, and training hyperparameters as in Appendix § 15 .§ 1 . In particular, the architecture, learning rate, number of epochs, batch size, and quantization settings are kept fixed. This isolates the effect of step-level intrinsic capability from other confounding factors.
Evaluation. We evaluate the step-wise log probabilities to make the empirical measurement consistent with the pathwise perspective in § 4.2 . Let ℓ s ( f s ( z ) ) \ell_s(f_s(z)) ℓ s ( f s ( z )) denote the model logits at execution step s s s , and let ℓ s ( z ) = g ( f s ( z ) ) \ell_s(z) = g(f_s(z)) ℓ s ( z ) = g ( f s ( z )) be the corresponding cross-entropy loss on the correct step output. If f s f_s f s is L f s L_{f_s} L f s -Lipschitz and the cross-entropy map g g g is L g L_g L g -Lipschitz on the bounded logit region considered in the experiment, then for two prompts z 1 , z 2 z_1,z_2 z 1 , z 2 along the same step-wise path,
∣ ℓ s ( z 1 ) − ℓ s ( z 2 ) ∣ ≤ L g ∥ f s ( z 1 ) − f s ( z 2 ) ∥ ≤ L g L f s ∥ z 1 − z 2 ∥ . |\ell_s(z_1) - \ell_s(z_2)| \le L_g \|f_s(z_1) - f_s(z_2)\| \le L_g L_{f_s} \|z_1 - z_2\|. ∣ ℓ s ( z 1 ) − ℓ s ( z 2 ) ∣ ≤ L g ∥ f s ( z 1 ) − f s ( z 2 ) ∥ ≤ L g L f s ∥ z 1 − z 2 ∥.
Thus, if prompts are varied along a fixed step-wise path, gradients of the correct-output log probability provide a proxy for the effective Lipschitz sensitivity of that transition. Our plots instead compare different execution steps, which generally implement different functions; their variation is therefore a qualitative stability diagnostic rather than a direct estimate of a within-step Lipschitz constant. Under the in-distribution agent plan, each transition invokes an operation that is better represented during training, so the log-probability profile is expected to vary more smoothly across steps. In contrast, the out-of-distribution plan retains difficult operations in the execution trajectory, leading to sharper step-level variations and greater effective step-wise sensitivity.
Figure 6. Agent transition accuracy. Left: ID plan; right: OOD plan.
Results. We report three types of measurements: (i) final accuracy, (ii) step-wise accuracy, and (iii) step-wise log-probabilities, which serve as a proxy for the effective Lipschitz behavior at each step.
Final accuracy. Consistent with Figure 1 c, the in-distribution (ID) agent plan substantially improves performance over direct prediction, whereas the out-of-distribution (OOD) plan degrades performance and is often worse than executing no plan. This matches Theorem 4.2 : an agent can realize an unsupported target when its planned operations are supported and identifiable, whereas one poorly identified or poorly approximated transition can dominate the execution trajectory.
Step-wise accuracy. To further understand this behavior, we measure the correctness of every state transition in the agent trajectory. Under the ID plan, early transitions are executed almost perfectly and most errors occur only at final aggregation. Under the OOD plan, accuracy degrades progressively, with each subsequent state transition less reliable than the previous one.
This progressive degradation is consistent with the error-propagation structure in Theorem 4.2 , whose final-error bound sums the identification and model-transport errors of the individual steps. When intermediate steps are unreliable, these contributions accumulate and lead to poor final performance.
Step-wise Lipschitz behavior (via log-probabilities). To connect these observations with the pathwise theory, we examine the average log-probability assigned to the correct token at each step. As explained above, the cross-step profile diagnoses stability along the realized agent trajectory; it does not by itself estimate a within-step pathwise Lipschitz constant.
In the ID setting, the log-probabilities remain stable across steps, providing evidence that no individual supported subtask introduces a pronounced loss spike. This is consistent with the favorable regime of Theorem 4.2 , in which every step has a controlled identification and model-transport error.
In contrast, in the OOD setting, step-wise accuracy decreases substantially and the log-probability profile exhibits larger fluctuations. This indicates that some intermediate computations are unreliable, exactly the failure mode captured by the step-wise sum in Theorem 4.2 . When a substep is poorly identified or has a large model-transport error, its contribution to the sum can dominate the final result. The experiments are therefore consistent with the theory’s qualitative prediction that an unreliable step can degrade the final answer; isolating the two error sources individually would require controlled within-step interventions.
Figure 7. Step-wise agent log-probability gradients. Left: ID plan; right: OOD plan.
Controlled validation of supported agent composition. We additionally conduct a controlled finite-task experiment that tests the central mechanism of Theorem 4.2 directly. The agent follows an explicit three-operation plan, and its intermediate states are fully observable, so its conditional transition errors can be compared directly with the theorem’s agent-execution bound. All computations are performed modulo 17. The training distribution contains only the three supported tasks
f 0 ( x ) = x + 1 , f 1 ( x ) = 2 x , f 2 ( x ) = x − 3 , (197) f_0(x) = x + 1,\qquad f_1(x) = 2x,\qquad f_2(x) = x - 3, \tag*{(197)} f 0 ( x ) = x + 1 , f 1 ( x ) = 2 x , f 2 ( x ) = x − 3 , (197)
whereas the composed target
f † ( x ) = 2 x − 1 = f 2 ∘ f 1 ∘ f 0 ( x ) ( m o d 17 ) (198) f^\dagger(x) = 2x - 1 = f_2 \circ f_1 \circ f_0(x) \pmod{17} \tag*{(198)} f † ( x ) = 2 x − 1 = f 2 ∘ f 1 ∘ f 0 ( x ) ( mod 17 ) (198)
is never included as a direct training task. Demonstrations contain 8% observation noise, so competing-task likelihood ratios have common support; the query and task outputs remain deterministic, avoiding an artificial final error floor.
We compare three execution procedures. Direct ICL asks for f † ( x ) f^\dagger(x) f † ( x ) as one indivisible mapping. The supported agent follows the three-operation plan
x → x + 1 x ( 1 ) → 2 x x ( 2 ) → x − 3 y . (199) x \xrightarrow{x+1} x^{(1)} \xrightarrow{2x} x^{(2)} \xrightarrow{x-3} y. \tag*{(199)} x x + 1 x ( 1 ) 2 x x ( 2 ) x − 3 y . (199)
The equal-length OOD agent instead follows
x → x + 2 x ( 1 ) → 2 x − 2 x ( 2 ) → x − 3 y , (200) x \xrightarrow{x+2} x^{(1)} \xrightarrow{2x-2} x^{(2)} \xrightarrow{x-3} y, \tag*{(200)} x x + 2 x ( 1 ) 2 x − 2 x ( 2 ) x − 3 y , (200)
whose first two subtasks never occur during training, although their composition still gives the same correct target 2 x − 1 2x - 1 2 x − 1 . This equal-length control separates support of the planned operations from the mere presence or length of an explicit execution trajectory.
We train five independently initialized models and use 12 prompt seeds. For each model–prompt pair, we evaluate all 17 query states at N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } N \in\{1, 2, 4, 8, 16, 32, 64\} N ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 } . Each reported configuration therefore averages over 60 model–prompt measurements, with all query states included in each measurement. The complete evaluation contains 840 aggregate records.
The contrast is sharp. The supported-agent rollout error decreases from 0.456 to 0.0078, a factor of approximately 58, and its greedy rollout error is zero for N ≥ 32 N \ge32 N ≥ 32 . Direct ICL remains near 0.96 error, consistent with the fact that the held-out composed task cannot be selected directly from the training-supported task set. The equal-length OOD agent remains between 0.865 and 0.904 error. Thus the improvement cannot be explained merely by emitting intermediate states or by plan length: it appears precisely when the plan consists of supported, identifiable operations, as required by Theorem 4.2 .
Step-wise error propagation. For the supported agent plan, let F k − 1 F_{k-1} F k − 1 be the event that all preceding transitions are correct and define the conditional step-error probability
q k ( N ) : = P M ( E k c ∣ F k − 1 ) . (201) q_k(N) := P_M(E_k^c \mid F_{k-1}). \tag*{(201)} q k ( N ) := P M ( E k c ∣ F k − 1 ) . (201)
Table 11. Controlled validation of supported agent composition. Probabilistic error under direct prediction and stochastic agent rollout, together with the sum of the supported-agent conditional transition errors. Values are mean ± standard deviation over five models and twelve prompt seeds; every measurement includes all 17 query states.
We compute these probabilities under the correct prefix and evaluate the exact stochastic autoregressive rollout distribution, rather than relying only on greedy decoding. The recursion used in the proof of Theorem 4.2 gives
e r o l l o u t ( N ) ≤ ∑ k = 0 2 q k ( N ) . (202) e_{\mathrm{rollout}}(N) \le\sum_{k=0}^{2} q_k(N). \tag*{(202)} e rollout ( N ) ≤ k = 0 ∑ 2 q k ( N ) . (202)
All 840 evaluated records satisfy this inequality. This checks error accumulation for the rollout kernel actually evaluated; the inequality itself does not require exact compatibility with an extracted local prompt. The bound is non-vacuous and becomes nearly tight once the individual step errors are small. Using unrounded means,
N = 4 : 0.0725 ≤ 0.0736 , N = 16 : 0.0161 ≤ 0.0162 , N = 64 : 0.00783 ≤ 0.00785. (203) \begin{aligned}
N = 4 &: \quad0.0725 \le0.0736,\\
N = 16 &: \quad0.0161 \le0.0162,\\
N = 64 &: \quad0.00783 \le0.00785. \tag*{(203)}
\end{aligned} N = 4 N = 16 N = 64 : 0.0725 ≤ 0.0736 , : 0.0161 ≤ 0.0162 , : 0.00783 ≤ 0.00785. (203)
This tightness is expected in the low-error regime because simultaneous-error corrections are higher order in the q k q_k q k . The experiment therefore shows that the theorem’s step-wise error decomposition is not merely a loose worst-case accounting device in this controlled setting: the measured conditional errors closely explain the final rollout error. It does not separately establish that extracted-prompt error bounds transfer to a full-context kernel without a correction. That requires matched evaluations of the two kernels in (143) or (144) . For an executor that explicitly invokes the extracted step prompts with no additional retained context, the zero-discrepancy guarantee follows instead from Corollary E.5.
Actual-model tracking of the reference predictor. Finally, we evaluate the discrepancy between the Transformer and the Bayesian reference predictor on the supported steps. The maximum step-wise model–reference gap decreases from 0.582 at N = 1 N = 1 N = 1 to 0.027 at N = 64 N = 64 N = 64 . Hence the observed concentration is not confined to the idealized Bayesian reference: as demonstration evidence accumulates, the actual Transformer also tracks that reference increasingly closely. The theorem keeps this discrepancy explicit through the terms ε M ( k ) ( N ) \varepsilon_M^{(k)}(N) ε M ( k ) ( N ) and does not require them to vanish; their empirical decrease is an additional favorable property of the learned model in this experiment.
Continuous Soft-Prompt Paths in a Pretrained Qwen3 Model
We finally test the pathwise perspective of § 4.2 directly in a pretrained open-weight language model. Unlike the preceding discrete prompt comparisons, this experiment bypasses tokenization after constructing the path: interpolated instruction embeddings are injected into Qwen3-4B-Instruct-2507 through inputs_embeds. The model is evaluated in BF16 without quantization or parameter updates.
Task and paths. The task is addition modulo 17. Each prompt contains one instruction, N N N addition demonstrations, and one query, with N ∈ { 1 , 2 , 4 , 8 , 16 , 32 } N \in\{1, 2, 4, 8, 16, 32\} N ∈ { 1 , 2 , 4 , 8 , 16 , 32 } . We use eight independently sampled prompts for each N N N and choose every query so that addition, subtraction, and multiplication give distinct answers. We pre-specify two paths. The first interpolates from the supported instruction “Perform addition modulo 17.” to the mismatched instruction “Perform subtraction modulo 17.” The second interpolates from the same supported anchor to a synthetic soft-OOD endpoint whose token-wise embedding norms are matched to those of the anchor. For both paths,
Table 12. Empirical sensitivity along genuine Qwen3 soft-prompt paths. Values average the finite-difference sensitivities within each path region and then across the six demonstration counts. Both paths show a substantially smoother neighborhood around the supported anchor than the intermediate task-transition region.
E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ { 0 , .05 , … , 1 } . (204) E_s = (1-s)E(i_0) + sE(\tilde{i}), \qquad s \in\{0,.05,\ldots,1\}. \tag*{(204)} E s = ( 1 − s ) E ( i 0 ) + s E ( i ~ ) , s ∈ { 0 , .05 , … , 1 } . (204)
The resulting evaluation contains 2,016 path points.
Both symbolic endpoint instructions occupy the same seven token slots and differ only in the task word. We first obtain the ordinary input embeddings from the model embedding layer, replace only these seven instruction slots by E s E_s E s , and pass the resulting tensor directly to the model. Sequence length, attention mask, position IDs, demonstrations, query, and every embedding outside the instruction span remain fixed along a path. At s = 0 s = 0 s = 0 , the maximum logit difference between the inputs_embeds computation and the ordinary input_ids computation is exactly zero; the same check at s = 1 s = 1 s = 1 for the symbolic path also gives zero. No evaluated prompt produces a NaN or infinite value. These checks verify that the experiment follows a genuine continuous path through the embedding space rather than a sequence of retokenized discrete prompts.
Output probabilities and empirical path sensitivity. We compute the full teacher-forced continuation log-probability ℓ t ( s , N ) \ell_t(s,N) ℓ t ( s , N ) for the addition, subtraction, and multiplication answers, including all answer tokens, and define the candidate-normalized probability
q t ( s , N ) : = exp ( ℓ t ( s , N ) ) ∑ t ′ ∈ { a d d , s u b , m u l } exp ( ℓ t ′ ( s , N ) ) . (205) q_t(s,N) := \frac{\exp(\ell_t(s,N))}{\sum_{t' \in\{\mathrm{add},\mathrm{sub},\mathrm{mul}\}} \exp(\ell_{t'}(s,N))}. \tag*{(205)} q t ( s , N ) := ∑ t ′ ∈ { add , sub , mul } exp ( ℓ t ′ ( s , N )) exp ( ℓ t ( s , N )) . (205)
For adjacent path points, we measure the path-restricted finite-difference sensitivity of the correct-output log-probability by
L ^ j log p ( N ) : = ∣ log M ( y ∗ ∣ z N ( E s j + 1 ) ) − log M ( y ∗ ∣ z N ( E s j ) ) ∣ ∥ E s j + 1 − E s j ∥ F . (206) \hat{L}^{\log p}_j(N) := \frac{\left|\log M(y^* \mid z_N(E_{s_{j+1}})) - \log M(y^* \mid z_N(E_{s_j}))\right|}{\left\|E_{s_{j+1}} - E_{s_j}\right\|_F}. \tag*{(206)} L ^ j l o g p ( N ) := E s j + 1 − E s j F log M ( y ∗ ∣ z N ( E s j + 1 )) − log M ( y ∗ ∣ z N ( E s j )) . (206)
We analogously compute L ^ j e r r \hat{L}^{\mathrm{err}}_j L ^ j err for 1 − q a d d 1-q_{\mathrm{add}} 1 − q add and L ^ j s u b \hat{L}^{\mathrm{sub}}_j L ^ j sub for the subtraction log-odds ℓ s u b − ℓ a d d \ell_{\mathrm{sub}}-\ell_{\mathrm{add}} ℓ sub − ℓ add . These are empirical sensitivities restricted to the specified paths, precisely matching the local quantity suggested by the pathwise analysis rather than a global Lipschitz constant.
A locally smooth supported-instruction neighborhood. The two independently specified paths exhibit the same geometric structure. On the symbolic mismatch path, the middle-to-anchor sensitivity ratios are 5.64, 5.50, and 7.14 for the correct-output log-probability, candidate error, and subtraction log-odds, respectively. On the synthetic soft-OOD path, the corresponding ratios are 5.58, 4.66, and 5.13. Thus, across both a semantically meaningful competing endpoint and a synthetic endpoint, Qwen3 has a comparatively smooth neighborhood around the supported addition instruction, separated from the alternative endpoint regime by a much more sensitive transition region.
This experiment supplies a direct model-level realization of the soft-prompt geometry used in the theory. The path is formed inside the actual embedding space of a pretrained language model, and the measured output variations show that the pathwise sensitivity distinguishes a stable supported neighborhood from the transition to alternative instruction interpretations. It therefore complements the discrete Qwen3 prompt experiments by exposing the continuous local structure that those comparisons cannot observe.
Limitations
Our results are conditional characterizations rather than unconditional claims about every pretrained language model. The latent-task framework assumes a finite task family, task-conditional generation, and the format-specific factorizations used in the proofs. In particular, repeated copies of one instruction are modeled as a single shared template, whereas distinct corruptions are treated as separate instruction slots. These choices isolate the effect of prompt structure, but a real pretraining distribution need not admit this exact decomposition. Task identifiability and the integrability conditions used for posterior concentration are likewise sufficient conditions and need not hold for ambiguous or overlapping tasks.
The treatment of unsupported instructions requires a distinction between what is identified by data and what is selected by the model. Population cross-entropy identifies the Bayes predictor only on the pretraining support and does not determine a latent-task decomposition or an off-support value. We therefore impose supported calibration and use a Transformer-induced scoring map to define the reference instruction log-odds away from symbolic support, as described in Appendix § 11 . Analytic Transformer components guarantee the existence of the finite continuation chain along a fixed compact soft-prompt path, but they do not imply that the selected extension is semantically correct or close to an unknown data-generating law off support. Moreover, nearby complex singularities can make the continuation radii small and the constants M ℓ M_{\ell} M ℓ and Ω \Omega Ω large, even when the chain exists. Appendix D.1.1 provides a quantitative local model-transport certificate under supported-anchor calibration and length-independent architectural stability. Its constants may be too large to certify an experimentally useful radius. Small average pretraining loss alone does not imply worst-case anchor accuracy: the loss-to-calibration result requires coverage, and its finite-family version does not extend to all prompt lengths. Fixed-context models are covered only over admissible lengths, not by an infinite-context asymptotic claim.
The condition p ( i ∣ t ∗ ) = 0 p(i \mid t^{*}) = 0 p ( i ∣ t ∗ ) = 0 is a statement about the latent pretraining data-generating distribution, rather than a quantity that can generally be verified for a real LLM. Complete pretraining corpora and their sampling mechanisms are usually unavailable. Even access to a finite corpus would show only whether a particular instruction–task pairing occurs in that realization, not whether its population probability is exactly zero. Consequently, experiments with real pretrained models can only use reasonable proxies—such as the provenance, novelty, or apparent absence of a pairing—to motivate that an instruction is unsupported or extremely rare for the target task. Such evidence does not certify the literal zero-support condition, so empirical “unsupported” instructions should be interpreted as plausible analogues of the theoretical regime.