Ollama and Together AI explain why coding assistants reprocess long inputs

On November 16, authors from Ollama and Together AI explained when prefix caching can help an AI coding assistant that takes dozens of steps. The technique reuses previous computations for the portion of the input that still matches from the beginning.
Reusing previous computations for matching input
Coding assistants often send earlier instructions and work history back to the model. As a session continues, the history grows relative to the new input. Prefix caching can reuse earlier work up to the first change in the input. Everything after that point must be processed again. In a simplified example where each step adds the same amount of input, ten steps require processing 55 units of input without reuse and 10 units with reuse. The figures illustrate the amount of input processed and do not measure speed.
Both input structure and request routing matter
Ollama explains that putting information that changes with each request near the start of the input, or inserting new tool definitions there, causes later portions to be processed again. Together AI notes that reuse depends on whether the machine handling the next request still has the cache. If that machine is busy, processing the input again on another machine can be faster than waiting.