Back to blog
Articles
May 8, 2023
·
3 MIN READ

Chat Markup Language (ChatML) Is Important For A Number Of Reasons

May 8, 2023
|
3 MIN READ

Latest content

Tutorials
5 min read

Optimizing RAG with Knowledge Base Maintenance

How to find gaps between knowledge base content and real user questions.
April 23, 2024
Tutorials
4 min read

Scaling Quality Assurance with HumanFirst and Google Cloud

How to use HumanFirst with Vertex AI to test, improve, and trust agent performance.
March 14, 2024
Announcements
2 min read

Full Circle: HumanFirst Welcomes Maeghan Smulders as COO

Personal and professional history might not repeat, but it certainly rhymes. I’m thrilled to join the team at HumanFirst, and reconnect with a team of founders I not only trust, but deeply admire.
February 13, 2024
Tutorials
4 min read

Accelerating Data Analysis with HumanFirst and Google Cloud

How to use HumanFirst with CCAI-generated data to accelerate data analysis.
January 24, 2024
Tutorials
4 min read

Exploring Contact Center Data with HumanFirst and Google Cloud

How to use HumanFirst with CCAI-generated data to streamline topic modeling.
January 11, 2024
Articles
5 min

Building In Alignment: The Role of Observability in LLM-Led Conversational Design

Building In Alignment: The Role of Observability in LLM-Led Conversational Design
December 6, 2023
Articles
5 min read

Rivet Is An Open-Source Visual AI Programming Environment

Rivet is suited for building complex agents with LLM Prompts, and it was Open Sourced recently.
September 27, 2023
Articles
6 min read

What Is The Future Of Prompt Engineering?

The skill of Prompt Engineering has been touted as the ultimate skill of the future. But, will prompt engineering be around in the near future? In this article I attempt to decompose how the future LLM interface might look like…considering it will be conversational.
September 26, 2023
Articles
4 min read

LLM Drift

A recent study coined the term LLM Drift. LLM Drift is definite changes in LLM responses and behaviour, over a relatively short period of time.
September 25, 2023
Tutorials
5 min read

Optimizing RAG with Knowledge Base Maintenance

How to find gaps between knowledge base content and real user questions.
April 23, 2024
Tutorials
4 min read

Scaling Quality Assurance with HumanFirst and Google Cloud

How to use HumanFirst with Vertex AI to test, improve, and trust agent performance.
March 14, 2024
Announcements
2 min read

Full Circle: HumanFirst Welcomes Maeghan Smulders as COO

Personal and professional history might not repeat, but it certainly rhymes. I’m thrilled to join the team at HumanFirst, and reconnect with a team of founders I not only trust, but deeply admire.
February 13, 2024

Let your data drive.

Chat Markup Language (ChatML) Is Important For A Number Of Reasons

COBUS GREYLING
May 8, 2023
.
3 MIN READ

Here I will discuss why ChatML, introduced alongside OpenAI's ChatGPT and Whisper APIs on 1 March 2023, is an important development that should not be overlooked.

A short Recap

The OpenAI announcement focused on several key aspects, including a dramatic decrease in the price of the hosted API, ChatGPT, which has been reduced by 90% since December 2022.

Additionally, the APIs hosted on Azure are expected to have more granular management and regional and geographic availability zones, providing further value.

The Whisper and ChatGPT APIs also make implementation and experimentation easier, and allow voice data to be included with text data.

ASR vendors must be feeling the pressure to stand out, and this can be achieved through superior customer service, fine-tuning, and support for minority languages.

Finally, OpenAI is allowing users to access a specific model version and update when needed, providing greater stability for production implementations, demonstrating the continuing maturation of the LLM environment.

Back to Chat Markup Langauge (ChatML)


The introduction of ChatML is highly significant and important due to its ability to protect against prompt injection attacks, to some degree at lest.

It segregates conversations into layers or roles, such as System, assistant, and user.

This is just version zero of the language, and more developments are expected.

Currently, the payload accommodated for in ChatML is only text, but OpenAI is planning on introducing other data types.

Users can still use the unsafe raw string format, but this approach is much more susceptible for injections. OpenAI is in a strong position to guide and manage the LLM landscape responsibly, setting the standard for creating applications.

ChatML makes explicit to the model the source of each piece of text, and particularly shows the boundary between human and AI text.
This gives an opportunity to mitigate and eventually solve injections, as the model can tell which instructions come from the developer, the user, or its own input.
~ OpenAI

ChatML Example Code

Below is a ChatML example JSON file with the roles defined of system, user & assistant.

And the working Python code snippet:

With the output below, notice the role which is defined, the model detail which is gpt-3.5-turbo-0301 and other detail.

In Closing

Creating a conversational interface based on Large Langauge Models (LLMs) presents a challenge due to the difficulty of sequencing prompt nodes into chains.

This is complicated by the unstructured nature of input, often in the form of natural language or conversation, making it difficult to manage the edges between nodes. ChatML can provide a standard target for data transformation and submission to a chain, thereby alleviating this issue.

I’m currently the Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; ranging from LLMs, Chatbots, Voicebots, Development Frameworks, Data-Centric latent spaces and more.

Subscribe to HumanFirst Blog

Get the latest posts delivered right to your inbox