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 in the attention chapters, for time steps in generation, and 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, counts layers, not tokens. When a formula has both, read the sentence around it to see which is which.
Example
Double N to 2000 and there are four million.
Where the course uses it
- 6.6 Multi-Head Attention · Module 6, Attentionfirst use
- 7.6 The Complete Model · Module 7, The Block and the Full Model
- 16.1 Memory, Not Arithmetic: The GPU Hierarchy · Module 16, Efficient and Long Attention
- 16.2 FlashAttention and the Online Softmax · Module 16, Efficient and Long Attention
- 16.3 Local and Global Attention · Module 16, Efficient and Long Attention
- 18.4 Hybrid Models · Module 18, Beyond Attention: Linear Attention and Hybrids
- 25.3 Contrastive Learning: CLIP and SigLIP · Module 25, Vision Transformers and Contrastive Learning
Related terms
- Big-O — how cost growsRead "order of" or "big O of". It describes how cost grows as the input gets bigger, ignoring constant factors. O(N²) means doubling N roughly quadruples the work.
- Scaled dot-product attentionEach token scores every other token, turns the scores into weights that add up to 1, and takes the weighted average of their value vectors.
- The KV cacheRead "K cache" and "V cache". They store the keys and values of earlier tokens during generation, so each is computed once instead of again at every step.