AISim › Chapter 2: Making it good
The contract reviewer
Level 6. Every answer is buried in a 90-page PDF.
Legal wants a bot that answers questions about long contracts. To "not miss anything", someone set retrieval to grab 12 huge chunks per question and pinned the cheap small model to save money. Now every request fails.
Goals
- error rate at most 1%
- accuracy at least 72%
- cost per 1,000 requests at most $6
Concepts: Context windows, Reranking, Cost.
Hint
Count the tokens: 12 chunks × 1,000 tokens won't fit in a small model's window. You can buy a bigger window, or send fewer, better chunks. Which one keeps the bill down?
What you learn
Context windows are a budget, not a bucket. Stuffing more into the prompt costs money, adds latency and drowns the answer ("lost in the middle"). Retrieving wide and reranking down to a few precise chunks fits a small, cheap model, and is usually more accurate than a huge prompt on a big one.
More in this chapter
- "It feels slow" (Level 7)
- The chat that never ends (Level 8)
- 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).