AISim › Chapter 2: Making it good
Bring it in-house
Level 10. We moved off the API to save money. Now everything times out.
The API bill was about $10 per 1,000 requests, so the team moved to an open 70B model on rented GPUs: 4 GPUs, one request at a time, full precision. The bill dropped to almost nothing, because almost nothing gets answered. Find a setup that is cheap, fast enough and still as good as the API.
Goals
- error rate at most 1%
- accuracy at least 88%
- median latency at most 7.0s
- cost per 1,000 requests at most $0.7
Concepts: Self-hosting, Batching, Quantization, GPU capacity.
Hint
One request per GPU wastes almost all of it. Raise the batch size and watch throughput jump while each answer slows down. Then decide how many GPUs you really need, and whether you can afford full precision.
What you learn
Self-hosting turns a per-token bill into a capacity-planning problem. Batching is the biggest lever (one GPU serves many requests at once), quantization makes each GPU faster for a small quality cost, and the GPU count sets your bill whether the GPUs are busy or not. The sweet spot is busy but not saturated: too few GPUs and requests queue and time out, too many and you pay for idle silicon.
More in this chapter
- The contract reviewer (Level 6)
- "It feels slow" (Level 7)
- The chat that never ends (Level 8)
- Flying blind (Level 9)
- The enterprise pilot (Chapter 2 boss)
This interactive level needs JavaScript. Built by Joshua Paul (cybernerdie).