Benchmarking the Computational and Representational Efficiency of State Space Models against Transformers on Long-Context Dyadic Sessions
Abidemi Koledoye, Chinemerem Unachukwu, Gold Nwobu, Hasin Rana
TL;DR
The paper tackles the inefficiency of Transformer-based long-context processing by benchmarking the State Space Model Mamba against LLaMA on synthetic, long therapy sessions. It demonstrates that Mamba achieves linear $O(N)$ memory and compute, yielding substantial crossovers over Transformers (e.g., around $N\approx220$ for memory and $N\approx370$ for time), with a pronounced advantage at longer sequences. Representationally, Mamba shows continuous hidden-state dynamics and a large effective context window, while Transformers preserve interpretable attention patterns but struggle with truly long-range dependencies. The results offer practical guidance for deploying long-context systems and motivate hybrid architectures that combine SSM efficiency with attention-based recall and interpretability benefits.
Abstract
State Space Models (SSMs) have emerged as a promising alternative to Transformers for long-context sequence modeling, offering linear $O(N)$ computational complexity compared to the Transformer's quadratic $O(N^2)$ scaling. This paper presents a comprehensive benchmarking study comparing the Mamba SSM against the LLaMA Transformer on long-context sequences, using dyadic therapy sessions as a representative test case. We evaluate both architectures across two dimensions: (1) computational efficiency, where we measure memory usage and inference speed from 512 to 8,192 tokens, and (2) representational efficiency, where we analyze hidden state dynamics and attention patterns. Our findings provide actionable insights for practitioners working with long-context applications, establishing precise conditions under which SSMs offer advantages over Transformers.
