AISim › Chapter 4: Running it for real
The 20-page system prompt
Level 16. Every request re-reads the whole manual.
Your compliance assistant sends a 12,000-token system prompt with every request: the full policy manual, tone guide and twenty worked examples. Quality is excellent. The bill is not: almost all of it pays for reading the same text over and over. The small model can't even fit it.
Goals
- cost per 1,000 requests at most $15
- accuracy at least 85%
- median latency at most 5.0s
Concepts: Prompt caching, Cost, Latency.
Hint
The manual is the same in every request. Is there a way to stop paying full price to process the same tokens every time?
What you learn
When every request starts with the same long prefix (system prompt, documents, examples), prompt caching lets the provider reuse its work: cached tokens cost roughly a tenth and are read almost instantly. Put the stable content first and the changing content last, so as much as possible can be cached.
More in this chapter
- The nightly job ate the day (Level 17)
- Fine-tune it? (Level 18)
- Nothing changed. Everything broke. (Level 19)
- Compliance is calling (Level 20)
- Finance wants a word (Chapter 4 boss)
This interactive level needs JavaScript. Built by Joshua Paul (cybernerdie).