Doesn't Understand fine tuned model cost

Hi there,

I am attempting to create a new fine-tuned model based on the Davinci base model, using around 2000 characters of training data contained in the “training_data.jsonl” file, which has 500 tokens.
The cost for the fine-tuned Davinci model is $0.03 per 1000 tokens.
Based on this, I calculated that my fine-tuning job would require 500 tokens and cost $0.015.
However, upon checking my OpenAI account, I noticed that the data showed 1512 trained tokens, which cost around $0.045.
I am curious as to why the fine-tuning job required more tokens than expected.

I’m not sure how you would do a finetune with only 500 tokens unless you were just doing 1 or 2 word prompts and completions.

I’m near my hard limit of $120 for fine tuning and I have a similar question on the calculation of the pricing. I have 270700 tokens in my doc and the cost should be (270700 / 1000 * $0.03) $8.12. I’m wondering if the fine tunes are double, triple or quadruple counted because they have to be processed multiple time? I did the napkin math on the token usage I’ve had and it seems like I’m being over-charged, unless there is something more to the calculation I don’t understand.

I have the same problem (MODIFIED by calculating with epochs):

Davinci model training using the API CLI
840 training records (12K words, cca. 20K token)
210 validation records
4 epochs
calculated training cost: 20K token * 0.03 USD/1K token * 4 epochs = 2.4 USD

Instead it displays 4.55 USD.

I am only getting to the 4.55 USD price, if I assume that it is also adding one-time or multiple times “Usage” as well per 0.12 USD/1K token:

20K token * 0.12 USD/1K token = 2.4 USD.

By the way, I could not find a token counter during the training.

You need to remember, training requires multiple “epochs” (loops through the data), the default number is 4.

Yes, that is definitelly a factor, but still the difference is too big. Is there any way to calculate the approximate cost before training? It displays it at the beginning of the process, but that is too late already. Also, it would be good to see the details of the price calculation. I am not looking for an exact calculation, but a rough one

It should be, roughly,

# of tokens × # of epochs × 0.03 / 1000

Create your own custom models by fine-tuning our base models with your training data. Once you fine-tune a model, you’ll be billed only for the tokens you use in requests to that model.

what does this means from above line

so it will charge only prompt tokens not responce tokens if i am requesting from fine tuned model

No you’ll get charged for both.

What it means is that you are only charged for the initial training and any requests for the model. There’s no base monthly cost or whatever for them hosting the model

so if i am training 50k tokens on davainci model and the per token price is 0.00003

so i will multilply 50k*0.00003=1.5 dollar

is this right or anything i forgot

Times the number of epochs you’re training for.

2 Likes

Please, I have questions urgently.
when I fine-tune Davinci model, and I want to save it in my local, is this possible?

and if I will save this model in their part, when I will use this model, I will billed by tokens all time, or just in once for Fine-Tuning.