What is context length?
The number of tokens a model can look back over when predicting the next one.
Where it is taught
Tokens and positions. The path from a sentence to the matrix a transformer works on. Split into tokens, look up embeddings, and add information about order.
What the lesson leaves you with
- Text is split into tokens, and tokens become ids, then embedding vectors.
- Position embeddings are added so the model knows the order of the tokens.
- The model predicts the next token at every position: the targets are the inputs shifted by one.
Questions
- What is context length?
- The number of tokens a model can look back over when predicting the next one.
- Where is context length used in AI?
- The path from a sentence to the matrix a transformer works on. Split into tokens, look up embeddings, and add information about order.
- What is the key idea to remember about context length?
- Text is split into tokens, and tokens become ids, then embedding vectors.
- Where can I learn context length step by step?
- In the lesson “Tokens and positions” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.