Transformer Blocks

Attention lets tokens exchange information, but that is only part of a transformer. We will put it together with per-token processing, normalisation, and residual connections, explaining the job of each component.

10 sections · 9 questions · 4 coding challenges

1 / 10

Could Every Position Consult the Others Directly?

BOTIE

A recurrent network carries information through successive steps. When two words are far apart, their relationship may have to survive many intermediate operations. The sequential processing also limits how much of a training sequence can be computed at once.

Vaswani and colleagues introduced the Transformer in 2017 for sequence transduction, including translation. It made attention the main means of exchanging information across positions, without the recurrent or convolutional layers used by many earlier systems.

A block first lets positions gather information through attention. A feed-forward stage then transforms each position's updated representation. Residual connections and normalisation help these stages work together in a trainable stack. The block is useful because it separates communication between positions from processing within a position. A language generator additionally restricts which positions can be consulted, so training does not reveal the next token's answer.

Sources for this history