Redesigning Cache Management for Hybrid Architectures: The Key to 3× Higher Agent Prefill Throughput
Hybrid architectures combine full attention with linear layers or state-space components to reduce decoding cost and memory usage, but their heterogeneous intermediate states create serious cache-management challenges for long-context, multi-turn Agent workloads. This article presents a layered caching design that separates attention KV caches from linear-layer state caches, coordinates cache reuse with computation scheduling, enables cross-node state sharing, and applies differentiated lifecycle policies. Replay tests on NVIDIA B200-class GPUs achieved up to 3.14× higher prefill throughput and an 88.4% reduction in p90 time to first token. The largest gains appeared in workloads with long, repeatedly reused prefixes.
Background and Challenges: Cache Management in Hybrid Models
Large language model inference systems are increasingly adopting hybrid architectures. These models retain full attention to preserve long-range dependency modeling while introducing linear layers, such as linear attention or state-space components, to compress key-value cache storage. The result is faster decoding and lower memory consumption.
Although hybrid architectures perform well with short contexts, they introduce more difficult cache-management problems for Agent workloads, which typically involve multiple turns and long contexts.
The core issue is that every layer in a hybrid model maintains its own intermediate state. Full attention layers cache complete key-value pairs, while linear layers maintain compressed state vectors that are updated as the sequence grows. During multi-turn Agent interactions, these states are not static. They evolve with every new input.
When a prefix is reused—for example, across multiple turns of a conversation or while multiple Agents debug the same codebase—traditional cache systems often cache only the KV pairs from full attention layers. They lack an effective way to manage the evolution of linear-layer states. As a result, prefill still has to recompute a large portion of the linear-layer forward pass, creating a significant throughput bottleneck.
Core Cache-Management Challenges
Hybrid model caching involves at least three major challenges.
1. Heterogeneous State Behavior
Full attention and linear layers have different state lifecycles. KV caches can be fully reused when the input prefix is identical. Linear-layer states, however, often depend on the exact input sequence, so even a small change can invalidate them.
2. Coarse-Grained Reuse
Most inference frameworks use the input sequence prefix as the primary cache unit. This makes it difficult to identify finer-grained reuse patterns within linear-layer states.
3. Tight Coupling Between Storage and Compute
The prefill phase concentrates much of its computation in full attention layers, while decoding latency is often dominated by linear layers. These different bottlenecks require different caching strategies, but existing systems tend to process both types of state uniformly.
Design Approach: State Separation and Hierarchical Caching
Reclassifying Cache Objects
The first design principle is to change the fundamental unit of cache management. Instead of treating all intermediate results uniformly, the system should explicitly divide them into two categories:
- KV caches from full attention layers
- Compressed state caches from linear layers
These two cache types differ fundamentally in storage format, update frequency, reuse probability, and lifecycle. They should therefore be managed independently.
KV caches have relatively permissive reuse conditions: if the token sequence in the input prefix is identical, the KV pairs can be reused without loss of accuracy. Linear-layer states are different. They are compressed representations of the complete prefix and are more sensitive to small sequence changes.
The cache system should therefore use separate lookup indexes and update policies for the two state types rather than relying on a single generic prefix table.
A Hierarchical Cache Architecture
A two-level cache architecture can be built around this separation.
The first level is a KV cache pool for full attention layers. It stores historical key-value pairs and provides high-fidelity prefix reuse.
The second level is a state cache pool for linear layers. It stores compressed state snapshots for different time steps and uses more flexible invalidation rules.
A coordination layer can be added between the two pools to:
- Analyze prefix characteristics
- Identify the best cache starting point
- Determine which cache entries can bypass recomputation
The main benefit of this layered design is that prefill only needs to process sequence segments that miss the cache. Matching KV and state entries can be reused directly. During decoding, the system can advance using the compressed linear-layer states without accessing the full historical KV cache for every token.
Decoupling the two cache types creates independent optimization opportunities for prefill throughput and decoding latency.
Coordinating Computation and Cache Scheduling
Layered caching alone does not solve every problem. Long-context Agent workloads are often characterized by many short requests arriving over multiple turns. Each request may add only a small number of tokens, while the total request volume is large.
For this pattern, the scheduler should adopt an incremental-first strategy. It should prioritize existing cached states and compute only the intermediate results required for newly added sequence segments. This differs substantially from the traditional approach of performing every prefill from scratch.
In practice, a KV cache hit should trigger a simultaneous validity check for the corresponding linear-layer state.
- If the linear-layer state is invalid, the system only needs to recompute the linear-layer forward pass. It does not need to rebuild the complete full-attention matrix.
- If the full-attention KV cache misses but the linear-layer state remains valid, the system can compute only the necessary attention scores while reusing the compressed historical state.
This fine-grained coordination between computation and caching can significantly reduce redundant work.
Cross-Node State Reuse
In distributed inference environments, including multi-GPU and multi-node clusters, another important optimization is cross-node reuse of hybrid states.
When a request is scheduled on a different compute node, nodes should be able to share cache metadata and quickly determine whether the target node already contains the required prefix state. If it does, the system can transfer only the incremental tokens instead of sending the entire context again.
This requires two capabilities:
- A unified global cache index that can locate the state for any prefix across different nodes.
- An efficient state-transfer protocol that can migrate KV caches and linear-layer states at different granularities.
Together, these capabilities can substantially reduce cross-node communication overhead in distributed Agent applications, particularly when multiple Agents collaborate in parallel.
Lifecycle Management and Memory Watermarks
As contexts grow, the size of both linear-layer states and KV caches can increase nonlinearly. Cache lifecycle management therefore becomes an essential part of the system design.
The system must store both cache types within limited high-bandwidth memory, but their eviction policies should be different.
For KV caches, a combination of sliding windows and hierarchical eviction can be used:
- Recent hot data remains in GPU memory.
- Medium-term data is moved to CPU memory.
- Cold data is evicted.
Linear-layer states can use on-demand snapshots. The system periodically records checkpoints. If rollback is required, it restores the latest checkpoint and replays only a small number of new tokens instead of recomputing the entire sequence.
This approach preserves a high cache-hit rate while reserving scarce high-bandwidth memory for the most active data, helping maintain stable overall throughput.
Implementation Path and Key Technical Considerations
Several implementation details are important when deploying this caching design:
- State snapshot serialization: Linear-layer state vectors should use a compact binary format that supports fast serialization and deserialization, reducing cache access latency.
- Cache index structure: Efficient structures such as prefix trees or skip lists should support fast matching based on the longest common prefix.
- Asynchronous prefetching: During decoding, the system can predict likely future prefix accesses and load the corresponding states into high-speed cache in advance to hide memory-access latency.
- Consistency guarantees: When multiple nodes update state caches concurrently, version consistency must be maintained to prevent reads from returning stale or partially written states.
Performance Validation and Results
Replay tests using traces from multiple real-world Agent workloads demonstrated substantial performance improvements.
On NVIDIA B200-class GPUs, prefill throughput increased by up to 3.14× compared with mainstream general-purpose inference frameworks. The p90 time to first token decreased by as much as 88.4%.
The benefits remained significant even when large CPU-memory caches were involved. This indicates that the optimization is not limited to GPU memory. It also applies to a two-tier storage hierarchy spanning CPU and GPU memory.
The performance gains were not uniform across all workloads. The largest improvements appeared in multi-turn workloads with long, frequently reused prefixes. Short-context, one-shot requests saw more limited benefits.
This behavior matches the design objective: hybrid state caching delivers the greatest value when reuse rates are high and interactions are iterative. These characteristics are especially important for Agent orchestration, automated programming, and multi-document analysis.
Conclusion and Outlook
The rise of hybrid architectures is driven by a practical need to overcome the decoding bottlenecks of pure Transformer models. However, fully realizing their architectural advantages requires corresponding improvements in cache infrastructure.
The redesigned approach described here addresses key obstacles in long-context Agent inference by:
- Separating full-attention KV caches from linear-layer state caches
- Coordinating cache reuse with computation scheduling
- Supporting cross-node state reuse
- Applying differentiated lifecycle and eviction policies
The design is not limited to a specific model. It can be applied broadly to hybrid architectures that combine attention with linear layers or related state-based components.
As Agents evolve toward more complex, multi-step reasoning, context lengths will continue to grow. Cache management will therefore need to become both more fine-grained and more intelligent. Maximizing state reuse under limited cache capacity and achieving globally optimal scheduling across concurrently collaborating Agents remain important areas for further research.
