Delayed Attention Training Improves Length Generalization in Transformer--RNN Hybrids

Buu Phan, Reza Ebrahimi, Sanjay Haresh, Roland Memisevic
9/30/2025
cs.LG

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

We study length generalization in sequence models on a composite problem involving both state tracking and associative recall. Prior work finds that recurrent networks handle state tracking well but struggle with recall, whereas Transformers excel at recall yet fail to extend state-tracking capabilities to longer sequences. Motivated by the complementary strengths of these architectures, we construct hybrid models integrating recurrent and attention-based components, and train them on the combined task to evaluate whether both capabilities can be preserved. Our results reveal that, in such hybrids, the Transformer component tends to exploit shortcut solutions, leading to poor length generalization. We identify this shortcut reliance as a key obstacle and propose a simple yet effective training strategy -- delaying the training of the attention layers -- that mitigates this effect and significantly improves length generalization performance. Our experiments show that this approach enables hybrid models to achieve near-perfect accuracy ($>90\%$) on hybrid sequences three times longer than those used during training.

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. 2 weaker matches are hidden by default — 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{phan2025delayed,
  title  = {Delayed Attention Training Improves Length Generalization in Transformer--RNN Hybrids},
  author = {Buu Phan and Reza Ebrahimi and Sanjay Haresh and Roland Memisevic},
  year   = {2025},
  eprint = {2510.00258},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.00258v1}
}

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

Discussion