N,T,LN, T, L

N, T, L — sequence length

The number of tokens in the sequence. Different modules call it N, T or L. N² ("N squared") is how attention's cost grows with it.

The course uses NN in the attention chapters, TT for time steps in generation, and LL for context length in the KV-cache calculations. All three mean the same thing; the different letters come from the original papers.

It is the number that appears squared in attention's cost, so many of the optimizations in Module 15 aim to reduce what it costs.

Watch the letters. In section 8.5, LL counts layers, not tokens. When a formula has both, read the sentence around it to see which is which.

Example

N=1000  ⟹  N×N=1,000,000 attention scoresN = 1000 \;\Longrightarrow\; N \times N = 1{,}000{,}000 \text{ attention scores}

Double N to 2000 and there are four million.

Where the course uses it

Related terms