liveBook · Manning

Special token

As explained in Reinforcement Learning from Human Feedback

A special token is a reserved token that marks structural or control information in a model's input or output sequence.

A special token is a reserved marker that carries structure or control information through a model’s token sequence. Chat templates use such markers to separate system, user, and assistant messages, while generation prompts and end-of-sequence tokens define where the assistant should begin and stop. section 4.1

Special tokens can control several parts of an inference or training pipeline:

  • Separate conversational turns with role and message-boundary markers such as <|im_start|> and <|im_end|>. section 4.1
  • Signal the assistant-generation position by appending an assistant marker after the user’s message. section 4.1
  • Encode tool calls and tool outputs so external execution can interrupt generation and return results to the model. section 13.2
  • Represent structured data either through architecture-specific delimiters or through structured formatting retained inside the token stream. section 13.5

Chat and tool-use sequence

A formatted conversation may end with <|im_start|>assistant so the model knows to continue generating. During tool use, generation can emit a tool call, receive an injected result, and then continue producing the answer. section 4.1 section 13.2

<|im_start|>system
You are a friendly chatbot who always responds in the style of a pirate<|im_end|>
<|im_start|>user
How many helicopters can a human eat in one sitting?<|im_end|>
<|im_start|>assistant

Inspect a concrete token sequence showing system, user, and assistant boundaries in a pirate-style chatbot prompt. section 4.1

How Reinforcement Learning from Human Feedback covers it

How deep it goes
Explains token placement and pipeline behavior, but defers tokenizer-specific implementation and provider-format details.
Examples
Uses role delimiters, assistant-generation prompts, end-of-sequence markers, function-call tags, and Fibonacci code-execution outputs.
What it assumes
Assumes familiarity with token sequences and language-model generation while teaching conversational roles and tool-call flow through examples.
What you can do after
Operate chat templates and tool-use pipelines by recognizing message boundaries, generation prompts, tool calls, and injected results.
How it connects
Connects special tokens to chat templates, instruction fine-tuning, tool use, function calling, tokenization, and constrained decoding.

Also explained in

Compare how 5 books explain special token →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Reinforcement Learning from Human Feedback. The section links point to the parts of the book it draws on.