ContentsThe library

The Mathematics of Attention

The Skip Connection Is the Main Road

Last timePosition Without Recurrence

The residual path is usually described as a fix for vanishing gradients. In a transformer it is better understood as a shared channel that every block reads from and adds to.

Residual connections arrived in computer vision as a training fix. Very deep

networks were performing worse than shallow ones, and adding the input back to

the output of each block made depth usable again.

That history is accurate and it is also misleading when applied to transformers,

because it frames the skip connection as a repair. In a transformer the

residual path is better read the other way round: it is the main channel, and

the blocks are things attached to it.

The recurrence, unrolled

A transformer block does not transform its input. It computes something and adds

it:

xn+1=xn+fn(xn)x_{n+1} = x_n + f_n(x_n)

Unroll that from the embedding:

The lesson stops here

7 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01Why Attention Needs Three Matrices, Not One
  2. 02Where the Square Root of dkd_k Comes Fromopening only
  3. 03Why Softmax and Not Some Other Normalisationopening only
  4. 04One Weighted Average Is Not Enoughopening only
  5. 05Attention Cannot See Order, So Order Has to Be Addedopening only
  6. 06The Skip Connection Is the Main Roadyou are here
  7. 07Why Transformers Normalise Across Features and Not Across the Batchopening only
  8. 08The Half of the Transformer That Does Not Move Informationopening only

Read alongside