AI & Computational Science

KV-streams for Efficient Compaction in Agentic Reinforcement Learning

How the science connects

Large language modelReinforcement lear…Caching

AI Insight

This preprint introduces KV-streams, a technique to improve the efficiency of training large language model agents that require long context windows. The method streams the key-value cache forward during context compaction rather than repeatedly refilling it, achieving 2.6 to 5x faster training speeds across three different compaction strategies. The researchers also found that the streamed KV cache functions as a recurrent state that retains information beyond what remains in the active context window.


This approach could significantly reduce computational costs and GPU memory requirements for training AI agents that need to process long sequences of information. The technique is designed as a plug-and-play solution compatible with existing compaction methods, making it readily adoptable in current reinforcement learning pipelines for agentic systems.


⚠️ Preprint – Noch nicht peer-reviewed

Dieser Artikel wurde noch nicht von unabhängigen Experten begutachtet. Die Ergebnisse sind vorläufig und sollten mit Vorsicht interpretiert werden.

Abstract: Scaling the horizon of agentic LLMs is bottlenecked by the need to fit ever longer context traces in GPU memory. Context compaction has been the most popular mechanism to alleviate this issue, keeping GPU memory constant for a given trace. Unfortunately, most compaction strategies rely on prefilling the LLM context many times over, hindering training throughput. To alleviate this bottleneck and enable efficient trainable compaction, we propose KV-streams, a plug-and-play strategy compatible with any compaction strategy that substantially increases throughput while showing no evidence of hindering performance. KV-streams enable scalable compaction by streaming the KV cache forward rather than flushing it after each compaction. We show that KV-streams enable three different compaction strategies, achieving a 2.6 to 5x wall-clock speedup in training. Beyond efficiency, we find that the streamed KV cache can act as a recurrent state, carrying forward information that has long since disappeared from the context. Specifically, in a controlled setting we show that, contrary to prior work, RL alone is all that is needed for this behavior to emerge. Overall, we show KV-streams to be an efficient and lightweight plug-and-play addition to any post-training pipeline.

Source: KV-streams for Efficient Compaction in Agentic Reinforcement Learning