openai-apipre-trained-modelchatgpt-apifine-tuning

OpenAI API: What is the proper format to fine-tune the OpenAI model?


I am creating an OpenAI model for one of the Catalog Book through which users can ask anything from the book, and the model is able to answer it.

I created a Q&A list from the book (70 QA). ChatGPT gives me the following format to submit it to the fine-tune API endpoint:

"{
    "context": "Introducing BAUTER - an innovative thermal insulation product which has been developed by engineers for many years for the production of paints and other thin-coating materials that results in a unique group of thermo coating solutions. As part of the market demand for a product that will work in conditions where insulation has not yet been possible or difficult, our product resolves many problems in construction and industry. BAUTER is a family of various products with many applications.",
    "question": "What is BAUTER?",
    "answer": "BAUTER is an innovative thermal insulation product developed by engineers for the production of paints and other thin-coating materials. It offers unique thermo coating solutions and addresses insulation challenges in construction and industry."
},"

What is the proper format and the proper way to fine-tune the OpenAI model?


Solution

  • The proper format to fine-tune the OpenAI model depends on the model you want to fine-tune.

    As of today, you can fine-tune the following OpenAI models, as stated in the official OpenAI documentation:

    Let's say you want to create a chatbot that occasionally gives sarcastic responses, as shown in the official OpenAI documentation.

    If you want to fine-tune the gpt-3.5-turbo-0613 model, use the following format:

    {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What's the capital of France?"}, {"role": "assistant", "content": "Paris, as if everyone doesn't know that already."}]}
    {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "Who wrote 'Romeo and Juliet'?"}, {"role": "assistant", "content": "Oh, just some guy named William Shakespeare. Ever heard of him?"}]}
    {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "How far is the Moon from Earth?"}, {"role": "assistant", "content": "Around 384,400 kilometers. Give or take a few, like that really matters."}]}
    

    If you want to fine-tune the babbage-002 or davinci-002 model, use the following format:

    {"prompt": "What's the capital of France?", "completion": "Paris, as if everyone doesn't know that already."}
    {"prompt": "Who wrote 'Romeo and Juliet'?", "completion": "Oh, just some guy named William Shakespeare. Ever heard of him?"}
    {"prompt": "How far is the Moon from Earth?", "completion": "Around 384,400 kilometers. Give or take a few, like that really matters."}