AITMONDO

Ollama and Together AI explain why coding assistants reprocess long inputs

Translucent teal and amber plates overlap in the opening of a dark machine, with another plate suspended in front.
Illustration of how AI systems can reuse prior computations when processing input. AITMONDO (AI-generated).

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.

Calculations for the matching beginning of an input can be reused. Changes near the start, or a missing cache on the machine handling the request, cause more of the input to be processed again.
AITMONDO graphic based on primary sources.

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.

Primary sources