arXiv(opens in a new tab)cs.CLSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.39740

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

Xiaoqiang Wang, Suyuchen Wang, Bang Liu

Xiaoqiang Wang 1,2^{1,2}, Suyuchen Wang 1,2^{1,2}, Bang Liu 1,2^{1,2}

1^{1}Université de Montréal 2^{2}Mila – Quebec AI Institute

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.9× faster than the strongest long-context baseline.

Date: October 1, 2026

Correspondence: bang.liu@umontreal.ca

Université de Montréal

Mila

Token space

Latent space

LatentHarness (Ours)

Long-context reasoning (2Wiki, MuSiQue, HotpotQA)

Figure

Latency per answer (s, log scale)

General reasoning (GSM8K, MATH500, GPQA)

Latency per answer (s, log scale)

Figure 1 Accuracy versus latency of LatentHarness on general and long-context reasoning with Ouro-1.4B-Thinking. The dashed arrow points from the strongest baseline to ours.

Figure

Figure 2 Comparison of Ouro (Zhu et al., 2025b), a looped reasoner that recurs over one weight-tied block, RLTT (Williams and Tureci, 2026), the same loop trained with an outcome reward, and LatentHarness, which interleaves latent reasoning and memory, with THINK writing the fast-weight memory that RECALL reads, and learns each latent action from its action gain G(a∣s)\mathcal{G}(a \mid s) of Equation (7).

1 Introduction

Large language models (Achiam et al., 2023; Yang et al., 2025; Guo et al., 2025; Wang et al., 2024a) increasingly act as agents over long horizons (Yao et al., 2022; Yang et al., 2024a; Wang et al., 2024b; Wang and Liu, 2025; Li et al., 2025b; Luo et al., 2025; Liu et al., 2025; Ding et al., 2026; Shi et al., 2026), so their reasoning becomes a long-context problem as trajectories accumulate observations, tool outputs, and intermediate reasoning states (Wu et al., 2025; Ye et al., 2025; Lu et al., 2025). This problem involves two distinct forms of length. First, relevant evidence may be distributed across long inputs (Bertsch et al., 2025; Bai et al., 2024; Hsieh et al., 2024) or multi-turn interactions (Maharana et al., 2024; Wu et al., 2024). Second, solving the task may require many intermediate reasoning steps (Wei et al., 2022; Guo et al., 2025; Team et al., 2025), and these steps may be interleaved with retrieval of the necessary evidence (Li et al., 2025a; Jin et al., 2025).

Existing approaches largely address these two forms of length separately. External-memory agents (Yan et al., 2026; Yu et al., 2026; Zhou et al., 2025; Yu et al., 2025) retain and retrieve distant evidence across a trajectory, which extends access beyond the current context window. Latent-reasoning methods (Hao et al., 2024; Shen et al., 2025; Wang et al., 2026b; Zhu et al., 2025b) instead move long intermediate computation from decoded text into internal representations. More recent methods move toward learned memory management by training models to decide when to compress the context (Zhou et al., 2025; Wu et al., 2025; Sun et al., 2025), and when to read or write stored entries (Yan et al., 2025; Zhang et al., 2026b,a; Dong et al., 2026; Li et al., 2026). However, these policies still rely either on memory that remains external to the model and is read back through the context window, or on compression rules fixed in advance. This limitation motivates a more direct question: can memory access and reasoning be unified natively within the model's latent computation?

Latent Trajectory Group

Figure

Figure 3 Illustration of counterfactual policy distillation (CPD) in LatentHarness. The G latent trajectories sampled from one input form the latent trajectory group, and their rewards determine the trajectory advantage A^(τ)\hat{A}(\tau). The one-step branches at each latent state form the latent action group, and scoring their decodes pap_a against psp_s yields the action gain distilled into the latent action policy πϕ\pi_\phi.

As illustrated in Figure 2, LatentHarness builds on the looped computation of latent-reasoning models and unifies memory access and reasoning as sequential latent action selection. At each internal step, a latent policy chooses THINK to continue computation, RECALL to access persistent memory, or Exit to emit the next token. These actions operate over a shared fast-weight associative memory that stores both input evidence and intermediate reasoning states, allowing RECALL to recover distant evidence or reuse prior computation while THINK deepens reasoning.

Learning such a policy requires assigning credit to individual latent decisions beyond the final task reward. Dense objectives such as RLTT (Williams and Tureci, 2026) supervise what each latent state predicts, but sampled action credit evaluates only the chosen action and vanishes when rollouts stop splitting across actions. We introduce counterfactual policy distillation, which branches every allowed latent action, including Exit, for one step at each latent state and measures the resulting change in the emitted token's log-probability. These counterfactual branches serve two roles. As state-level action credit, their gains teach the policy whether a memory read, further reasoning, or exiting yields the largest advantage-signed, cost-charged one-step gain. As gain-credited memory writing, their recall changes, differentiated through the fast-weight memory on positive-advantage trajectories, credit each earlier THINK write by how much it raises or lowers later recalls, which teaches the write gate which derived states to write for later reuse.

LatentHarness improves both reasoning quality and efficiency across three general and three long-context reasoning suites. It raises the six-suite average over the strongest baseline by 3.9 points at 1.4B and 4.1 points at 2.6B. At 1.4B, it improves on the strongest baseline in each family by 2.8% relative on general reasoning and 10.0% on long-context reasoning, while using 55% of the backbone's full-depth compute. As Figure 1 previews, on long-context reasoning LatentHarness is 5.9× faster than Memory-R2 and 1.5× faster than RLTT.

References (92)