Editor’s Image
In case you haven’t heard yet, OpenAI recently announced that fine tuning is available for GPT-3.5 Turbo. Additionally, tweaks for GPT-4.0 are also expected to be released later in the fall. For developers in particular, this has been very welcome news.
But why precisely was this such an important announcement? In short, it’s because tuning a GPT-3.5 Turbo model offers several important benefits. While we’ll explore what these benefits are later in this article, in essence, the tweak allows developers to manage their projects more effectively and shorten their directions (sometimes by up to 90%) by having instructions built into the model itself. .
With an enhanced version of GPT-3.5 Turbo, it is possible to exceed the basic capabilities of Chat GPT-3.5 for certain tasks. Let’s explore how you can tune your GPT-3.5 Turbo models in greater depth.
The first step to tune your data for GPT-3.5 Turbo is format it in the correct structure in JSONL format. Each line of your JSONL file will have a message key with three different types of messages:
- Your input message (also called user message)
- The context of the message (also called system message)
- The model response (also called the wizard message)
Below is an example with the three types of messages:
{
"messages": (
{ "role": "system", "content": "You are an experienced JavaScript developer adept at correcting mistakes" },
{ "role": "user", "content": "Find the issues in the following code." },
{ "role": "assistant", "content": "The provided code has several aspects that could be improved upon." }
)
}
You will then need to save your JSON object file once your data has been prepared.
Once you’ve created and saved your dataset as shown above, it’s time to upload the files so you can fine-tune them.
Below is an example of how you can do this using a Python script provided by OpenAI:
curl https://api.openai.com/v1/files \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F "purpose=fine-tune" \
-F "file=@path_to_your_file"
Now it’s time to finally execute the adjustment. Again, OpenAI provides an example of how you can do this:
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"
}'
As the example above shows, you will need to use openai.file.create to send the request to upload the file. Remember to save the file ID as you will need it for future steps.
Now it’s time to implement and interact with the refined model. You can do this within the OpenAI playground.
Consider the OpenAI example below:
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 experienced JavaScript developer adept at correcting mistakes"
},
{
"role": "user",
"content": "Hello! Can you review this code I wrote?"
}
)
}'
This is also a good opportunity to compare the new refined model with the original GPT-3.5 Turbo model.
GPT-3.5 Turbo’s fine-tuning of indications offers three main advantages to improve model quality and performance.
Improved manageability
This is another way of saying that tuning allows developers to ensure that their custom models better follow specific instructions. For example, if you want your model to be completed in a different language (like Italian or Spanish), adjusting your models allows you to do this.
The same goes if you need your model to shorten its results or for the model to respond in a certain way. Speaking of outings…
Most reliable output format
Through tuning, a model can improve its ability to format responses consistently. This is very important for any application that requires a specific format, such as encoding. Specifically, developers can adjust their models so that user prompts become in JSON fragmentswhich can then be incorporated into larger data modules later.
Custom ringtone
If any company needs to ensure that the results generated by their ai models are completed with a specific tone, fine-tuning is the most efficient way to ensure this. Many businesses need to ensure their content and marketing materials match their brand voice or have a certain tone as a means to better connect with customers.
If any company has a recognizable brand voice, they can tune their GPT-3.5 Turbo models by preparing their data for tuning. Specifically, this will be done on the ‘user message’ and ‘system message’ message types as discussed above. When done correctly, this will result in all messages being created with the company’s brand voice in mind, while significantly reducing the time needed to edit everything from social media copy to the technical documents.
As noted above, OpenAI is also expected to release tweaks for GPT-4.0 soon. Beyond that, the company is expected to release upcoming features like offering support for function calls and the ability to make adjustments through the user interface. The latter will make the adjustment more accessible to novice users.
These developments with adjustments are not only important for developers but also for companies. For example, many of the most promising startups in the technology space and developers, like Sweep or SeekOut, depend on the use of ai to complete their services. Companies like these will find good use in the ability to tune their GPT data models.
Thanks to this new ability to tune GPT-3.5 Turbo, both companies and developers can now ai-artificial-intelligence” rel=”noopener” target=”_blank”>monitor your models more effectively to ensure they perform in a manner more consistent with your applications.
Nahla Davies is a software developer and technology writer. Before dedicating her full-time job to technical writing, she managed, among other interesting things, to work as a lead programmer at an Inc. 5,000 experiential brand organization whose clients include Samsung, Time Warner, Netflix, and Sony.