GPT-3.5 Turbo Fine-Tuning and API Updates By OpenAI

Hello Learners…

Welcome to the blog…

Table of Contents

  • Introduction
  • GPT-3.5 Turbo Fine-Tuning and API Updates By OpenAI
  • Fine-tuning steps Of GPT-3.5 Turbo
  • GPT-3.5 Turbo Fine-tuning Pricing
  • Summary
  • References

Introduction

In this post, we discuss GPT-3.5 Turbo Fine-Tuning and API Updates By OpenAI.

In the ever-evolving landscape of artificial intelligence,

  • GPT-3.5 Turbo has emerged as a beacon of innovation, holding the potential to reshape the way we learn, communicate, and create.

GPT-3.5 Turbo Fine-Tuning and API Updates By OpenAI

OpenAI has just released GPT-3.5 Turbo, which can now be fine-tuned using your own data, intriguingly.

This update gives developers the ability to customize models that perform better for their use cases and run these custom models at scale.

Early tests have shown a fine-tuned version of GPT-3.5 Turbo can match, or even outperform, base GPT-4-level capabilities on certain narrow tasks.

Just like all our APIs, customers own data sent to/from fine-tuning API; OpenAI or others don’t use it for training.

Fine-tuning customers have been able to meaningfully improve model performance across common use cases, such as:

Improved steerability:

  • Fine-tuning allows businesses to make the model follow instructions better, such as making outputs terse or always responding in a given language.
  • For instance, developers can use fine-tuning to ensure that the model always responds in German when prompted to use that language.

Reliable output formatting:

  • Fine-tuning improves the model’s ability to consistently format responses—a crucial aspect for applications demanding a specific response format, such as code completion or composing API calls.
  • Fine-tuning empowers developers to convert user prompts into reliable, high-quality JSON snippets for their systems.

Custom tone:

  • Fine-tuning is a great way to hone the qualitative feel of the model output, such as its tone, so it better fits the voice of businesses’ brands.
  • A business with a recognizable brand voice can use fine-tuning for the model to be more consistent with its tone.

Fine-tuning steps Of GPT-3.5 Turbo

Prepare your data

{
  "messages": [
    { "role": "system", "content": "You are an assistant that occasionally misspells words" },
    { "role": "user", "content": "Tell me a story." },
    { "role": "assistant", "content": "One day a student went to schoool." }
  ]
}

Upload files

curl -https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "purpose=fine-tune" \
  -F "file=@path_to_your_file" 

Create a fine-tuning job

curl https://api.openai.com/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
  "training_file": "TRAINING_FILE_ID",
  "model": "gpt-3.5-turbo-0613",
}'

Use a fine-tuned model

curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
  "model": "ft:gpt-3.5-turbo:org_id",
  "messages": [
    {
      "role": "system",
      "content": "You are an assistant that occasionally misspells words"
    },
    {
      "role": "user",
      "content": "Hello! What is fine-tuning?"
    }
  ]
}'

GPT-3.5 Turbo Fine-tuning Pricing

Fine-tuning costs are broken down into two buckets: the initial training cost and the usage cost:

  • Training: $0.008 / 1K Tokens
  • Usage input: $0.012 / 1K Tokens
  • Usage output: $0.016 / 1K Tokens

For example, a gpt-3.5-turbo fine-tuning job with a training file of 100,000 tokens that is trained for 3 epochs would have an expected cost of $2.40.

Summary

Also, you can refer to this,

References

Leave a Comment