Fine tuning prompts question

Question:

We have been doing our text completions like this:

Text_from_Whisper=“Good afternoon this is Mary with CVS Pharmacy in Prospect. I’m just calling because I need dr. Scott Van Der his DEA number or NPI number that order to fill a prescription for Michelle Paige Smith date of birth 8 9 74. We would appreciate it. Thank you. By phone number is 203-758-3316. Thank you. Bye.”

Prompt_for_GPT_J=“Extract and display only the first date of birth found as two digits with leading zeros for the month, two digits with leading zeros for the day, and four digits with leading zeros for the year from the following sentence: Text_from_Whisper|DOB:”

Then we get the result.

However we have been doing our fine tunings like this:

Fine_tuning_rule=“Good afternoon this is Mary with CVS Pharmacy in Prospect. I’m just calling because I need dr. Scott Van Der his DEA number or NPI number that order to fill a prescription for Michelle Paige Smith date of birth 8 9 74. We would appreciate it. Thank you. By phone number is 203-758-3316. Thank you. Bye.|DOB: 08/09/1974”

So the question is should our fine tunings actually be like this instead?

Fine_tuning_rule=“Extract and display only the first date of birth found as two digits with leading zeros for the month, two digits with leading zeros for the day, and four digits with leading zeros for the year from the following sentence: Good afternoon this is Mary with CVS Pharmacy in Prospect. I’m just calling because I need dr. Scott Van Der his DEA number or NPI number that order to fill a prescription for Michelle Paige Smith date of birth 8 9 74. We would appreciate it. Thank you. By phone number is 203-758-3316. Thank you. Bye.|DOB: 08/09/1974”

Or is it ok to just do them like this?

Fine_tuning_rule=“Good afternoon this is Mary with CVS Pharmacy in Prospect. I’m just calling because I need dr. Scott Van Der his DEA number or NPI number that order to fill a prescription for Michelle Paige Smith date of birth 8 9 74. We would appreciate it. Thank you. By phone number is 203-758-3316. Thank you. Bye.|DOB: 08/09/1974”

Any thoughts or ideas greatly appreciated.

Carl

1 Like

Hi @silvacarl

According to my understanding, fine-tuning, among other purposes, is done to reduce the prompt tokens to reduce cost for a high volume of calls.

In my opinion, it should be just the text from Whisper as prompt and the desired result in completion. Even remove the term “DOB:” from the completion.

@daveshapautomator, @ruby_coder and @PaulBellow may have more insights.

2 Likes

Yeah, I believe OpenAI suggests not to use something at the beginning that repeats every single entry.

1 Like

I agree with that, I just noticed depending on the fine tuning use of it or not, you get different results.

which is why i was asking, seems strange to me.

Well, if you think about it… the model would suddenly have the same exact text 100 to 1000 times depending on your dataset. So, it would be “baked in” that those sequences of words are important (because they showed up so often in the training data…) and that could affect your output when querying the fine-tuned model.

1 Like

yeah we are basically trying to extract a date of birth from a spoken sentence.

how people state a date of birth is all over the map.

to get high accuracy, we have been experimenting with different prompts as well as fine tuning.

for things like patient self-scheduling.

1 Like

from chatgpt:

It is generally recommended to include the prompt in the fine-tuning rule to ensure that the model learns to generate the desired output based on the input. Therefore, it would be better to include the prompt in the fine-tuning rule, as in the following example:

Fine_tuning_rule=“Extract and display only the first date of birth found as two digits with leading zeros for the month, two digits with leading zeros for the day, and four digits with leading zeros for the year from the following sentence: Good afternoon this is Mary with CVS Pharmacy in Prospect. I’m just calling because I need dr. Scott Van Der his DEA number or NPI number that order to fill a prescription for Michelle Paige Smith date of birth 8 9 74. We would appreciate it. Thank you. By phone number is 203-758-3316. Thank you. Bye.|DOB: 08/09/1974”

I mean, ChatGPT is known to give false information, but sure. :wink:

This is from the docs…

In particular, while prompts for base models often consist of multiple examples (“few-shot learning”), for fine-tuning, each training example generally consists of a single input example and its associated output, without the need to give detailed instructions or include multiple examples in the same prompt.

https://platform.openai.com/docs/guides/fine-tuning

https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset

Might be best to try it both ways and see which resulting model gives best results for your use-case?

Good luck!

2 Likes

yeah we are going to try the fine tuning multiple ways and run tests to determine the best approach.

:sunglasses:

Thanks for the @ mention, @sps, must appreciated.

I think it’s a good idea when we use a common vocabulary to talk about technology, especially when coding solutions @silvacarl; and to be honest, your use of the term “Fine_tuning_rule” makes it more time consuming to process your questions and provide guidance.

Are you talking about GPT-J or OpenAI fine-tunings?

If you are talking about OpenAI fine-tunings, how does your use of the term “Fine_tuning_rule” map to a JSONL line, exactly? Can you post an example of your JSONL file?

Thanks!

:slight_smile:

1 Like

we are testing both. we need to do 10K calls a day, and the issue is that openai runs out of tokens per day and we have not been able to get them to increase it enough for our use case.

so we are working on fine tuning of both and comparing results.

So yes, we are doing testing on both openAI and GPT-J-6B side by side fine tuned to beanchmark each one.

If you have any thoughts on this let me know.

What did you find out? I have a large dataset of regulatory information. I’ve broken down into sections, and would like to fine-tune with a multi-question prompt for each completion section. Did you try this method and did it work?

because openai runs out of tokens very quickly in a production enviroment, we have had to focus on GPT-J, buth fine tuning and inference.

it is possible with the new API for gpt-3.5-turbo and gpt-3.5-turbo-0301, it may work ok, we just have not had enough time to test it yet.

i find it strange that no one brings up this giagantic short coming of running out of tokens so quickly.

we have asked if tokens per 24 hour period can be increased but have not heard back.