The Role of Special Tokens in LLMs
1
Murat Ayfer [proposed](https://twitter.com/mayfer/status/1634686758981091328) an idea to introduce new special tokens apart from <|im_start|>, <|im_end|> and <|endoftext|>. ## Overview Modern Language Models receive tokens as inputs and produce tokens as outputs. Tokens are sequences letters, which frequently occur in training corpus, for example there can be tokens like: apple, good, the (whole words) pre, er, ing (frequent parts of word) e, y, a (single letters) Each token has its own vector/numeric representation (embedding). Apart from natural tokens which consist of letters, there are usually several utility tokens. In ChatGPT there are two as far as I know: im_start and im_end. They delimit separate messages in a conversation. According to [this](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/chatgpt) they are used like this: ``` <|im_start|>system You are ChatGPT, helpful chatbot assistant. <|im_end|> <|im_start|>user Hello! <|im_end|> <|im_start|>assistant Hello, I am ChatGPT, how can I help you? <|im_end|> <|im_start|>user What is the highest mountain in the world? <|im_start|>assistant ... <|im_end|> ``` When ChatGPT produces im_end token it indicates that text generation for the current message should be stopped. It uses im_start and im_end in the input to distinguish between messages of different actors - user and itself (assistant). So, im_start and im_end are used for purely technical, utility purpose of delimiting different messages in chat history. ## Discussion My opinion on the idea from the tweet is summed up by BlarghamelJones - "What, like English words?". I don't see any reason to introduce new non-natural special tokens, when we can very flexibly modify the behavior of the model using natural language prompts. Introducing new special tokens would complicate the training of the model (training data would have to be manually filled with new special tokens) as well as using the model (user would have to learn how to use new special tokens). Although Murat makes a very interesting point: >the hypothesis is that it would prevent temperature from derailing the completion unnecessarily by placing discrete meaning tokens in appropriate places. this way random syllables don't cause chain reactions. they would act as anchors i.e. <|agree|>, <|search|> or <|guess|> it's not clear how to implement something like this in practice.