가장 큰 production cost lever
요즘 API는 프롬프트 일부를 cached로 mark 가능 — system 프롬프트, 긴 문서, tool catalog. Cache hit은 input cost의 일부로 billed (Anthropic: read 10%, write 25%, TTL 분~시간 범위). 같은 프롬프트 하루 1M번 부르는 시스템에 caching은 $60K/월 vs $6K/월 차이.
cache할 것
- System 프롬프트 — tiny 아니면 거의 항상.
- 거의 안 변하는 긴 문서 — manual, reference data.
- Tool definition — schema와 description, 특히 many-tool agent에.
- Few-shot example — example block 크고 stable하면.
cache 안 할 것
- user의 현재 message.
- per-request 데이터.
- RAG 결과 (query마다 다름).
순서 trap
Cache breakpoint은 positional. breakpoint 전 모든 게 cache, 후 모든 게 fresh. 작은 system 프롬프트 + 큰 문서면 breakpoint를 문서 후에 set해. 프롬프트 reorder하면 cache invalidate. cache layout 한 번 결정, stable하게 유지.