Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Glossary › Token

What is token?

A piece of text, such as a character, a word or part of a word, that a model treats as one unit and represents by an id.

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.
Open the lesson

Questions

What is token?
A piece of text, such as a character, a word or part of a word, that a model treats as one unit and represents by an id.
Where is token 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 token?
Text is split into tokens, and tokens become ids, then embedding vectors.
Where can I learn token step by step?
In the lesson “Tokens and positions” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.

See it in 3D on the blog

  • How does ChatGPT work? The maths for Class 108 min
  • What are word embeddings? Words as points4 min
  • How does attention work in transformers?3 min

Related terms

  • Attention
  • Attention head
  • Autoregressive
  • Byte-pair encoding
  • Causal mask
  • Context length