[Paper Review] Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space
This paper reveals that feed-forward network (FFN) layers in transformer language models construct predictions by applying additive updates to token representations in vocabulary space, where each update corresponds to a human-interpretable concept (e.g., 'pronouns' or 'breakfast'). By decomposing FFN outputs into sub-updates driven by individual parameter vectors, the authors enable interpretability, reduce GPT-2 toxicity by nearly 50%, and achieve 20% computation savings via early exit rules.
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.
Motivation & Objective
- Understand how feed-forward network (FFN) layers in transformer-based language models contribute to prediction construction.
- Address the opacity of FFN operations, which are a key but understudied component in modern NLP models.
- Develop a method to interpret FFN updates as concept-promoting mechanisms in the output vocabulary space.
- Enable practical applications such as toxicity mitigation and computational efficiency through sub-update manipulation.
- Provide a framework for fine-grained control and interpretability of transformer internals at the level of individual FFN parameter vectors.
Proposed method
- Reframe the FFN output as an additive update to the token representation, treating the representation as a distribution over the vocabulary.
- Decompose each FFN update into sub-updates corresponding to individual columns (vectors) in the second FFN matrix, termed 'value vectors'.
- Interpret each value vector as promoting a specific, human-interpretable concept in the vocabulary space, validated through manual annotation.
- Model the prediction process as a sequence of concept-promoting updates, where the final output distribution emerges from cumulative sub-update effects.
- Use dominant sub-updates as a signal for early exit, reducing computation by predicting when sufficient confidence is reached.
- Apply intervention by modifying the weights of specific value vectors to steer model generations toward desired behaviors (e.g., reduced toxicity).
Experimental results
Research questions
- RQ1How do FFN layers in transformer models contribute to the construction of final predictions in the output vocabulary space?
- RQ2Can individual FFN parameter vectors (value vectors) be interpreted as promoting specific, human-understandable concepts?
- RQ3To what extent do FFN updates rely on promoting high-probability tokens rather than suppressing low-probability ones?
- RQ4Can the sub-updates from FFN layers be leveraged to control model behavior, such as reducing toxicity in generations?
- RQ5Can dominant sub-updates serve as a reliable signal for early exit in inference, improving computational efficiency?
Key findings
- FFN layers apply additive updates to token representations, which can be interpreted as shifting the probability distribution over the output vocabulary.
- Each FFN update decomposes into sub-updates driven by individual value vectors, each of which promotes a distinct, human-interpretable concept such as 'pronouns' or 'breakfast'.
- The prediction process is dominated by token promotion: high-probability tokens in the output are those strongly influenced by multiple sub-updates.
- Intervening in the model by increasing the weights of just 10 sub-updates in GPT-2 reduces toxicity in generated text by nearly 50%.
- Dominant sub-updates provide a strong signal for early exit, enabling a 20% average reduction in computation without significant accuracy loss.
- The interpretability of individual value vectors is higher than that of their combinations, suggesting that analyzing them in isolation is a promising first step for model interpretability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.