All jobs / AI engineer / LLM APIs
AI engineer interview question · 1–3 years
You turned on prompt caching for an assistant with a long system prompt and a dozen tools, but the provider’s usage report shows almost no cached tokens.
What do you look for?
The strongest answer
Something that changes near the start of the request: caching matches an exact prefix, so a timestamp or user detail in the system prompt, or tools sent in a different order, invalidates everything after it — I put stable content first and volatile content last
Why it works
Exactly — tools, then system prompt, then messages, matched byte for byte from the top. One changing value early on makes every request a cache miss.
What a good answer covers
- Caching is an exact prefix match.
- Stable first, volatile last.
- Hunt timestamps and unordered tools.
- Verify with cached-token counts.
Answers that fall short
- Close, but not the strongest: Whether the cache lifetime is too short for our traffic, so entries expire before the next request
Worth checking second: expiry does matter for sparse traffic. But a near-zero rate on steady traffic almost always means the prefix differs. - Weak: Whether the prompt is long enough; maybe caching needs to be requested with a higher priority
There is a minimum length, but you said the prompt is long. Priority is not how caching works. - Red flag: Nothing — caching is the provider’s job, so a low hit rate means their cache is not working
Whether the prefix is stable is decided by how you build the request. This is one of the cheapest cost wins there is, and it is yours to get.
Who gets asked this
More LLM APIs questions
- At peak your service starts getting HTTP 429 from the model provider. What should the client do?
- You switch the assistant to streaming. What changes for your backend beyond “the text appears sooner”?
- Traffic to the assistant grew by a tenth this month and the model bill doubled. How do you find out why, and…
- A nightly job classifies the day’s support tickets through the same synchronous endpoint and API key as the…
- What are your levers, in what order, and what do you promise?
- Your chat feature sends only the user’s newest message to the model API, and follow-up questions get confused…
- How do you choose which model to call for a new feature?
- What is missing between the model’s reply and your order object?