Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space

By Mor Geva, Avi Caciularu, Ke Wang, Kevin Wang, Yoav Goldberg. 2022

595 citations recorded by the source corpus.

Transformer-based language models (LMs) are at the core of modern NLP, but their internal prediction construction process is opaque and largely not understood. In this work, we make a substantial step towards unveiling this underlying prediction process, by reverse-engineering the operation of the feed-forward network (FFN) layers, one of the building blocks of transformer models. We view the token representation as a changing distribution over the vocabulary, and the output from each FFN layer as an additive update to that distribution. Then, we analyze the FFN updates in the vocabulary space, showing that each update can be decomposed to sub-updates corresponding to single FFN parameter vectors, each promoting concepts that are often human-interpretable. We then leverage these findings for controlling LM predictions, where we reduce the toxicity of GPT2 by almost 50%, and for improving computation efficiency with a simple early exit rule, saving 20% of computation on average.

Subfields: Artificial Intelligence, Materials Chemistry, Natural Language Processing, Model Architectures

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Yi Tay
  2. Mostafa Dehghani
  3. Donald Metzler
  4. Jonathan Berant
  5. Percy Liang
  6. Mohit Bansal
  7. Yulia Tsvetkov
  8. Luke S. Zettlemoyer

In Materials Chemistry

  1. Ankit Gupta
  2. Jonathan Berant
  3. Mor Geva
  4. Efstratios Gavves
  5. Mostafa Dehghani
  6. Leonard Bereska

In Natural Language Processing

  1. Yulia Tsvetkov
  2. Vidhisha Balachandran
  3. Jonathan Berant
  4. Yi Tay
  5. Sachin Kumar
  6. Donald Metzler
  7. Antonios Anastasopoulos
  8. Lucille Njoo

In Model Architectures

  1. Yi Tay
  2. Mostafa Dehghani
  3. Donald Metzler
  4. Dara Bahri
  5. Ankit Gupta
  6. Jai Gupta
  7. Jacob Steinhardt
  8. Jasmijn Bastings

Citations in the corpus