A Tight Hierarchy for Chain of Thought
Thanh Le, A. Pavan, N. V. Vinodchandran
NeurIPS 2026
TL;DR. We prove a tight hierarchy theorem for chain-of-thought reasoning in transformers.
Abstract. Chain-of-thought (CoT) reasoning has emerged as a powerful paradigm for extending the computational capabilities of transformer-based models. A growing body of recent work has begun to uncover the fine-grained computational power of transformers augmented with CoT, as well as their connections to classical complexity theory.
In this work, we advance this line of research by establishing the first hierarchy theorem for CoT-based computation. Our main result shows that for any reasonable resource bound and any ,
where denotes the class of decision problems solvable by transformers using CoT reasoning steps on inputs of length . Our result shows that increasing the number of CoT reasoning steps provably yields strictly greater computational power, establishing CoT steps as a fundamental resource in transformer-based computation.
Unlike classical hierarchy theorems, which are typically proved via diagonalization, our approach leverages known coarse-grained simulations between CoT-augmented transformers and Turing machines in both directions. Building on these connections, we adapt the classical padding technique from complexity theory to this setting to obtain a tight hierarchy. A key technical contribution of our work is the implementation of padding within the transformer-based CoT model.
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:45 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
This paper theoretically analyses transformers with chain of thought, proving that adding chain of thoughts steps strictly increases the ability of the model to solve decisiion problems. The reviewers have raised some concerns regarding significance, unrealisitc assumptions on the transformer models, some mathematical errors, and the fact that the mathematical contribution seems to be based strongly on known results. The authors are encouraged to give their persepctive on these points in their rebuttal.
Final justification
The authors addressed most of the reviewer's concerns in the rebuttal. There seems to be a consensus among the reviewers that this result is novel, mathematically correct and interesting. At the same time, there are some concerns regarding unrealistic assumptions made in the analysis, and there is a feeling that the mathematical results are relatively straightforward. Following two of the three reviewers, I recommended to accept this paper.
Read meta-review
Meta-review
This paper theoretically analyses transformers with chain of thought, proving that adding chain of thoughts steps strictly increases the ability of the model to solve decisiion problems. The reviewers have raised some concerns regarding significance, unrealisitc assumptions on the transformer models, some mathematical errors, and the fact that the mathematical contribution seems to be based strongly on known results. The authors are encouraged to give their persepctive on these points in their rebuttal.
Final justification
The authors addressed most of the reviewer's concerns in the rebuttal. There seems to be a consensus among the reviewers that this result is novel, mathematically correct and interesting. At the same time, there are some concerns regarding unrealistic assumptions made in the analysis, and there is a feeling that the mathematical results are relatively straightforward. Following two of the three reviewers, I recommended to accept this paper.
1 comment
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 2/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proves the first hierarchy theorem for chain-of-thought (CoT) computation in transformers. Working with decoder-only transformers that generate intermediate reasoning tokens before answering, the authors define CoT(r(n)) as the class of decision problems solvable using O(r(n)) chain-of-thought steps on inputs of length n. Their main result is that for any time-constructible resource bound r(n) ≥ n and any e > 0, CoT(r(n)) is strictly contained in CoT(r(n)^{1+e}): a small increase in the number of reasoning steps strictly increases computational power. This positions the number of CoT steps as a computational resource analogous to time and space in the Turing machine model, where increased resources are known to yield strictly greater capability.
The proof avoids diagonalization, which is awkward in this setting because there is no clean notion of a universal transformer that parses and simulates another transformer step by step. Instead, the authors build on known two-way simulations between CoT transformers and time-bounded Turing machines (following Merrill–Sabharwal): combined with the classical Time Hierarchy Theorem, these simulations yield a coarse CoT hierarchy, separating CoT(r) from CoT(r^9) but no finer. To sharpen this into the tight (1+e) separation, the authors adapt the padding (translational) technique from complexity theory: assuming two CoT classes collapse, a padded language is used to bootstrap the collapse to successively larger exponents until it contradicts the coarse separation. The central technical work is implementing padding within the transformer model itself, which requires constructing transformers that append and verify padding tokens, mask attention so the padding does not disturb the simulated computation, and copy intermediate representations to the needed positions, all built from a set of small transformer gadgets developed in the appendix. The paper is purely theoretical and leaves open the tighter, classical-strength separation CoT(r) strictly contained in CoT(r·polylog(r)).
Strengths and weaknesses
Strengths:
- Treating the number of CoT steps as a computational resource and asking whether it admits a hierarchy is natural and well-motivated, and the main results is quite remarkable.
- Sidestepping diagonalization (which doesn't fit transformers) and instead combining known TM to CoT simulations with the padding technique is the right move. The single padding exponent c = (1+2ε)/(1+ε) serves both directions of the argument at once.
Weaknesses:
- The coarse hierarchy CoT(r) strictly contained in CoT(r^9) falls immediately out of Merrill–Sabharwal's simulations plus the classical Time Hierarchy Theorem. The contribution is the padding refinement to (1+ε), and padding is a textbook 1960s technique; the authors' own framing concedes the novelty is implementing it, not the idea.
- The writing repeatedly obscures the steps needed to check it. For instance, the exponent step in the construction is stated as an exact equality, , which is false; it holds only as a -relation (via , a fact the paper never states explicitly). Compounding this, the two length variables, (original input) and (padded input), are used interchangeably as the argument of across both constructions without a consistent conversion. Each issue is individually fixable, but collectively they mean the construction cannot be verified without substantial reconstruction by the reader.
Questions
Q1. In the copy gadget (layer L+2), your scores are qᵢᵀkⱼ = 1·(−1/j) + 1(i = m+\lfloor m^c \rfloor·1(j = m). The −1/j term differs between adjacent positions by O(1/j²), while the indicator bump has magnitude 1. Under average-hard attention, why does the argmax come out as a unique winner (j = i normally, j = m at the special position) instead of producing a tie set that gets averaged?
q2. Can you please comment on the masking assumption that you make in the paper, i.e., you disregard attending to all positions in the past. How meaningful is this assumption in practice? Is it possible to obtain the result without this assumption?
Limitations
The main limitation of the paper is that it cannot replicate classical time hierarchy theorems separating functions up to a logarithmic factor. This is acknowledged by the authors and left as an open problem.
Final justification
The authors have clarified some issues I had with the paper's presentation. I feel the paper can be accepted, but I personally do not feel it is a particularly strong or novel contribution.
Formatting concerns
No concerns.
4 comments
Rebuttal
W1: As addressed earlier in response to Reviewer bYu2 (Weakness 3), implementing padding is not a priori clear. Many results in the area are obtained by translating known techniques to the realm of transformers.
W2: Padding arguments inherently require reasoning about both the original input length and the padded input length. The proofs translate the original inputs to the padded inputs (when moving from to ) and again from the padded inputs to the original inputs (when moving from to ), and this could be confusing.
While we intended to distinguish these quantities throughout the proof, we will carefully review both constructions and revise the presentation so that every conversion between the original input length and the padded input length is stated explicitly and used consistently.
We thank the reviewer for pointing out that the relation should be stated as a relation rather than as an exact equality. Since the class is defined up to asymptotic bounds, this imprecision does not affect the correctness of the theorem. Nevertheless, we agree that making the asymptotic relationship explicit will improve readability and we will revise the proof accordingly.
Q1: In average hardmax, only the keys with the maximum score will be taken. So, even though the scores differ by only as you mentioned, in the particular case, only one key attains the maximum score, meaning that there is a unique winner. In more details:
We have:
If the query , then we have
Here, the maximum of is uniquely obtained at . Thus, is the unique winner for average hardmax in this case.
On the other hand, if the query , then
so is the unique winner for average hardmax in this case.
Q2: Even though masking is standard, we can avoid it as explained to the reviewer bYu2 (Question 3).
Dear reviewer YKnE,
As the author-reviewer discussion period is coming to an end, could you please respond to the rebuttal? Thanks, AC
I am ok with the response, thanks for the clarifications! I will update my score.
Thank you.
- Rating
- 4/6
- Confidence
- 2/5
- Quality
- 3/4
- Clarity
- 2/4
- Significance
- 3/4
- Originality
- 2/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper establishes a hierarchy theorem for chain-of-thought (CoT) reasoning for decision problems, with the number of reasoning steps as the computational resource. That is, the paper shows that the power of a length- CoT is strictly larger than the power of a length- CoT. Thus, increasing the number of CoT steps strictly increases the computational power of the model.
Their technique uses reductions between CoT transformers and Turing machines instead of the diagonalization technique used in classical results in computational complexity (e.g. time/space hierarchies). A hierarchy theorem follows from previous work of MS23a, however it is more coarse in the sense that there is a polynomial loss in (from to ). This work aims at establishing a tighter CoT hierarchy, that does not experience this loss. Towards this end, they use padding arguments, and their main technical contribution is adapting this technique to transformer architectures.
Overall, the paper contributes a complexity-theoretic structural result for CoT computation, supporting the view that CoT steps are a meaningful formal resource in transformer-based computations.
Strengths and weaknesses
Strengths (1) The question is natural and well-motivated, as CoT is widely used technique and understanding its power is beneficial. A hierarchy theorem is the right kind of structural result to establish this.
(2) The paper bridges classical results from computational complexity theory and modern AI research, which is valuable and appreciated. Also, the high-level proof strategy is elegant: instead of trying to directly diagonalize over transformers, the paper uses known simulations between CoT-augmented transformers and TMs and then uses padding to amplify this into a finer hierarchy.
(3) The main theorem is strong: it separates from for every time-constructible and every . This gives a sharp formal sense in which even a small polynomial increase in CoT steps increases computational power.
Weaknesses
-
The model assumptions and the padding construction should be stated in a more precise and modular way. Also, it was not completely clear to me whether all of the assumptions used in the proof (saturated attention, special positional encodings, tailored attention masks, etc.) are part of of the standard CoT transformer model from the cited work, and I think this should be clarified.
-
The paper would benefit from a clearer discussion of limitations. In particular, the result is about a formal transformer model with specific assumptions, not directly about practical LLM chain-of-thought behavior (for example, the theorem is for decision problems whereas transformers are usually used for "search problems" such as open-ended generation, problem solving, etc.). The introduction sometimes motivates the result through modern AI reasoning, but the formal theorem is a complexity-theoretic result about a stylized/ideal model.
-
The presentation needs polishing. This is especially problematic because the proof is technical and depends on many small construction details. A few examples are detailed next:
(-) The discussion in lines 82-88 is highly interesting, but the bottom line (why a "universal transformer" is conceptually unclear) is not clear enough: is it only the problem of discrete vs. continuous? I think the text should be slightly clarified.
(-) I think that "Descriptions and justifications of " in lines 246-304 is a bit dense and hard to follow.
(-) Very minor points (that do not affect my score):
The is a missing dot at the end of footnote 1.
There is a missing ")" in line 127
"in the Appendix A" should be w/o the "the"
Questions
-
How should the reader interpret the condition ? Is there an inherent reason that the CoT hierarchy should only be stated for at least linear numbers of decoding steps? Indeed, in lines 64-65 you mention that previous works show that any language decidable by -time TM can be decided by a transformer with CoT steps. However, for languages in P for example, the machine will naturally run in polynomial time, but polynomially-many CoT steps seems like a high-depth computation (i.e., highly sequential). So even though previous work considers polynomial-depth CoT, could you please elaborate on the meaning of this regime?
-
Does the hierarchy theorem extend to search problems as well, rather than only decision problems? If not directly, what changes would be needed in the definition of and in the padding argument?
-
The conclusion asks whether one can prove a tighter hierarchy such as . Could the authors clarify whether the current barrier is only the quadratic simulation of CoT by Turing machines, or whether the padding implementation inside the transformer model would also need new ideas for such a result?
Limitations
The authors discuss some open problems in the conclusion, but I think the limitations could be addressed more explicitly. In particular, the main theorem is proved for a formal transformer/CoT model with several specific assumptions and I think it would be useful for the authors to clearly state which assumptions are essential, which are inherited from prior work, and and how the theorem should be interpreted relative to practical transformer/LLM chain-of-thought behavior.
Final justification
I maintained my rating of 4 for the following reasons. I find the sharp hierarchy theorem to be a meaningful structural result, and I think that adapting the padding argument to the Transformer CoT model constitutes a sufficient technical contribution for acceptance. At the same time, the discussion reinforced several limitations and concerns: the model is stylized, the high-level theoretic technique is classical, the result concerns decision problems rather than a natural multi-token search model, and the linear lower bound on the CoT length is a limitation of the current technique. All in all, I do not view this as a particularly novel contribution, but I do believe that the reasons for accepting outweigh the reasons for rejection.
Formatting concerns
none
4 comments
Rebuttal
W1: Thank you for your suggestion. The assumptions that we made are currently stated in Appendix A (Remark A.6). We will move this to the main body. As discussed in response to Reviewer bYu2, the assumptions used are standard in prior works. For example, the attention and precision that we use are the same as in [MS23a]. Regarding padding construction, we attempted to explain the high-level overview in lines 168--186. We will add more details and illustrate this by adding a picture, in the final version.
W2: The goal of this paper is the conceptual understanding of Chain-of-Thought as a computational resource, in the same spirit that one studies Turing machines, Boolean circuits, and RAMs as abstractions of real-world computational devices.
Regarding decision versus search problems, we note that decision problems are a special case of search problems. Consequently, any hierarchy theorem for decision problems implies a corresponding hierarchy for any sufficiently expressive notion of search that subsumes decision. We therefore formulate our results in the decision setting, following the standard practice, where hierarchy theorems are traditionally established for decision problems because they provide the cleanest formal framework.
W3: We agree that the paper would benefit from additional polishing. We will do that in the final version.
Q1: For the padding to work is a technical requirement. Padding as a technique is not translatable to the sub-linear regime.
Q2: As stated above, a hierarchy theorem for decision problems yields a hierarchy theorem for search problems.
Q3: The barrier is not the quadratic simulation of CoT by Turing machines. This is a limitation of the padding technique. In our proof, we invoke the padding a constant number of times. To obtain an even finer hierarchy result, this needs to be done an unbounded number of times, and the proof does not carry through.
Thank you for the clarifications. The rebuttal addresses several of my concerns, although I have remaining questions regarding the model assumptions and the extensions beyond the stated decision setting.
First, I do not think the response fully answers my question about search problems (Q2). It is true that decision problems can be embedded into any sufficiently broad search class by treating the decision bit as a one-bit output. Thus, the decision hierarchy yields a separation for a search class that contains these one-bit problems. However, this is not the same as showing that a natural search version reduces to the decision version or that the padding theorem extends to genuinely multi-token search problems. Even in classical complexity theory, search-to-decision reductions are not automatic -- they generally require additional problem-specific structure, such as self-reducibility (e.g.,, SAT search reduces to SAT decision because one can successively fix variables and ask whether the remaining formula is satisfiable). In the present CoT setting, a genuine search extension would additionally require a precise definition of the resource: how output length is charged, whether producing output tokens consumes CoT steps, what constitutes successful search, and how the padding construction preserves the output. Could the authors clarify whether they intend only the one-bit embedding observation, or whether they claim an extension to a natural multi-token search model?
Moreover, I am also not fully satisfied with the answer concerning (i.e., to Q1). The response explains that this condition is required by the current padding technique, but my question was also how the reader should interpret the regime. Is the at-least-linear condition believed to be merely a limitation of the present proof, or is there a a reason to expect qualitatively different behavior for sublinear numbers of CoT steps?
Search Problems and Linear Bounds
Q1: Thanks for clarifying this question. We agree with the distinction being made. Our intention was only the first observation, namely that every decision problem can be viewed as a search problem with a one-bit output. Consequently, any sufficiently general search model that subsumes such one-bit outputs immediately inherits the corresponding hierarchy theorem.
Following your suggestion, below is an initial attempt to define COT for search problems.
A search problem is specified by a polynomially bounded relation $ R \subseteq \Sigma^* \times \Sigma^*.$ For simplicity, we consider total search problems, where for every , there is a such that and , where is a polynomial-bounded function.
We define the class to consist of all relations such that there is a Transformer decoder which, on every input of length ,
1) generates at most r(n) internal Chain-of-Thought tokens,
2) subsequently generates at most m(n) output tokens, and
3) outputs exactly y such that R(x, y) =1.
The output length accounts for the cost of writing the answer, while the reasoning budget measures the computational power provided by internal Chain-of-Thought reasoning. Thus, when comparing two classes, the output budget is kept fixed, and only the reasoning budget is varied. A natural hierarchy theorem would therefore take the form $ SearchCOT(r,m) \subsetneq SearchCOT(r^{1+\epsilon},m), $
Such a theorem would establish that additional Chain-of-Thought reasoning strictly increases the computational power for search problems, independent of the cost of producing the output. The present work establishes a hierarchy theorem for decision problems.
Obtaining hierarchy theorems for natural search problems is challenging; it is not even known in the Turing machine model and is a significant open problem.
Q2: Thank you for clarifying this question. We conjecture that a similar hierarchy theorem should also hold in the sublinear regime; for example, we expect that $ COT(n^\varepsilon)\subsetneq COT(n^{\varepsilon'}) \text{ for every } 0<\varepsilon<\varepsilon'<1. $ However, our current proof technique does not extend to this setting for two reasons. First is that our argument proceeds by a time-bounded simulation of Transformers by Turing machines. Since Turing machines typically require time at least linear, the classical hierarchy theorem applies only to time bounds that are at least linear. Consequently, our result inherits the assumption that .
It is also unclear to us how the padding construction should be adapted to the sublinear regime, where the reasoning budget is smaller than the input length. Extending hierarchy theorems to sublinear Chain-of-Thought lengths is an interesting open problem. We will include this discussion in the revised version as part of the limitations and future directions.
Thank you, this addresses both of my remaining questions.
On search problems, I agree with the clarification that the present result only gives the one-bit embedding, while obtaining hierarchy theorems for natural multi-token search problems is a genuinely challenging separate question. The proposed definition helps make this distinction precise.
On , the response also clarifies that this is a limitation of the current simulation-and-padding proof technique, rather than a conjectured barrier for sublinear CoT.
- Rating
- 3/6
- Confidence
- 4/5
- Quality
- 4/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 investigates fine-grained time hierarchies for Transformer decoders equipped with chain-of-thought (CoT) reasoning.
Its central question is whether increasing the number of available CoT steps leads to a strict increase in expressiveness. The main result answers this affirmatively: for every and every time-constructible function with , the paper proves
.
Thus, in this formal model, allowing more CoT steps strictly increases the class of problems that can be solved.
Strengths and weaknesses
The main strength of the paper is that it is clearly written and makes a substantial effort to make the theoretical constructions accessible. This is very helpful for readers who are not already familiar with this kind of argument. Even though I am generally familiar with these techniques, I found the exposition useful for recapitulating the relevant classical ideas.
The main weaknesses of the paper concern significance.
First, I think the motivation for studying Transformer decoders as an abstract computational model could be made stronger. As stated in the introduction, the model under consideration is already known to be Turing-complete. The translation from Turing machines to Transformer decoders may indeed be too coarse to immediately transfer a fine-grained hierarchy such as to the corresponding chain-of-thought setting. However, one might expect that weaker hierarchy results could be obtained rather directly from the existing simulation. This raises the question of what additional conceptual or technical insight is gained from the fine-grained hierarchy established in the paper.
Second, the Transformer decoder model considered in the paper appears rather artificial. It relies on assumptions such as average-hardmax attention, powerful positional encodings, and very specialised use of masking in the original input during inference. I understand that related Turing-completeness results for Transformer decoders also rely on idealized assumptions. Nevertheless, this makes it less clear what the significance of a fine-grained study of this particular model is, especially from the perspective of understanding practically relevant Transformer architectures.
Third, the argument for Theorem 3.2 seems relatively straightforward once the relevant classical results from computability theory are available. For instance, Lemma 3.1 appears to contain most of the technical work. The paper identifies as a key technical challenge the problem of simulating on inputs containing padding tokens without changing its original behavior. However, the proposed solution uses masking in a way that, in my view, makes this challenge largely disappear. Since this masking mechanism is itself quite specialised, I found it difficult to identify substantial new technical insight gained by the proof techniques developed in the paper.
Questions
-
I think that my first and second concerns could potentially be addressed by a stronger motivation and a clearer explanation of the intended modelling assumptions. I would be open to discussing this further, and it is possible that I am missing part of the broader picture here.
-
Lines 182--183: If I understand the construction correctly, the input is already assumed to be padded. Why are additional heads or layers needed to write padding tokens?
-
Do the authors see a way to make the proof work without effectively masking the padding tokens away? This would make the construction more convincing to me, since the current use of masking seems to remove precisely the difficulty that the simulation has to overcome.
-
Line 375: Unless I am mistaken, iterating the argument yields an exponent of the form , rather than . If this is correct, I assume this should be easy to fix.
Limitations
The assumptions and results are rigorous, so the limitations are clear after a careful read of the paper.
Formatting concerns
None
6 comments
Rebuttal on Weaknesses
W1: We believe the key conceptual contribution is establishing a tight hierarchy theorem as well as establishing that the Chain-of-Thought length itself is a genuine computational resource. While Turing completeness shows that Transformer decoders can eventually simulate arbitrary computation, it does not reveal how computational power scales with the available reasoning budget.
Indeed, the known simulation from Turing machines yields only a coarse hierarchy result (mentioned in line 97). Our theorem establishes a fine-grained hierarchy, showing that for every ,
This rules out the possibility that large ranges of reasoning budgets are computationally equivalent (for example, ) and demonstrates that every polynomial increase, however small, in the Chain-of-Thought length yields strictly greater computational power. Thus, our result demonstrates that Chain-of-Thought length behaves as a bona fide computational resource, analogous to time and space in classical complexity theory. We believe this constitutes a substantially richer structural understanding than the qualitative statement of Turing completeness alone.
W2: In the emerging area that studies the expressive power of Transformers, the assumptions used in the paper are standard. Average hardmax is widely studied due to its mathematical simplicity compared to softmax. Based on current theoretical results, average hardmax appears to be computationally equivalent to softmax, in the sense that no separation between them is known (see Table 1 of the survey article [Str+24]).
From a practical point of view, trained softmax systems usually exhibit attention concentrated almost equally on a few dominant positions. Thus, the work of [1] argues that average hardmax is a realistic approximation of how Transformers behave in practice. This motivates average hardmax as a reasonable and mathematically simple abstraction of softmax attention.
W3: We would like to clarify that the masking assumption is not essential. The masking mechanism can be eliminated by introducing a constant number of additional Transformer layers (rebuttal to Q3), and is used only to simplify the presentation rather than as a source of computational power.
More broadly, while our proof draws on classical ideas from computational complexity, adapting these ideas to the Transformer model is a priori not straightforward. This phenomenon is common in the emerging theory of Transformers. For example, the lower bounds of [Hah20] for constant-depth Transformers are inspired by techniques from circuit complexity, yet their implementation requires substantial new arguments tailored to the Transformer architecture.
Likewise, our contribution is not merely invoking a padding technique, but showing how these complexity-theoretic ideas can be realized within the constraints of the Transformer model. We believe this adaptation constitutes the main technical contribution of the paper.
Finally, we would like to point out that a (perhaps minor) contribution is providing a comprehensive collection of primitives for manipulating Transformers (Appendix B).
[1] Merrill, William Cooper, Ashish Sabharwal, and Noah A. Smith. "Saturated transformers are constant-depth threshold circuits." Transactions of the Association for Computational Linguistics 10 (2022): 843-856.
Rebuttal: answers to Questions
Q1: Please see our responses to the first and second weaknesses.
Q2: The first part of the construction is not padding an already padded input. The Transformer receives a padded string as input, and the challenge is to simulate on the unpadded portion of the input. A straightforward simulation would place attention on the * symbols and therefore does not work.
Once we have a Transformer that solves using reasoning steps, we would like to solve using reasoning steps. Since operates on the padded language , we first use the initial CoT steps to insert the * symbols, thereby reconstructing the padded string on which can operate. We will clarify this point in the final version.
Q3: Yes, we can avoid the use of masking using additional layers and we explain below. We will include this in the final version.
-
Use the first few layers of the transformer to do the following:
- Layer 1, 2: Calculate $ \mathbf{1}(i \geq m + \lfloor m^c \rfloor + 1) $ (for each query ) - this can be achieved by Corollary B.3. Note that Corollary B.3. is more general than than task of calculating just but can be modified easily to achieve the effect.
- Layer 3, 4: Calculate $ \mathbf{1}(m+1 \leq i \leq m + \lfloor m^c \rfloor) $ by Corollary B.3.
- Layer 5: Use feedforward network to multiply to $ \mathbf{1}(m+1 \leq i \leq m + \lfloor m^c \rfloor) $ to get $ (-\infty)\mathbf{1}(m+1 \leq i \leq m + \lfloor m^c \rfloor). $
-
Next, for every layer afterwards that does not involve layer_norm, use the exact same heads as in (in Lemma 3.1) with the only difference that for every head, for any query and key , embed the query and key such that
So, when $ i \geq m + \lfloor m^c \rfloor + 1 \quad\text{and}\quad m+1 \leq j \leq m + \lfloor m^c \rfloor, $ we have $ \mathbf{q}_i^T \mathbf{k}_j = -\infty, $ meaning query will not attend to key .
Otherwise, $ \mathbf{q}_i^T \mathbf{k}_j = 0 + \text{ other stuff}, $ so attention is calculated as normal.
-
On the other hand, for every layer afterwards that involves layer_norm, layer_norm will interfere with (i.e. alter) the values $ v_{i,1} := \mathbf{1}(i \geq m + \lfloor m^c \rfloor + 1) $ and $ v_{i,2} := \mathbf{1}(m+1 \leq i \leq m + \lfloor m^c \rfloor), $ which is not what we want.
To solve this, say
is the current vector, and wants to perform layer_norm on the part (where is a vector, are scalars). We can add a layer just to perform layer_norm on (construct so that values are (for each key ), key is maximized at (just by using key at to be ), and query to be (using the affine part of the query transformation)). We save
into placeholder dimensions. So, after this layer we yield
Next we add a layer on what would have performed on
The difference is that now we already have
so no need to do layer_norm anymore (therefore, the numbers and are intact). We just need to use the numbers and to reproduce the mask and perform calculations just on (like in the bullet point above).
Thus, we have obtained the desired mask effect.
Q4: In line 375, is correct. Lemma 3.1 essentially gives "if , then ". Thus, inductively if we have for some , then letting and applying Lemma 3.1, we obtain that
By induction, we get that line 375 is valid.
thanks
Thank you for responding to my points and making your view of things clear! I see all my major points adressed and no need for further discussion on this.
Regarding Q3: What exactly do you mean by "using an FFN to multiply \infty"?
Comments on the paper
1 comment
Dear reviewers, could you please carefully read the responses of the reviewers and let us know if you are convinced, and if you have any further questions?
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Rebuttal
We thank the reviewers and the meta-reviewer for constructive suggestions and questions. We addressed all the concerns about the model assumptions and the significance of the results and also explained that there are no mathematical errors in the proofs.