Preparing your dataset

Example format

In this example, our goal is to create a chatbot that occasionally gives sarcastic responses, these are three training examples (conversations) we could create for a dataset:

{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the weather like today?"},{"role":"assistant","content":"Sunny, as if we need any more of that."}]}
{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the highest mountain in the world?"},{"role":"assistant","content":"Everest, because who doesn't know that, right?"}]}
{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the average human life expectancy?"},{"role":"assistant","content":"About 72 years, but who's counting, right?"}]}

Multi-turn chat examples

Examples in the chat format can have multiple messages with the assistant role. The default behavior during fine-tuning is to train on all assistant messages within a single example. To skip fine-tuning on specific assistant messages, a weight key can be added disable fine-tuning on that message, allowing you to control which assistant messages are learned. The allowed values for weight are currently 0 or 1. Some examples using weight for the chat format are below.

{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the weather like today?"},{"role":"assistant","content":"Sunny","weight":0},{"role":"user","content":"Can you be more humorous?"},{"role":"assistant","content":"Sunny, as if we need any more of that.","weight":1}]}
{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the highest mountain in the world?"},{"role":"assistant","content":"Everest","weight":0},{"role":"user","content":"Can you be more humorous?"},{"role":"assistant","content":"Everest, because who doesn't know that, right?","weight":1}]}
{"messages":[{"role":"system","content":"ChatBot is an informative and witty conversational agent."},{"role":"user","content":"What's the average human life expectancy?"},{"role":"assistant","content":"72 years","weight":0},{"role":"user","content":"Can you be more humorous?"},{"role":"assistant","content":"About 72 years, but who's counting, right?","weight":1}]}

Crafting prompts

We generally recommend taking the set of instructions and prompts that you found worked best for the model prior to fine-tuning, and including them in every training example. This should let you reach the best and most general results, especially if you have relatively few (e.g. under a hundred) training examples.

If you would like to shorten the instructions or prompts that are repeated in every example to save costs, keep in mind that the model will likely behave as if those instructions were included, and it may be hard to get the model to ignore those "baked-in" instructions at inference time.

It may take more training examples to arrive at good results, as the model has to learn entirely through demonstration and without guided instructions.

Example count recommendations

We recommend starting with 50 well-crafted demonstrations and seeing if the model shows signs of improvement after fine-tuning. In some cases that may be sufficient, but even if the model is not yet production quality, clear improvements are a good sign that providing more data will continue to improve the model. No improvement suggests that you may need to rethink how to set up the task for the model or restructure the data before scaling beyond a limited example set.

Upload dataset files

Please refer to "Files"

Last updated