Traveling Words: A Geometric Interpretation of Transformers
Raul Molina

TL;DR
This paper offers a geometric interpretation of transformer models, showing how layer normalization and attention mechanisms operate on a hyper-sphere to model semantic relationships, validated through probing a GPT-2 model.
Contribution
It introduces a novel geometric perspective that explains transformer inner workings, connecting properties like iterative refinement and contextual embeddings.
Findings
Layer normalization confines features to a hyper-sphere.
Early layers show distinct query-key attention patterns.
Deeper layers exhibit subject-specific attention heads.
Abstract
Transformers have significantly advanced the field of natural language processing, but comprehending their internal mechanisms remains a challenge. In this paper, we introduce a novel geometric perspective that elucidates the inner mechanisms of transformer operations. Our primary contribution is illustrating how layer normalization confines the latent features to a hyper-sphere, subsequently enabling attention to mold the semantic representation of words on this surface. This geometric viewpoint seamlessly connects established properties such as iterative refinement and contextual embeddings. We validate our insights by probing a pre-trained 124M parameter GPT-2 model. Our findings reveal clear query-key attention patterns in early layers and build upon prior observations regarding the subject-specific nature of attention heads at deeper layers. Harnessing these geometric insights, we…
Peer Reviews
Decision·Submitted to ICLR 2024
1. The paper presents a study on understanding transformers through the lens of layer normalization, a key component in transformers, and the matrices $W_{QK}, W_{VO}$ used in the attention mechanism. 2. The main insights are that in each layer, the layer normalization projects the features to a shared hyper-sphere. The proposed interpretation of attention is similar to the feed-forward module by Geva et al. (2021) in that both calculate relevance scores and aggregate sub-updates for the resid
1. The presentation can be improved significantly. I find it hard to see the differences from prior works and what exactly are the main contributions of this paper. 2. Most of the emprical results are using some selected examples and I do not quite follow these results. Could you list the main points that you are making from these experiments and how the evidence justifies them? What is the trajectory in figure 4 trying to show?
* The paper provides an intuitive, geometry perspective for interpreting the Transformer architecture. * Empirical probing experiments on GPT-2 validated some claims in the paper.
* Some ideas discussed in the paper, such as interpreting LayerNorm as surface projection have been discussed in prior works and are not novel. A discussion on the novelty of the proposed paper and how it compares with prior works will help clarify this concern. * The paper provides an interesting perspective on the specific architecture in popular implementations of Transformers, but its applications or insights for further results are not fully discussed in the paper.
- This is an easy to follow paper, with interesting and intuitive geometric arguments, supported by simple matrix formulas. - Some of the examples/demonstrations reveal patterns which tend to happen either on early or deep layers and could loosely fit into the high-level geometric insights developed.
- The novelty of this work is limited since the key observations have already been mentioned in other works (that are adequately cited): [Brody et al.] for layer normalization, query-key matrix; [Millidge & Black] for value-output matrix. - The "journey" of the representation of one word towards the representation of the next one in a sentence is interesting but is could well be an artifact of the reduction in dimensionality in the projection as also noted. Regarding the examples that are expec
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Computational Physics and Python Applications · Natural Language Processing Techniques
MethodsMulti-Head Attention · Attention Is All You Need · Cosine Annealing · Linear Layer · Attention Dropout · Discriminative Fine-Tuning · Residual Connection · Adam · Weight Decay · Softmax
