Got awful results after fine-tuning

Hi guys,

I just fine tuned my first model but got awful results, even with the davinci model. The sentences I get don’t have any sense. I created a dataset of 269 paragraphs from blog articles on a very specific topic and with ideas I agree with.
The prompt is the title of the paragraph and the completion is the paragraph itself.

Also, the dataset prepration tool made me add +++ but I got a lot of these in my results.

Is it the wrong approach ? Is my dataset just too small ?
Did anyone manage to have good results with a custom dataset of blog articles ?

Would be so very helpful. Thank you!

1 Like

Hi, could you share a line of your dataset? Do they all have the same format?

2 Likes

Sure :

prompt : The Link Between Character Arcs and Story Structure
completion : Too often, character and plot are viewed as separate entities—to the point that we often pit them against each other, trying to determine which is more important. But nothing could be farther from the truth. Plot and character are integral to one another. Remove either one from the equation, or even just try to approach them as if they were independent of one another, and you risk creating a story that may have awesome parts, but which will not be an awesome whole.We often think of plot as being about structure, but our notions of character and character arc tend toward the more airy-fairy. Surely, character arc is something that must evolve organically from the characters themselves. Surely, we can’t structure our character arcs without making them formulaic or robbing them of life and spontaneity.Surely, right?Wrong, actually. When we say plot and character are integral to one another, what we’re really saying is that plot structure and character arc are integral to one another. In his classic Story, Robert McKee says:If you’re familiar with the basics of story structure , then you can probably already see some of this structuring of character arc in action . The Major Plot Points all revolve around the character’s actions and reactions. As Michael Hauge says in Writing Screenplays That Sell:The character drives the plot, and the plot molds the character’s arc. They cannot work independently.

edit : Maybe best to share a line from my jsonl file

{“prompt”:“The Link Between Character Arcs and Story Structure ->”,“completion”:" Too often, character and plot are viewed as separate entities—to the point that we often pit them against each other, trying to determine which is more important. But nothing could be farther from the truth. Plot and character are integral to one another. Remove either one from the equation, or even just try to approach them as if they were independent of one another, and you risk creating a story that may have awesome parts, but which will not be an awesome whole.We often think of plot as being about structure, but our notions of character and character arc tend toward the more airy-fairy. Surely, character arc is something that must evolve organically from the characters themselves. Surely, we can’t structure our character arcs without making them formulaic or robbing them of life and spontaneity.Surely, right?Wrong, actually. When we say plot and character are integral to one another, what we’re really saying is that plot structure and character arc are integral to one another. In his classic Story, Robert McKee says:If you’re familiar with the basics of story structure , then you can probably already see some of this structuring of character arc in action . The Major Plot Points all revolve around the character’s actions and reactions. As Michael Hauge says in Writing Screenplays That Sell:The character drives the plot, and the plot molds the character’s arc. They cannot work independently.+++"}

They all have the same format.

Thanks for the help!

1 Like

+++ should be set as the stop word to get it to stop at the right point… If you don’t have it set as stop word, it could show up multiple times in the output…

1 Like

Thank you ! One problem solved :slight_smile:

1 Like

No problem. As for the quality, 269 might be too small of a dataset. I believe OpenAI recommends doubling if it doesn’t work well. So, try to get at least 500 or so and try to fine-tune again. If that doesn’t work, try 1,000, etc.

2 Likes

Could the structure of the training data be throwing it off? The prompts are written as heading titles, followed by a little arrow. But it’s unlikely that users are going to prompt like that. Maybe structure the prompts in a similar way that a user might actually prompt. As a question perhaps? e.g. “What is the link between Character Arcs and Story Structure?”

How do expect your bot to behave? Is it going to give long monologs, like in your training data? You could try to break that material down into more manageable chunks. Each prompt/competion should resemble how the bot and user will actually interact.

When I’ve trained a model on lots of material, I’ve also had good luck just leaving all the prompts empty, which gives the AI flexibility to mix and match text in it’s responses. Good luck.

2 Likes

+1 to the prompt comment. Try removing the prompt and just train on paragraphs or rephrasing the prompt to be longer.

3 Likes

I’d try without the prompt. If you do include the prompt, though, it’s best practice to keep the text on the very end the same, I believe.

1 Like

That’s a great suggestion, thank you so much !

1 Like

Take into account that fine tunning does not work with davinci002, but an older version so the answers will be always worse than in the playground.

1 Like

Personally I notice the space issues in completion:

Incorrect spacing may cause issues with the tokenization of the elements. I bet this came from the poor code to remove the line breaks in your completion generator. The approach I usually use is:

1 Break text into lines
2 Trim each line separately
3 Implode the array of lines with one space

Also, a regex to replace multiple spaces with one space only is a must. Also, ensure punctuation is followed by a space (I don’t see exceptions to this rule, do you?).

Then the format I’d use would be something like this:

{“prompt”:“<|title|>The Link Between Character Arcs and Story Structure<|endoftext|><|paragraph|>”,“completion”:" Too often, character and plot are viewed as separate entities — to the point that we often pit them against each other, trying to determine which is more important. But nothing could be farther from the truth. Plot and character are integral to one another. Remove either one from the equation, or even just try to approach them as if they were independent of one another, and you risk creating a story that may have awesome parts but which will not be an awesome whole. We often think of the plot as being about structure, but our notions of character and character arc tend toward the more airy-fairy. Surely, a character arc is something that must evolve organically from the characters themselves. Surely, we can’t structure our character arcs without making them formulaic or robbing them of life and spontaneity. Surely, right? Wrong, actually. When we say plot and character are integral to one another, we’re saying that plot structure and character arc are integral to one another. In his classic Story, Robert McKee says: If you’re familiar with the basics of story structure, then you can probably already see some of this structuring of character arc in action. The Major Plot Points all revolve around the character’s actions and reactions. As Michael Hauge says in Writing Screenplays That Sell: The character drives the plot, and the plot molds the character’s arc. They cannot work independently.<|endoftext|>"}

Use the ‘<|endoftext|>’ as a stop sequence in your completion API calls.

Also, I wouldn’t rely on tools to sanitize the data for the training, I personally prefer using my proper code (PHP json_encode() ) that takes care of special characters, etc., to be sure the data I’m giving to the model is as clean as I can make it.

Another thing to play with is the n_epochs parameter; here, you have a shorter prompt and longer completion, so I would try to increase that parameter to 5 or 6 to start with and see if it gives better results.

But there is one thing that triggers an alarm for me in your initial post:

What is the final goal you’re trying to achieve?

1 Like