Positional Encoding and Prompt-Order Sensitivity in In-Context Learning
Zhijie Wang, Bo Jiang, Shuai Li
NeurIPS 2026
Abstract. Transformer models have demonstrated a remarkable ability to perform a wide range of tasks through in-context learning (ICL), where the model infers patterns from a small number of example prompts provided during inference. However, empirical studies have shown that the effectiveness of ICL can be significantly influenced by the order in which these prompts are presented. Despite its significance, this phenomenon has been largely unexplored from a theoretical perspective. In this paper, we theoretically investigate how positional encoding (PE) affects the ICL capabilities of linear attention transformer models, particularly in tasks where prompt order plays a crucial role. We examine two distinct cases: linear regression, which represents an order-invariant task, and dynamical systems, a classic time-series task that is inherently sensitive to the order of input prompts. Theoretically, we evaluated the change in the model output when two types of positional encoding (one-hot and RoPE) is incorporated and the prompt order is altered. In all cases, the leading dependence on the permutation size and context length is , with constants determined by the positional encoding, model weights, input dimension, and task dependent parameters. These theoretical findings are experimentally validated.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:46 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
The reviewers agree that the paper is clearly presented and that prompt-order sensitivity is an important problem. However, concerns were raised about the novelty of the k/N scaling relative to existing Transformer stability results. The authors should carefully clarify how the main theorems differ from previous work. They should also distinguish more clearly between stability of the model output and stability of ICL performance, and clarify the scope and need of the simplifications of their model (e.g. one-layer linear-attention setting, the nonstandard one-hot positional encoding, and the absence of causal masking). Moreover, the authors should better isolate positional encoding from other sources of order sensitivity.
Final justification
The rebuttal satisfactorily clarified the novelty relative to prior Transformer stability results and the additional experiments further strengthen the empirical support. Some limitations remain, including the simplified theoretical setting and the distinction between output stability and downstream performance, especially for classification tasks. These points should be clearly stated in the revised paper.
The citation checker identified the following problematic citation, which should be corrected in the final version:
- The paper 'Attention Is All You Need' exists and was published in Advances in Neural Information Processing Systems (NeurIPS 2017) in 2017. However, the author field only lists 'A Vaswani', omitting 7 of the 8 co-authors (Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin), which exceeds the acceptable limit of 1–2 missing authors.
Overall, I believe the rebuttal has adequately addressed the main concerns and that the paper makes a useful theoretical contribution to understanding prompt-order sensitivity. I therefore recommend acceptance.
Read meta-review
Meta-review
The reviewers agree that the paper is clearly presented and that prompt-order sensitivity is an important problem. However, concerns were raised about the novelty of the k/N scaling relative to existing Transformer stability results. The authors should carefully clarify how the main theorems differ from previous work. They should also distinguish more clearly between stability of the model output and stability of ICL performance, and clarify the scope and need of the simplifications of their model (e.g. one-layer linear-attention setting, the nonstandard one-hot positional encoding, and the absence of causal masking). Moreover, the authors should better isolate positional encoding from other sources of order sensitivity.
Final justification
The rebuttal satisfactorily clarified the novelty relative to prior Transformer stability results and the additional experiments further strengthen the empirical support. Some limitations remain, including the simplified theoretical setting and the distinction between output stability and downstream performance, especially for classification tasks. These points should be clearly stated in the revised paper.
The citation checker identified the following problematic citation, which should be corrected in the final version:
- The paper 'Attention Is All You Need' exists and was published in Advances in Neural Information Processing Systems (NeurIPS 2017) in 2017. However, the author field only lists 'A Vaswani', omitting 7 of the 8 co-authors (Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin), which exceeds the acceptable limit of 1–2 missing authors.
Overall, I believe the rebuttal has adequately addressed the main concerns and that the paper makes a useful theoretical contribution to understanding prompt-order sensitivity. I therefore recommend acceptance.
1 comment
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 2/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper studies how positional encoding affects prompt-order sensitivity. For one layer of linear attention, it bounds the change in the query output after the examples are permuted. The bound scales roughly as k/N, where k is the Cayley distance of the permutation and N is the context length. The paper considers one-hot encoding and RoPE on linear regression and a stable linear dynamical system. It tests the scaling on synthetic models (LR and DS tasks) and reports prediction-change rates for three Qwen2.5 model sizes on the Subj dataset.
Strengths and weaknesses
Prompt-order sensitivity is an important and well-studied problem. It is useful to study the role of positional encoding and the sensitivity of LLMs on a specific set of tasks. The paper gives explicit bounds for one-hot encoding and RoPE. It also considers both an order-invariant task and an order-sensitive task. The synthetic experiments recover the trends in k and N predicted by the theory.
The bounds also suggest useful directions for future work. It would be interesting to test them more extensively across model families and study how their constants vary with architectural choices such as hidden dimension and weight norms. For RoPE-based models, the dependence on the displacement term \Theta_\text{RoPE}(\pi) may also help study positional tasks, where the model must retrieve an item from a queried position, and identify limits caused by rotary phase structure. This would require showing that the bounds are tight or non-vacuous in realistic models, but the current analysis provides a possible starting point.
My main concern is the framing of the contributions. Lemma 5 of Hahn, ``Theoretical Limitations of Self-Attention in Neural Sequence Models'' (TACL 2020), already shows that changing one input symbol changes the output of a fixed-depth soft-attention transformer by O(1/N). A permutation with Cayley distance k is a composition of k transpositions, and each transposition changes the contents of two positions. Applying Hahn's lemma to these changes and using the triangle inequality therefore appears to give an O(k/N) bound. This paper does not cite or distinguish itself from that result. The 1/N factor is also built directly into the definition of linear attention and is discussed for softmax attention in the discussion section ("Toward softmax attention and multiple layers".).
The related work is incomplete. The paper does not compare carefully with Lu et al. (2021) [16] on order sensitivity in in-context demonstrations, even though it uses the same Subj dataset. The choice of the natural-language task is also insufficiently motivated. Does Subj represent a typical use case for testing order sensitivity?
Finally, the statement in lines 27-30 is imprecise. Permutation equivariance does not mean that every output remains unchanged; it means that the outputs are permuted together with the inputs. In the paper's specific setting, equivariance implies invariance of the query readout only because the permutation moves the demonstrations while leaving the query position fixed. This argument also assumes that other sources of order information, such as a causal mask, are absent. This should be stated explicitly, especially because causal masking is another source of order information absent from the theory.
Questions
I would like to know how Theorems 3.1-3.4 differ from Lemma 5 of Hahn (2020), and why that lemma does not already give the O(k/N) result. Can the authors provide a matching lower bound or show that the numerical bounds are useful for trained models, for example by explaining how they depend on parameter choices and hidden size in the Qwen family? Can they isolate positional encoding from causal masking (not mentioned in the paper), recency bias, majority-label bias, and attention dispersion? Of course, the authors are welcome to respond to the other points raised above.
Limitations
No. The limitations checklist states that the paper discusses its limitations in the conclusion. However, Section 6 only summarizes the results and does not discuss the main restrictions of the analysis. Finally, the claim that PE is a central mechanism is not isolated experimentally from causal masking or other known sources of order sensitivity (in particular for the LLMs experiments).
Final justification
Thank you for pointing this out (Contribution type). My assessment in the review was based on the correct contribution type and therefore remains unchanged; however, I mistakenly selected the wrong contribution type in the review form. I have now corrected that selection so that it matches the authors’ reported contribution type and the criteria used in my review.
After considering the authors’ response, the other reviews, and the discussion, I increase my score.
W1 & Q1: The authors clearly distinguished their main results from the classical (O(1/N)) sensitivity result for transformers established by Hahn. This comparison better highlights the novelty and distinct contribution of their results. I also appreciate the clarification of how Theorems 3.1 and 3.4 differ from the standard (O(1/N)) sensitivity bound. W2: The authors explained why their results provide a “quantitative, mechanism-level characterization” of the phenomenon identified by Lu et al. This clarification substantially improved my understanding of the paper’s contribution relative to that work. W3: The authors acknowledged that the permutation-equivariance statement requires greater precision and indicated that they will clarify it in the revised manuscript. Q2: The authors provided a concrete family of models for which the expected sensitivity matches the asymptotic (1/N) bound, addressing my question about the relevance and tightness of the theoretical result. Q3: The authors clarified that causal masking is absent from both the theoretical results and the experiments, which resolves my concern about whether the effects of positional encodings were isolated from those of masking.
Formatting concerns
No.
5 comments
Rebuttal to reviewer zk5q
We thank the reviewer for the careful review and we provide our responses below.
Weakness 1: The result appears to follow from Hahn (2020), and the factor is built into linear attention
We would like to clarify in the following perspectives.
First, Hahn's Lemma 5 bounds the effect of exchanging one input symbol on the final activation of a fixed-depth soft-attention Transformer by , with an unspecified constant depending on the parameter matrices. In contrast, our results characterize a structured permutation that preserves the demonstration multiset while changing its alignment with positional information.
More specifically, for one-hot PE, we derive the exact transposition identity (line 492), which gives the sharper bound (line 519, eq. 12), where and measure variation across the actual position-related columns of the attention model. These two quantities can vanish (by properly choosing transformer weight parameters) even when the global weight norms are nonzero.
For RoPE, the bound depends on the frequency-resolved displacement , so two permutations with the same Cayley distance can have different sensitivity, thus this is a finer bound than the result. Additionally, for dynamical systems, the constants depend on stability and covariance parameters, showing how task types affect permutation sensitivity.
Second, the explicit normalization supplies only a denominator. It does not show that the remaining numerator is independent of , nor that only the moved examples contribute after cancellation, especially with unbounded Gaussian inputs and correlated dynamical-system states. Establishing those facts and identifying the PE and task-dependent constants are the content of the proofs. Moreover, our Theorems (comparing Theorem 3.1/3.2 or 3.3/3.4) show the different dependence of the output difference on the feature dimension , implying RoPE are more sensitive to feature dimension than one-hot PE (Please see the Additional Experiments part of the rebuttal). Thus the contribution is therefore not only the isolated exponent , but also the mechanism and quantities hidden by that notation.
Weakness 2: The comparison with Lu et al. is incomplete and the choice of Subj is insufficiently motivated
Lu et al. establish empirically that different prompt orders can produce large accuracy differences and propose an entropy-based method for selecting performant orders. Our paper addresses a different question: how the magnitude of the change depends on a controlled permutation distance, the context length, the positional encoding, and the task distribution. Their work establishes the phenomenon and proposes a mitigation strategy, motivating us to provide a quantitative mechanism-level characterization.
Subj is chosen precisely because it is a canonical prompt-order-sensitivity benchmark in Lu et al., where order sensitivity persists across model sizes. Using the same task creates a direct bridge between their empirical observation and our scaling prediction.
Notably, their observation that increasing the number of demonstrations does not necessarily reduce variance is also consistent with our result. Their experiment samples global prompt orders, for which the number of moved examples generally grows as , therefore need not decrease. Our dilution statement holds when the perturbation size is fixed. This local-versus-global distinction is exactly what the explicit permutation metric contributes.
We'll add the above discussion to our paper.
Weakness 3: The permutation-equivariance statement
We thank the reviewer for pointing this out. We will state the full-sequence equivariance and fixed-query invariance separately to remove any ambiguity. And we'll also add a remark on causal mask to make the statement in the paper precise.
Rebuttal to reviewer zk5q part II
Question 1: How do Theorems 3.1--3.4 differ from Hahn's Lemma 5?
We've discussed this in Weakness 1, and we summarize the differences as follows:
- Perturbation: Hahn changes one input symbol; we analyze permutations that preserve all demonstrations but reassign them to positions.
- Architecture and input domain: Hahn studies soft attention over a finite input alphabet; our theorems study linear attention with unbounded Gaussian regression inputs and correlated Gaussian dynamical states.
- Positional encoding: Hahn's constant does not distinguish one-hot positional-column variation from RoPE rotary displacement, but our bounds explicitly do so, and find that RoPE are more sensitive to feature dimension .
- Permutation geometry: Hahn's lemma does not distinguish two permutations with equal Cayley distance but different RoPE phase displacement.
- Task dependence: Hahn's result does not expose the dependence on tasks, such as the stability, covariance, and process-noise quantities appearing in Theorems 3.3 and 3.4.
- Exact robustness: Hahn's generic influence bound does not provide the parameter-level condition in Appendix B under which the query output is exactly permutation invariant.
Question 2: Matching lower bound or show that the bounds are non-vacuous
A universal positive lower bound cannot hold over the entire model class, because Appendix B gives parameter settings for which the prediction is exactly invariant under every permutation. However, the exponent in Theorem 3.1 is sharp: there exist non-degenerate, bounded-norm attention layers whose expected change under one transposition is exactly proportional to .
To see this explicitly, recall (line 492) that swapping the contents at positions and gives
where is the query's position-dependent attention factor, is the value readout of example , and is the positional contribution to the value readout.
We now give a concrete parameter choice. Let be the coordinate of the query-position one-hot vector. Choose and , and set for a fixed constant , while setting the other entries of these two columns on the support of the query to zero. Because the query vector always has value in coordinate , this gives for every input prompt.
Next, choose the prediction row of to extract only the first feature coordinate: with all other content coefficients in that row equal to zero. Then , and hence . Finally, set so that and the second interaction term vanishes. The exact identity therefore reduces to
Since and are independent variables, and thus
All nonzero parameter entries in this construction are constants independent of . Therefore, there is a bounded-norm, non-degenerate family of models for which the expected sensitivity is exactly . Consequently, the dependence in Theorem 3.1 cannot be uniformly improved to .
Question 3: Can PE be isolated from causal masking, or other Transformer features?
The synthetic analysis isolates PE by construction. The theoretical and synthetic models are unmasked and the demonstration contents are permuted while their positional encodings remain attached to positions. Therefore, the measured change in the order-invariant regression task is caused by the content-position interaction identified in the proof, without causal masking or recency effects. Also, the Qwen experiment (Section 5) shows the same qualitative scaling remains visible when realistic mechanisms coexist, indicating PE may be the biggest cause for the sensitivity scaling in real LLMs.
Attention dispersion is addressed explicitly in Section 5. For softmax attention, the relevant quantity is Diffuse attention gives , whereas moving one highly attended demonstration can produce an effect. We've conducted experiments to show that moving instances with high attention mass affects sensitivity greater than moving low attention mass instances, please see the Additional Experiments part of the rebuttal.
Causal masking and recency are absent from the mechanism-isolation experiment by design and may contribute additional sensitivity in causal LLMs, but this does not confound the PE-specific theorem because the theorem is proved and validated in the unmasked controlled setting.
Additional Experiments
Experiment 1: How softmax attention influencs sensitivity
Setting
Section 5 suggests that for softmax attention, prompt-order sensitivity depends on the attention mass assigned to the moved demonstrations rather than only on the permutation size . We test this hypothesis using Qwen models on Subj and SST-2 (sentiment classification).
We use Qwen2.5-1.5B/7B-Instruct with balanced demonstrations and disjoint same-label transpositions. For each original prompt, we compute the attention score for each demonstration by summing the query readout position's attention over the tokens belonging to that demonstration and averaging over all heads in the final four layers of the model. We then rank the demonstrations by this score. Starting from the same base prompt, we constructed two matched permutations:
- In the high-influence setting, we select target demonstrations from the top of the attention ranking.
- In the low-influence setting, we select target demonstrations from the bottom of the ranking.
For each original or permuted prompt , we score each candidate class label by appending the label to the prompt and averaging the teacher-forced log probabilities of its tokens. Let and denote the two label scores, and define the signed class margin as We measure the effect of permutation using which quantifies how much the reordering changes the model's relative preference between the two labels, even when the predicted label does not flip.
We use 200 queries, three independently sampled base prompts per query, and both values of , yielding 1200 matched high-versus-low pairs.
Results
| Model, task, and influence measure | Mean : high | Mean : low | |
|---|---|---|---|
| Qwen-1.5B, SST-2 | 0.526 / 0.626 | 0.369 / 0.439 | |
| Qwen-1.5B, Subj | 0.330 / 0.419 | 0.226 / 0.334 | |
| Qwen-7B, Subj | 1.180 / 1.394 | 0.746 / 0.972 |
In both Subj and SST-2 experiments, moving high-attention demonstrations produce significantly larger class-margin perturbation than moving low-attention demonstrations.
Experiment 2: How input dimension affects permutation sensitivity
Setting
Remark 3.1 predicts that RoPE has a stronger dependence on the input dimension than one-hot PE. We test this prediction on the synthetic linear-regression task using one-layer, single-head linear self-attention models with either one-hot PE or RoPE.
For each input dimension , we sample and , normalize to unit norm, and generate labels as . We train a separate model for each positional encoding and input dimension using Adam with learning rate , batch size 32, and 10,000 training steps.
At inference, we fix the context length to and transposition number to . For each dimension, we estimate the expected prediction change over 500 independently sampled test instances.
To quantify the dimension dependence, we fit the power law by ordinary least squares in log-log coordinates, where is the empirical scaling exponent.
Results
| Input dimension | One-hot PE: | RoPE: |
|---|---|---|
| 1 | 0.00127078 | 2.57079044e-06 |
| 2 | 0.00184711 | 6.56334041e-06 |
| 3 | 0.00267245 | 3.55658272e-05 |
| 4 | 0.00297187 | 6.91486326e-05 |
| 5 | 0.00359123 | 6.97901324e-05 |
| 6 | 0.00370920 | 8.05296159e-05 |
| 7 | 0.00431968 | 1.01911101e-04 |
| 8 | 0.00433967 | 1.25445788e-04 |
| 9 | 0.00471575 | 1.52291278e-04 |
| 10 | 0.00544142 | 1.64726569e-04 |
| 11 | 0.00529275 | 1.58021702e-04 |
| 12 | 0.00591298 | 2.11370882e-04 |
| 13 | 0.00580478 | 2.48443487e-04 |
| 14 | 0.00645514 | 3.74706805e-04 |
| 15 | 0.00698223 | 3.69552327e-04 |
| 16 | 0.00682288 | 3.88806292e-04 |
| 17 | 0.00695006 | 4.42465334e-04 |
| 18 | 0.00676017 | 4.69836790e-04 |
| 19 | 0.00711238 | 5.03529845e-04 |
A log-log least-squares fit to the points gives
| Positional encoding | power law | |
|---|---|---|
| One-hot PE | 0.991409 | |
| RoPE | 0.966782 |
The prediction change grows approximately as for one-hot PE and as for RoPE. Thus, the empirical dimension dependence under RoPE is substantially steeper than under one-hot PE, directly supporting the qualitative ordering predicted by Theorems 3.1 and 3.2.
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 2/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper analyzes theoretically how the ICL order affects the model outputs. The authors focus on two tasks: linear regression (order invariant) and linear dynamical systems, which depend on the order. For one layer linear attention models with one-hot positional encoding (or RoPE), they prove how much the model output changes when ICL examples are permuted, finding a scaling of , where is the Cayley distance of the permutation and is the number of ICL examples. The paper shows that this scaling is supported by synthetic experiments, with a similar trend in a small real-data experiment.
Strengths and weaknesses
Strengths
- The problem is well motivated, since ICL sensitivity to prompt ordering is important in practice.
- The theoretical setup is clean. The two tasks chosen are useful to disentangle two different scenarios: tasks invariant and not invariant to ordering.
- The scaling message is intuitive and useful. It gives a simple explanation for why small prompt reorderings may matter less as the context length increases.
- The empirical results are useful. They help validate the qualitative dependence on and , especially in the synthetic settings.
Weaknesses
- For me, the main limitation is the gap between the theoretical bounds and the intuition about ICL performance. The theorems bound output change under prompt permutations, but they do not directly bound ICL success, especially for more complex types of answers.
- The model setup is very simplified, with one-layer linear attention, Gaussian inputs, stable linear systems, and simplified positional encodings. These are reasonable for theory, but the authors should be more careful about how far the conclusions transfer to real LLMs.
- The one-hot positional encoding with concatenation is useful for theoretical analysis, but it is not a standard implementation of positional encoding in modern LLMs. The authors should better explain this difference in the paper.
Questions
- Could the authors make a distinction between the stability of the model output and the stability of ICL performance? In my point of view, the theorem's bounds do not directly imply small changes in test error or prediction accuracy. A short discussion about this would strengthen the paper.
- Remark 3.1 suggests that RoPE may be more unstable in high dimensions. This is a very interesting statement that could be verified empirically and would bridge the gap between the theory and the intuition that can be derived from it. Could the authors add a small experiment varying ?
Limitations
More or less, yes, but I think the limitations should be stated more explicitly. I suggest adding a short limitations paragraph that lists the main simplifying assumptions.
Final justification
In general, I think that the paper improved with the rebuttal. I am still positive about the paper, and I will keep my score. The new experiments address my empirical questions, but my main concern about the connection between output stability and ICL performance remains.
Formatting concerns
No.
4 comments
Rebuttal to reviewer R742
We sincerely thank the reviewer for the careful review and provide our respones below.
Weakness 1 and Question 1: The theoretical bounds concern output change rather than ICL success
Our paper studies permutation robustness which isolates the ordering effect from baseline task difficulty, approximation error, and model capacity. Absolute ICL performance and prompt-order robustness are distinct but complementary quantities: a model may be accurate yet order-sensitive, or inaccurate yet order-stable. Moreover, previous papers have studied the ICL performance on many tasks. For example, linear attention can learn linear regression in-context through gradient descent [1], and ReLU transformers can learn dynamical systems in-context with certain accuracy [2]. These papers use the same in-context format as stated in our paper (eq. 3), where the ICL prediction is stored at the position of 0, and our results are quantifying the output change at this position. So our "output change" result is exactly the same as "ICL prediction change", which makes "the stability of the model output" and "the stability of ICL performance" the same thing, given that our results can directly apply to those papers on ICL performance [1,2].
Our experiments evaluate both quantities (ICL performance and ICL stability) separately. Figure 4 reports inference-time MSE to verify that the models indeed learn the underlying ICL tasks, while Figures 1-3 and 5-6 measure the additional change caused only by prompt reordering.
[1] Von Oswald, Johannes, et al. "Transformers learn in-context by gradient descent." International Conference on Machine Learning. PMLR, 2023.
[2] Guo, Tianyu, et al. "How do transformers learn in-context beyond simple functions? a case study on learning with representations." ICLR 2024.
Weakness 2: The theoretical setting is simplified and may not transfer to real LLMs
The simplified setting is used to isolate the positional mechanism. Linear regression is order-invariant, so any change after reordering is attributable to the architecture; the dynamical system is order-sensitive, so the analysis additionally reveals how task dynamics affect the sensitivity constant. This controlled contrast would be obscured in a fully realistic language-model setting.
Our paper then tests transfer beyond the assumptions rather than assuming it. Appendix D studies 12-layer, 8-head softmax Transformers with MLPs and layer normalization, and Section 4 studies pretrained Qwen2.5-Instruct models. The qualitative dependence on permutation size and context length remains visible in these substantially more realistic architectures. Therefore, the theory provides mechanism-level predictions, and the deep/pretrained experiments evaluate their external relevance.
Weakness 3: Concatenated one-hot PE is not a standard PE implementation
The concatenated one-hot construction is a direct-sum realization of additive positional encoding: Its purpose is to place content and position in identifiable subspaces, allowing the proof to determine exactly which columns of and create content--position coupling. A dense additive embedding mixes the same interaction across coordinates and makes this mechanism less identifiable.
Of course, the paper's conclusions are not restricted to this analytical construction. Theorems 3.2 and 3.4 independently analyze RoPE, and Appendix D empirically evaluates RoPE, sinusoidal PE, and ALiBi in deep softmax Transformers.
We'll add the discussion above in the paper.
Question 2: Can the authors empirically test the dimension dependence suggested for RoPE?
Yes. We added a controlled dimension sweep in which the context length, permutation size, training protocol, and evaluation distribution are fixed while only the input dimension is varied (please refer to the Additional Experiments part). A log-log fit gives an empirical exponent of approximately for one-hot PE and for RoPE. Thus, the observed RoPE sensitivity grows substantially faster with dimension than the one-hot sensitivity, supporting the qualitative prediction of Remark 3.1.
The theoretical factors for one-hot PE and for RoPE are worst-case upper-bound dependences obtained through norm inequalities. The empirical exponents are smaller than the worst-case exponents in the upper bounds, which is expected because the theoretical derivation uses uniform max-norm and matrix-norm relaxations and does not assume that the learned weights attain the worst case.
Additional Experiments
Experiment 1: How softmax attention influencs sensitivity
Setting
Section 5 suggests that for softmax attention, prompt-order sensitivity depends on the attention mass assigned to the moved demonstrations rather than only on the permutation size . We test this hypothesis using Qwen models on Subj and SST-2 (sentiment classification).
We use Qwen2.5-1.5B/7B-Instruct with balanced demonstrations and disjoint same-label transpositions. For each original prompt, we compute the attention score for each demonstration by summing the query readout position's attention over the tokens belonging to that demonstration and averaging over all heads in the final four layers of the model. We then rank the demonstrations by this score. Starting from the same base prompt, we constructed two matched permutations:
- In the high-influence setting, we select target demonstrations from the top of the attention ranking.
- In the low-influence setting, we select target demonstrations from the bottom of the ranking.
For each original or permuted prompt , we score each candidate class label by appending the label to the prompt and averaging the teacher-forced log probabilities of its tokens. Let and denote the two label scores, and define the signed class margin as We measure the effect of permutation using which quantifies how much the reordering changes the model's relative preference between the two labels, even when the predicted label does not flip.
We use 200 queries, three independently sampled base prompts per query, and both values of , yielding 1200 matched high-versus-low pairs.
Results
| Model, task, and influence measure | Mean : high | Mean : low | |
|---|---|---|---|
| Qwen-1.5B, SST-2 | 0.526 / 0.626 | 0.369 / 0.439 | |
| Qwen-1.5B, Subj | 0.330 / 0.419 | 0.226 / 0.334 | |
| Qwen-7B, Subj | 1.180 / 1.394 | 0.746 / 0.972 |
In both Subj and SST-2 experiments, moving high-attention demonstrations produce significantly larger class-margin perturbation than moving low-attention demonstrations.
Experiment 2: How input dimension affects permutation sensitivity
Setting
Remark 3.1 predicts that RoPE has a stronger dependence on the input dimension than one-hot PE. We test this prediction on the synthetic linear-regression task using one-layer, single-head linear self-attention models with either one-hot PE or RoPE.
For each input dimension , we sample and , normalize to unit norm, and generate labels as . We train a separate model for each positional encoding and input dimension using Adam with learning rate , batch size 32, and 10,000 training steps.
At inference, we fix the context length to and transposition number to . For each dimension, we estimate the expected prediction change over 500 independently sampled test instances.
To quantify the dimension dependence, we fit the power law by ordinary least squares in log-log coordinates, where is the empirical scaling exponent.
Results
| Input dimension | One-hot PE: | RoPE: |
|---|---|---|
| 1 | 0.00127078 | 2.57079044e-06 |
| 2 | 0.00184711 | 6.56334041e-06 |
| 3 | 0.00267245 | 3.55658272e-05 |
| 4 | 0.00297187 | 6.91486326e-05 |
| 5 | 0.00359123 | 6.97901324e-05 |
| 6 | 0.00370920 | 8.05296159e-05 |
| 7 | 0.00431968 | 1.01911101e-04 |
| 8 | 0.00433967 | 1.25445788e-04 |
| 9 | 0.00471575 | 1.52291278e-04 |
| 10 | 0.00544142 | 1.64726569e-04 |
| 11 | 0.00529275 | 1.58021702e-04 |
| 12 | 0.00591298 | 2.11370882e-04 |
| 13 | 0.00580478 | 2.48443487e-04 |
| 14 | 0.00645514 | 3.74706805e-04 |
| 15 | 0.00698223 | 3.69552327e-04 |
| 16 | 0.00682288 | 3.88806292e-04 |
| 17 | 0.00695006 | 4.42465334e-04 |
| 18 | 0.00676017 | 4.69836790e-04 |
| 19 | 0.00711238 | 5.03529845e-04 |
A log-log least-squares fit to the points gives
| Positional encoding | power law | |
|---|---|---|
| One-hot PE | 0.991409 | |
| RoPE | 0.966782 |
The prediction change grows approximately as for one-hot PE and as for RoPE. Thus, the empirical dimension dependence under RoPE is substantially steeper than under one-hot PE, directly supporting the qualitative ordering predicted by Theorems 3.1 and 3.2.
Thank you to the authors for the extremely detailed rebuttal.
Weakness 1 and Question 1
So our "output change" result is exactly the same as "ICL prediction change", which makes "the stability of the model output" and "the stability of ICL performance" the same thing, given that our results can directly apply to those papers on ICL performance [1,2].
I completely disagree that the stability of model outputs is the same thing as the stability of ICL performance. For instance, in a classification problem, the model outputs can change substantially while the predicted label, and then the accuracy still is the same. Also, a small output change can change the prediction when the model is close to the decision boundary.
Weakness 2
The qualitative dependence on permutation size and context length remains visible in these substantially more realistic architectures. Therefore, the theory provides mechanism-level predictions, and the deep/pretrained experiments evaluate their external relevance.
I don't agree with this conclusion, since there is no mechanism-level analysis in the paper. Still, I agree that the paper provides intuition about possible mechanisms used by real LLMs.
Weakness 3
Thanks for the answer. Adding this discussion will improve the paper.
Question 2 and Additional Experiments
Thank you for these experiments. They indeed make the arguments in the paper more solidly grounded.
In general, I think that the paper improved with the rebuttal. I am still positive about the paper, and I will keep my score. The new experiments address my empirical questions, but my main concern about the connection between output stability and ICL performance remains.
We thank the reviewer for the further discussion and recognition of our work.
For weakness 1, we are trying to say that under the setting studied in our paper (linear regression and dynamical systems), or more generally, for continuous functions with finite Lipschitz constant (or if the test loss is measured by MSE), the statement "the stability of ICL is the same as the stability of the output" holds. We agree with the reviewer that for those tasks with infinite Lipschitz constant such as classification, a small shift in the output may lead to a very different ICL prediction result, and we think that studying how permutation affects the ICL stability of tasks such as classification would be very interesting and may be left as future work.
For Weakness 2, the phrase “mechanism-level predictions” was potentially misleading. We did not intend to claim that the paper identifies the algorithm by which real LLMs implement ICL. By “mechanism,” we mean the explicit dependency structure governing permutation-induced output changes in our theoretical model. In particular, our bounds show how sensitivity depends jointly on the type of positional encoding, positional displacement, transformer weights, context length, input dimension, and task-specific stability and covariance parameters. The one-hot analysis exposes the relevant content–position interactions, while the RoPE analysis identifies the dependence on rotary phase displacement. We will use the more precise phrase “controlled architectural explanation” rather than “mechanism-level prediction.”
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 2/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper analyses prompt-order sensitivity for in-context learning with transformer-based architecture. Linear regression and simple time-series problems are used in conjunction with positional encodings (concatenative one-hot/absolute positional encodings, and (matrix) multiplicative rotary positional encodings. Positional encodings break the permutation invariance that transformer-based architectures would have possessed in their absence. The authors suggested metrics to quantify the sensitivity to permutations and order changes. The presented simulations agree with the proposed theory and existing literature on the topic of in-context learning.
Strengths and weaknesses
The paper is clear, well-written, and forms a well-structured narrative. The presented analysis and examples are useful illustrations of permutation sensitivity with transformer-based architectures and positional encodings/embeddings. The paper largely consolidates existing knowledge on transformers and in-context learning with illustrative examples, and it serves as a valuable reference that brings these ideas together in a coherent and accessible way. The authors did an excellent job visualizing and communicating their ideas.
The main weakness of the paper is that the ideas and information are well-established. The specific details of their approach, architecture, choice of problems and metrics might be unique, but it does not provide significantly new insights beyond what has already been established.
The authors provided additional empirical evidence to support their theory-derived claims.
Questions
Are there implications for real-world in-context learning setups beyond the highly specific problems studied?
Limitations
yes
Final justification
The authors provided additional empirical evidence to support their theory-derived claims. Moderately adjusted score to reflect improvements and discussion based on rebuttal.
Formatting concerns
None
4 comments
Rebuttal to reviewer 5s5C
We sincerely thank the reviewer for the careful review and we provide our responses below.
Weakness 1. New insights beyond what has already been established
We believe our contribution is beyond re-establishing the observation that prompt order matters. Prior work establishes the existence of prompt-order sensitivity, and our paper characterizes its magnitude and mechanism as a joint function of the permutation, context length, positional encoding, model parameters, and task distribution.
We list the new insights provided by the paper below:
- Local and global reorderings behave differently. The leading dependence is , where is the Cayley distance. Thus, a fixed-size reordering is diluted as the context grows, whereas a global reordering with can retain an effect. This distinction is not available from the qualitative statement that order matters.
- Different positional encodings induce different permutation geometries. For one-hot PE, sensitivity is controlled by Cayley distance and explicit differences between position-related columns of and . For RoPE, it is controlled by the accumulated rotary displacement $ \Theta_{\mathrm{RoPE}}(\pi) =\sum_j 2\max_r|\sin(\frac{(\pi(j)-j)\theta_r}{2})|. $ Therefore, two permutations with the same number of transpositions can have different effects because they produce different rotary phase displacements.
- The task distribution changes the sensitivity constant. In the dynamical-system results, the bound depends explicitly on stability, process noise, state covariance, and temporal correlation (Theorem 3.3-3.4). This separates architecture-induced order sensitivity from sensitivity inherited from the sequential task itself.
These conclusions constitute a PE-specific and task-specific characterization of prompt-order sensitivity, which we believe are never quatitatively stated before.
Question 1. Implications for real-world ICL beyond the specific problems studied
We list the implications for real-world ICL below.
First, for a fixed-size reordering, increasing the context length generally reduces prompt-order sensitivity. This trend appears in our synthetic experiments, deep softmax Transformers, and pretrained Qwen models on Subj (Section 4). For softmax attention, Section 5 suggests that the relevant refinement of is the attention mass assigned to moved demonstrations, . We directly test this prediction through a paired intervention on Qwen2.5-Instruct. Holding fixed the demonstration set, label sequence, Cayley distance and positional displacement, moving high-attention demonstrations produces a significantly larger class-margin change than moving low-attention demonstrations (please see the Additional Experiments part of the rebuttal). Thus, practical prompt robustness depends not only on how many demonstrations are moved, but also on which demonstrations are moved.
Second, our RoPE theory and synthetic experiments show that positional displacement matters in addition to the number of moved examples. The bound depends on the accumulated rotary displacement , so permutations with the same support size can have different sensitivity because they induce different rotary phase changes. This suggests that prompt-ordering methods for RoPE-based models should account for positional displacement rather than treating all permutations of the same size as equivalent.
Third, the law clarifies the scope of the context-length dilution effect. It provides a decreasing robustness bound for sparse or fixed-size reorderings. When the permutation size grows proportionally with the context length, however, the bound no longer vanishes. Thus, the paper implies longer prompts do not by themselves provide a uniform robustness guarantee against global reorderings.
Additional Experiments
Experiment 1: How softmax attention influencs sensitivity
Setting
Section 5 suggests that for softmax attention, prompt-order sensitivity depends on the attention mass assigned to the moved demonstrations rather than only on the permutation size . We test this hypothesis using Qwen models on Subj and SST-2 (sentiment classification).
We use Qwen2.5-1.5B/7B-Instruct with balanced demonstrations and disjoint same-label transpositions. For each original prompt, we compute the attention score for each demonstration by summing the query readout position's attention over the tokens belonging to that demonstration and averaging over all heads in the final four layers of the model. We then rank the demonstrations by this score. Starting from the same base prompt, we constructed two matched permutations:
- In the high-influence setting, we select target demonstrations from the top of the attention ranking.
- In the low-influence setting, we select target demonstrations from the bottom of the ranking.
For each original or permuted prompt , we score each candidate class label by appending the label to the prompt and averaging the teacher-forced log probabilities of its tokens. Let and denote the two label scores, and define the signed class margin as We measure the effect of permutation using which quantifies how much the reordering changes the model's relative preference between the two labels, even when the predicted label does not flip.
We use 200 queries, three independently sampled base prompts per query, and both values of , yielding 1200 matched high-versus-low pairs.
Results
| Model, task, and influence measure | Mean : high | Mean : low | |
|---|---|---|---|
| Qwen-1.5B, SST-2 | 0.526 / 0.626 | 0.369 / 0.439 | |
| Qwen-1.5B, Subj | 0.330 / 0.419 | 0.226 / 0.334 | |
| Qwen-7B, Subj | 1.180 / 1.394 | 0.746 / 0.972 |
In both Subj and SST-2 experiments, moving high-attention demonstrations produce significantly larger class-margin perturbation than moving low-attention demonstrations.
Experiment 2: How input dimension affects permutation sensitivity
Setting
Remark 3.1 predicts that RoPE has a stronger dependence on the input dimension than one-hot PE. We test this prediction on the synthetic linear-regression task using one-layer, single-head linear self-attention models with either one-hot PE or RoPE.
For each input dimension , we sample and , normalize to unit norm, and generate labels as . We train a separate model for each positional encoding and input dimension using Adam with learning rate , batch size 32, and 10,000 training steps.
At inference, we fix the context length to and transposition number to . For each dimension, we estimate the expected prediction change over 500 independently sampled test instances.
To quantify the dimension dependence, we fit the power law by ordinary least squares in log-log coordinates, where is the empirical scaling exponent.
Results
| Input dimension | One-hot PE: | RoPE: |
|---|---|---|
| 1 | 0.00127078 | 2.57079044e-06 |
| 2 | 0.00184711 | 6.56334041e-06 |
| 3 | 0.00267245 | 3.55658272e-05 |
| 4 | 0.00297187 | 6.91486326e-05 |
| 5 | 0.00359123 | 6.97901324e-05 |
| 6 | 0.00370920 | 8.05296159e-05 |
| 7 | 0.00431968 | 1.01911101e-04 |
| 8 | 0.00433967 | 1.25445788e-04 |
| 9 | 0.00471575 | 1.52291278e-04 |
| 10 | 0.00544142 | 1.64726569e-04 |
| 11 | 0.00529275 | 1.58021702e-04 |
| 12 | 0.00591298 | 2.11370882e-04 |
| 13 | 0.00580478 | 2.48443487e-04 |
| 14 | 0.00645514 | 3.74706805e-04 |
| 15 | 0.00698223 | 3.69552327e-04 |
| 16 | 0.00682288 | 3.88806292e-04 |
| 17 | 0.00695006 | 4.42465334e-04 |
| 18 | 0.00676017 | 4.69836790e-04 |
| 19 | 0.00711238 | 5.03529845e-04 |
A log-log least-squares fit to the points gives
| Positional encoding | power law | |
|---|---|---|
| One-hot PE | 0.991409 | |
| RoPE | 0.966782 |
The prediction change grows approximately as for one-hot PE and as for RoPE. Thus, the empirical dimension dependence under RoPE is substantially steeper than under one-hot PE, directly supporting the qualitative ordering predicted by Theorems 3.1 and 3.2.
Thanks for providing more information. The presented results are consistent with the predictions from theorem 3.1 and 3.2. I will adjust my review scoring.
We thank the reviewer for the careful consideration and for updating your assessment. We are glad that our response addressed your concerns. We sincerely appreciate your constructive review, which has helped us improve the paper.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
We thank the AC for the summary and summarize our discussions with the reviewers below.
First we clarify that the contribution is not only the isolated O(k/N) exponent. Repeatedly applying Hahn's single-symbol influence result may motivate a coarse O(k/N) envelope, but it does not recover Theorems 3.1-3.4. Hahn considers a generic perturbation of one input in a fixed-depth soft-attention Transformer, whereas we study structured permutations that preserve the complete demonstration multiset but change its alignment with positional information. For one-hot PE, our proof gives an exact transposition decomposition and a sharper bound controlled by differences between the position-related columns of K⊤Q and V. These quantities can vanish even when the global weight norms are nonzero. For RoPE, the bound depends on the frequency-resolved rotary displacement ΘRoPE(π), so two permutations with the same Cayley distance can have different sensitivity. For dynamical systems, the constants additionally expose stability, covariance, and process-noise dependence, and Appendix B gives a parameter-level condition for exact query invariance. Moreover, the explicit 1/N normalization supplies only the denominator, and we need to prove that the remaining numerator is independent of N after cancellation for unbounded Gaussian and correlated inputs. We also added additional experiments with controlled dimension sweep, further supporting the PE-specific distinction, with empirical exponents of approximately 0.6 for one-hot PE and 1.7 for RoPE. Thus, the contribution is the PE, permutation, model, and task-dependent structure hidden by the coarse k/N notation.
Second, in the settings analyzed in our paper, the query-position output is exactly the ICL prediction, and performance is evaluated by MSE. Therefore, stability of the output and stability of the ICL prediction refer to the same quantity. Under the Gaussian assumptions of our regression and dynamical-system analyses, controlling this prediction change also directly controls the corresponding change in MSE. More generally, the same implication holds whenever the evaluation loss has a finite Lipschitz constant with respect to the prediction. For discrete classification the scenario is different since label and accuracy stability additionally depend on the decision margin. We will clarify that our equivalence claim concerns the continuous ICL settings studied in the paper, and leave a formal margin-based classification extension to future work.
Third, each simplification is introduced to isolate positional encoding as a source of order sensitivity and to make its effect mathematically identifiable. The one-layer linear-attention setting permits an exact decomposition of the query-output change into content-position interaction terms. With softmax attention and multiple layers, these terms would be entangled with attention normalization and layerwise propagation. The concatenated one-hot PE is not intended as a standard implementation for modern LLMs. It places content and position in separate coordinate subspaces, allowing us to identify precisely which positional columns of K⊤Q and V control the sensitivity. Finally, omitting the causal mask removes an independent source of order information and recency bias. Thus, in the order-invariant linear regression task, when demonstration contents are permuted while the positional vectors remain fixed, the resulting output change can be attributed specifically to the PE-content interaction. These controlled choices are complemented by separate RoPE theorems and experiments with deep softmax Transformers and pretrained Qwen models, which indeed verify that the resulting qualitative dependencies persist beyond the formal setting.
Fourth, PE is isolated by construction in the theoretical and synthetic settings: positional encodings remain attached to positions while only demonstration contents are permuted, and no causal mask is present. Thus, causal masking and recency cannot explain the measured sensitivity in the order-invariant regression experiment. For pretrained causal LLMs, we do not claim that PE is the only source of order sensitivity. Those experiments on Qwen models test whether the qualitative signatures remain visible when realistic mechanisms coexist. To further separate attention effects, our additional experiments during rebuttal holds fixed the demonstration set, label sequence, Cayley distance, and positional displacement, and compares moving high versus low-attention demonstrations. Moving high-attention demonstrations consistently produces larger class-margin changes on both Subj and SST-2 and at both 1.5B and 7B Qwen models. This directly supports that PE is an important source of order sensitivity even under causal softmax attention, and aligns with our attention mass prediction in Section 5.