Specialized Large Language Models for Markovian Reasoning: Structural Cache Compression, Transition Pretraining, and Dual-Loop Transformers

Haibin Tong, Liangliang Xin, Yamei Zhu, Jiang YuarXiv 2026

TL;DR

Standard LLMs are memory hoarders; they try to remember every single token they’ve ever generated, causing their memory usage (the KV cache) to explode during long reasoning tasks. This paper introduces a "Markovian" approach where the model learns to carry forward only a compact "sufficient state" of the problem, allowing it to reason over thousands of steps with a memory footprint that stays constant rather than growing forever.

What Problem Does This Paper Address?

If you’ve ever tried to run a large model on a long document, you’ve hit the KV Cache bottleneck. In standard autoregressive models, every new token generated requires the model to "look back" at all previous tokens. This history is stored in the Key-Value (KV) cache, which grows linearly with the length of the conversation. For a 70B parameter model at a 128K context, this cache can swallow tens of gigabytes of VRAM, making long-chain reasoning or complex branching searches incredibly expensive.

However, the authors argue that many reasoning tasks—like solving a math problem, executing code, or proving a theorem—are naturally Markovian. In a Markov process, the "next step" only depends on the current state, not the entire history of how you got there. If you’re halfway through a long division problem, you only need the current remainder and the next digit, not the exact wording of the original prompt. Current LLMs fail to exploit this, wasting massive amounts of memory on redundant historical text.

Figure 1: Structural KV-cache compression for a Markovian reasoning chain. Conventional autore- gressive 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.

Methods

The authors propose a unified paradigm to turn LLMs into specialized "Markovian reasoning engines" through three main pillars:

  1. Structural KV-Cache Compression: Instead of one giant growing buffer, they divide the cache into three regions:
  2. Static: Stores the original problem prompt and "attention sinks" (permanent).
  3. State: Stores a fixed number of "memory tokens" that represent the current progress (updated at each step).
  4. Within-step: A temporary workspace for the current reasoning step, which is wiped clean as soon as the step is finished.
  5. Transition-Centric Pretraining: Rather than training on long, monolithic documents, they train the model on (state, action, next-state) triplets. They use specific loss functions to force the model to be efficient:
  6. State Bottleneck: Penalizes the model if it tries to "cheat" by just copying the history into the state.
  7. Drift Consistency: Ensures that the model’s reasoning stays stable even after many steps of "forgetting" the raw history.
  8. The Dual-Loop Transformer: This is a novel architectural twist.
  9. The Outer Loop advances the reasoning from one step to the next.
  10. The Inner Loop (Recurrent Depth) allows the model to "think harder" by passing the current step's data through the same Transformer layers multiple times. This provides adaptive computation—harder steps get more iterations without needing more parameters.
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.

Datasets

The researchers evaluated their ideas using:

  • Synthetic Transition Tasks: Deterministic multi-step addition and modulo-10 arithmetic to test if the model can maintain state over 128+ steps.
  • Pretrained Backbones: They performed "probes" on existing models like Qwen3-8B, Qwen2.5-Coder-14B, and Mistral-7B-Instruct-v0.3 to see how well they handle state-only prompts versus full-history prompts.
  • The paper also discusses the construction of verifiable datasets from program traces, game records (like Chess), and theorem-proving tactic states.

Key Insights and Ideas

  • "The optimal reasoning system need not remember everything; it must carry forward exactly what the future needs." This is the paper's core philosophy. It shifts the goal from maximizing retained history to enforcing the transmission of sufficient state.
  • Decoupling Memory from Length: By using a fixed-size state interface, the memory cost becomes $O(1)$ relative to the number of reasoning steps $k$. You could theoretically reason for a million steps without running out of VRAM.
  • Recurrent Depth as a Resource: Reusing weights in an inner loop is a clever way to increase "effective depth" (e.g., making a 12-layer model act like a 48-layer one for a difficult step) without increasing the memory footprint of the model weights themselves.

Key Results

The authors conducted a "controlled state-only inference probe" to prove the immediate benefits of this approach:

  • Massive Memory Savings: On the Qwen2.5-Coder-14B model, using a state-only interface reduced the measured KV cache size by 96.9% during a 128-step addition task.
  • Constant Footprint: While the "Full KV" baseline saw memory usage climb steadily as the reasoning chain grew, the "State KV" approach stayed flat.
  • Accuracy Retention: Despite throwing away ~97% of the data, the models often maintained perfect or near-perfect accuracy on deterministic tasks, proving that the "transcript" of previous steps is often semantically redundant.
Table 1: Cache strategies and their organizing principles. W and B are fixed cache budgets; k is the number of reasoning steps.

Limitations and Future Work

  • Non-Markovian Tasks: This architecture is a "specialist." It wouldn't be good at writing a novel or summarizing a long book where specific details from page 5 might be needed on page 500 in a non-structured way.
  • Fixed State Size: Currently, the "state" has a fixed capacity (e.g., 8 or 16 tokens). The authors suggest future work should explore adaptive state capacity—letting the memory grow only when the complexity of the problem actually demands it.
  • Hybrid Architectures: They envision a future where a general-purpose LLM handles the "planning," while this specialized Markovian kernel executes the long, repetitive "low-level" reasoning steps.

Summary updated

Abstract

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.
BibTeX
@misc{tong2026specialized,
  author = {Haibin Tong and Liangliang Xin and Yamei Zhu and Jiang Yu},
  title = {{Specialized Large Language Models for Markovian Reasoning: Structural Cache Compression, Transition Pretraining, and Dual-Loop Transformers}},
  year = {2026},
  eprint = {2611.28285},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.28285},
}
Figure