AI Research Scientist · Transformer Architecture Components
Feed-forward and normalization sublayers
Feed-forward and normalization sublayers
Feed-forward sublayer (FFN)
The feed-forward sublayer is the second sublayer in a transformer block, sitting right after attention. Unlike attention, which mixes information across positions, the FFN processes each position’s vector entirely on its own.How the FFN transforms one position
- 1Project upA linear layer projects into a wider space:
- 2Apply nonlinearityAn elementwise nonlinearity (ReLU or GELU) is applied to , adding curvature attention alone can’t produce.
- 3Project downA second linear layer projects back to the model’s width:
- 4Repeat identically per positionThese same weights apply identically and independently at every position — no position influences another here.
Recall check from the same lesson
Because the FFN sublayer's weight matrices are shared across positions, two different tokens at two different sequence positions in the same block are transformed using the exact same $W_1$ and $W_2$, even though each token still gets its own distinct output vector.
Review the explanation
Answer: True. The FFN applies the identical two-layer transformation independently at every position using the same weights — position-wise, not position-specific. Each token's output differs only because its input vector differs, not because it uses different weights.
Sources
One sitting · 20–30 minutes
A focused session on your AI Research Scientist interview
LearnBench starts from what you already know — skip what you have, master what you’re missing.
Start now