All Questions
Llm Gateway Cost And Caching medium

A document summarization feature averages 1,500 input tokens and 1,000 output tokens per request, and output tokens cost about 5x input tokens. You must cut its cost by roughly 40% without changing models. Which change gets you there?

  1. A Halve the input prompt with a retrieval filter, since input tokens make up the majority of tokens in each request.
  2. B Cap outputs at around 400 tokens with a length instruction, since output is priced about 5x input and dominates.
  3. C Add a semantic cache, since summaries of documents on similar topics will match often enough to cover the saving.
  4. D Enable prompt caching on the whole request, since cached reads cost about one tenth and also discount output tokens.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions