Boss lesson · Unit 04
Design an inference service
Route, cache, fail over, and watch cost, latency and quality together
What you practise
- Route easy requests to a small model, cache what repeats, fall back when a replica fails, watch cost, latency and quality together
Try a question from this lesson
Pick one
A support assistant sends every request to its largest model. 70% are simple (order status, password reset). Which change cuts cost most without hurting the hard 30%?
Correct answer
Send simple requests to a small, cheap model
Why
Most of the traffic does not need the big model. Routing the easy 70% to a small one cuts cost and latency for them and leaves the large model for the requests that need it. A lower token limit for all would cut off the hard answers.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
A router
A router looks at each request and picks a model for it. It can be a set of rules, a small classifier, or the small model itself saying "this one is beyond me".
It is cheap compared with the models behind it, and its mistakes go both ways: easy requests sent up cost money, hard ones sent down cost quality.
request -> router -+-> small model
+-> large modelConcept
Three dials
A serving system is judged on three things at once. Cost: tokens in and out, per request. Latency: time to first token, tokens per second, the p99. Quality: eval scores on sampled live traffic, and what users report.
Almost every optimisation improves one and risks another. Watch all three on the same screen.
10 more exercises in the app
- 3× type the answer
- 3× multiple choice
- 1× fill the blanks
- 1× true or false
- 1× match the pairs
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.