liveBook · Manning

Token

As explained in Build a Reasoning Model (From Scratch)

A discrete text unit used as the basic element of language-model generation.

A token is a small, discrete text unit that a language model processes and predicts. Depending on the tokenizer, it can represent a full word, part of a word, or punctuation. Tokenized text is converted into numerical IDs that the model can ingest. section 1.2

Example token sequence

The sentence “An LLM can be useful.” may become “An”, “ L”, “LM”, “ can”, “ be”, “ useful”, and “.”. During pretraining, the model learns to predict the next token from large collections of such sequences. section 1.2

Tokens connect text processing to the standard training pipeline: massive unlabeled datasets are represented as token sequences, and pretraining optimizes next-token prediction. The tokenizer is separate from the language model but remains essential to text processing and generation. section 1.2

How Build a Reasoning Model (From Scratch) covers it

How deep it goes
Defines token representation and numerical IDs, while deferring tokenizer mechanics to later treatment.
Examples
Uses the sentence “An LLM can be useful.” and its token sequence to demonstrate subword, word, and punctuation units.
What you can do after
Evaluate/understand how text becomes model input and how pretraining uses token sequences for next-token prediction.
How it connects
Connects tokenizer, language model, pretraining, post-training, supervised fine-tuning, and preference fine-tuning.

Also explained in

Compare how 31 books explain token →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Reasoning Model (From Scratch). The section links point to the parts of the book it draws on.