DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoning

Hengyu Fu, Tianyu Guo, Zixuan Wang, Hanlin Zhu, Jason D. Lee, Jiantao Jiao, Stuart Russell, Song MeiNeurIPS 2026

TL;DR

Large language models are great at "thinking out loud" via Chain-of-Thought, yet they surprisingly struggle to connect two simple facts silently inside a single forward pass. The authors discover that even recurrent "looped" transformers stumble here because their internal thoughts get geometrically garbled between loops—an insight they turn into DiscoLoop, a clean architectural fix that unlocks near-perfect implicit multi-hop reasoning.

What Problem Does This Paper Address?

Suppose a language model memorizes two standalone facts during training: "Alice’s son is Bob" and "Bob’s wife is Carol." If you ask, "Who is the wife of Alice’s son?" without letting it write out intermediate tokens, standard transformers frequently fail.

Why? Previously, researchers diagnosed a depth-local storage problem: early layers retrieve "Bob," so later layers need the fact about Bob's wife. However, if "Bob’s wife is Carol" was only ever learned as an isolated fact, it might be stored in early layers, making it unavailable in the deeper layers where it's needed.

Looped Transformers—which pass outputs back through the exact same block of layers recurrently—should naturally fix this, since every loop shares the same parametric memory. Yet, looped transformers still train slowly and fail miserably out-of-distribution (OOD), where facts are learned in isolation and never seen in multi-step combinations during training. If memory is shared, what is still holding them back?

Figure 1: Overview of our analysis and DiscoLoop. The figure summarizes the two-hop reasoning setup, the depth-local storage issue of vanilla non-looped transformers, the representation-mismatch issue that remains in vanilla looped transformers, and our DiscoLoop architecture that injects a soft decoded embedding into the recurrent residual stream. The rigorous two-hop task formulation is defined in Section 2, and the DiscoLoop recurrence is formalized in Section 4.

Methods

The authors first play detective using mechanistic interpretability. Probing a vanilla 2-loop transformer on a two-hop task, they discover a representation mismatch: loop 1 expects clean, discrete token embeddings as input, whereas loop 2 is fed noisy, continuous hidden states output by loop 1.

To prove this is the culprit, they try a training-free surgical intervention: right between loop 1 and loop 2, they decode the hidden state at the "bridge" position into its top predicted token ("Bob"), fetch its clean token embedding, and mix it back into the hidden state.

To turn this manual patch into a general, fully differentiable architecture, they propose DiscoLoop (Discrete + Continuous Looping). Between recurrent passes, DiscoLoop keeps the standard continuous hidden state stream, but adds a parallel soft decode-then-encode channel:

  1. At every token position, the hidden state is projected through the language model head to get next-token probabilities.
  2. Those probabilities compute a weighted average of clean vocabulary embeddings.
  3. This normalized, "discrete-aligned" vector is added back into the continuous residual stream via a fixed or lightweight learnable gate (adding just $d + 1$ parameters).

Unlike prior approaches like PonderLM—which discard the continuous hidden state entirely in favor of soft embeddings—DiscoLoop preserves both channels so gradients flow smoothly across deeper reasoning steps.

Datasets

  • Symbolic Multi-Hop Dataset: A synthetic setup using two completely entity-disjoint knowledge graphs (500 entities and 5,000 atomic facts each) sharing 50 relations. Models train on atomic facts from both graphs, plus two-hop questions from Graph A. Testing on unseen Graph A chains measures in-distribution (ID) generalization; testing two-hop chains on Graph B—whose entities were never seen in two-hop training examples—serves as a strict OOD test. (Extended up to 5 hops in appendices).
  • Synthetic Natural-Language Dataset: The same two-graph logic verbalized into English, tested in both Direct ("Finley’s teacher’s wife is...") and Reverse ("Who is the wife of the teacher of Finley?") orders.
  • Open-Domain Pretraining & Benchmarks: A 20B-token corpus mixing FineWeb-Edu and FineMath (6:4 ratio), evaluated zero-shot on ARC-C, ARC-E, HellaSwag, LAMBADA, PIQA, RACE, and SciQ.

Key Insights and Ideas

  • It’s in there, just crooked: After the first loop, reading the hidden state via the output head predicts the correct bridge entity ("Bob") with 100% probability—even on OOD data! Yet, the cosine similarity between that hidden state and "Bob's" actual input embedding is only ~0.27–0.33. The knowledge is retrieved, just spoken in a "dialect" the second loop doesn't cleanly understand.
  • Training-free realignment works wonders: Simply blending the clean decoded embedding into the bridge position at inference time—without changing a single weight—causes OOD accuracy to skyrocket from 8.3% to nearly 100%. Training-free intervention diagram and the resulting jump in ID and OOD accuracy.

  • Accelerating the "anti-memorization" phase transition: Early in training, looped models try to memorize two-hop answers in a single pass. Around epoch 500, DiscoLoop triggers a sharp phase transition where single-loop accuracy collapses to zero and two-loop test accuracy shoots past 80%—forcing the network to learn true compositional rules much faster than vanilla looping.

Figure 2: Left: the intervention procedure. At α = 0 the position-1 representation is unchanged; at α = 1 it is replaced entirely by the decoded bridge embedding Norm(W[bmax]). The substitution is applied only at position 1 and only between the two loops; the rest of the forward pass is untouched. Right: ID and OOD two-hop accuracy as a function of the intervention strength α in Eq. (3).

Key Results

  • Symbolic Reasoning: Non-looped transformers (even with $2\times$ the parameters) score <20% ID and ~0% OOD. Vanilla looped transformers reach 71.1% ID and 8.3% OOD. DiscoLoop achieves near-100% on both ID and OOD, reaching >80% accuracy in roughly one-sixth the training epochs.
  • Synthetic English: DiscoLoop hits ~100% ID and ~95% OOD accuracy across both phrasing orders, whereas vanilla looped models fail OOD (especially on reverse queries) and non-looped baselines get ~0% OOD.
  • 440M Language Model Pretraining: Across seven zero-shot benchmarks, DiscoLoop achieves the highest average score (50.5), edging out PonderLM (49.8) and vanilla looped transformers (49.3), winning or tying on six of seven tasks.

Limitations and Future Work

  • Pretraining scale and variance: Due to compute limits, real-world pretraining was capped at 440M parameters and 20B tokens. Across three random seeds, DiscoLoop maintained the top mean score (50.9 vs. 50.6 and 50.2), though the sub-point gains fall within seed variance—making it a promising sanity check rather than definitive proof of pretraining superiority.
  • Length generalization: The authors match loop count $K$ to task depth; testing whether a model trained on $k$ hops can extrapolate to $>k$ hops at test time remains open.
  • Continual pretraining: Rather than training from scratch, future work could explore retrofitting existing, large pretrained LLMs with DiscoLoop's recurrent mechanics.

Summary updated

Abstract

Implicit in-weight multi-hop reasoning---composing multiple pieces of parametric knowledge within a single forward pass---is a fundamental yet challenging task of language models. Vanilla transformers consistently fail at this task, and even *looped transformers*, whose recurrent structure naturally fits its iterative nature, generalize imperfectly, particularly out-of-distribution (OOD). We make two contributions toward closing this gap. First, on a symbolic two-hop reasoning task, we mechanistically diagnose why looped transformers fall short: after the first loop, the intermediate answer is already decodable from the residual stream with certain probability, yet the continuous hidden vector carrying it is noisy and geometrically misaligned with the clean discrete embedding of the intermediate answer that the next loop would ideally consume. A training-free intervention that re-aligns this representation nearly closes the OOD gap, indicating that the representational mismatch is a bottleneck. Second, building on this insight, we propose **DiscoLoop**, a looping architecture whose recurrence carries both a **dis**crete embedding channel and a **co**ntinuous hidden-state channel. DiscoLoop achieves near-perfect two-hop accuracy with substantially less training across symbolic and synthetic-language multi-hop reasoning tasks. When applied to real pretraining, DiscoLoop attains lower training loss and stronger performance on pretraining benchmarks than looped-transformer baselines, suggesting that the mixed-channel design transfers to practical language modeling.
BibTeX
@inproceedings{fu2026discoloop,
  author = {Hengyu Fu and Tianyu Guo and Zixuan Wang and Hanlin Zhu and Jason D. Lee and Jiantao Jiao and Stuart Russell and Song Mei},
  title = {{DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=26R1JkrIyI},
}
Figure