Organizations: Henan University · China Construction Seventh Engineering Division · Henan Natural Resources and Environment Testing Co. · National University of Defense Technology
Standard autoregressive large language models attend to the growing history of generated tokens, making the key-value (KV) cache a central memory and throughput bottleneck in long-chain reasoning and multi-branch sampling. Yet an important class of reasoning problems is naturally first-order Markovian: the next step depends on a sufficient representation of the current state, rather than on the raw sequence of all earlier steps. We develop a unified design paradigm for Markovian-reasoning specialized large language models. At the cache level, the Markovian state interface transforms history-dependent KV storage into constant-size state transfer with respect to the number of reasoning steps. At the learning level, we reformulate long-chain prediction as independently trainable one-step transition objectives, with explicit state bottlenecks, distillation, invariance, and drift-consistency losses. At the architectural level, we introduce a dual-loop Transformer: an outer loop advances the reasoning state, while an inner recurrent-depth loop allocates adaptive computation to each transition through shared weights and explicit memory tokens or recurrent matrix states. We connect this architecture to a three-region cache, step-relative positions, truncated backpropagation, branch-aware checkpoints, and a transition-centric evaluation protocol. The organizing principle is simple: the optimal reasoning system need not remember everything; it must carry forward exactly what the future needs. This principle opens a path toward specialized reasoning engines whose memory footprint is decoupled from reasoning-chain length.
Figures & tables
Strategy
Cache in k
Retention principle
Full autoregressive KV
O(k)
Preserve all generated tokens
StreamingLLM / sliding window
O(W)
Fixed window with attention sinks
H2O / SnapKV
O(B)
Attention-based token selection
CacheGen
Compressed O(k)
Encode/transmit stored KV
Recurrent state / SSM
O(1)
Update a fixed latent state
Markovian structural pruning
O(1)
Preserve only sufficient step state
Table 1: Cache strategies and their organizing principles. W and B are fixed cache budgets; k is the number of reasoning steps.
Region
Content
Lifetime
Static
System / Q tokens and sinks
Entire chain
State
m memory tokens or recurrence tensor zi
Replaced at each step
Within-step
Current step’s causally generated KV
Released at step boundary
Table 2: A three-region KV-cache discipline.
Figure 1: Structural KV-cache compression for a Markovian reasoning chain. Conventional autoregressive attention retains the entire sequence of previous reasoning steps. In contrast, a Markovian state-rolling interface retains the fixed context Q , the latest sufficient state zt , and the bounded current-step KV workspace, which is released after each transition. With a fixed-size sufficient-state interface and bounded step length, cross-step memory does not grow with the number of completed steps k .
Dimension
General-purpose LLM
Markovian specialized model
Attention
Global causal sequence
Local causal step + state interface
Training example
Long document / complete CoT
State–action–next-state triplet
Supervision
Joint next-token loss
Transition + state compression
Position
Global sequence coordinates
Reset step-relative coordinates
Gradient path
Long-sequence activations
Independent transitions / truncated recurrence
Parallelism
Sequence-aware TP/PP/CP
Strong data-parallel scaling
Table 3: The pretraining paradigm changes when the primitive is a state transition.
Figure 2: Dual-loop Transformer architecture with transition-centric pretraining. The outer loop advances the reduced state (qt,Mt) across reasoning steps and releases step-local KV, while the inner loop repeatedly applies a shared Transformer core for Rt computation iterations. The transition training objectives shape the same shared core to support state evolution and compact cross-step memory.
Backbone
Task
Full KV
State KV
Full acc.
State acc.
Qwen3-8B
Addition
333.54
8.16
10/12
8/12
Qwen3-8B
Modulo 10
336.23
8.44
10/12
7/12
Qwen2.5-Coder-14B-Instruct
Addition
447.91
14.06
12/12
12/12
Qwen2.5-Coder-14B-Instruct
Modulo 10
451.50
14.44
12/12
12/12
Mistral-7B-Instruct-v0.3
Addition
296.35
7.00
11/12
12/12
Mistral-7B-Instruct-v0.3
Modulo 10
298.88
7.38
5/12
11/12
Table 4: Controlled 128-step probe, 12 paired cases per task and model. Cache entries are mean measured KV tensor sizes (MiB); accuracy is number correct out of 12. Full retains all earlier transition text and State carries only the current value.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Route
Mechanism
Precision and engineering cost
A: Zero-training approximation
Step-wise rolling of sinks, static prompt, and current state under unchanged weights
Approximate; divergence probes and fallback
B: Training-aligned masking
Block-level causal mask, step-end state token, local position convention, SFT
Exact computation graph; training pipeline changes
C: Architecture replacement
Fixed-size SSM or linear-attention recurrence
Native bounded state; exact historical retrieval is not its goal
Appendix
Table 5: Implementation routes for Markovian cache pruning.
Dimension
Token/segment memory (RMT, RATE)
Recurrent depth (MoR, Ouro)
Recurrence meaning
Carry state between segments
Reapply one stack to hidden states
State carrier
Learnable memory tokens
Updated hidden representations
Cross-step KV
Memory-token KV
Cleared at step boundaries
Single-step compute
One stack application
Multiple shared-weight applications
Characteristic risk
Memory capacity bottleneck
Cache/position errors or loop collapse
Appendix
Table 6: Two complementary recurrent Transformer traditions.
Stage
Implementation
Acceptance signal
0
Audit remote historical dependence
Distant history is dispensable
1
Training-free rolling KV with KL probes
Bounded distribution drift
2
Block-causal mask, state tokens, multi-objective tuning
Stable transition accuracy
3
Distillation into a native recurrent-state core
Long-horizon extrapolation
4
Counterfactual, memory, TPOT, drift validation
Accuracy and resource targets met
Appendix
Table 7: Recommended implementation roadmap, preserving the original manuscript’s five-stage validation logic.
Backbone
Task
Full KV
State KV
Factor
Full ms
State ms
Qwen3-8B
Addition
333.54
8.16
40.89 ×
352.9
147.9
Qwen3-8B
Modulo 10
336.23
8.44
39.85 ×
382.1
75.3
Qwen2.5-Coder-14B
Addition
447.91
14.06
31.85 ×
533.8
154.9
Qwen2.5-Coder-14B
Modulo 10
451.50
14.44
31.27 ×
467.4
78.6
Mistral-7B
Addition
296.35
7.00
42.34 ×
1592.6
813.0
Mistral-7B
Modulo 10
298.88
7.38
40.52 ×
1842.4
764.5
Appendix
Table 8: Measured 128-step KV and generation-time comparison; 12 paired cases per row. Full and State KV are mean MiB; times are median ms. Accuracy appears in Table 4 .
Symbol
Meaning
Q
Fixed task condition / retained prompt
qt,st
Reduced state and action / reasoning segment at step t
zt,Mt
Compressed state, memory tokens, or recurrent tensor
Large language models achieve superior performance on tasks that require extended reasoning, but long chains of thought make the KV cache a severe memory bottleneck. Existing KV cache compression methods share one paradigm: score each cached token by some estimate of how much it will matter later, and keep the top-scoring ones. We show that the selection signal contributes almost nothing. Random Attention keeps the prompt and evicts uniformly at random within each attention head, computing no score at all; across four models and six reasoning tasks, it matches the strongest baseline in task performance while delivering 32-43% higher throughput than that method when deployed with vLLM. Controlled experiments explain this by showing that 1) the prompt is the fragile part of the cache, and most of the gap between selectors is just whether their selection signal happened to keep it; 2) the reasoning trace protects itself against eviction with redundancy at two levels, in the text (the model restates what it still needs as it works) and across attention heads (each keeps its own copy of the trace), so once the prompt is safe, a random draw retains enough copies of what the model still needs, and no score is required to pick them. Our code is publicly available at https://github.com/SalesforceAIResearch/Random-Attention.
Heng Wang, Jielin Qiu, Wenting Zhao +8
Salesforce AI Research · University of Illinois Urbana-Champaign
Large Reasoning Models (LRMs) achieve superior problem-solving through extended Chain-of-Thought (CoT) generation, but the resulting key-value (KV) cache grows linearly with sequence length and creates severe memory bottlenecks, often exceeding GPU capacity for long reasoning traces. Existing KV cache compression methods rely on recent queries to estimate future token importance, implicitly assuming these serve as reliable proxies for future attention patterns. We demonstrate that this assumption fails in long-horizon reasoning: certain decoding steps generate Thought Revisiting Tokens (TRT) that re-attend to distant previous context, such as task-solving plans formulated early in the trace. Through systematic analysis, we discover that queries corresponding to the TRT cluster into a small number of similarity groups in the embedding space. Based on this insight, we propose BeaconKV, a training-free KV cache compression method that maintains beacon queries, compact representatives for each global query cluster, to anticipate which KV pairs will be revisited without storing the entire query history. Across four open-source LRMs and diverse reasoning benchmarks, BeaconKV generally outperforms existing compression methods, achieving up to 5.8× memory reduction while nearly preserving full cache accuracy and improving throughput by over 4.3×.
Large Reasoning Models (LRMs) excel on complex tasks through long chain-of-thought (CoT) reasoning, but their lengthy intermediate steps cause severe overthinking that inflates inference cost. KV-cache compression is a common solution, yet existing reasoning-oriented methods apply a uniform policy across the trajectory and judge compression only by what it removes from the cache. Two observations point the other way. First, a reasoning state's tolerance to context loss varies along the trajectory, and process reward tracks it: deleting tokens at high-reward steps preserves accuracy far better than deleting the same budget at random. Second, compression is not free on the generation side, since a smaller cache leads the model to generate more tokens, partly canceling the saving. Together these motivate coordinating both sides under a single process reward. We propose ReCo (Reward-Coordinated Compression), a step-wise framework in which a lightweight process-reward estimator scores each completed step and drives three components: (1) reward-adaptive KV-cache compression that shrinks the retained cache harder at high-reward steps and less at low-reward ones, (2) a reward-banded penalty on reflection tokens that curbs redundant generation, and (3) confidence-based early stopping that triggers when the reasoning is reliable. Across three reasoning models and six benchmarks, ReCo reduces generated tokens by 37%-65% and end-to-end latency by 2.08x-2.35x over Full CoT, all while largely preserving accuracy.