[KongchangAI]
· 2 min read· 1,478 words

FrontierReplay: A New Breakthrough in Lossless Prefix Caching for Hybrid Models

FrontierReplay: A New Breakthrough in Lossless Prefix Caching for Hybrid Models

FrontierReplay uses boundary-predicted checkpoints and state-only replay for exact prefix reuse in hybrid models.

Hybrid language models combine self-attention with recurrent layers, but in-place state updates force prefix reuse to depend on precisely saved positions: coarse-grained grids waste reusable prefixes, while fine-grained caching requires repeatedly cutting the forward pass during prefill, introducing scheduling overhead that exceeds reuse gains under high load. FrontierReplay takes a middle path: let the prefill run to completion, materialize exact checkpoints only at predictable structural boundaries in workloads like multi-turn conversations and tree search, and use a cross-layer, state-only replay kernel to reconstruct target states at 6-37x lower per-token cost than full recomputation without host synchronization. With a frontier-aware retention policy that lends dead checkpoint slots to the attention KV cache, experiments show a 16%-89% reduction in median TTFT and up to 4.26x higher goodput while preserving exact accuracy.

Hybrid language models combine self-attention with recurrent layers, but the in-place state updates of recurrent layers mean prefix reuse can only rely on precisely saved positions. Existing approaches either save states on a coarse-grained grid (wasting reusable prefixes) or repeatedly cut the forward pass during prefill (scheduling overhead eats into the gains). FrontierReplay proposes a middle path: don't cut the prefill, materialize exact checkpoints only at predictable structural boundaries, and then cheaply reconstruct the target state via a cross-layer, state-only replay kernel.

FrontierReplay paper page screenshot

The Dilemma of Prefix Reuse in Hybrid Models

The core contradiction of hybrid architectures is this: the KV cache of the self-attention part can naturally be reused incrementally by token, but the state of the recurrent layer is updated in place—once the forward pass has moved past a certain position, there is no way to go back and retrieve the exact state at that moment.

This leads to costs in both existing approaches. Saving states on a coarse-grained grid wastes a large amount of reusable prefix—the portion between checkpoints can only be recomputed. Fine-grained exact caching, on the other hand, must cut the prefill forward pass at intermediate checkpoint positions within each prompt, which introduces extra scheduler steps; under high load, the overhead of these steps exceeds the gains from reuse itself. The paper explicitly states that this fine-grained approach "adds scheduling steps that exceed the reuse gains under load."

FrontierReplay starts from an observation: in typical scenarios such as multi-turn conversations, agent loops, document QA, and tree search, prefix reuse almost always terminates at structural boundaries that can be predicted in advance—such as the end position of a conversation turn or a known branch point. These boundaries do not need to be discovered dynamically at runtime; they can be known in advance from the structure of the workload.

Hybrid language models refer to architectures that contain both self-attention layers and recurrent layers (such as state space models, linear attention, or gated recurrent units). These models attempt to combine the strengths of both: self-attention excels at precise long-range retrieval, while recurrent layers handle long sequences with linear complexity. The distinction most relevant to prefix reuse lies in state semantics—the KV cache of self-attention layers is appended incrementally by token position, and any historical position can be retained independently; whereas the hidden state of recurrent layers is updated recursively in place along the sequence, with the state at step t overwriting that at step t-1, so intermediate states cannot be retrieved after the fact without having been saved in advance. Prefix caching depends precisely on this traceability: on a cache hit, the state at a certain position is restored directly, skipping redundant computation. In hybrid models, recurrent layers break this premise, which is what gives rise to the trade-off between coarse-grained saving and fine-grained cutting.

Exact Checkpoints Without Cutting the Prefill

The core of FrontierReplay's design is: the prefill forward pass runs to completion without interruption. On the other side, the system records a small window of recurrent-layer inputs and then invokes a cross-layer, state-only replay kernel to build the target state.

The key property of this replay kernel is "state-only"—it does not rerun the full attention computation, but only reconstructs the state needed by the recurrent layers. The paper reports that this replay approach costs 6 to 37 times less per token than full recomputation and requires no host synchronization. The cross-layer design means replay can process multiple layers at once, rather than reconstructing them serially layer by layer.

Because the forward pass is not cut, the scheduler does not need to insert extra steps for each checkpoint, eliminating the largest source of overhead in fine-grained exact caching.

Prefill refers to the phase in which the inference service passes all input prompt tokens through the forward pass at once, building the KV cache and recurrent state; its duration directly determines time-to-first-token (TTFT). In continuous batching schedulers, prefill is typically executed as a single complete scheduling step; to obtain an exact state at some intermediate position within a prompt, the traditional approach is to split this prefill into multiple segments, inserting extra scheduling steps between them. The computation itself is unchanged by splitting, but it increases the number of scheduler decisions, batching fragmentation, and pipeline bubbles—these fixed overheads erode reuse gains under high load. FrontierReplay's "not cutting the prefill" means letting the entire prefill run as a single scheduling unit and moving the task of obtaining intermediate states to an independent, cheap state replay kernel, thereby decoupling scheduling overhead from state reconstruction overhead.

Boundary-Aware Retention Policy

Checkpoint space is limited, so FrontierReplay needs a policy to decide which checkpoints to retain. It adopts a "frontier-aware" retention policy: it prioritizes active anchors and verified branches, while lending checkpoint slots that have become invalid to the attention KV cache.

This slot reuse is important. In multi-turn conversations and tree search, the liveness distribution of checkpoints is highly uneven—a few branches are hit repeatedly, while many branches may never be visited again. Lending the space of dead checkpoints to the KV cache effectively improves the utilization of both types of cache without increasing the total memory budget.

Active anchors refer to prefix positions in the workload that are confirmed to be accessed again, such as the end point of the previous turn in a multi-turn conversation, or a branch node in tree search that has been expanded and may be backtracked to. Unlike ordinary checkpoints, the reuse probability of an anchor is determined by the structure of the workload rather than historical hit statistics, so it can be predicted before the request arrives. Verified branches refer to branches in tree search or agent loops that have completed evaluation and whose results may still be referenced by subsequent nodes; their states need to be retained for backtracking. The essence of the frontier-aware policy is to allocate limited checkpoint slots by "expected reuse value" rather than "most recently used": active anchors and verified branches take priority, while the remaining slots are released as branches become invalid and lent to the attention KV cache, thereby improving hit rates for both types of cache under the same memory budget.

Performance Data and Accuracy Advantages

The paper reports consistent results across multiple hybrid architectures, model scales, and workloads. Compared with existing exact caching approaches, FrontierReplay reduces median time-to-first-token (TTFT) by 16% to 89%, with up to 8.9x speedup; improves capacity at the 80% service level objective (SLO) by up to 1.73x; and improves goodput by up to 4.26x, or 3.67x at larger scales.

The comparison with approximate replay methods is even more telling. Approximate methods trade state exactness for speed, resulting in up to a 17% accuracy drop in long-context scenarios. FrontierReplay maintains exact task accuracy while achieving up to 1.54x higher goodput than approximate methods. This means it is not making a "precision for speed" trade-off, but rather improving throughput within the constraint of exactness.

Implications for Inference System Design

The value of FrontierReplay lies not in any single optimization trick, but in how it redefines the problem: rather than choosing between "coarse-grained waste of reuse" and "fine-grained cutting of the forward pass," it exploits the structural predictability of the workload itself to place exact checkpoints at positions that will actually be hit.

This idea is also relevant beyond hybrid architectures. Any model structure with a "state cannot be traced back" constraint could consider a similar boundary-prediction plus low-cost replay strategy. And the practice of "lending dead checkpoint slots to other caches" offers a general resource reallocation pattern for memory-constrained inference services.

The paper also highlights an easily overlooked cost item: scheduler steps are a real overhead under high load. The design of a caching system must consider not only the computational savings from a single reuse, but also how much burden it adds to the scheduling path.

One-line Summary

FrontierReplay uses boundary-predicted checkpoints and state-only replay to achieve exact prefix reuse in hybrid models.

Paragraph Summary

Hybrid language models combine self-attention with recurrent layers, but the in-place state updates of recurrent layers mean prefix reuse can only rely on precisely saved positions: coarse-grained grids waste reusable prefixes, while fine-grained caching requires repeatedly cutting the forward pass during prefill, introducing scheduling overhead that exceeds reuse gains under high load. FrontierReplay proposes a middle path: let the prefill run to completion without interruption, materialize exact checkpoints only at predictable structural boundaries in workloads such as multi-turn conversations and tree search, and then cheaply reconstruct the target state with a cross-layer, state-only replay kernel that costs 6 to 37 times less per token than full recomputation and requires no host synchronization. Combined with a frontier-aware retention policy that lends dead checkpoint slots to the attention KV cache, experiments report a 16%-89% reduction in median TTFT and up to 4.26x higher goodput while maintaining exact accuracy.

#FrontierReplay#prefix caching#hybrid language models#TTFT#inference systems
Share:

Related articles