Learning State-Tracking from Code Using Linear RNNs

Julien Siems, Riccardo Grazzi, Kirill Kalinin, Hitesh Ballani, Babak Rahmani
2/16/2026
cs.LGcs.CL

No confident code implementation found for this paper.

Abstract

Over the last years, state-tracking tasks, particularly permutation composition, have become a testbed to understand the limits of sequence models architectures like Transformers and RNNs (linear and non-linear). However, these are often sequence-to-sequence tasks: learning to map actions (permutations) to states, which is incompatible with the next-token prediction setting commonly used to train language models. We address this gap by converting permutation composition into code via REPL traces that interleave state-reveals through prints and variable transformations. We show that linear RNNs capable of state-tracking excel also in this setting, while Transformers still fail. Motivated by this representation, we investigate why tracking states in code is generally difficult: actions are not always fully observable. We frame this as tracking the state of a probabilistic finite-state automaton with deterministic state reveals and show that linear RNNs can be worse than non-linear RNNs at tracking states in this setup.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{siems2026learning,
  title  = {Learning State-Tracking from Code Using Linear RNNs},
  author = {Julien Siems and Riccardo Grazzi and Kirill Kalinin and Hitesh Ballani and Babak Rahmani},
  year   = {2026},
  eprint = {2602.14814},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.14814v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2602.14814.svg)](https://codeofpaper.com/paper/2602.14814)

Discussion