Feed-forward layers guide transformer tokens toward agreement dynamically
The Role of Feed-Forward Layers in Transformer Dynamics
Machine Learning
Summary
Transformers are computer programs that process language by passing information between tokens. This paper looks at how one part of these transformers—the feed-forward layer—helps guide tokens toward agreeing with one another regardless of how the attention part works. The researchers showed mathematically that the feed-forward layers can steer tokens to align closely, even pushing tokens into groups. They then tested their math with computer simulations and compared it to behavior seen in big language models.
What this means in practice
- •For language model builders: Design feed-forward layers to control token behavior and improve model stability.
- •For neural network engineers: Use insights on feed-forward control to guide convergence and clustering in transformer architectures.
A theory result. No direct application yet.
Authors
Thomas Jacob Maranzatto, Semih Akkoc, Sennur Ulukus
Abstract
We study the dynamical behavior of tokens in transformers from a control-theoretic perspective. Our model includes the feed-forward layer present after the self-attention mechanism, with the self-attention mechanism interpreted as an interacting particle system and the feed-forward layer as an independent control. Our main theoretical result establishes that the feed-forward network can steer the tokens arbitrarily close to consensus regardless of the key, query, and value matrices. Our result are easily extended to convergence to many clusters and to multi-head attention. We conduct numerical experiments to verify our results, and compare thresholding behavior from our theory to real-world LLMs.