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.