Alibaba Cloud's AI Coding Assistant Qoder Nearly Doubles Tasks Per Quota Through Three Cache Optimization Strategies
Alibaba Cloud's AI coding assistant Qoder details how three caching optimizations—layered system prompts, two-level session affinity routing, and parent-child session inheritance—raised cache hit rates and reduced average Credits per Auto task from 4.43 to 2.6.
Model caching matches the prefix of a request. A hit requires three conditions to hold at once: the content before the cache point must be identical word for word, the request must land on the same resource that stored the cache, and it must arrive within the cache's validity window. Any change anywhere in between forces everything after it to be reprocessed. Qoder made three optimizations along these conditions, each aimed at a different scenario. The result is a 41% drop in average Credits consumed per Auto task over the past month, from 4.43 to 2.6. At that average, a quota that previously covered 10 tasks now covers roughly 17.
The first strategy addresses prefix identity. In a single development task, an agent may send dozens of rounds of requests to the model. Each round carries tool definitions, the system prompt, and the entire conversation so far, yet what is actually new is usually just the latest tool result. Model caching says the repeated content does not need recomputation: if the input prefix matches content the model has already processed, that portion costs far less than reprocessing, potentially dropping to one-tenth or even one-twentieth of the uncached rate. The problem Qoder found was that on explicit-caching models such as Qwen and an overseas SOTA model, 5% of requests recorded zero cache hits. The cause was how the system prompt was organized: it contained both public rules shared by all users and personalized content that varies per user, all in a single block. A cache point could only be placed at the end of that whole block, so once the personalized content changed, the large fixed chunk ahead of it could not be reused independently.
The fix was to split the system prompt into ordered content blocks, placing the globally shared part first and the personalized part last, then positioning cache points at the boundary of each layer. After this change, a single request to the overseas SOTA model carries up to 4 cache points, ordered from widest to narrowest reuse scope: end of built-in tools, end of the globally shared prompt, end of the full system prompt, and end of the conversation. The earlier a layer, the more stable it is, and the more chances there are to reuse it. Only the common prefix containing no user information is reused across users; prefixes with personalized content and conversation history are reused only by the same user's subsequent requests.