Repeat After Me: Transformers are Better than State Space Models at Copying

Samy Jelassi, David Brandfonbrener, S. Kakade, Eran Malach

arXiv:2402.01032 · 2026-07-27 공개 · arXiv · PDF

large-language-models state-space-models sequence-modeling transformers latent-state string-copying generalized-state-space-models context-copying

Abstract

Transformers are the dominant architecture for sequence modeling, but there is growing interest in models that use a fixed-size latent state that does not depend on the sequence length, which we refer to as"generalized state space models"(GSSMs). In this paper we show that while GSSMs are promising in terms of inference-time efficiency, they are limited compared to transformer models on tasks that require copying from the input context. We start with a theoretical analysis of the simple task of string copying and prove that a two layer transformer can copy strings of exponential length while GSSMs are fundamentally limited by their fixed-size latent state. Empirically, we find that transformers outperform GSSMs in terms of efficiency and generalization on synthetic tasks that require copying the context. Finally, we evaluate pretrained large language models and find that transformer models dramatically outperform state space models at copying and retrieving information from context. Taken together, these results suggest a fundamental gap between transformers and GSSMs on tasks of practical interest.

한국어 요약

한 줄 요약

트랜스포머는 GSSM 대비 컨텍스트 복사 능력에서 근본적 우위를 보인다.

핵심 기여도

핵심 아이디어

이 연구는 트랜스포머와 GSSM 간 컨텍스트 복사 능력의 근본적 차이를 탐구한다. 트랜스포머는 다중 헤드 어텐션을 통해 n-그램 기반의 저장 및 검색 메커니즘을 구현할 수 있다. 이는 특정 위치의 입력을 추적하고 복사하는 데 활용된다. 반면, GSSM은 고정 크기의 잠재 상태로 인해 입력 길이가 잠재 상태 크기를 초과하면 정확한 복사가 불가능하다는 이론적 한계를 보인다. 이는 트랜스포머가 GSSM보다 컨텍스트 내 임의 위치의 정보를 접근하는 데 더 유리하다는 통찰을 제공한다.

기술적 접근법

주요 결과

의의 및 한계

이 연구는 트랜스포머와 GSSM 간 컨텍스트 접근 능력의 근본적 차이를 이론과 실험을 통해 입증한다. 이는 트랜스포머가 GSSM보다 컨텍스트 내 임의 위치의 정보를 접근하는 데 더 유리하다는 점을 강조한다. 그러나 GSSM은 입력 길이에 무관한 메모리 복잡도를 가지므로, 긴 입력 처리나 추론 효율성 측면에서는 여전히 유리하다. 또한, 인간의 언어 처리가 GSSM과 유사하다는 점에서 GSSM의 잠재적 가치도 언급된다.

실용적 활용

이 연구는 컨텍스트 내 정보 접근이 중요한 작업, 예를 들어 문서 검색, 질문 응답, 정보 추출 등에서 트랜스포머가 GSSM보다 우수함을 시사한다. 또한, GSSM에 어텐션 기반 메커니즘을 결합한 하이브리드 아키텍처 개발이 필요하다는 제안을 제공한다.