liveBook · Manning

Chat Markup Language

As explained in Generative AI in Action

ChatML is a markup format for representing chat messages and distinguishing their sources or roles for language-model processing.

Chat Markup Language (ChatML) is a message-formatting approach that distinguishes system prompts, user prompts, and external content for language-model processing. It helps applications reduce the influence of untrusted content during prompt-injection attacks. section 13.2.1

Use ChatML as one layer of a broader defensive design:

  • Separate user instructions from external content so the model can identify where input originated. section 13.2.1
  • Limit model access with least privilege, identity-based authentication, and function-level permissions. section 13.2.1
  • Require user confirmation before sensitive operations and preserve human control over consequential decisions. section 13.2.1
  • Combine markup with logging, trust limits, and visual warnings for potentially untrustworthy responses. section 13.2.1

How Generative AI in Action covers it

How deep it goes
Defines role separation and defensive purpose but stops short of specifying ChatML syntax or implementation details.
Examples
Uses external-content separation and sensitive-operation confirmation as defensive application patterns.
What it assumes
Assumes familiarity with language-model prompts and external content while teaching role distinctions directly.
What you can do after
Apply ChatML-style role separation when designing defenses against indirect prompt injection.
How it connects
Connects ChatML with prompt injection, system prompts, user prompts, least privilege, authentication, human confirmation, and observability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.