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

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

This interactive level needs JavaScript. Built by (cybernerdie).