LatentHarness: Learning Latent Actions for Memory and Reasoning via Counterfactual Policy Distillation

Xiaoqiang Wang, Suyuchen Wang, Bang LiuarXiv 2026

TL;DR

LatentHarness unifies memory access and reasoning by treating them as sequential "latent actions"—THINK, RECALL, and EXIT—selected by a learned policy. By using a novel training method called Counterfactual Policy Distillation (CPD), the model learns exactly when to compute further and when to retrieve stored evidence, resulting in a 10% accuracy boost and a massive 5.9x speedup on long-context reasoning tasks.

What Problem Does This Paper Address?

Reasoning over long contexts presents two major hurdles for Large Language Models (LLMs). First, they must retain evidence across massive inputs (the "needle in a haystack" problem). Second, they must sustain complex, multi-step computation without losing their way.

Current solutions usually treat these as separate problems: "external memory" (like RAG or specialized memory tokens) handles the evidence, while "latent reasoning" (looping through layers) handles the computation. However, these systems are often inefficient. Models might waste "thinking" cycles on information they already have or fail to recall a crucial fact because the memory system is disconnected from the reasoning process. The authors ask: can we unify memory and reasoning into a single, fluid latent process?

Methods

The authors introduce LatentHarness, which builds on "looped" transformer architectures. Instead of a fixed number of layers, the model treats each internal step as a decision point.

The Latent Action Space

At each step, a policy chooses one of three actions:

  • THINK: Applies the transformer block again to deepen reasoning and writes the result to a fast-weight associative memory.
  • RECALL: Performs a cheap matrix-vector product to read from that memory, injecting evidence or prior thoughts back into the hidden state.
  • EXIT: Stops internal processing and emits the next token.
Comparison of LatentHarness against standard looped reasoners.

Counterfactual Policy Distillation (CPD)

The core innovation is how this policy is trained. Standard Reinforcement Learning (RL) provides "coarse" credit—you only know if the final answer was right. LatentHarness uses CPD, which branches every possible action for one step at every internal state to see how it affects the probability of the correct next token.

If a RECALL action significantly boosts the probability of the right word compared to a THINK action, the policy receives a strong signal to prefer memory in that specific context. This also teaches a "write gate" which intermediate states are actually worth saving for later.

Illustration of the CPD branching process.

Datasets

The model was evaluated across two main categories:

  • General Reasoning: GSM8K (math), MATH500, and GPQA-Diamond (science).
  • Long-Context Reasoning: 2WikiMultihopQA, MuSiQue, and HotpotQA. These were specifically padded with "distractor" text to lengths of 4k, 8k, 16k, 32k, and 64k tokens to test the limits of memory retrieval.

Key Insights and Ideas

  • Selective Recall is Mandatory: The authors found that an "always read" strategy (reading memory at every step) actually performs worse than LatentHarness. The model needs to decide to read only when evidence is missing; otherwise, the memory signal just acts as noise.
  • Thinking Converges, Memory Diverges: Analysis showed that repeated THINK steps eventually produce diminishing returns, as the hidden state converges. RECALL, however, introduces a "new direction" to the hidden state that further computation alone cannot reconstruct.
  • Efficiency on Long Inputs: On long-context tasks, LatentHarness actually uses fewer THINK steps than baselines. It realizes that for unsettled positions, evidence is missing from the hidden state, making RECALL a much higher-gain action than another loop of computation.
Latent step dynamics showing how recalls increase with input length while think steps remain stable.

Key Results

LatentHarness demonstrates that being "smart" about when to think leads to both better answers and faster inference:

  • Accuracy: At the 1.4B parameter scale, it improved general reasoning by 2.8% and long-context reasoning by 10.0% relative to the strongest baselines.
  • Speed: It is 5.9x faster than the strongest long-context baseline (Memory-R2) because it avoids unnecessary token-space memory operations and redundant computation.
  • Compute Efficiency: It achieves these gains while using only about 55% of the backbone's full-depth FLOPs.
Accuracy vs. Latency: LatentHarness sits in the top-left "sweet spot" of high accuracy and low latency.

Limitations and Future Work

  • Distractor Interference: While highly effective, the model still struggles with "nearby distractors" in extremely complex multi-hop queries (like 4-hop MuSiQue). The query mechanism sometimes retrieves a plausible-looking distractor instead of the true supporting fact.
  • Training Overhead: While inference is much faster, the CPD training process requires branching and scoring multiple actions, which increases the computational cost during the training phase.
  • Scaling: The study focused on 1.4B and 2.6B models. Exploring how these latent actions scale to 70B+ models remains a promising frontier.

Summary updated

Abstract

Long-context reasoning faces two complementary bottlenecks: retaining evidence across long inputs and sustaining computation across many reasoning steps. Existing approaches largely address them separately, with external memory extending access to distant evidence and latent reasoning compressing multi-step computation. We introduce LatentHarness, which unifies memory access and latent reasoning as sequential latent action selection. At each internal step, the model chooses THINK for further computation, RECALL from a fast-weight memory of input evidence and intermediate reasoning states, or EXIT to emit the next token. We train this policy with counterfactual policy distillation, which branches every action for one step and scores its effect on the emitted token. These gains teach the policy when memory is more useful than further reasoning, while gradients through counterfactual recall teach which intermediate states should be retained in memory for future use. Across six general and long-context reasoning benchmarks, LatentHarness at 1.4B improves on the strongest baselines by 2.8% and 10.0% relative, respectively, and runs 5.9x faster than the strongest long-context baseline.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
GSM8KLatentHarness (Ouro-1.4B-Thinking)Exact match83.2split: test · in-distribution · params=1.4B
Source quote
L922: 83.2
MATH500LatentHarness (Ouro-1.4B-Thinking)Exact match51.6split: test · in-distribution · params=1.4B
Source quote
L931: 51.6
GPQA Diamond · GPQA-DiamondLatentHarness (Ouro-1.4B-Thinking)Exact match32.6split: test · out-of-distribution · params=1.4B
Source quote
L940: 32.6
2WikiMultiHopQALatentHarness (Ouro-1.4B-Thinking)Answer F155.9split: test · params=1.4B
Source quote
L950: 55.9
MuSiQueLatentHarness (Ouro-1.4B-Thinking)Answer F133.1split: test · params=1.4B
Source quote
L959: 33.1
HotpotQALatentHarness (Ouro-1.4B-Thinking)Answer F160.1split: test · in-distribution · params=1.4B
Source quote
L968: 60.1
BibTeX
@misc{wang2026latentharness,
  author = {Xiaoqiang Wang and Suyuchen Wang and Bang Liu},
  title = {{LatentHarness: Learning Latent Actions for Memory and Reasoning via Counterfactual Policy Distillation}},
  year = {2026},
  eprint = {2609.39740},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.39740},
}
Figure