Length Generalization with Log-Depth Recurrent Units

Charles Pert, Dalal Alrajeh, Alessandra Russo
5/25/2026
cs.LG

No confident code implementation found for this paper.

Abstract

Length generalization remains a persistent challenge for neural networks: recurrent models tend to suffer from positional biases, while transformers are constrained by fixed computational depth. Regular languages provide a frequently used testbed for evaluating length generalization, as label prediction can be checked for any sequence length. We propose MLP-LDRU, a type of Log-Depth Recurrent Unit, which captures a class of associativity-biased operators designed to approximate recurrence through parallel reduction. We evaluate MLP-LDRU on 21 regular-language tasks, consisting of standard benchmarks and new prefix languages, where it achieves 100% out-of-distribution accuracy on 18 tasks and at least 99.9% on the remaining 3 when increasing max training length, outperforming comparable recurrent and attention-based models. We further evaluate MLP-LDRU beyond regular languages on ListOps and NLP classification benchmarks, where it performs competitively.

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{pert2026length,
  title  = {Length Generalization with Log-Depth Recurrent Units},
  author = {Charles Pert and Dalal Alrajeh and Alessandra Russo},
  year   = {2026},
  eprint = {2605.26035},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.26035v1}
}

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/2605.26035.svg)](https://codeofpaper.com/paper/2605.26035)

Discussion