In this guide, we’ll show you exactly how to create a fine-tuned GPT model that’s integrated directly into Marketo for enhanced persona classification.
 
Persona classification plays a crucial role in successfully delivering targeted and personalized content to your audience.
 
However, traditional classification methods often fall short due to the dynamic nature of job titles, industry terms, and other parameters.
 
For example, Persona A may include a job title with the word “Tech”. Then, some months or even years later, that same job title drops “Tech” and uses “IT” in the title instead. This can be true for several different job titles and even entire industries.
 
All these words and terms must be constantly updated for your personas to accurately reflect the roles you want to target – and this takes a lot of manual work.
 
Put simply, marketers spend a lot of time defining personas only for them to quickly become outdated.
 

This is where GPT comes in

The good news is, we can create our own fine-tuned GPT that understands the patterns of these term changes.

It can take “Technology Analyst” and “IT Analyst” and feed them into the same group, for example. Then, when a new term like “Python” comes up in a job title, it’ll understand where to categorize that role based on your existing persona instructions and examples.

And since we’ll be training our model on job titles and industry terms rather than actual private identifiers, this application of GPT has no privacy or compliance risks whatsoever.

Here’s our guide on how to set it up!

(This guide is for tech professionals and enthusiasts who use Marketo. Not a lot of coding is required, but it would help to know coding basics or be willing to learn!)
 

Understanding persona classification

Before we get into the technical aspects of tuning your GPT model and integrating it with Marketo:

None of this will be very useful if you haven’t already taken the time to define your personas.

This almost goes without saying, but we still wanted to quickly mention it.

Defined persona groups based on job title, industry, pain points, and other characteristics are information that your fine-tuned GPT will need in order to automatically update and recategorize contacts when terms change.
 

1) Prepare your data for GPT fine-tuning

The first thing we need to do is prepare our data for fine-tuning. Let’s walk through what that looks like.

  1. Start by reaching out to your Marketing and Sales teams and gather about 200 leads/customers that will be used as examples for a given persona. The job titles, industries, and other important characteristics of these contacts need to fit your previously defined persona as closely as possible.
  2. Once you have those contacts, it’s time to clean the data. Eliminate any duplicate entries, weird characters, or other erroneous inputs.
  3. Now, we need to transform this data into a JSONL format (for those who may not know, this is a JSON but without any commas). This will allow us to feed it into our custom GPT with instructions and descriptions about persona classification. Since this step is very important, we’ve created a resource that will help you through it. Follow the guide below:

How to convert your data to JSONL format

  1. Open up this JSONL formatting tool we created and create a copy for yourself to edit.
  2. The “System” column is where our instructions for GPT go. The message can be something like: “You are going to analyze lead job titles to fit them into the correct persona. I’ll send you the job title only, and you should respond with the persona classification only.”
  3. In the “User” column, input the job titles of each of your contacts. In our example, we’ve put “Cloud Infrastructure Analyst” as the job title.
  4. In the “Assistant” column, we are going to input the persona “type” that we want GPT to give us. In other words, when it receives the job title from the “User” column, we want it to categorize that as “Persona A” or simply “A”. Here is an example of what your first row should look like at this point:

     

  5.  

  6. From here, you can repeat the same “System” column message for every single row. Then copy and paste the rest of the job titles from your contacts in the “User” column, and “A”, “B”, “C”, etc. for the corresponding persona type as your output in every row of the “Assistant” column. You don’t need to touch anything in the “JSONL” column, as this has been set up to automatically populate based on the inputs from the other columns.
  7. Once all your data is in there, we need to get it out of the sheet and into a .txt file. Simply copy and paste everything in the JSONL column and paste that into your .txt file.

Important note: Take 80% of your data (if you have 600 rows, then take 480 rows) and put that into one .txt file, then take the remaining 20% of your data (120 rows) and paste those into a second .txt file. We do this because we want two separate JSONLs: One for training (80% of our data) and one for testing (20% of our data).

We do this because GPT will not only train itself on the larger file but will also optimize itself using the test file as a reference – leading to better performance and results.

 

2) Creating a fine-tuned GPT model

Now that our data is cleaned and formatted into 2 JSONL files (one for training, one for testing), we can send it to the OpenAI API to fine-tune our GPT model.

If you want, you can check out OpenAI’s extensive tutorial on how to create a fine-tuned model here. But we will quickly walk you through the basic, high-level steps.

  1. When you start the process of fine-tuning a model through the OpenAI SDK, use a snippet of Python code to upload your JSONL training file like this:
  2. import openai
    openai.api_key = ""
    openai.File.create(
      file=open(r"train_file_path", "rb"),
      purpose='fine-tune'
    )
    

     

  3. Do this again, but now upload your JSONL testing file.
  4. openai.File.create(
      file=open(r"test_file_path", "rb"),
      purpose='fine-tune'
    )
    

     

  5. Check that both files were uploaded and processed successfully using the command “openai.file.retrieve” to check their status.
  6. openai.File.retrieve("Train-File-ID"),openai.File.retrieve("Test-File-ID")
    

     

  7. Now, we can actually fine-tune the model using the code below. Here, GPT will optimize itself by measuring the training file against the test file reference.
  8. openai.FineTuningJob.create(training_file="Train-File-ID", validation_file= "Test-File-ID", model="gpt-3.5-turbo or gpt-4o-mini")
    

     

  9. Lastly, we can confirm that the model is fine-tuned. This is also the step where we receive the fine-tuned model ID, which we will use in our webhook in Marketo. You can also take it upon yourself to test your model before committing it to Marketo using this line of code:
  10. openai.FineTuningJob.retrieve("FT-ID")
    completion = openai.ChatCompletion.create(
      model="MODEL_ID",
      temperature=0,
      max_tokens=100,
      messages=[
        {"role": "user", "content": "Your Test Message"}
      ]
    )
    print(completion.choices[0])
    

     

Note: When creating a fine-tuned model, we are currently limited to GPT 3.5 turbo and GPT4o Mini.
 

3) Integrate your fine-tuned GPT model with Marketo

Our fine-tuned GPT model is now ready to be integrated with Marketo. This is a relatively short step that involves creating a webhook in Marketo (which we covered in Step 4 of this guide) with the following fields:
 

 

4) Integrate your fine-tuned GPT model with Marketo

So we have our fine-tuned GPT model set up (Step 2) and we have our webhook in Marketo created (Step 3). Now we’ll set up some automation in Marketo to use them together.

We’ll do this by creating a smart campaign in Marketo that will be triggered when a new lead is created or when lead information changes.

Once triggered, the smart campaign will send the information via webhook to the fine-tuned GPT, which will respond with the correct persona type (A, B, C, or whatever signifiers you used in your JSONL files).

Finally, if the persona for that lead has changed, the lead record will be automatically updated with the new classification.

Smart List:

 

Flow:

 

Outcome:

 

The Result

When all of this is set up properly, you will have an automatically updating field in Marketo for each lead that will signify which persona they fit into.

  • Here’s a quick example that demonstrates how this new setup will operate:
    • Jim is an “IT Analyst” and has been classified as Persona A.
    • Jim’s role changes to “Technology Analyst”. This new role information could’ve come from a new form Jim filled out, a salesperson on your team updating Jim’s information, etc.
    • Your smart campaign in Marketo is triggered (the one from Step 4).
    • This will call on your fine-tuned GPT model and ask it something like “Which persona is Tech Analyst?” It will respond with Persona A or whichever persona is most appropriate.
    • Then, the Marketo field for Jim’s persona will be automatically updated.

Note: This entire process is not limited to the language you are working in either. It can apply to any language worldwide.

pink line

The upfront work required to set this up is definitely worth it in the long run.

By leveraging a fine-tuned GPT model with proper integration and automation in Marketo, your persona classifications will be far more accurate and up to date, with minimal manual intervention required.

Ultimately, this will improve the effectiveness of your campaigns through better targeting, while freeing up more time for strategic and creative thinking.

And if you need help setting this up or have any other questions about how AI can improve marketing operations efficiency, send us a message here!

Recommended: