1.2.6
Special Tokens and Structured Prompts
What is it?
Special tokens are dedicated tokens used by a model or its tokenizer to represent structural information in addition to ordinary text. Depending on the model, they can mark the beginning or end of a message, separate sections, indicate roles or signal task-specific information. Structured prompts use these markers and consistent formatting to organize instructions and conversation content.
Key points
1. Special tokens have structural meaning for a model.
2. Some tokens mark the beginning or end of a message.
3. Some tokens separate instructions from other content.
4. Chat models may use role and message-boundary markers.
5. Special tokens differ between model families.
6. Correct prompt structure helps the model interpret the input format.
Example: A structured conversation
A simplified conversation structure might look like this:
System: You are a helpful assistant.
User: Explain tokenization.
Assistant: Tokenization converts text into smaller units called tokens.
Actual chat models may represent these messages using dedicated special tokens and model-specific templates. The labels above are for illustration, not literal token IDs.
Real-world application
Structured prompts are useful in conversational AI, tool-calling systems, multi-agent workflows and applications where instructions, user messages and model responses must be clearly separated.
Key takeaway
Special tokens provide structure to model inputs. Always use the message format and chat template expected by the selected model.