AISim › Chapter 2: Making it good
The chat that never ends
Level 8. Memory optimization: it either forgets what you said, or costs a fortune.
Customers love planning whole kitchens with your shopping assistant, in chats that run 20, 40, 80 messages. They refer back all the time ("like I said earlier, my budget is…"). The prototype resends the entire conversation with every message. The bill grows every week, answers get worse as chats get longer, and the longest chats have started failing.
Goals
- cost per 1,000 requests at most $12
- accuracy at least 85%
- error rate at most 1%
Concepts: Memory optimization, Stateless models, Cost.
Hint
Open a few requests and look at what each one sends. Does the model need every word from 40 turns ago, or only the few facts this message depends on? Try each memory strategy and watch which goal breaks.
What you learn
Models are stateless: they remember nothing between calls, so "memory" is whatever you choose to resend. Resending everything is accurate at first, then gets expensive, slow and noisy, and eventually overflows. A sliding window is cheap but forgets. A summary keeps the gist but loses specifics. Storing the conversation as long-term memory and retrieving only what each message needs keeps prompts small and the important facts in view.
More in this chapter
- The contract reviewer (Level 6)
- "It feels slow" (Level 7)
- Flying blind (Level 9)
- Bring it in-house (Level 10)
- The enterprise pilot (Chapter 2 boss)
This interactive level needs JavaScript. Built by Joshua Paul (cybernerdie).