Venue: NeurIPS 2022 Conference

Reviews:

final_score: rating: 7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.
review_content: summary: This paper tried to find an energy function underlying the transformer model and reinterpret transformers as the unfoling of an interpretable optimization process across iterations. This paper starts from the complete Transformer architecture, and due to the structural complexity of the transformer, this paper addresses several challenges in the derivation process including heterogeneous layer types and non-linear activations.
strengths_and_weaknesses: Strengths
- Detailed theoretical proofs are provided.
- Writing is logical and well laid out.

Weaknesses
- The approach of this paper seems to construct an energy function behind the network optimization process by analyzing the existing standard Transformer structure. Although the article mentions the practical value, this approach seems to be difficult to inspire the network design and the experimental part fails to provide the corresponding proof. Is there any actual demonstration of constructing a network out of the energy function in reverse?
- This paper mentions that the unfolding perspective has been adopted to analyze MLPs and CNNs. In terms of comparison at the network level, is there an opportunity to compare the energy function behind the different networks and the difference between their strengths and weaknesses?
questions: Please refer to the weaknesses.
limitations: No but not need.
review_title: null

final_score: rating: 5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.
review_content: summary: The paper attempts to analyze the Transformer architecture from energy minimization perspective. In other words, authors seek an energy function (of input representations), such that minimizing this function is equivalent to running the forward pass of a corresponding transformer model. The paper lists the key challenges of building such energy function. Authors then address these challenges and propose an AIM-based procedure that corresponds to running the forward pass of a transformer with some additional constraints on model parameters.
Finally, the paper conducts two practical experiments where they show that transformers "as described previously, up to known limitations 
like symmetric weights" actually reduce the corresponding energy function with subsequent model layers.


strengths_and_weaknesses: Authors propose a curious and novel (to my understanding) perspective on the popular transformer architecture.
To the best of my understanding, the overall approach looks sound, and the specific theoretical derivations for constructing the optimization procedure look solid. However, I am not an expert in the narrow domain of viewing and may have missed something.

My main concerns, however, are about practical applicability of the derived results.

### Section 6, Figures 5,6

Based on my understanding of the supplementary code (in particular, ./code/energy_curve/main.py , line 32-55) and the text presented in Section 6, __the energy figures 5,6 represent an untrained model.__

For instance, the figure with relu is constructed by the following code in ./code/energy_curve/main.py :

```
model_2 = Transformer(d , num_layers , 2)
model_2.normalize_weight()
paint(model_2 , "../generated_figures/%s.png" % relu_name)
```

The model is initialized, normalized, and immediately used for producing the plot. The training data is loaded a few lines above, but ultimately does not affect the plot in any manner except one: the model input dimension is based on word embedding (d). However, the embeddings themselves do not participate in updating model parameters.

Interestingly, __Section 6 does not explicitly contradict that__, but does not discuss it either. As such, the reader may be misled into believing that the practical experiments are more significant than they actually are.

To the best of my understanding, the actual evidence of practical applicability of this work is as follows:

1. all observations are made not with actual transformers, but with the proxy as defined in the paper (stated in Section 6)
    - in addition to the assumptions stated in the paper, there are other subtle differences, i.e. lack of scaling, or unconventional initialization
2. all observations are mad with randomly initialized weights, without any training on the data
3. it is unclear whether the said proxy retains the practical properties of actual transformers, i.e. whether it can actually solve the same tasks with the same quality
4. if it does, it is unclear whether the properties of the proxy transformer reflect the properties of actual transformer __once it has been trained on actual data__

With these four concerns in mind, it might be premature to claim that:

> Hence although seemingly complicated, the conditions adopted by Lemma 4.3 and Theorem 5.1 are nonetheless likely hold in many practical settings

> the unfolding perspective can be used to devise architectures with inductive biases aligned with downstream tasks to help compensate for less model flexibility

To summarize, I believe this paper proposes a curious theoretical perspective that may yet improve our understanding of real-world transformers. However, in its current for, it is unclear how well does the proposed approximation reflect the real world behavior of transformers, especially when trained.
questions: 
### Minor corrections:
> (supplementary) ./code/README.md L5: python appllo_circle.py

perhaps, `apollo_circle` ? (typo)


Though authors have every right to decide for themselves, I would also recommend specifying the environment needed to run the supplementary code. Once could, for instance, add requirements.txt with specific library versions, or a docker container. This would simplify the task of reproducing the paper's results, especially in the far future.


limitations: The paper explicitly states the main limitations of their theoretical results (i.e. the requirement for symmetric weights).
However, I believe that the limitations of the proposed empirical results could be stated more clearly, so as not to mislead practically minded readers. I elaborate on these limitations in the "Strengths And Weaknesses" section.
review_title: null

final_score: rating: 6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.
review_content: summary: This paper proposes to understand Transformer through the lens of unfolding optimization. It overcomes several challenges in previous works of formulating the complex Transformer architecture and obtains several insights from the new interpretation.
strengths_and_weaknesses: Strengths:
- The formulation of the Transformer layer as unfolding optimization is novel in the Transformer literature and brings several new ideas, e.g., potential improvement of the architecture inspired by optimization techniques.
- The paper clearly states and tackles the challenge from previous works and is able to formulate the whole complicated Transformer layer.

Weakness:
- It would be great if the authors can further elaborate on how can we benefit from this new interpretation, e.g., any direct implication on architecture design.
- Is unclear if this analysis can be extended to a more practical setting of Transformer models, i.e., with components like LayerNorm.

questions: Please refer to the weakness part.
limitations: The author may want to elaborate on the implication of the proposed interpretation.
review_title: null

final_score: rating: 5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.
review_content: summary: To find an energy function underlying the Transformer model, the authors first outline 4 major obstacles and focus on solving or at least partly partially addressing them. The experimental results also help to support their results.
strengths_and_weaknesses: Strength:
This paper is well-written. The background is easy to understand and friendly to the readers not in the unfolded optimization track. The problems the authors want to solve are also well-defined and explained clearly.
The novelty is also well claimed. The authors provided a clear comparison between this work and existing literature.
The experiments are also helpful to verify the viewpoints in this work.

Weakness:
The transformer architecture has been simplified. I worry about the impact of normalization layers and residual connection. Also, the order of different layers may also have an impact to the results. For instance, what would happen if the transformer used pre-LayerNorm or post-LayerNorm?

Similarly, what would happen if we use the widely used multi-head attention and other non-linear activation functions (e.g. GeLU)? The corresponding analysis is missing in this work.

In real-world applications, we usually use a pre-trained transformer instead of Glove+Transformer. Authors’ evaluation setting is a bit different from the real-world ones.
questions: How does the energy function underlying the Transformer help us to design or train the transformer? I’m interested in how useful the theorems are.
limitations: NA
review_title: null

Meta-review: metareview: The submission analyses the (simplified) Transformer architecture from the unfolding optimisation perspective, which was recently used to analyse simpler MLP and CNN models. Four reviewers are positive on the submission results and agree that they potentially can bring new insights and more powerful architectures. AC recommends acceptance.
confidence: Less certain
Decision: Accept