CLI Fine-Tune Error: Hard Billing Limit Exceeded

I’m encountering an error that says my fine-tune via the CLI will exceed my billing hard limit, even though my calculation for how much the fine-tune should cost is lower than my billing hard limit. I’ve reached out to OpenAI via email and their support “chat” to see if I can get an estimate for how much it will cost to fine-tune the davinci model, but it’s been over a week without a response from OpenAI.

The training file contains 11,125 lines, with a prompt and completion pair on each line. The file is 23.8 MB. The file contains 23,426,369 characters. According to OpenAI, fine-tuning the davinci model costs $0.0300 / 1K tokens.

According to OpenAI, 1 token equals approximately 4 characters (What are tokens and how to count them? | OpenAI Help Center). So if I did my math right, my training file contains 5,856,592.25 tokens and should equate to a cost of $175.70. My soft billing limit is $200, and my hard billing limit is $500.

However, when I run the fine-tune command via the command line, I receive the following error:

"[2023-05-17 13:41:53] Fine-tune failed. Fine-tune will exceed billing hard limit

Job failed. Please contact support@openai.com if you need assistance."

Why is this not working? Can anyone help me with it?

Do you already have billing usage this month? The billing limit is per month.

Yes, but my billing usage this month is only $39.36.

I just increased my soft billing limit to $300 and am retrying just in case that is the issue.

After increasing the soft billing limit, I still received the same error.

Welcome to the community @tff

IIRC n_epochs also influences the price of fine-tuning.

Thanks for the welcome, @sps!

Do you know how n_epochs affects the price? If the default is 4 epochs, does that mean it costs 4*$175.70?

Edit: I’m adding --n_epochs 1 to the CLI command and retesting.

Looks like it’s working now! Thanks so much for the help.

Yes, because 1 epoch is one complete cycle through the training dataset.

Although it’s worth noting that n_epoch of 1 may not result in adherence to the behavior defined in the training dataset, while higher values may overfit.

From this, it looks like 1 epoch should work for my use case:

[

Conditional generation

](OpenAI API)

Conditional generation is a problem where the content needs to be generated given some kind of input. This includes paraphrasing, summarizing, entity extraction, product description writing given specifications, chatbots and many others. For this type of problem we recommend:

  • Use a separator at the end of the prompt, e.g. \n\n###\n\n. Remember to also append this separator when you eventually make requests to your model.
  • Use an ending token at the end of the completion, e.g. END
  • Remember to add the ending token as a stop sequence during inference, e.g. stop=[" END"]
  • Aim for at least ~500 examples
  • Ensure that the prompt + completion doesn’t exceed 2048 tokens, including the separator
  • Ensure the examples are of high quality and follow the same desired format
  • Ensure that the dataset used for finetuning is very similar in structure and type of task as what the model will be used for
  • Using Lower learning rate and only 1-2 epochs tends to work better for these use cases
1 Like