Introduction to Cost Optimization for GenAI
Reducing FM costs with token efficiency, cost-effective model selection, capacity planning and Provisioned Throughput optimisation, and caching that avoids unnecessary invocations.
- 4 lessons
- Module quiz
Generative AI costs are driven mainly by tokens and by model choice. Every request is charged for the input tokens it sends and the output tokens it receives, output tokens usually cost several times more than input tokens, and prices differ by an order of magnitude or more between the smallest and largest models. Costs can therefore grow quickly as usage grows, and small design choices, such as how many retrieved chunks are included in each prompt, have large effects at scale.
Cost optimisation works on several levers. Token efficiency reduces the tokens each request uses. Cost-effective model selection uses the smallest model that meets the quality bar, with larger models only where needed. Capacity planning chooses between on-demand pricing, Provisioned Throughput and lower-cost tiers for work that can wait. Caching, through prompt caching of repeated prefixes, exact and semantic caches of answers and edge caching, avoids paying for the same work twice.
What the exam expects
Questions test matching the technique to the pattern, such as prompt caching for a repeated long prefix, a semantic cache for paraphrased questions, and batch inference or the Flex tier for latency-tolerant work. Models should be compared on cost per successful outcome rather than price per token, and costs are attributed to teams with tagged application inference profiles.
How this module is organised
Reducing Cost with Token Efficiency explains how input and output tokens are reduced. Selecting Cost-Effective Models explains how cost and capability are traded off. Planning Capacity and Sizing Provisioned Throughput explains how capacity is sized and monitored, and Caching Prompts and Responses to Reduce Cost explains each kind of cache and when it applies.
- Reducing Cost with Token Efficiency Lesson 1
- Selecting Cost-Effective Models Lesson 2
- Planning Capacity and Sizing Provisioned Throughput Lesson 3
- Caching Prompts and Responses to Reduce Cost Lesson 4
- Practise and review
- Checkpoint Practice activities across the module
- Test your knowledge 3 questions