Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Keeping AI Features Fast, Affordable and Running (Summary)

You’ve finished Keeping AI Features Fast, Affordable and Running. Now you can:

  • Pin and upgrade the model with evals
  • Give every request a time budget, with fallbacks
  • Cache what can be cached
  • Keep cost within a budget
  • Make answers feel fast, measuring each change

Kept Running

  • Over five eval runs on 24 cases, the current model passed 86.7% of its answers (104 of 120). Its successor, with one prompt line added, passed every time.
  • On the stand-in provider, a time budget cut the worst wait from 27 seconds to 7.
  • With one simulated call in twenty timing out, five requests in a thousand failed. With the fallback chain, all 1,000 were served, five of them with only the latest reports. The answer role gave 939, the fast role 56 and the latest-reports message 5.

Kept Affordable

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 You’ve finished Keeping AI Features Fast, Affordable and Running. You can pin and upgrade the model with evals, give every request a time budget with fallbacks, cache what can be cached, keep cost within a budget, and make answers feel fast.

00:17 Every change came with a number.

00:21 Over five eval runs, the current model passed 86.7 percent. Its successor, with one prompt line added, passed every time. On the stand-in provider, a time budget cut the worst wait from 27 seconds to 7.

00:38 With one call in twenty timing out, five in a thousand failed. With the fallback chain, all got a useful answer, a few limited.

00:49 With the stable part first, 94.2 percent of input tokens came from cache, and cost per thousand questions fell from 2.78 dollars to 2.15 on one provider. A cold cache costs more than retrieval.

01:05 Keying cached answers on the reports’ version cut stale answers from five to none. On one recorded day, routing low-stakes questions to the fast role did most to cut cost from over two dollars to 1.63, with every eval passing and emergencies kept on the answer role.

01:25 Looking up free beds up front, and streaming without tools, cut the wait for the first words on beds questions from about 4 seconds to under 3, and for the day’s slowest answers from over 8 seconds to under 7.

01:41 In the project, you checked the August rush against the wardens’ targets for p95 latency, cost and pass rate, on your model and its successor.

01:51 Pin the model. Upgrade with evals. Budget the whole request. Fall back to something useful, and say it’s limited. Put the stable part first. Expire cached answers with their sources.

02:05 Count quotas in tokens. Split the wait into first token and generation. Cut the bigger part.

02:14 Next on this path: what if hikers misuse a free assistant? A related course, Concurrency, Failures and Cancellation in Async Code, covers deadlines and cancellation.

02:28 Thanks for working through the course, and congratulations.

Become a Member to join the conversation.