Phenx
← All research
AI Research·September 2026·9 min read

What travels around the loop?

We swapped hidden states in Coconut and a small recurrent transformer to test what their loops carry and how they use it.

An indigo ribbon loops through ceramic frames. A coral cartridge replaces the carried state, and the outgoing ribbon changes color.
Conceptual illustration of a state swap, not a model architecture diagram.

We gave Coconut an arithmetic problem whose calculation was (4 + 9) × 8. It answered 104. Then we replaced its six hidden reasoning vectors with vectors from a different problem, (2 + 7) × 6, while keeping the original question. This time it answered 54, the answer to the other problem.

Reversing the conflict gave the opposite result. We kept the original reasoning vectors, changed the question shown during answer generation, and got 104 again. In this example, the answer followed the hidden state.

That experiment gets closer to what we wanted to know after our earlier Coconut tests: what information does the loop carry, and how does the model use it? Removing a state can show that a model depends on it. Replacing it with a state from another problem lets us predict which answer should follow.

Coconut feeds a model's hidden state directly back in as its next input during reasoning. A hidden state is a vector of numbers. It can influence the next computation without first becoming a word or a digit. Our checkpoint uses six of these vector inputs before producing an answer as text.

We also tested an independent, small implementation of the Recurrent Looped Transformer proposal. RLT carries its decoder's output state from one input position to the next. The decoder can also consult representations of the text stored by an encoder and a short cache of its own recent computations. Those give information several possible routes through the model.

These are two case studies with different tasks and training histories. Coconut was an existing 124-million-parameter language model trained on arithmetic word problems. Our RLT had 133,248 parameters and learned a task with five possible register values. The experiments can tell us what these models did; their differences don't establish a general difference between the architectures.

In one recorded Coconut pair, the original question with donor vectors produces 54; the donor question with original vectors produces 104.

The opening example, shown at answer time. Each group contains all six feedback vectors; their colors identify which problem supplied them.

For Coconut, we built a controlled set of problems of the form (a + b) × c. Each replacement came from a problem with a different sum and multiplier. That gave us three distinguishable answers: the original answer, the donor's answer, and a mixed calculation using the donor's sum with the original multiplier. In the opening example, those were 104, 54, and 72.

The model solved 191 of 192 test problems correctly. There were 185 pairs where it solved both the original and donor problems, so we used those pairs for the main comparison. This was deliberately simple arithmetic: on our separate sample of 256 GSM8K word problems, the same checkpoint answered 84 correctly, or 32.8%.

Replacing all six reasoning vectors produced the donor's answer in 158 of 185 pairs, or 85.4%. Changing only the question during answer generation preserved the original answer in 158 of 185 pairs. Those identical totals came from separate interventions.

Outcomes when Coconut's reasoning vectors and question context come from different problems. Donor vectors usually produce the donor answer; changing only the answer-stage question usually preserves the original answer.

The chart uses the 185 pairs for which both baseline answers were correct. “Mixed calculation” means the donor's intermediate sum multiplied by the original problem's multiplier. The full results also include all 192 pairs.

The vectors carry information that answer generation uses. We can't yet say exactly what that information is. They might contain the completed answer, enough of the problem to calculate it, intermediate values, or some combination.

The question also matters while those vectors are being formed. We changed the stored question representations that the model reads during its latent updates, keeping its initial feedback vector fixed. That produced the donor answer in 133 of 185 pairs. The loop can continue taking information from the question as it runs.

We then looked for intermediate calculations inside the six vectors. The model's output layer assigns scores to vocabulary tokens. Applying that layer to a hidden vector lets us ask how highly it ranks a particular number, even when the model isn't being asked to print that number.

On the GSM8K sample, the first annotated intermediate value had its best median rank at vector slot 2. The second peaked at slot 4. The third peaked at slot 6. At those positions, their median vocabulary ranks were 3, 18, and 21. Lower is better.

Vocabulary ranks of the first three annotated intermediate values across Coconut's six feedback slots, compared with wrong-value controls. The best median ranks occur at slots 2, 4, and 6.

This exploratory audit includes 210 eligible first-step values, 143 second-step values, and 70 third-step values. Values had to fit in one token, be absent from the question, and differ from the final answer. The 2/4/6 pattern also appears in the 51 problems where all three values qualify. Wrong-value controls rank much lower at those positions.

The timing fits the checkpoint's training schedule, which allocated two latent slots to each removed written reasoning step. The training procedure appears to have left a trace in when intermediate numbers become readable.

We added this three-step audit after seeing the first-step result. It is an exploratory observation that needs confirmation on fresh problems. Reading the expected value from a vector also doesn't prove that the model uses that value to perform the next operation. We needed an intervention that would change one intermediate value and make the rest of the calculation follow it.

Our attempt to do that with J-lens was unreliable. J-lens uses gradients to relate an internal state to a later representation. We adapted it to target the representation just before Coconut's first answer token, averaging gradients over 128 calibration problems. The resulting maps still varied substantially between halves of the calibration sample, especially at early slots. Direct vocabulary readouts were more useful for the early arithmetic values in this study; the readout comparison includes both J-lens fits and labelled controls.

We also used a J-derived direction to try to replace the intermediate sum. The intended result was the mixed calculation: use the donor's sum, then multiply by the original multiplier. After choosing the intervention on validation data, it produced that answer in 6 of 185 test pairs. It changed 25 answers altogether, so most changes didn't follow the intended calculation. A separate edit aimed explicitly at the final answer produced four mixed answers.

That leaves the Coconut result at a specific point: we can move useful problem information through its latent sequence, and we can read a staged trace of intermediate values. We haven't isolated a dependable way to rewrite one arithmetic step. These results concern our answer-targeted J-lens adaptation; they don't settle how well other targets or fitting procedures would work.

The small RLT gave us a more direct test of an intermediate value. We trained it to maintain a register that could hold 0, 1, 2, 3, or 4. Each input token either added a number or negated the current value, with arithmetic wrapping around modulo five. For example, adding 3 to a register holding 4 gives 2.

We supplied only the final answer during training. The model had to learn how to carry the value through the intervening operations. We trained two versions from different random initializations, or seeds.

Training initially failed. Both the RLT and a conventional recurrent baseline, a GRU, stayed near chance when we started with programs four to sixteen operations long. We preserved those runs and switched to a curriculum that began with shorter programs. Both RLT seeds then learned the task, as did the GRU. The curriculum was part of the successful recipe; learning this task wasn't a capability unique to RLT.

At the midpoint of a test program, we replaced the RLT's recurrent output with a state from another prefix that ended at a different register value. We kept the original program's remaining operations. That let us calculate exactly what should happen if the model continued from the substituted value.

In one sixteen-operation example, the original register held 3 after operation eight. We replaced its state with a donor state representing 0. The remaining additions were 2, 2, 3, 4, 2, 4, 1, and 1. Starting from zero, the expected register values were:

0 → 2 → 4 → 2 → 1 → 3 → 2 → 3 → 4

A simple linear readout, trained separately to recover the register from the hidden state, tracked that sequence. The final answer changed from 2 to 4. The remaining operations and the encoder's context stayed fixed.

An actual RLT program before and after a midpoint state swap. Replacing register 3 with 0 produces decoded values 0, 2, 4, 2, 1, 3, 2, 3, 4, exactly matching the predicted continuation.

Seed 0, test program 0. The lower colored row is decoded from the intervened model; the grey row gives the independently calculated prediction. This is one recorded program, not an aggregate.

This behavior held across the test set. Among sixteen-operation cases where both the original program and the donor-prefix continuation were correctly solved, swapping only the recurrent output produced the predicted new answer in 512 of 512 cases for one seed and 500 of 501 for the other.

Swapping only the decoder's recent cache produced none of those predicted new answers. Replacing the encoder information produced zero for one seed and one for the other. That encoder test included recomputing future input representations on the donor prefix, so we checked both the stored memory and the representations of the remaining tokens.

Across two small RLT runs, replacing only the output state produces the predicted new answer in 512 of 512 and 500 of 501 eligible programs. Cache-only and encoder-only replacements rarely do.

Selected interventions at length 16. Each marker represents one training run; whiskers show 95% Wilson intervals. Counts use programs where both baseline continuations were correct. The full report includes every intervention and the unconditional results.

On this task, the recurrent output carried the register that controlled the remaining calculation. The other channels didn't normally restore the value implied by the original prefix after we substituted a different state. They may still contribute to computation; this experiment identifies which route carries the register. A language-trained RLT could use those routes differently.

The same test worked on longer, thirty-two-operation programs: state swaps produced the predicted alternative answer in 100% and 98.7% of jointly correct cases. For the second seed, success over all cases was lower, at 96.3%, alongside 96.5% baseline accuracy. The two training runs also stopped at different curriculum stages, so their longer-program results reflect different training exposure as well as different initialization.

We checked the intervention code against ordinary execution before interpreting these results. Coconut's unmodified generations matched the reference implementation. For RLT, swapping all the relevant state and encoder channels reproduced running the corresponding mixed program directly. The full report contains the controls, remaining charts, failed training runs, and links to the protocols and raw results.

The next Coconut experiment should target the arithmetic step we can currently only read. In the opening example, we would replace the sum 13 with 9 while retaining the multiplier 8. If later states and the answer then followed the calculation to 72, we would have stronger evidence that we had changed an intermediate calculation. Moving the entire latent sequence already gives us 54. The unresolved question is whether we can change just the sum.