atlas

Research map / Architectures and efficiency / Attention and transformers

Analyzing Feed-Forward Blocks in Transformers through the Lens of Attention Maps

ICLR 2024 · Architectures and efficiency › Attention and transformers · approach: Attention head mechanisms · 7 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Extends norm-based attention-map analysis to whole Transformer layers including feed-forward blocks by decomposing GELU with integrated gradients, and finds FF blocks amplify specific linguistic compositions while FF and LayerNorm/residual cancel each other's contextualization effects.

Problem

Attention-map interpretations of Transformers ignore feed-forward (FF) blocks, even though they hold about two-thirds of layer parameters and may change how tokens are contextualized; the nonlinear activation prevents straightforward norm-based decomposition.

Approach

Decompose the FF nonlinearity (GELU and similar activations) with integrated gradients using a zero baseline, which satisfies completeness, so that norms of per-token contributions can be computed across the full layer (ATTN, RES, LN, FF) without approximation, yielding refined attention maps with component-by-component scopes.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Apply FF to the attention-block contextualizationBERT-base and GPT-2 · Wikipediacontextualization change (1 - ρ): 0.21 and 0.15Helped
Apply LN after the attention blockBERT-base and GPT-2 · Wikipediacontextualization change (1 - ρ): 0.27 and 0.38Helped
Add RES2 after FFBERT and GPT-2 Transformer layers · Wikipediacontextualization change relative to before FFHurt
Add LN after FF and RESBERT and GPT-2 Transformer layers · Wikipediacontextualization change relative to before FFHurt
Ignore bottom 1% of dimensions with the lowest LN γ when calculating FF contextualization (ablation)BERT · Wikipediacontextualization change (1 - ρ), layer average: 0.21 to 0.09Hurt
Ignore bottom 1% of dimensions with the lowest LN γ when calculating FF contextualization (ablation)GPT-2 · Wikipediacontextualization change (1 - ρ), layer average: 0.15 to 0.02Hurt
Use FF to amplify selected token-pair contextualizationBERT-base and GPT-2 · WikipediaFF-amp scoreHelped
Explain FF amplification using word co-occurrenceBERT-base · WikipediaSpearman correlation between FF-amp scores and PMI: 0.06--0.14No clear effect
Use LN γ weights against mean absolute FF output by dimensionBERT and GPT-2 · WikipediaPearson correlation: -0.45 to -0.78 in BERTs; -0.22 to -0.59 in GPT-2Mixed

Surprising findings

Limitations

Experimental setup

Datasets: Wikipedia excerpts (992 sequences) Stanford Sentiment Treebank v2 (872 sequences from validation set)

Benchmarks: Wikipedia excerpts Stanford Sentiment Treebank v2

Metrics: 1 - Spearman rank correlation between attention maps (contex FF-amp score Pearson correlation (LN gamma vs FF output) PMI correlation

Baselines: Atb (norm-based attention block analysis) Shapley value (SHAP) DecompX

Builds on: norm-based analysis (ATTN decomposition) ALTI / attention block norm analysis Integrated Gradients GlobEnc

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy