What are special tokens in an LLM?
Special tokens are reserved tokens that carry structural or control information rather than ordinary text content.
They help an LLM or its tokenizer mark boundaries, distinguish roles, represent padding, indicate the end of generation, or encode other special instructions.
Common types of special tokens
Depending on the model, special tokens can include:
- Beginning-of-sequence token — marks the start of a sequence.
- End-of-sequence token — marks the end of a sequence and can tell generation to stop.
- Padding token — fills unused positions when sequences of different lengths are batched together.
- Unknown token — represents text that a tokenizer cannot otherwise encode in some tokenizer designs.
- Separator token — separates different text segments.
- Mask token — hides a token during masked-language-model training.
- Chat or role tokens — distinguish system, user, assistant, or other message roles in chat models.
Not every LLM uses all of these.
Are special tokens normal words?
No.
A special token may have a readable representation such as:
<BOS>
<EOS>
<PAD>but internally it is usually represented by a reserved token ID in the tokenizer vocabulary.
For example:
text → ordinary token IDs
<EOS> → reserved special token IDThe exact token names and IDs differ between model families.
Why are special tokens needed?
Normal text alone does not always provide enough structure for model training and inference.
Special tokens can tell the model things such as:
- Where a sequence begins
- Where it ends
- Which tokens are padding
- Where one segment ends and another begins
- Which speaker produced a message
- When generation should stop
This makes them useful for both training and serving LLMs.
How are they used in chat models?
Chat models often use reserved tokens or equivalent formatting to represent conversation structure.
Conceptually, a conversation may be encoded like:
<system> instructions
<user> question
<assistant> responseThe actual format is model-specific and may use hidden or documented control tokens rather than these exact strings.
This structure helps the model distinguish different message roles.
Can users type special-token text directly?
Typing text that looks like a special token does not always make it behave as one.
Tokenizer implementations may reserve these tokens, escape them, reject them, or require special handling in the API.
The model's official tokenizer and chat template determine how special tokens are inserted and interpreted.
For individual token types, see the dedicated articles on beginning-of-sequence, end-of-sequence, and padding tokens.
In short: special tokens are reserved tokens used to represent structure and control information—such as sequence boundaries, padding, masks, separators, or chat roles—so the model can interpret text in the correct format.
Learning Sequence
Large Language Models Curriculum
Explore Related Questions
Deepen your understanding across related Large Language Models topics.