5+ ways to optimize GPT costs
In this course I provide ideas to optimize GPT costs.
Not all of them may apply to your specific use case, but it is still a good idea to at least learn about them.
This is not meant to be an exhaustive list, but I will keep updating the list as and when I find new ideas.
1 Avoid bad use cases
There are some use cases where it does not really make sense to use GPT.
Make sure you learn about GPT’s limitations too.
2 Provide better instructions
Design your prompts in such a way that you can get the expected result but without having to use up too many tokens.
3 Choose the right OpenAI model
Don’t just blindly choose the cheapest one.
Learn about the tradeoffs. Sometimes models which are more expensive on a per 1K token basis end up costing less in the long run.
4 Shorten Completion length
You don’t always have to send the entire GPT response back to the user.
You can also intercept it and use it to construct your own response. This allows you to design much shorter Completions.
5 Specify suitable output formats for entity extraction
This is a tricky problem to solve, but you can get around it by testing different kinds of prompts.
6 Minimum Viable Token Usage (Avoid LLM Maximalism)
Ideally, you would derive maximum benefit from using GPT while incurring the minimum cost.
I will call this Minimum Viable Token Usage (yeah, I am not very good at coming up with names).
Here is the easiest way to do this.