RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrieval

Kaiyue Wen, Xingyu Dang, Kaifeng Lyu
2/12/2026

No official code found. Best implementation: dangxingyu/rnn-icrag (27 stars, last commit 2024-04-17).

Abstract

This paper investigates the gap in representation powers of Recurrent Neural Networks (RNNs) and Transformers in the context of solving algorithmic problems. We focus on understanding whether RNNs, known for their memory efficiency in handling long sequences, can match the performance of Transformers, particularly when enhanced with Chain-of-Thought (CoT) prompting. Our theoretical analysis reveals that CoT improves RNNs but is insufficient to close the gap with Transformers. A key bottleneck lies in the inability of RNNs to perfectly retrieve information from the context, even with CoT: for several tasks that explicitly or implicitly require this capability, such as associative recall and determining if a graph is a tree, we prove that RNNs are not expressive enough to solve the tasks while Transformers can solve them with ease. Conversely, we prove that adopting techniques to enhance the in-context retrieval capability of RNNs, including Retrieval-Augmented Generation (RAG) and adding a single Transformer layer, can elevate RNNs to be capable of solving all polynomial-time solvable problems with CoT, hence closing the representation gap with Transformers.

View on arXivView PDF

Code Implementations(1)

Official repository of paper "RNNs Are Not Transformers (Yet): The Key Bottleneck on In-context Retrieval"

271PythonFeb 26, 20242 years ago

Similar Papers

Cite this paper

@article{wen2026rnns,
  title  = {RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrieval},
  author = {Kaiyue Wen and Xingyu Dang and Kaifeng Lyu},
  year   = {2026},
  eprint = {2402.18510},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2402.18510},
  journal = {ICLR 2024 2024}
}

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

Discussion