Rethinking State Caching for Hybrid-Architecture LLMs: Over 3x Prefill Throughput Gains
Hybrid architectures that mix full attention with linear attention layers are becoming mainstream for long-context LLMs, but they complicate server-side prefix caching. This article explains why linear-layer state caches break token-level prefix reuse, describes a FlashStates-style chunk-aligned state caching design with KV/state consistency and distributed reuse, and shares the measured results: prefill throughput up more than 3x and p90 TTFT reduced by up to 88% on multi-turn agent workloads.
Why Hybrid Architectures Are Going Mainstream
Several recently released large language models share the same architectural pattern: linear attention layers interleaved into the Transformer backbone, forming a hybrid of “full attention + linear layers.” The motivation is straightforward:
- Attention is the decode bottleneck. In standard self-attention, both computation and KV cache grow linearly or quadratically with sequence length, making decoding costs spike sharply for long contexts.
- Linear attention compresses history. Linear attention layers compress historical information into a fixed-size state, drastically reducing KV cache footprint and significantly improving decode throughput.
- The hybrid design is a compromise. Full attention layers preserve the ability to precisely retrieve key information, while linear layers handle most sequence modeling, balancing quality and efficiency.
This approach is especially attractive for long-context and multi-turn conversation scenarios, which is why it has quickly become a mainstream architecture for the new generation of models.
The Problem: Prefix Caching Breaks Down Under Agent Workloads
Hybrid architectures are not free, though—the cost shows up in server-side cache management. A pure Transformer’s KV cache is stored per token, so prefix caching can achieve precise block-level reuse at token boundaries. Hybrid architectures introduce two new complications:
1. Boundary dependency of state caches. A linear layer’s state is computed recursively per chunk, and the state of one chunk depends on the states of all preceding chunks. This means cache reuse cannot be truncated at arbitrary token positions like KV cache; it must align to chunk boundaries, and the reuse granularity is coarser.
2. Failure amplification in multi-turn interactions. A typical coding agent workload looks like this: a system prompt plus repository context, with multi-turn tool call results continually appended. Prefixes across turns overlap heavily and should hit the cache often. But a hybrid model requires maintaining both the KV cache for full attention layers and the state cache for linear layers, each with different lifecycles, invalidation conditions, and memory layouts. Poor management leads to:
- Recomputing the states of many already-seen chunks on every turn, multiplying prefill time;
- Desynchronized caches producing “KV hit, state miss” half-hits that degrade into full recomputation;
- Growing memory pressure from the state cache, with poorly tuned eviction policies causing cache hit rates to collapse.
The Solution: A FlashStates-Style Hybrid State Cache Redesign
To address these issues, recent research has proposed a cache management mechanism designed for hybrid architectures. Its core design can be summarized in four points:
1. Make state caches explicit and block-managed. The linear layers’ recursive states are promoted from implicit intermediate variables during inference into first-class cache objects, managed in parallel with the KV cache. States are stored chunk-aligned, forming an addressable, reusable structure analogous to KV cache blocks.
2. Chunk-level prefix reuse. When a request arrives, prefix matching is performed at chunk boundaries: cached chunks are read directly, skipping recomputation, and prefill starts only from the divergence point. Compared with naive “state not reusable” or coarse-grained reuse approaches, this compresses repeated computation in multi-turn agent workloads to near the theoretical minimum.
3. Atomic consistency between the two caches. KV blocks and state blocks are bound to the same prefix fingerprint, with hits and invalidations handled in pairs, avoiding correctness or performance issues from half-hits. Eviction also reclaims by prefix as a whole, reducing fragmentation.
4. Distributed and cross-node reuse. The state cache can be attached to an independent CPU memory pool (such as a high-capacity memory caching system), pulled on demand by inference nodes, enabling state sharing across multiple instances. This means cache hit benefits are no longer confined to a single instance’s lifetime—reuse works across requests and across nodes.
A schematic request-handling flow:
# Pseudocode: prefill flow for hybrid architecturesprefix_chunks = chunk_align(tokens)hit = state_cache.lookup(prefix_chunks) # joint KV + state matchingfor c in prefix_chunks[len(hit):]:state = linear_layer.step(state, c) # recompute only chunks after divergencekv_cache.append(full_attn(c))state_cache.store(prefix_chunks, state) # explicitly persist to cache
Results and Engineering Takeaways
In replay-based evaluations using real multi-turn coding agent trajectories, this design delivered benefits at two scales:
- Prefill throughput: up to more than 3x higher compared with baseline implementations in mature open-source inference frameworks;
- Time to first token (TTFT): p90 latency reduced by up to ~88%, a dramatic improvement for interactive agents;
- Benefits persist with attached high-capacity CPU caches, with support for cross-node state reuse in distributed deployments.
There are three takeaways for engineering teams. First, hybrid architectures shift the cost center from decoding to prefill and cache management—model selection must account for whether server infrastructure matches. Second, cache design must cover every “memory format” a model uses; any uncached state becomes a recomputation hotspot. Third, prefix overlap in multi-turn agent workloads is extremely high, so investing in chunk-level prefix reuse pays off far more than simply adding compute.
As hybrid-architecture models proliferate, server-side optimization around state caching—tiered storage, cross-node reuse, and coordinated scheduling with KV caches—will become a key competitive frontier for inference systems, and deserves close attention from every team building long-context agent services.
