How to stop a fine-tuned model from generating additional tokens?

Hello, friends. I was experimenting with the OpenAI playground. I got a big problem here. I don’t know how to stop a model from writing extra text after it’s done what I want it to do.

Here, I’ve already got my desired completion : If you exercise on a regular basis, you will have good health.

However, the model is still generating additional tokens (This sentence…as long as it is changed). Please take a look at the attached screenshot


Does anybody have any ideas on how to get rid of it? I really need this one fixed. Your kind answer will be much appreciated. Thank you so much!

1 Like

Hi @conda78o :wave:

I’d use stop and specify ‘\n’ as a stop sequence. You can experiment with different stop sequences to see what works best.

Edit: On taking a careful look at your prompt, I noticed that you’re using ‘\n’ in playground. I’m curious why would you do that? Given that simply writing in the next line automatically appends a ‘\n’ in the string. ‘\n’ is an escape sequence which means new-line.

1 Like

Hi @conda78o ! You can also add a stop word to your dataset, the data prep tool can help if you haven’t tried already.

1 Like