How to make open-source AI models run fast for long coding tasks
According to Ollama Blog: Together AI and Ollama explain why coding agents slow down over long sessions and how to fix it. Because agents send the entire conversation history with every step, the GPU has to re-read thousands of tokens unless you protect the prefix cache.

Original image temporarily unavailable
According to Ollama Blog:
Coding agents have a unique traffic pattern involving a large input sequence length and a small output sequence length. As a session progresses through dozens or hundreds of turns, the input grows massively while the output remains a short tool call. Without proper optimization, the GPU re-reads the entire history on every turn, causing performance to degrade quadratically.
To solve this, developers must rely on prefix caching, which saves intermediate key-value pairs so the engine only processes new content. However, the cache breaks easily. Ollama's harness side highlights that putting changing elements like timestamps in the system prompt, altering reasoning effort mid-session, or injecting tool definitions near the top will instantly destroy the cache. Meanwhile, Together AI's inference engine side explains the challenges of keeping the cache alive, including smart request routing to the correct data center node, offloading idle session memory to the CPU, and splitting prefill and decode phases across clusters.
View selection rationale
Importance 88/100
About this brief
- Content type
- News summary
- Source type
- First-party / official source
- Original source
- Ollama Blog ↗
- Source published
- Process
- AI-assisted discovery, translation, summarisation, classification and scoring; standards and corrections are maintained by the editorial desk.
- Verification
- The original URL and publication metadata are retained. This brief is not independently fact-checked unless explicitly stated.
- Published by
- Polyemergence Editorial Desk · PolyEmergence Pte Ltd.
- Conflict disclosure
- No financial or commercial conflict declared.