Paper commentary
Halting in Recurrent Sequence Models
Recurrent models encode how many copies remain, then shift state to stop early
- Problem Recurrent models are trained to emit an end-of-sequence token, but how they decide when to stop is not understood. Earlier attempts give no step-by-step account of how a count instruction reaches the EOS comparisons.
- Method The authors compare two hidden trajectories that copy the same sequence under different repeat counts. They then shift the RNN state at each copy boundary toward one fewer copy remaining.
- Results Shifting the RNN state at copy boundaries made the unchanged network emit EOS one copy earlier in 94.4% of new sequences.
Why EOS timing is hard to explain
Recurrent sequence models such as RNNs and SSMs often end generation by emitting an EOS token after their content. The EOS margin is the score of EOS minus the largest score of any other token, so it turns positive exactly when EOS is emitted. The margin only records when EOS wins, so a negative margin doesn't tell us which steps remain before the stop.
With fixed inputs, the current state determines the whole future trajectory, so the stopping time is already set while the margin remains negative.
The authors use a repeat-copy task in which a count instruction asks for the sequence to be copied K times before EOS. Two runs with different count instructions J and K produce hidden trajectories hJt and hKt over the same stored sequence. Existing attempts at characterizing EOS prediction don't give a transition-level account of how the count instruction enters the EOS comparisons.
Trajectory difference and the EOS hitting time
The authors separate the repeat count from the stored sequence by running two rollouts of the same input under count instructions J and K. At each output step shared by both rollouts, the trajectory difference is taken as the hidden state of J minus that of K. Because both rollouts store the same sequence, the difference keeps only the effect of the repeat count.
The repeat-copy task gives the model an eight-symbol sequence and a one-hot count instruction after a delimiter, followed by EOS. Counts of 2, 3 and 4 copies are used, so the instruction cK has a single +1 entry among three values. Once the input is zero, the recurrence runs on its own, so the hidden state alone must carry the stopping time.

Figure 1 : The count instruction changes the EOS time while the stored sequence remains fixed.A, RNN trajectory differences on held-out sequences projected onto two principal components obtained from separate sequences. Open circles mark the state after the count instruction, stars mark the earlier target EOS, and arrows follow the autonomous recurrence.B, mean contributions of the 64 SSM rotation blocks to the limiting EOS comparison for count change 4→2 . Between copy boundaries the contributions have mixed signs. At the target EOS, most contributions have the same sign and the EOS margin crosses zero.C, repeat-copy examples ending after two or four copies of S. RNN seed 5, the model with the median energy in the two plotted components, and SSM seed 1 are shown.
Original paper · CC BY 4.0The EOS hitting time counts the steps left before the EOS margin first turns positive along the autonomous trajectory. Correct stopping means this hitting time must equal the number of output steps the count instruction asks for. The trajectory difference therefore carries the gap between the two required hitting times along the trajectory.
The EOS margin is computed from the limiting EOS comparison, which is the comparison that attains the minimum over content tokens. Figure 1 shows that the RNN differences trace coherent curves in two principal components, while SSM contributions change sign between copy boundaries. Both models have width 128, and the SSM transition contains 64 learned and scaled 2×2 rotation blocks.
How the RNN carries the difference forward
During autonomous output, both rollouts follow the recurrence from preactivations that begin with W_x(c_J − c_K). For scalar preactivations a and b, the tanh secant is the slope of tanh between them, or 1 − tanh² when they coincide. The diagonal matrix D of these secants makes the difference follow an exact recurrence, Δ_{t+1} = D W_h Δ_t.
Each step applies W_h first, and then the secants shrink every unit into the range (0,1].
To test which dependencies matter, the authors replaced the secants and propagated the difference with the replacements. These runs stayed open loop, so the network never received the resulting states. Exact secants give continuation accuracy 1.000, while the identity replacement gives 0.000. Hidden-unit identity and temporal order carry most of the effect, while the secant values are largely shared across sequences.

Figure 2 : Transport of the RNN trajectory difference.A, mean tanh secants for model seed 5 and count change 4→2 , with hidden units ordered by the step of strongest attenuation on separate sequences.B, multiplication by Wh expands the trajectory difference before tanh attenuates it. Faint lines denote model means and solid lines denote the cohort mean.C, EOS margins along the two trajectories.D, continuation accuracy under the exact secants and their controlled replacements.
Original paper · CC BY 4.0 · Simon Dräger · Halting in Recurrent Sequence Models · Original paper figure · Extracted the figure area from page 5 of the original PDF.Figure 2 shows the mean secants for model seed 5 and count change 4→2, with units ordered by their attenuation step. Across the five RNNs, the first two PCA components hold on average 74.5% of the energy of the difference.
The transported difference separates trajectories by the steps that remain, described by position and copies left. With the states indexed by n copies and position p, each autonomous step advances p or drops n by one. Since L is fixed, (n, p) is equivalent to the remaining steps, nL minus p.
Remaining steps in shared RNN states
The authors index each RNN state as H^K_{n,p}(S), with n copies remaining and p as the position within the current copy. Autonomous steps move p forward until a copy ends, and then n drops by one. Because L is fixed, the pair (n, p) equals the hitting time nL − p, so a state's (n, p) fixes how many output steps remain. A model asked for four copies reaches n = 2 after two copies, while a model asked for three copies reaches n = 2 after one copy.
The authors therefore test whether states that share (n, p) and S coincide regardless of the count instruction. Across 5 RNN seeds and 512 held-out sequences, the mean distance was 0.165 of the distance between adjacent values of n. Full-state cosine stayed between 0.996 and 0.998, and the largest ratio at any count and position was 0.862.
Once the mean state of each emitted symbol is subtracted, the cycle centers ordered by n appear in a low-dimensional PCA projection. This readout beats each of 32 random two-dimensional projections per model. Subtracting the cycle center leaves a centered path that tracks the motion through p within one copy. Shifting that path by one position drops the cosine to −0.138, which shows the path depends on its position.
A centered path follows p and depends on S, which fits a position that advances and resets after each copy. To test whether the shared state drives stopping, the authors fit a rank k affine map on separate fitting sequences. The map moves a state at n to the state with n − 1 by adding a centered difference estimated from the source state.
They apply this transformation only to the hidden state at a copy boundary, leaving the unchanged RNN to continue on its own.
Shifting the state one copy earlier
The affine map T128 starts from a state with n copies remaining and aims at the state with one fewer copy. The authors apply it only at a copy boundary, where one copy has completed and another starts at the next time step. The unchanged RNN then continues its autonomous recurrence without any other edit.
With the fitted transformation on new sequences, the unchanged network emits EOS one copy earlier in 94.4% of sequences. The tokens copied before EOS are not affected by the transformation.

Table 2 : Interventions on the stopping mechanism, evaluated on held-out sequences. All accuracies are computed over every rollout. RNN entries are means over the five models, and SSM entries are ranges across the five models. The fixed-direction rows pool the targets r= 1,2,4,5 , starting from a rollout of three copies. Since the SSM rotations preserve almost all of the copied content, their complete-sequence accuracy rounds to the same range as their stopping accuracy.
Original paper · CC BY 4.0That is lower than the fitted map, so the mean change alone doesn't carry the full effect. The authors conclude that most of the change removing one copy is shared by all sequences.
Shuffling the target states across fitting sequences keeps the mean change but breaks the link to the stored sequence.
Rotation planes in the linear SSM
The SSM pushes the difference forward with a fixed linear update, and each rotation block adds its own term to the EOS comparison. After u autonomous steps, the EOS comparison difference is C A^u W_x times the count-instruction difference. Each block is a scaled rotation, so its contribution traces a two-dimensional path set by an amplitude and a phase.

Figure 4 : Coherence of the rotation-plane contributions at EOS in each SSM, compared with independent amplitude-preserving rotations of the planes. Stopping and content accuracy under these rotations are given in Table 2.
Original paper · CC BY 4.0Because amplitude and phase are separable, the authors rotate each plane's difference on its own while keeping its amplitude fixed. Independent rotations cut stopping accuracy to 0.015 to 0.047, while content accuracy stays between 0.999 and 1.000. The copied content survives because the rotations leave every plane amplitude unchanged. These rotations change only the phases relative to the other planes, and that is where the intended stopping goes.
A single rotation applied to all planes keeps every relative phase, so the planes stay aligned with each other. Under this shared rotation, stopping accuracy stays between 0.268 and 0.316, higher than under independent rotations. The authors read this as evidence that relative phase across planes is necessary for correct EOS timing. The shared rotation still removes most of the intended stopping, so relative phase isn't sufficient alone.
The orientation of the difference relative to W_y must therefore matter as well.
Both interventions hold each plane's amplitude fixed, so they don't test whether amplitudes affect EOS timing. The authors also fit one direction ξ on separate sequences, adding (r−3)ξ to the first output state of a three-copy rollout. This fixed direction sets the copy count from one to five, including five copies, one more than the model was trained on.
The fixed direction meets the pre-specified success criteria in four of the five models.
A fixed direction sets the copy count
Because the SSM is linear, the authors can set the stopping time by adding a fixed direction to the hidden state. For each model, they fit one direction ξ so that a three-copy rollout yields r copies after an offset of (r−3)ξ on its first output state. They fit ξ on separate sequences for r in {1, 2, 5}, keeping the target token ahead of every future comparison by a margin of 0.1.
They hold out r = 4 as a test case.
On new sequences, the fitted direction gives complete-sequence accuracy of 0.911 to 0.974 for the tested targets. Norm-matched random directions give complete-sequence accuracy of 0.000 to 0.001, so the fitted direction is far more effective. The mean count-instruction difference reaches complete-sequence accuracy of 0.547 to 0.724, which is lower than the fitted direction.
The direction meets the pre-specified success criteria in four of the five models. The fitted direction fails at r = 6.
Linearity explains why a fixed offset can set the count, because the state adds the offset to its trajectory.
What the two architectures share
Both architectures use a linear decoder, so each must make the count visible to the EOS comparisons. The paper measures the trajectory difference's magnitude as the norm of Delta JK t, and its visibility as the norm of C Delta JK t divided by that magnitude. During the last copy of S, the RNN trajectory difference grows by factors between 1.52 and 2.16.
In the same stretch, the SSM trajectory difference contracts by factors between 0.61 and 0.65. Visibility rises in every SSM too, by factors between 1.12 and 1.29, so growth or contraction alone doesn't decide it.
Its magnitude at that step, however, remains a property of the recurrent transition.
The difference persists through the autonomously generated output, including steps where the EOS margin stays negative. That presence shows the hidden dynamics hold information about the future stopping time before it can affect the current output. The RNNs transport the trajectory difference through repeated mixing by Wh and state-dependent scaling by the tanh secants.
Limitations and untested settings
The experiments can't separate the copies remaining from the position within a copy, because the sequence length is fixed. With fixed length, the pair of copies remaining and position is equivalent to one countdown of remaining steps. The nested description of the RNN's dynamics therefore looks the same as a single counter of output steps.
The affine state transformation at copy boundaries doesn't separate these indices either. Varying the sequence length independently of the repeat count would be needed to tell these two axes apart.
The explicit count tokens and deterministic sequences make the timing response easier to identify. Because of this setup, the authors don't test whether the network keeps the copy index and position as separate variables. The affine transform shifts a boundary state so the unmodified RNN ends its output one copy earlier. In that intervention, the RNN still copies every preceding token correctly.
The analysis covers only small tanh RNNs and linear SSMs. Gated RNNs and nonlinear SSMs are left for future experiments. Whether the same forms of transport appear in other recurrent architectures remains open.
Paper info
- Authors
- Simon Dräger
- Venue
- arXiv · Preprint
- First published
- 2026-11-16
- Added
- 2026-11-17
- Updated
- 2026-11-16
- Version
- v1
- arXiv
- 2611.20377
- Category
- cs.LG
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Recurrent sequence models, such as recurrent neural networks (RNNs) and state space models (SSMs), are often trained to emit an end-of-sequence (EOS) token when their output sequence is complete. During training, EOS is treated as another token without a special loss term or incentive. Although this training paradigm is widely used, it is not understood how models decide to output EOS. We study a minimal version of the EOS halting problem in which networks are trained to emit a given input sequence an instructed number of times, followed by EOS. We train tanh RNNs and linear SSMs on this task, finding that the RNNs encode the number of tokens left to copy in a linear subspace, of which two principal components capture most of the variation. Hidden states with the same remaining count converge to a shared representation regardless of their instructed repeat count. By modulating the hidden state using an affine transformation at the boundary between copied sequences, we shift the RNN's state to the representation shared by states with one fewer copy remaining. The unchanged network emits EOS one copy earlier while reproducing the shortened target sequence in 94.4% of new sequences, revealing that this representation causally determines the stopping time. In the SSMs, the difference between trajectories with different repeat counts is separated across two-dimensional rotation planes whose contributions to the EOS comparison cancel during copying and align near the stopping time. Rotating the planes independently removes most of the intended stopping while preserving the copied content, which shows that the stopping time depends on the planes' relative phases. These results identify two candidate primitives of EOS halting in recurrent models: a shared encoding of the number of remaining tokens in tanh RNNs and phase alignment across fixed rotations in linear SSMs.
Quote from the paper
Simon Dräger (2026). Halting in Recurrent Sequence Models. arXiv:2611.20377v1. https://arxiv.org/abs/2611.20377v1
BibTeX
@misc{drger2026halting,
title = {{Halting in Recurrent Sequence Models}},
author = {Simon Dräger},
year = {2026},
eprint = {2611.20377},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.20377v1}
}