ChatML

A markup format for chat-style language model input that separates system, user, and assistant messages with special delimiter tokens.

1 articleLast mentioned

ChatML (Chat Markup Language) is a text format that structures the conversation fed to a language model as a sequence of role-tagged messages. Each message begins with `<|im_start|>` followed by a role name such as system, user, or assistant, and ends with the `<|im_end|>` token. This lets the model tell where the user's turn ends and where the assistant's reply should stop, and helps keep instructions separate from ordinary text.

OpenAI introduced the format in 2023 alongside the gpt-3.5-turbo API. It was later adopted as the chat template of several open-weight model families, including Alibaba Cloud's Qwen. When using instruct models, the chat template provided by the tokenizer usually converts messages into this format automatically.

This entry is based on AIPOST articles and widely known facts. If something is wrong, please send us a correction request.

Articles covering this entry

  • Pre-Training, Fine-Tuning and RL: Where Frontier LLMs Get Their QualityAI Performance ·

    Even with the model's native ChatML delimiters, the special tokens that mark where a system, user or assistant turn begins and ends, the base model does not kno…

    Read article

Found a mistake or missing an entry?

Wiki entries are based on AIPOST articles and widely known facts. If an entry is wrong, send us a correction request and we will check and fix it. Names from new articles are added to the wiki after the article is published.